Hi Rustam,
The selection mechanism is at the same time the weight to fill the histogram.
In your case you can do:
ntupleCut14q0->Draw("Prel>>prel",weight,"goff");
ntupleCut14q0->Draw("Prel>>+prel","weight==0","goff");
The first call will fill your histogram with all entries with a non null weight
The second call will continue (+) to fill the histogram with entries having
weight=0
Rene Brun
Rustam Niyazov wrote:
>
> 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