Multiplication of histo


I have pT specta of a particle, I want to find sqrt(pT^2 + ma^2 - mb^2)
I am finding pt^2 by multpling pT sepctra two times . Is it right or wrong?
I attached macro .

mTScale_rebin.C (2.7 KB)

You should use Multiply

Thank you.
I have one more question, Is it possible to take square-root of a histogram?
e.g if I have spectra of pT^2 , how to find sqrt(pt^2)?
Regars
Nasir

I guess @moneta should know.

Hi,
We don’t have the support for sqrt operations. You can either loop on the bin contents and perform yourself the operation or use something like this:

auto h1 = new TH1D("h1","h1",100,-3,3);
h1->FillRandom("gaus");
// transform content in sqrt of contents
double * values = h1->GetArray();
std::transform(values, values+ h1->GetSize(), values,[](double x) { return sqrt(x);});

and you can do a similar think if you want to transform the histogram errors

Cheers

Lorenzo

2 Likes