Is there any documented example in ROOT website rather than a definition to see the difference in use?
I found one line for IntegralAndError method as below:
Double_t error;
Double_t integral = Hist->IntegralAndError(10, 70, error, “”); // “” … or … “width”
std::cout << "Hist. integral = " << integral << " ± " << error << std::endl;
//////////////////////////////// These are the definitions of the methods in short . Link is here.
IntegralAndError(int binx1, int binx2, double &error, Option *option="");
DoIntegral( int binx1, int binx2, double &err, Option *opt);
///////////////////////////////////
I almost don’t see any difference without looking at the actual line of long codes in the descriptions.
Again, what is the usage of this option pointer if we avoid (don’t understand) the lines of codes… I mean any example anywhere? Appreciated in advance.
Is this correct: all we need to do is define a variable in advance before calling the method because it knows what to do to retrieve the error.
Is it just the binwidth that wee need to specify?
For instance, h1->Integral( 5, 15,???);
One another related question with integral method:
I wrote just a small part of the code to discuss to main idea.
////////////////////////////////////////////////////// 1ST PART //////////////////////////////////////////
int LL= 5, UL= 20;
for (int i = LL; i < UL+1 ; i++ ){
The definition of the GetBinError is sigma value of the count in that bin, right?
For instance, N1 and N2 are count numbers.
sigma_total_square = var(N1+N2)=var(N1)+var(N2)
sigma1_square = var(N1)
sigma2_square= var(N2)
sigma_total = sqrt ( var(N1)+var(N2) ) = sqrt (sigma1_square + sigma2_square )
Thus, sigma_total should be equal to sqrt ( [h1->GetBinError(bin1)*h1->GetBinError(bin1)]+ [h1->GetBinError(bin1)*h1->GetBinError(bin1)] )
we can summarize as TotalError += std::pow(h1->GetBinError(i), 2.);
TotalErrorUpdated= sqrt (TotalError);
I think you forgot sqrt() , right?
BTW.
How should I use this string part so called option ?
For instance, h1->Integral( 5, 15,???);