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

Comparing UserCode/cbrown/AnalysisFramework/Plotting/Modules/Systematics.C (file contents):
Revision 1.33 by buchmann, Mon Sep 26 15:09:41 2011 UTC vs.
Revision 1.36 by buchmann, Wed Sep 28 15:58:09 2011 UTC

# Line 281 | Line 281 | void PeakError(TTree *events,float &resu
281   //returns the efficiency WITHOUT signal contamination, and the result and resulterr contain the result and the corresponding error
282   Value MCefficiency(TTree *events,float &result, float &resulterr,string mcjzb,bool requireZ,int Neventsinfile, string addcut="", int k = 0) {
283          
284 +        if(!events) {
285 +          write_error(__FUNCTION__,"Tree passed for efficiency calculation is invalid!");
286 +          return Value(0,0);
287 +        }
288 +        
289          char jzbSelStr[256]; sprintf(jzbSelStr,"%f",jzbSel);
290          // All acceptance cuts at gen. level
291          //TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&genJZB"+geq_or_leq()+TString(jzbSelStr)+"&&genId1==-genId2");
# Line 301 | Line 306 | Value MCefficiency(TTree *events,float &
306          string newNegSide = "(" + snegSide + ")*" + svar;
307  
308          TH1F *effh= new TH1F("effh","effh",1,-14000,14000);
309 <        if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newPosSide.c_str(),"goff");
310 <        else events->Draw((mcjzbexpression+">>effh").c_str(), sposSide.c_str(),"goff");
309 >        cout << "right before drawing" << endl;
310 >        if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newPosSide.c_str(),"");
311 >        else events->Draw((mcjzbexpression+">>effh").c_str(), sposSide.c_str(),"");
312 >        cout << "right after drawing" << endl;
313 >        cout << "consider sigcont?" << ConsiderSignalContaminationForLimits << endl;
314          Float_t sel = effh->Integral();
315          Float_t nsel=0;
316          if(ConsiderSignalContaminationForLimits) {
317 <          if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff");
318 <          else events->Draw((mcjzbexpression+">>effh").c_str(), snegSide.c_str(),"goff");
317 >          if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"");
318 >          else events->Draw((mcjzbexpression+">>effh").c_str(), snegSide.c_str(),"");
319            nsel = effh->Integral();
320          }
321          //Corrections due to normalization in the PDF. This has to be applied as well to the number of events in a file if the definition changes at some point.
# Line 334 | Line 342 | Value MCefficiency(TTree *events,float &
342          if(!automatized && k>0 ) dout << "PDF assessment: ";
343          if(!automatized) dout << "  MC efficiency: " << result << "+-" << resulterr << "  ( JZB>" << jzbSel << " : " << sel << " , JZB<-" << jzbSel << " : " << nsel << " and nevents=" << tot << ") with normFact=" << normFactor << std::endl;
344          delete effh;
345 +        return result_wo_signalcont;
346   }
347  
348  
# Line 501 | Line 510 | void do_systematics_for_one_file(TTree *
510    
511    float mceff,mcefferr,jzbeff,jzbefferr;
512    if(!automatized) dout << "MC efficiencies:" << endl;
513 <  MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut,-1);
513 >  Value mceff_nosigcont = MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut,-1);
514 >  if(!automatized) cout << "   Without signal contamination, we find an efficiency of " << mceff_nosigcont << endl;
515 >
516    if(PlottingSetup::computeJZBefficiency) JZBefficiency(events,informalname,jzbeff,jzbefferr,requireZ,addcut);
517    if(!automatized) dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << endl;
518    
# Line 561 | Line 572 | void do_systematics_for_one_file(TTree *
572    
573    dout << "FINAL RESULT : " << 100*mceff << " +/- "<< 100*mcefferr << " (stat) +/- " << 100*systerr << " (syst)   %" << endl;
574    dout << "     we thus use the sqrt of the sum of the squares of the stat & syst err, which is : " << 100*toterr << endl;
575 +  dout << "_______________________________________________" << endl;
576    
577    //Do not modify the lines below or mess with the order; this order is expected by all limit calculating functions!
578    vector<float> res;
# Line 572 | Line 584 | void do_systematics_for_one_file(TTree *
584    if(fabs(jesup)>fabs(jesdown)) res.push_back(fabs(jesup)); else res.push_back(fabs(jesdown));
585    if(fabs(scaleup)>fabs(scaledown)) res.push_back(fabs(scaleup)); else res.push_back(fabs(scaledown));
586    res.push_back(fabs(resolution));
587 +  res.push_back(mceff_nosigcont.getValue());
588 +  res.push_back(mceff_nosigcont.getError());
589    if(ismSUGRA) res.push_back(PDFuncert);
590    results.push_back(res);
591   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines