Square root - TH2F

Hi,

My question is: I have a bi-dimensional histogram and I need the square root of it, bin by bin. Is there any easy way to do this, or I need to use GetBinContent() of something like this?

Thank you.

I think you will need to use GetBinContent():

for (int bin=0;bin<=hist->GetNcells();++bin) {
   hist->SetBinContent(bin, sqrt(hist->GetBinContent(bin));
}
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.