# Is this the expected behaviour for a weighted profile histog

Dear All,

I am computing a profile histogram with weights. It seems that
when I fill a profile histogram with EQUAL weights that the error bar
depends on the weight used. Is this the
expected behaviour? It seems to me (after some thought) that
although the spread is computed correctly the error in the
mean is not.

You compute:

spread/ Sqrt( sum of weights ) .

I guess I would expect:

spread/ Sqrt( N ) where N is the actually number of entries in the bin.

Derek Teaney
BNL

The macro that I have used is here:

{

gROOT->Reset() ;

const int n = 1000000 ;

double alpha = 3.;

double ptmax = 10. ;
TProfile *prof1 = new TProfile(“test”,“A test”, 10, 0., ptmax) ;
TProfile *prof2 = new TProfile(“test2”,“A test 2”, 10, 0., ptmax) ;

double w, v ;
for (int i= 0 ; i < n ; i++) {

``````  w = 0.01 ;
double pt = ptmax * gRandom-> Rndm() ;
double vmean1  = 3.0 * pt ;

v = vmean1 + gRandom->Gaus(0., 100.) ;

prof1->Fill(pt, v, w) ;
``````

}

TF1 f1(“f1”, “*x”, 0., 10.) ;
f1->SetLineColor(kGreen) ;
f1->SetParameter(0, 2.) ;

prof1->Fit(“f1”) ;
prof1->SetLineColor(kBlue) ;
prof1->SetMarkerColor(kBlue) ;
prof1->Draw() ;

for (int i= 0 ; i < n ; i++) {

``````  w = 1.0 ;
double pt =  ptmax*gRandom->Rndm() ;
double vmean1  = 3.0 * pt ;
v = vmean1 + gRandom->Gaus(0., 100.) ;
prof2->Fill(pt, v, w) ;
``````

}

prof2->SetMarkerColor(kRed) ;
prof2->SetLineColor(kRed) ;
prof2->SetLineWidth(4) ;
prof2->Draw(“same”) ;
}