506 |
|
|
507 |
|
//________________________________________________________________________ |
508 |
|
// Effect of energy scale on efficiency |
509 |
< |
void JZBjetScale(TTree *events, float &jesdown, float &jesup, string informalname, int flipped, bool requireZ,string addcut="",float syst=0.1, Float_t jzbSelection=-1, TString plotName = "" ) { |
509 |
> |
void JZBjetScale(TTree *events, float &jesdown, float &jesup, string informalname, int flipped, bool requireZ,string addcut="",Float_t jzbSelection=-1, TString plotName = "" ) { |
510 |
|
TCut kbase(genMassCut&&"genZPt>0"); |
511 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
512 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
515 |
|
TCut ksel(cutmass&&cutOSSF); |
516 |
|
TCut nJets("pfJetGoodNum>2"); |
517 |
|
stringstream down,up; |
518 |
< |
down << "pfJetGoodNum"<<30*(1-syst)<<">=3"; |
519 |
< |
up << "pfJetGoodNum"<<30*(1+syst)<<">=3"; |
518 |
> |
down << "pfJetGoodNumn1sigma>=3"; |
519 |
> |
up << "pfJetGoodNump1sigma>=3"; |
520 |
|
|
521 |
|
TCut nJetsP(up.str().c_str()); |
522 |
|
TCut nJetsM(down.str().c_str()); |
637 |
|
|
638 |
|
|
639 |
|
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) { |
640 |
< |
float JetEnergyScaleUncert=0.1; |
641 |
< |
float JZBScaleUncert=0.1; |
640 |
> |
float JZBScaleUncert=0.05; |
641 |
|
mcjzbexpression=mcjzb; |
642 |
< |
float triggereff=5.0/100;// in range [0,1] |
642 |
> |
float triggereff=2.0/100;// in range [0,1] |
643 |
|
dout << "Trigger efficiency not implemented in this script yet, still using external one" << endl; |
644 |
|
float leptonseleff=2.0/100;// in range [0,1] |
645 |
|
leptonseleff=TMath::Sqrt(leptonseleff*leptonseleff+leptonseleff*leptonseleff); // because the 2% is per lepton |
663 |
|
|
664 |
|
if(!automatized) dout << "Jet energy scale: " << std::endl; |
665 |
|
float jesup,jesdown; |
666 |
< |
JZBjetScale(events,jesdown,jesup,informalname,flipped,requireZ,addcut,JetEnergyScaleUncert); |
666 |
> |
JZBjetScale(events,jesdown,jesup,informalname,flipped,requireZ,addcut); |
667 |
|
|
668 |
|
if(!automatized) dout << "JZB scale: " << std::endl; |
669 |
|
float scaleup,scaledown,scalesyst; |
673 |
|
float resp,resperr; |
674 |
|
if(PlottingSetup::computeJZBresponse) { |
675 |
|
if(!automatized) dout << "JZB response: " << std::endl; |
676 |
< |
JZBresponse(events,requireZ,resp,resperr,flipped,addcut); |
676 |
> |
if(!ismSUGRA) JZBresponse(events,requireZ,resp,resperr,flipped,addcut); |
677 |
|
} |
678 |
|
|
679 |
|
if(!automatized) dout << "Pileup: " << std::endl; |
680 |
< |
float resolution; |
681 |
< |
resolution=pileup(events,requireZ,informalname,flipped,addcut); |
680 |
> |
// float resolution; |
681 |
> |
//resolution=pileup(events,requireZ,informalname,flipped,addcut); |
682 |
|
|
683 |
|
float PDFuncert=0; |
684 |
|
if(!automatized) dout << "Assessing PDF uncertainty: " << std::endl; |
693 |
|
dout << "Lepton Sel Eff: " << leptonseleff << endl; // in range [0,1] |
694 |
|
dout << "Jet energy scale: " << jesup << " " << jesdown << endl; // in range [0,1] |
695 |
|
dout << "JZB Scale Uncert: " << scaledown << " " << scaleup << endl; // in range [0,1] |
696 |
< |
dout << "Resolution : " << resolution << endl; // in range [0,1] |
696 |
> |
// dout << "Resolution : " << resolution << endl; // in range [0,1] |
697 |
|
dout << "From peak : " << sysfrompeak << endl; // in range [0,1] |
698 |
|
if(ismSUGRA) dout << "PDF uncertainty : " << PDFuncert << endl; // in range [0,1] |
699 |
|
if(PlottingSetup::computeJZBefficiency) dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << " (not yet included below) " << endl; // in range [0,1] |
704 |
|
toterr+=(leptonseleff)*(leptonseleff); |
705 |
|
if(fabs(jesup)>fabs(jesdown)) toterr+=(jesup*jesup); else toterr+=(jesdown*jesdown); |
706 |
|
if(fabs(scaleup)>fabs(scaledown)) toterr+=(scaleup*scaleup); else toterr+=(scaledown*scaledown); |
707 |
< |
toterr+=(resolution*resolution); |
707 |
> |
// toterr+=(resolution*resolution); |
708 |
|
toterr+=(sysfrompeak*sysfrompeak); |
709 |
|
if(ismSUGRA) toterr+=(PDFuncert*PDFuncert); |
710 |
|
dout << "TOTAL SYSTEMATICS: " << TMath::Sqrt(toterr) << " --> " << TMath::Sqrt(toterr)*mceff << endl; |
724 |
|
res.push_back(TMath::Sqrt((mcefferr)*(mcefferr)+(toterr*toterr))); |
725 |
|
if(fabs(jesup)>fabs(jesdown)) res.push_back(fabs(jesup)); else res.push_back(fabs(jesdown)); |
726 |
|
if(fabs(scaleup)>fabs(scaledown)) res.push_back(fabs(scaleup)); else res.push_back(fabs(scaledown)); |
727 |
< |
res.push_back(fabs(resolution)); |
727 |
> |
// res.push_back(fabs(resolution)); |
728 |
|
res.push_back(mceff_nosigcont.getValue()); |
729 |
|
res.push_back(mceff_nosigcont.getError()); |
730 |
|
if(ismSUGRA) res.push_back(PDFuncert); |