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 |
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; |
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 |
|
} |