Re: Projection of a histograms

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 4 Mar 2008 17:24:53 +0100


Hi Melinda,

The projection of the effective entries is currently not implemented. It is not too complex to obtain what you want if you have called Sumw2 on your TH2 object.
In this case, make the projection using TH2::ProjectionX (or Y) and compute the effective entries
with a code looking like

     TH2 *h2;  //your Th2 object where Sumw2 has been called before filling
     TH1D *px = h2->ProjectionX();
     Int_t nbins = px->GetXaxis()->GetNbins();
     for (Int_t bin=1;bin<=nbins;bin++) {
        double y = px->GetBinContent(bin);
        double e = px->GetBinError(bin);
        double effe = 0;
        if (e != 0) effe = y*y/e*e;
        px->SetBinContent(bin,effe);
       px->SetBinError(bin,0);

   }

This could be an option when calling TH2::ProjectionX,Y. Lorenzo, could you implement this code in all Projection functions?

Rene Brun

Melinda Siciliano wrote:
> Dear all,
>
> I have an 2D-histogram filled using the weight. I would like to ask
> you if there a way to make the projection of the effective entries of
> the histogram.
>
> Thanks,
>
> Melinda
Received on Tue Mar 04 2008 - 17:22:01 CET

This archive was generated by hypermail 2.2.0 : Wed Mar 05 2008 - 23:50:01 CET