[ROOT] Filling TH1 from ntuple with weight

From: Rustam Niyazov (rust@physics.odu.edu)
Date: Wed Nov 21 2001 - 16:52:58 MET


Hello Rooters,

Could anybody help?

I have an ntuple that consist of variables Prel and weight.
I want to fill  prel histogram with given weight and compare it
with unweighted distribution and the same weighed 1D distribution I
already filled earlier.
After I do that I see that I am loosing some fraction of events, because

of the selection I apply. How should I define my selection
that to keep all events?

{

TH1F *hprel = new TH1F("prel","prel",50,0,1);
TH1 *hist;
TString Weight="1*weight"; //Selection need to be changed????

ntupleCut14q0->SetLineColor(4);
ntupleCut14q0->Draw("Prel>>prel",Weight,"goff");
pad[0]->cd();
ntupleCut14q0->Draw("Prel");  //Not weighted
Int_t Numb1Prel=ntupleCut14q0->GetEntries();//Integral of total entries
cout<<"1: "<<Numb1Prel<<" ";
pad[1]->cd();
PrelCut14q0->Draw();  //Previously weighted 1D histogram I also want to
compare with
Int_t rebin_factor=2;
hist =prel->Rebin(rebin_factor,"hb");
hist->Draw("Sames");
Int_t NumbPrel=hist->GetEntries();//Integral of total entries
cout<<"2: "<<NumbPrel<<" ";
cout<<endl;
}

The output:

.x get_acceptance.C
1: 45148 2: 43456


Thanks a lot,


Rustam



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:09 MET