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

Comparing UserCode/cbrown/AnalysisFramework/Plotting/Modules/SampleClass.C (file contents):
Revision 1.9 by buchmann, Wed Jul 27 13:07:42 2011 UTC vs.
Revision 1.13 by buchmann, Wed Aug 17 09:22:37 2011 UTC

# Line 124 | Line 124 | bool doesROOTFileExist(string filename)
124   //********************************************************
125  
126   TCut essentialcut("mll>0");
127 + // This will reweight all the events: use "weight" to correct MC for pileUP
128 + TCut cutWeight("weight");
129  
130   void setessentialcut(TCut ess) {
131    essentialcut=ess;
# Line 280 | Line 282 | TH1F* samplecollection::Draw(string m_hi
282      tempdrawhisto->Sumw2();
283      if(use_this_sample) {
284        if(Verbosity>0) dout << "[samplecollection::Draw] : Added contribution from sample " << (this->collection)[isample].samplename << endl;
285 <      (this->collection)[isample].events->Draw(drawthis.str().c_str(),(essentialcut&&Cut)*"weight");//this weight is based on PU etc. not XS
285 >      (this->collection)[isample].events->Draw(drawthis.str().c_str(),(essentialcut&&Cut)*cutWeight);//this weight is based on PU etc. not XS
286        if(addoverunderflowbins) {
287          //now also adding the overflow & underflow bins:
288          tempdrawhisto->SetBinContent(tempdrawhisto->GetNbinsX(),tempdrawhisto->GetBinContent(tempdrawhisto->GetNbinsX()+1));
# Line 345 | Line 347 | TH2F* samplecollection::Draw(string m_hi
347      tempdrawhisto->Sumw2();
348      if(use_this_sample) {
349        if(Verbosity>0) dout << "[samplecollection::Draw] : Added contribution from sample " << (this->collection)[isample].samplename << endl;
350 <      (this->collection)[isample].events->Draw(drawthis.str().c_str(),(essentialcut&&Cut)*"weight");//this weight is based on PU etc. not XS
350 >      (this->collection)[isample].events->Draw(drawthis.str().c_str(),(essentialcut&&Cut)*cutWeight);//this weight is based on PU etc. not XS
351        if(addoverunderflowbins) {
352          //now also adding the overflow & underflow bins:
353          tempdrawhisto->SetBinContent(tempdrawhisto->GetNbinsX(),tempdrawhisto->GetBinContent(tempdrawhisto->GetNbinsX()+1));
# Line 400 | Line 402 | THStack samplecollection::DrawStack(stri
402      if(!drawsignal&&(this->collection)[isample].is_signal) continue;
403      if((this->collection)[isample].is_active&&(this->collection)[isample].is_data==m_is_data) {//fills mc if we want mc, else fills data.
404        TH1F *tempdrawhisto = new TH1F("tempdrawhisto","",binning.size()-1,binningarray);
405 <      (this->collection)[isample].events->Draw(drawthis.str().c_str(),(essentialcut&&Cut)*"weight");
405 >      (this->collection)[isample].events->Draw(drawthis.str().c_str(),(essentialcut&&Cut)*cutWeight);
406        
407        if(addoverunderflowbins) {
408          //now also adding the overflow & underflow bins:
# Line 467 | Line 469 | vector<int> samplecollection::FindSample
469    {
470      if(((this->collection)[isam].filename).find(what)!=string::npos) {
471        hitcollection.push_back(isam);
472 +    } else {
473      }
471    else {
472    }
474    }
475 <  if(hitcollection.size()==0) hitcollection.push_back(-1);
475 >  if(hitcollection.size()==0) {
476 >    hitcollection.push_back(-1);
477 >    write_warning(__FUNCTION__,"Couldn't find sample "+string(what)+" using sample collection \""+string(this->name)+"\"");
478 >  }
479    return hitcollection;
480   }
481  
# Line 560 | Line 564 | void samplecollection::PickUpFromThisFil
564    (this->collection)[isamp].events->SetBranchAddress("eventNum",&eventNum);
565    (this->collection)[isamp].events->SetBranchAddress("lumi",&lumi);
566    (this->collection)[isamp].events->SetBranchAddress("runNum",&runNum);
567 +
568    
569    TTreeFormula *select = new TTreeFormula("select", cut.c_str()&&essentialcut, (this->collection)[isamp].events);
570    int npickedup=0;
# Line 592 | Line 597 | void samplecollection::PickUpEvents(stri
597  
598   void switch_overunderflow(bool newpos=false) {
599    addoverunderflowbins=newpos;
600 < }
600 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines