# Integral for Tprofile histogram

Hi I need to make the integral for a surface selected from a TProfile histogram. Can someone suggest me some tutorials or examples for this?
Many thanks
Sorro

Rene

Dear Rene

I have a TProfile histogram, and I would like to get the are of just the tail of the histogram. I suppose on must use the Integral, but I do not find any example on how to use this.
Many thanks
Sorro

just do

myprofile.Integral(binmin,binmax); where ninmin and binmax are the first and last bin numbers where you want to compute the integral.

Rene

Dear Rene

here is my code

Float_t a = sighistoS4.Integral(110,140);
Float_t b = sighistoS4.Integral(0,250);
sighistoRatio->Fill(i, a/b);

I was following your indication…send yesterday. SOmehow it doesn’t work, I have the following error message:

Warning:wrong member access operator '.'
Error:operator ‘/’ divided by zero…

Any idea? many thanks
sorro

Could you send the shortest possible (but RUNNING) script reproducing the problem?

Rene

TProfile *sighistoS4 = new TProfile(“sighistoS4”,“run1918, S4”,150, 50.,200.,0.,1000.);
TH1F *sighistoRatio = new TH1F(“ratio”,“run1918, ratio20/tot”,1000,0,100000);

for(event=0;event<entries;event++){
t->GetEntry(event);

for (Int_t i=0; i<282;i++) {
if(CHFOSC[3] == 1) {
float bin4a =(((float)(DATAOSC[i+282*3])5/127)+5-(float)POSOSC[3]/1000)(float)SCALEOSC[3];
float bin4b =(((float)(PED_MEAN_OSC[3])5/127)+5-(float)POSOSC[3]/1000)(float)SCALEOSC[3];
sighistoS4->Fill((i+18.3),(-1)*(bin4a-bin4b),1);
}

} //end 282 points

Float_t a = sighistoS4.Integral(110.,140.);
Float_t b = sighistoS4.Integral(10.,250.);
sighistoRatio->Fill(i, a/b);

}//end event

TCanvas *c104 = new TCanvas(“c104”,“c104”);
sighistoRatio->Draw();

}

but the data file is big. Hopethis works.

I cannot use this. Post a RUNNING script.

Rene