Hi,rooters,

Here is an example about the TProfile.

A 1d-histogram (TH1D *h1) is obtained by TProfileX of a TH2D *h2.

I want to know the binerror of the TH1D *h1, which I guess is equal to the std Dev(ProjectionY in each x bin) / sqrt(sum of the each x-axis bin counts). But the results shown in the figure doesn’t look that way.

The code is:

```
#include "TF2.h"
#include "TH2.h"
#include "TMath.h"
double g2(double *x, double *par) {
double r1 = double((x[0]-par[1])/par[2]);
double r2 = double((x[1]-par[3])/par[4]);
return par[0]*TMath::Exp(-0.5*(r1*r1+r2*r2));
}
double fun2(double *x, double *par) {
double *p1 = &par[0];
double *p2 = &par[5];
double *p3 = &par[10];
double result = g2(x,p1) + g2(x,p2) + g2(x,p3);
return result;
}
void example_profile() {
const int npar = 15;
double f2params[npar] =
{100,-3,3,-3,3,160,0,0.8,0,0.9,40,4,0.7,4,0.7};
TF2 *f2 = new TF2("f2",fun2,-10,10,-10,10, npar);
f2->SetParameters(f2params);
//Create an histogram and fill it randomly with f2
TH2F *h2 = new TH2F("h2","from f2",10,-5,5,10,-5,5);
int nentries = 2000;
h2->FillRandom("f2",nentries);
//================================
TCanvas *c1 = new TCanvas("","",400,600);
c1->Divide(1,2);
c1->cd(1);
h2->Draw("colz");
c1->cd(2);
TH1D *h1 = h2->ProfileX();
h1->Draw();
}
```

The results is:

binx = 7 ---- the std Dev = 1.992 (calculated by projectionY)

but the profilex results in the lower left figure is not equal to **1.992** or **1.992/sqrt(125)**.

Besides, I want to get the TH1D *h1 bin error by

h1->GetBinError(7),

But, the error message is:

Best regards,

hurricane…