124 |
|
//******************************************************** |
125 |
|
|
126 |
|
TCut essentialcut("mll>0"); |
127 |
< |
// This will reweight all the events: use "weight" to correct MC for pileUP |
127 |
> |
// This will reweight all the events: use "weight" to correct MC for pileUP, "1.0" otherwise |
128 |
|
TCut cutWeight("weight"); |
129 |
|
|
130 |
|
void setessentialcut(TCut ess) { |
169 |
|
|
170 |
|
void PickUpFromThisFile(int isamp, string cut, vector<string> &output, vector<string> &pickupfile); |
171 |
|
void PickUpEvents(string cut); |
172 |
+ |
string find_units(string&); |
173 |
|
}; |
174 |
|
|
175 |
|
samplecollection::samplecollection(string m_name) |
299 |
|
}//end of loop over isample |
300 |
|
if(Verbosity>0) dout << "Histo has been filled and now contains " << histo->Integral() << " points (integral)" << endl; |
301 |
|
histo->GetXaxis()->SetTitle(m_xlabel.c_str()); |
302 |
< |
histo->GetYaxis()->SetTitle(m_ylabel.c_str()); |
302 |
> |
// Try to add bin width information: look for units in m_xlabel |
303 |
> |
string units = find_units(m_xlabel); |
304 |
> |
if ( units.length()>0 ) { |
305 |
> |
stringstream ylabel; |
306 |
> |
ylabel << m_ylabel << " / " << histo->GetBinWidth(1) << " " << units; |
307 |
> |
histo->GetYaxis()->SetTitle( ylabel.str().c_str() ); |
308 |
> |
} else { |
309 |
> |
histo->GetYaxis()->SetTitle(m_ylabel.c_str()); |
310 |
> |
} |
311 |
|
histo->GetXaxis()->CenterTitle(); |
312 |
|
histo->GetYaxis()->CenterTitle(); |
313 |
|
if(do_only_selected_samples) histo->SetLineColor(this->GetColor(onlyindex[0])); |
483 |
|
} |
484 |
|
if(hitcollection.size()==0) { |
485 |
|
hitcollection.push_back(-1); |
486 |
< |
dout << "*** Warning: couldn't find sample " << what << ": using all" << endl; |
486 |
> |
write_warning(__FUNCTION__,"Couldn't find sample "+string(what)+" using sample collection \""+string(this->name)+"\""); |
487 |
|
} |
488 |
|
return hitcollection; |
489 |
|
} |
573 |
|
(this->collection)[isamp].events->SetBranchAddress("eventNum",&eventNum); |
574 |
|
(this->collection)[isamp].events->SetBranchAddress("lumi",&lumi); |
575 |
|
(this->collection)[isamp].events->SetBranchAddress("runNum",&runNum); |
576 |
+ |
|
577 |
|
|
578 |
|
TTreeFormula *select = new TTreeFormula("select", cut.c_str()&&essentialcut, (this->collection)[isamp].events); |
579 |
|
int npickedup=0; |
603 |
|
//do something with output and of course the pickup file! |
604 |
|
} |
605 |
|
|
606 |
+ |
//________________________________________________________________________________________ |
607 |
+ |
// Find units from histogram x-label (looks for '[...]') |
608 |
+ |
string samplecollection::find_units(string& xlabel) { |
609 |
+ |
|
610 |
+ |
string units; |
611 |
+ |
size_t pos1 = xlabel.find("["); |
612 |
+ |
if ( pos1 != string::npos ) { |
613 |
+ |
size_t pos2 = xlabel.find("]"); |
614 |
+ |
units = xlabel.substr(pos1+1,pos2-pos1-1); |
615 |
+ |
}// else { |
616 |
+ |
// size_t pos1 = xlabel.find("("); |
617 |
+ |
// if ( pos1 != string::npos ) { |
618 |
+ |
// size_t pos2 = xlabel.find(")"); |
619 |
+ |
// units = xlabel.substr(pos1+1,pos2-pos1-1); |
620 |
+ |
// } |
621 |
+ |
// } |
622 |
+ |
return units; |
623 |
+ |
|
624 |
+ |
} |
625 |
|
|
626 |
|
void switch_overunderflow(bool newpos=false) { |
627 |
|
addoverunderflowbins=newpos; |
628 |
|
} |
629 |
+ |
|
630 |
+ |
|