# IntegralAndError Calculation

Hello Rooters,

I used IntegralAndError option to look at the integration error of the histogram.(range of integration)
But when I subtract two histogram integration, can root handle the error propagation?

Here is the snippet

``````    Double_t error1,error2,error3,error4,error5;
TAxis *axis1 = h3fold->GetXaxis();
int bmin1 = axis1->FindBin(0.3);  //xmin=0.3
int bmax1 = axis1->FindBin(0.5);
double norm3tot = h3fold->IntegralAndError(bmin1,bmax1,error1,"");
TAxis *axis2 = h3->GetXaxis();
int bmin2 = axis2->FindBin(0.3);
int bmax2 = axis2->FindBin(0.5);
double norm3bck = h3->IntegralAndError(bmin2,bmax2,error2,"");
TH1F h3norm=  (norm3tot/norm3bck)*(*h3);

TAxis *axis3 = h3fold->GetXaxis();
int bmin3 = axis3->FindBin(-0.01);
int bmax3 = axis3->FindBin(0.05);
double Signal = h3fold->IntegralAndError(bmin3,bmax3,error3,"");
TAxis *axis4 = h3norm.GetXaxis();
int bmin4 = axis4->FindBin(-0.01);
int bmax4 = axis4->FindBin(0.05);
double  Bgnd = h3norm.IntegralAndError(bmin4,bmax4,error4,"");
double Trues = Signal-Bgnd;
``````

Just to know that is that error calculating for the Trues? Look like it doesn’t.
I used sumW() for h3,h3fold histograms.
Any help would be greatly appreciated.

You may want:
`double Error = TMath::Sqrt(error3 * error3 + error4 * error4);`

Thank you, Wile.
So If I am taking division of Coinc/Trues, What should be the error?

double Trues = Signal-Bgnd;
TAxis *axis5 = h2->GetXaxis();
int bmin5 = axis5->FindBin(-0.01);
int bmax5 = axis5->FindBin(0.05);
double Coinc = h2->IntegralAndError(bmin5,bmax5,error5,"");
double Efficiency = Coinc/Trues;

Error of Efficiency???