ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/SampleClass.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/SampleClass.C (file contents):
Revision 1.4 by buchmann, Mon Apr 30 08:37:01 2012 UTC vs.
Revision 1.7 by buchmann, Wed May 23 15:13:17 2012 UTC

# Line 87 | Line 87 | sample::sample(string m_filename, string
87      gErrorIgnoreLevel=currlevel;
88      this->events=(TTree*)(this->tfile)->Get(treename.c_str());
89      if(Verbosity>0) dout << "The " << write_mc_or_data(is_data) << " file " << this->filename << " has been added successfully to the list of samples. " << endl;
90 <    long long measured_nevents=(this->events)->GetEntries();
90 >    long long measured_nevents=(long)1;
91 >    TH1F *weight_histo = (TH1F*)(this->tfile)->Get("weight_histo");
92 >    float average_weight = 1.0;
93 >    if(weight_histo) {
94 >      average_weight = weight_histo->Integral()/weight_histo->GetEntries();
95 >      measured_nevents = (long)weight_histo->GetEntries();
96 >    } else {
97 >      measured_nevents=(this->events)->GetEntries();
98 >    }
99 >
100      if(((this->Nentries>1)||(this->Nentries==0))&measured_nevents!=this->Nentries) {
101        //special cases: m_Nentries=1 : we want to give each event the full weight (->scans!)
102        //               m_Nentries=0: detect the number of events and set the nevents automatically
# Line 98 | Line 107 | sample::sample(string m_filename, string
107        this->Nentries=measured_nevents;
108      }
109      this->weight=(xs/(float)Nentries);
110 +    TH1F *weight_histo = (TH1F*)(this->tfile)->Get("weight_histo");
111 +    this->weight/=average_weight;
112    }
113    else {
114      this->is_active=false;
# Line 437 | Line 448 | THStack samplecollection::DrawStack(stri
448        if(!(this->collection)[isample].is_data) tempdrawhisto->Scale(luminosity*((this->collection)[isample].weight));
449        tempdrawhisto->SetFillColor(this->GetColor(isample));
450        if(bookedhistos[(this->collection)[isample].groupindex]==0) {
451 <        tempdrawhisto->SetName(GetNumericHistoName().c_str());
451 >        tempdrawhisto->SetName((removefunnystring((this->collection)[isample].samplename)+"__"+GetNumericHistoName()).c_str());
452          histogroups[(this->collection)[isample].groupindex]=(TH1F*)tempdrawhisto->Clone();
453          bookedhistos[(this->collection)[isample].groupindex]=1;
454        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines