Dear all,
I have this problem:
I have a TH1F object: the x-axis contains 100 bin in the range 0-10.
I have to divide all the bin from 0 to 1 by a number, from 1 to 2 by another one number, etc.
Is there a simple way to perform this task?
thank you,
Marco
Nobody can help me?
Hi,
I think you can do this very easily with few lines (maybe even 3) of code:
double a[] = { c1, c2, c3,.....};
for (int i = 1; i < h1->GetNbinsX(); ++i)
h1->SetBinContent(i , h1->GetBinContent( i) / a [ int(i /10) ] );
If needed , you might want also to scale the errors
Cheers,
Lorenzo
Ciao Lorenzo,
thank you very much, I’ll try this method.