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.54 by pablom, Wed Nov 23 16:39:56 2011 UTC vs.
Revision 1.57 by buchmann, Thu Dec 1 11:29:48 2011 UTC

# Line 11 | Line 11
11   #include <TF1.h>
12  
13   #ifndef SampleClassLoaded
14 < #include "ActiveSamples.C"
14 > #include "SampleClass.C"
15   #endif
16  
17   #ifndef Verbosity
# Line 297 | Line 297 | void PeakError(TTree *events,float &resu
297          }
298          if(TMath::Abs(rescent-resup)>TMath::Abs(rescent-resdown)) result=(TMath::Abs(rescent-resup)/(float)rescent);
299          else result=(TMath::Abs(rescent-resdown)/(float)rescent);
300 <        cout << "    " << result << endl;
300 >        if(!automatized) cout << "    " << result << endl;
301   }
302  
303  
# Line 435 | Line 435 | Value MCefficiency(TTree *events,float &
435          string emnewNegSide = "((id1!=id2)&&(" + snegSide + "))*" + svar; // only used for off peak analysis
436  
437          TH1F *effh= new TH1F("effh","effh",1,-14000,14000);
438 <        if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), TCut(newPosSide.c_str())*PlottingSetup::Weight,"goff");
439 <        else events->Draw((mcjzbexpression+">>effh").c_str(), TCut((sposSide+"&&(id1==id2)").c_str())*PlottingSetup::Weight,"goff");//the OSSF condition is added for the offpeak analysis, in onpeak case it's there already but doesn't change anything.
438 >        if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), TCut(newPosSide.c_str())*cutWeight,"goff");
439 >        else events->Draw((mcjzbexpression+">>effh").c_str(), TCut((sposSide+"&&(id1==id2)").c_str())*cutWeight,"goff");//the OSSF condition is added for the offpeak analysis, in onpeak case it's there already but doesn't change anything.
440  
441          Float_t sel = effh->Integral();
442          Float_t nsel=0;
# Line 446 | Line 446 | Value MCefficiency(TTree *events,float &
446          if(ConsiderSignalContaminationForLimits) {
447            flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
448            if(PlottingSetup::RestrictToMassPeak) {
449 <            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(newNegSide.c_str()))*PlottingSetup::Weight,"goff");
449 >            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(newNegSide.c_str()))*cutWeight,"goff");
450              nsel += effh->Integral();
451            } else {
452 <            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(newNegSide.c_str()))*PlottingSetup::Weight,"goff");
452 >            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(newNegSide.c_str()))*cutWeight,"goff");
453              nsel += effh->Integral();
454 <            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(emnewPosSide.c_str()))*PlottingSetup::Weight,"goff");
454 >            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(emnewPosSide.c_str()))*cutWeight,"goff");
455              nsel += effh->Integral();
456 <            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(emnewNegSide.c_str()))*PlottingSetup::Weight,"goff");
456 >            events->Draw((mcjzbexpression+">>effh").c_str(), (TCut(emnewNegSide.c_str()))*cutWeight,"goff");
457              nsel -= effh->Integral();
458            }
459          }
# Line 644 | Line 644 | int get_npdfs(TTree *events) {
644   }
645    
646  
647 < void do_systematics_for_one_file(TTree *events,int Neventsinfile,string informalname, vector<vector<float> > &results,int flipped, string mcjzb,string datajzb,float peakerror,bool requireZ=false, string addcut="", bool ismSUGRA=false) {
647 > void do_systematics_for_one_file(TTree *events,int Neventsinfile,string informalname, vector<vector<float> > &results,int flipped, string mcjzb,string datajzb,float peakerror,bool requireZ=false, string addcut="", bool isscan=false) {
648    float JZBScaleUncert=0.05;
649    mcjzbexpression=mcjzb;
650    float triggereff=2.0/100;// in range [0,1]
# Line 654 | Line 654 | void do_systematics_for_one_file(TTree *
654    dout << "Lepton selection efficiency not implemented in this script  yet, still using external one" << endl;
655    
656    int NPdfs=0;
657 <  if(ismSUGRA) NPdfs = get_npdfs(events);
657 >  if(isscan) NPdfs = get_npdfs(events);
658    
659    float mceff,mcefferr,jzbeff,jzbefferr;
660    if(!automatized) dout << "MC efficiencies:" << endl;
# Line 681 | Line 681 | void do_systematics_for_one_file(TTree *
681    float resp,resperr;
682    if(PlottingSetup::computeJZBresponse) {
683          if(!automatized) dout << "JZB response: " << std::endl;
684 <        if(!ismSUGRA) JZBresponse(events,informalname,requireZ,resp,resperr,flipped,addcut);
684 >        if(!isscan) JZBresponse(events,informalname,requireZ,resp,resperr,flipped,addcut);
685    }
686  
687    if(!automatized) dout << "Pileup: " << std::endl;
# Line 690 | Line 690 | void do_systematics_for_one_file(TTree *
690  
691    float PDFuncert=0;
692    if(!automatized) dout << "Assessing PDF uncertainty: " << std::endl;
693 <  if(ismSUGRA) PDFuncert = get_pdf_uncertainty(events, flipped, mcjzb, requireZ, Neventsinfile, NPdfs, addcut);
693 >  if(isscan) PDFuncert = get_pdf_uncertainty(events, flipped, mcjzb, requireZ, Neventsinfile, NPdfs, addcut);
694  
695    dout << "_______________________________________________" << endl;
696    dout << "                 SUMMARY FOR " << informalname << " with JZB>" << jzbSel << "  (all in %) ";
# Line 703 | Line 703 | void do_systematics_for_one_file(TTree *
703    dout << "JZB Scale Uncert: " << scaledown << " " << scaleup << endl; // in range [0,1]
704   //  dout << "Resolution : " << resolution << endl; // in range [0,1]
705    dout << "From peak : " << sysfrompeak << endl; // in range [0,1]
706 <  if(ismSUGRA) dout << "PDF uncertainty  : " << PDFuncert << endl; // in range [0,1]
706 >  if(isscan) dout << "PDF uncertainty  : " << PDFuncert << endl; // in range [0,1]
707    if(PlottingSetup::computeJZBefficiency) dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << " (not yet included below) " << endl; // in range [0,1]
708    if(PlottingSetup::computeJZBresponse)dout << "JZB response  : " << resp << " +/-" << resperr << " (not yet included below) " << endl; // in range [0,1]
709    
# Line 714 | Line 714 | void do_systematics_for_one_file(TTree *
714    if(fabs(scaleup)>fabs(scaledown)) toterr+=(scaleup*scaleup); else toterr+=(scaledown*scaledown);
715   //  toterr+=(resolution*resolution);
716    toterr+=(sysfrompeak*sysfrompeak);
717 <  if(ismSUGRA) toterr+=(PDFuncert*PDFuncert);
717 >  if(isscan) toterr+=(PDFuncert*PDFuncert);
718    dout << "TOTAL SYSTEMATICS: " << TMath::Sqrt(toterr) << " --> " << TMath::Sqrt(toterr)*mceff << endl;
719    float systerr=TMath::Sqrt(toterr)*mceff;
720    toterr=TMath::Sqrt(toterr*mceff*mceff+mcefferr*mcefferr);//also includes stat err!
# Line 736 | Line 736 | void do_systematics_for_one_file(TTree *
736    res.push_back(0.0);
737    res.push_back(mceff_nosigcont.getValue());
738    res.push_back(mceff_nosigcont.getError());
739 <  if(ismSUGRA) res.push_back(PDFuncert);
739 >  if(isscan) res.push_back(PDFuncert);
740    results.push_back(res);
741   }
742  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines