11 |
|
#include <TF1.h> |
12 |
|
|
13 |
|
#ifndef SampleClassLoaded |
14 |
< |
#include "ActiveSamples.C" |
14 |
> |
#include "SampleClass.C" |
15 |
|
#endif |
16 |
|
|
17 |
|
#ifndef Verbosity |
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 |
|
|
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; |
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 |
|
} |
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] |
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; |
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; |
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 %) "; |
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 |
|
|
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! |
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 |
|
|