From 39d1524853d00e88ab72c43e287766db2050a9d6 Mon Sep 17 00:00:00 2001 From: Fengwangdong Date: Sat, 30 Apr 2016 01:01:50 +0200 Subject: [PATCH 1/4] update JRA code from latest offline to online --- JetAnalyzers/bin/jet_apply_jec_x.cc | 4 +- JetAnalyzers/bin/jet_l2_correction_x.cc | 2 +- JetAnalyzers/bin/jet_l3_correction_x.cc | 4 +- JetAnalyzers/bin/jet_response_analyzer_x.cc | 98 +- .../bin/jet_response_and_resolution_x.cc | 9 +- JetAnalyzers/bin/jet_response_fitter_x.cc | 2 +- .../config/jra_Eta_finebinning.config | 151 ++ JetAnalyzers/config/jra_QCDflat.config | 153 ++ .../config/jra_QCDflat_MergeEta.config | 144 ++ .../config/jra_QCDflat_MergePt.config | 150 ++ .../config/jra_QCDflat_MergePtEta.config | 141 ++ JetAnalyzers/config/jra_dr_finebinning.config | 160 +- JetAnalyzers/interface/JetResponseAnalyzer.hh | 3 +- JetAnalyzers/python/JetReconstruction_cff.py | 6 + JetAnalyzers/python/addAlgorithm.py | 149 +- JetAnalyzers/src/JetResponseAnalyzer.cc | 16 +- JetAnalyzers/test/run_JRA_hlt_cfg.py | 211 ++ JetAnalyzers/test/sanity/CaloCorFactor.cc | 60 + JetAnalyzers/test/sanity/PFCorFactor.cc | 61 + JetUtilities/Makefile | 8 +- JetUtilities/bin/BuildFile.xml | 2 + JetUtilities/bin/jet_inspect_graphs_x.cc | 2143 ++++++++--------- JetUtilities/bin/jet_inspect_multigraphs_x.cc | 1224 ++++++++++ JetUtilities/interface/JRAEvent.h | 6 + JetUtilities/plugins/MatchRecToGen.cc | 45 +- JetUtilities/src/JRAEvent.cc | 14 + JetUtilities/src/L2Creator.cc | 10 +- JetUtilities/src/classes_def.xml | 3 +- 28 files changed, 3581 insertions(+), 1398 deletions(-) create mode 100644 JetAnalyzers/config/jra_Eta_finebinning.config create mode 100644 JetAnalyzers/config/jra_QCDflat.config create mode 100644 JetAnalyzers/config/jra_QCDflat_MergeEta.config create mode 100644 JetAnalyzers/config/jra_QCDflat_MergePt.config create mode 100644 JetAnalyzers/config/jra_QCDflat_MergePtEta.config create mode 100644 JetAnalyzers/test/run_JRA_hlt_cfg.py create mode 100644 JetAnalyzers/test/sanity/CaloCorFactor.cc create mode 100644 JetAnalyzers/test/sanity/PFCorFactor.cc create mode 100644 JetUtilities/bin/jet_inspect_multigraphs_x.cc diff --git a/JetAnalyzers/bin/jet_apply_jec_x.cc b/JetAnalyzers/bin/jet_apply_jec_x.cc index ec531cde..c6671029 100644 --- a/JetAnalyzers/bin/jet_apply_jec_x.cc +++ b/JetAnalyzers/bin/jet_apply_jec_x.cc @@ -59,9 +59,9 @@ int main(int argc,char**argv) string output = cl.getValue ("output", ""); string jecpath = cl.getValue ("jecpath", ""); vector algs = cl.getVector ("algs", ""); - bool L1FastJet = cl.getValue ("L1FastJet", false); + bool L1FastJet = cl.getValue ("L1FastJet", true); vector postfix = cl.getVector ("postfix", ""); - bool useTags = cl.getValue ("useTags", true); + bool useTags = cl.getValue ("useTags", false); bool saveitree = cl.getValue ("saveitree", true); bool debug = cl.getValue ("debug", false); diff --git a/JetAnalyzers/bin/jet_l2_correction_x.cc b/JetAnalyzers/bin/jet_l2_correction_x.cc index 769a0e61..f242b196 100644 --- a/JetAnalyzers/bin/jet_l2_correction_x.cc +++ b/JetAnalyzers/bin/jet_l2_correction_x.cc @@ -33,7 +33,7 @@ int main(int argc,char**argv) CommandLine cl; if (!cl.parse(argc,argv)) return 0; - bool batch = cl.getValue ("batch", false); + bool batch = cl.getValue ("batch", true); if (!cl.partialCheck()) return 0; cl.print(); diff --git a/JetAnalyzers/bin/jet_l3_correction_x.cc b/JetAnalyzers/bin/jet_l3_correction_x.cc index 511ae7c3..4bdfe85d 100644 --- a/JetAnalyzers/bin/jet_l3_correction_x.cc +++ b/JetAnalyzers/bin/jet_l3_correction_x.cc @@ -65,9 +65,9 @@ int main(int argc,char**argv) string input = cl.getValue ("input"); string era = cl.getValue ("era"); string output = cl.getValue ("output","l3.root"); - vector formats = cl.getVector("formats", ""); + vector formats = cl.getVector("formats", "png"); vector algs = cl.getVector("algs", ""); - bool batch = cl.getValue ("batch", false); + bool batch = cl.getValue ("batch", true); bool logx = cl.getValue ("logx", false); bool logy = cl.getValue ("logy", false); string flavor = cl.getValue ("flavor", ""); diff --git a/JetAnalyzers/bin/jet_response_analyzer_x.cc b/JetAnalyzers/bin/jet_response_analyzer_x.cc index 245c41cd..9545c4f5 100644 --- a/JetAnalyzers/bin/jet_response_analyzer_x.cc +++ b/JetAnalyzers/bin/jet_response_analyzer_x.cc @@ -62,6 +62,10 @@ TString pdgid_to_flavor_name(int pdgid); void fill_histo(float value,float weight,float x, const vector& binsx,const vector& histos); +/// fill the appropriate histogram (histos), based on x and binsx +void fill_histo(float value,float weight,float x, + const vector& binsx,const vector& histos); + /// fill the appropriate histogram (histos), based on pdgid, x and binsx void fill_histo(int pdgid,float value,float weight,float x, const vector& binsx,const vector& histos, @@ -72,6 +76,11 @@ void fill_histo(float value,float weight,float x,float y, const vector& binsx,const vector& binsy, const vector& histos); +/// fill the appropriate histogram (histos), based on x, y, binsx, and binsy +void fill_histo(float value,float weight,float x,float y, + const vector& binsx,const vector& binsy, + const vector& histos); + /// fill the appropriate histogram (histos), based on pdgid, x, y, binsx, and binsy void fill_histo(int pdgid,float value,float weight,float x,float y, const vector& binsx,const vector& binsy, @@ -128,6 +137,7 @@ int main(int argc,char**argv) vector binseta = cl.getVector ("binseta", ""); vector binsphi = cl.getVector ("binsphi", ""); vector binsy = cl.getVector ("binsy", ""); + vector binsTrueNPU = cl.getVector ("binsTrueNPU", ""); vector binsmu = cl.getVector ("binsmu", ""); vector binsrho = cl.getVector ("binsrho", ""); string treename = cl.getValue ("treename", "t"); @@ -151,7 +161,7 @@ int main(int argc,char**argv) bool doflavor = cl.getValue ("doflavor", false); TString flavorDefinition = cl.getValue("flavorDefinition", "phys"); bool noabsflavors = cl.getValue ("noabsflavors", false); - float drmax = cl.getValue ("drmax", 0.3); + float drmax = cl.getValue ("drmax", 0.25); float dphimin = cl.getValue ("dphimin", 2.7); bool dojetpt = cl.getValue ("dojetpt", false); bool dorefpt = cl.getValue ("dorefpt", true); @@ -394,7 +404,12 @@ int main(int argc,char**argv) vector relRspVsJetEtaRhoRefPt; vector relRspVsJetYJetPt; vector relRspVsJetYRefPt; - + + /// add for HLT usage: true pileup will be treated as variable + vector relRspVsTrueNPU; + vector relRspVsTrueNPUJetPt; + vector relRspVsTrueNPURefPt; + vector absRspVsJetPt; vector absRspVsRefPt; vector absRspVsRefPtBarrel; @@ -419,7 +434,19 @@ int main(int argc,char**argv) vector phiRspVsJetPhi; vector phiRspVsJetEtaJetPt; vector phiRspVsJetEtaRefPt; - + + // book TrueNPU histograms + if (binsTrueNPU.size()>=2){ + string hname; + if (dorelrsp&&dorefpt) { + for(unsigned int iTPU=0;iTPU=2) { for (unsigned int ipt=0;ipt=2 && binspt.size()>=2){ + for (unsigned int iTPU=0;iTPU=2&&binseta.size()>=2) { @@ -1312,6 +1379,7 @@ int main(int argc,char**argv) tree->GetEntry(ientry); float mu = JRAEvt->tnpus->at(itInd); + float TrueNPU = JRAEvt->tnpus->at(0); if (nrefmax>0) JRAEvt->nref = std::min((int)JRAEvt->nref,nrefmax); for (unsigned char iref=0;irefnref;iref++) { @@ -1569,6 +1637,7 @@ int main(int argc,char**argv) } if (dorefpt) { fill_histo(relrsp,weight,refpt,binspt,relRspVsRefPt); + fill_histo(relrsp,weight,TrueNPU,binsTrueNPU,relRspVsTrueNPU); //Fill TrueNPU hist!!! if (doflavor) fill_histo(pdgid,relrsp,flavorWeight, refpt,binspt,relRspVsRefPt, noabsflavors); @@ -1591,6 +1660,7 @@ int main(int argc,char**argv) if (dojetpt) { fill_histo(relrsp,weight,eta,pt,binseta,binspt,relRspVsJetEtaJetPt); + fill_histo(relrsp,weight,TrueNPU,pt,binsTrueNPU,binspt,relRspVsTrueNPUJetPt); if (domu) fill_histo(relrsp, weight, eta, mu, pt, binseta, binsmu, binspt, relRspVsJetEtaMuJetPt); if (dorho) fill_histo(relrsp, weight, eta, JRAEvt->rho, pt, binseta, binsrho, binspt, relRspVsJetEtaRhoJetPt); @@ -1608,6 +1678,7 @@ int main(int argc,char**argv) } if (dorefpt) { fill_histo(relrsp,weight,eta,refpt,binseta,binspt,relRspVsJetEtaRefPt); + fill_histo(relrsp,weight,TrueNPU,refpt,binsTrueNPU,binspt,relRspVsTrueNPURefPt); if (domu) fill_histo(relrsp, weight, eta, mu, refpt, binseta, binsmu, binspt, relRspVsJetEtaMuRefPt); if (dorho) fill_histo(relrsp, weight, eta, JRAEvt->rho, refpt, binseta, binsrho, binspt, relRspVsJetEtaRhoRefPt); @@ -1809,7 +1880,6 @@ int get_index(float x,const vector& binsx) return -1; } - //______________________________________________________________________________ vector get_flavors(bool noabsflavors) { @@ -1883,6 +1953,14 @@ void fill_histo(float value,float weight,float x, if (ix>=0) histos[ix][0]->Fill(value,weight); } +//______________________________________________________________________________ +void fill_histo(float value,float weight,float x, + const vector& binsx, const vector& histos) +{ + if (binsx.size()==0) return; + int ix=get_index(x,binsx); + if (ix>=0) histos[ix]->Fill(value,weight); +} //______________________________________________________________________________ void fill_histo(int pdgid,float value,float weight,float x,const vector& binsx, @@ -1948,6 +2026,18 @@ void fill_histo(float value,float weight,float x,float y, } +//______________________________________________________________________________ +void fill_histo(float value,float weight,float x,float y, + const vector& binsx,const vector& binsy, + const vector& histos) +{ + if (binsx.size()==0||binsy.size()==0) return; + int ix=get_index(x,binsx); + int iy=get_index(y,binsy); + if (ix>=0&&iy>=0) histos[ix][iy]->Fill(value,weight); +} + + //______________________________________________________________________________ void fill_histo(int pdgid,float value,float weight,float x,float y, const vector& binsx,const vector& binsy, diff --git a/JetAnalyzers/bin/jet_response_and_resolution_x.cc b/JetAnalyzers/bin/jet_response_and_resolution_x.cc index ef26b7cc..c255a11c 100644 --- a/JetAnalyzers/bin/jet_response_and_resolution_x.cc +++ b/JetAnalyzers/bin/jet_response_and_resolution_x.cc @@ -59,7 +59,7 @@ int main(int argc,char**argv) bool dorho = cl.getValue ("dorho", false); vector flavors = cl.getVector("flavors", ""); vector algs = cl.getVector("algs", ""); - bool fitres = cl.getValue ("fitres", true); + bool fitres = cl.getValue ("fitres", false); bool unweighted = cl.getValue ("unweighted", false); bool verbose = cl.getValue ("verbose", false); bool forcefit = cl.getValue ("forcefit", false); @@ -76,9 +76,9 @@ int main(int argc,char**argv) float fracRMSjpt = cl.getValue ("fracRMSjpt", 1.); float fracRMScalo = cl.getValue ("fracRMScalo", 1.); - float calomin = cl.getValue ("calomin", -1.); + float calomin = cl.getValue ("calomin", -5.); float jptmin = cl.getValue ("jptmin", -1.); - float pfmin = cl.getValue ("pfmin", -1.); + float pfmin = cl.getValue ("pfmin", -5.); float puppimin = cl.getValue ("puppimin", -1.); float calofitmin = cl.getValue ("calofitmin", -1.); @@ -133,6 +133,9 @@ int main(int argc,char**argv) //variables.push_back("RelRsp:JetY"); variables.push_back("RelRsp:JetEta:RefPt"); variables.push_back("RelRsp:JetEta#1:RefPt"); //fitmin and min options affect JetEta#1 (vs. JetEta), seems to try to fit res but not rsp + variables.push_back("RelRsp:TrueNPU"); + variables.push_back("RelRsp:TrueNPU:RefPt"); + variables.push_back("RelRsp:TrueNPU#1:RefPt"); //variables.push_back("RelRsp:JetY:RefPt"); //variables.push_back("RelRsp:JetY#1:RefPt"); //variables.push_back("RelRsp_Barrel:RefPt"); diff --git a/JetAnalyzers/bin/jet_response_fitter_x.cc b/JetAnalyzers/bin/jet_response_fitter_x.cc index b332f6e3..960dd97b 100644 --- a/JetAnalyzers/bin/jet_response_fitter_x.cc +++ b/JetAnalyzers/bin/jet_response_fitter_x.cc @@ -88,7 +88,7 @@ int main(int argc,char**argv) string output = cl.getValue ("output", ""); double nsigma = cl.getValue ("nsigma", 1.5); float jtptmin = cl.getValue ("jtptmin", 1.0); - int niter = cl.getValue ("niter", 3); + int niter = cl.getValue ("niter", 30); int ndfmin = cl.getValue ("ndfmin", 5); vector algs = cl.getVector("algs", ""); int verbose = cl.getValue ("verbose", 0); diff --git a/JetAnalyzers/config/jra_Eta_finebinning.config b/JetAnalyzers/config/jra_Eta_finebinning.config new file mode 100644 index 00000000..9d50fea4 --- /dev/null +++ b/JetAnalyzers/config/jra_Eta_finebinning.config @@ -0,0 +1,151 @@ +$ +$ jet_response_analyzer_x: define binning in pt & eta +$ ------------------------ as well as dr matching criteria +$ found to yield comparable +$ matching efficiencies +$ for jet performance studies +$ + +$ +$ algorithms [format: algorithm:drmax] +$ +algs = ic5calo:0.210 + ak5calo:0.250 + gk5calo:0.210 + sc5calo:0.240 + kt4calo:0.200 + kt5calo:0.240 + ca4calo:0.190 + ca5calo:0.220 + ak5calol1:0.250 + ak5calol1l2:0.250 + ak5calol1l2l3:0.250 + ak5calol1off:0.250 + ak5calol1offl2l3:0.250 + ic5calol2l3:0.210 + ak5calol2l3:0.205 + gk5calol2l3:0.210 + sc5calol2l3:0.240 + kt4calol2l3:0.200 + kt5calol2l3:0.240 + ca4calol2l3:0.190 + ca5calol2l3:0.220 + ak7calo:0.350 + gk7calo:0.290 + sc7calo:0.340 + kt6calo:0.275 + kt7calo:0.325 + ca6calo:0.250 + ca7calo:0.300 + ak7calol1:0.350 + ak7calol1off:0.350 + ak7calol2l3:0.280 + gk7calol2l3:0.290 + sc7calol2l3:0.340 + kt6calol2l3:0.275 + kt7calol2l3:0.325 + ca6calol2l3:0.250 + ca7calol2l3:0.300 + ak5caloHLT:0.250 + ak5caloHLTl1:0.250 + ak5caloHLTl1l2:0.250 + ak5caloHLTl1l2l3:0.250 + ak4caloHLT:0.250 + ak4caloHLTl1:0.250 + ak4caloHLTl1l2:0.250 + ak4caloHLTl1l2l3:0.250 + ak8caloHLT:0.250 + ak8caloHLTl1:0.250 + ak8caloHLTl1l2:0.250 + ak8caloHLTl1l2l3:0.250 + ic5pf:0.105 + ak5pf:0.250 + gk5pf:0.110 + sc5pf:0.135 + kt4pf:0.120 + kt5pf:0.145 + ca4pf:0.115 + ca5pf:0.125 + ak5pfl1:0.250 + ak5pfl1l2:0.250 + ak5pfl1l2l3:0.250 + ak5pfl1off:0.250 + ic5pfl2l3:0.105 + ak5pfl2l3:0.110 + gk5pfl2l3:0.110 + sc5pfl2l3:0.135 + kt4pfl2l3:0.120 + kt5pfl2l3:0.145 + ca4pfl2l3:0.115 + ca5pfl2l3:0.125 + ak7pf:0.350 + gk7pf:0.150 + sc7pf:0.180 + kt6pf:0.180 + kt7pf:0.210 + ca6pf:0.150 + ca7pf:0.190 + ak7pfl1:0.350 + ak7pfl1off:0.350 + ak7pfl2l3:0.150 + gk7pfl2l3:0.150 + sc7pfl2l3:0.180 + kt6pfl2l3:0.180 + kt7pfl2l3:0.210 + ca6pfl2l3:0.150 + ca7pfl2l3:0.190 + ak5pfchs:0.250 + ak5pfchsl1:0.250 + ak5pfchsl2l3:0.250 + ak5pfchsl1l2l3:0.250 + ak5pfchsl1off:0.250 + ak7pfchs:0.350 + ak7pfchsl1:0.350 + ak7pfchsl1off:0.350 + ak5pfHLT:0.250 + ak4pfHLT:0.250 + ak4pfHLTl1:0.250 + ak4pfHLTl1l2:0.250 + ak4pfHLTl1l2l3:0.250 + ak8pfHLT:0.250 + ak8pfHLTl1:0.250 + ak8pfHLTl1l2:0.250 + ak8pfHLTl1l2l3:0.250 + ak4pfHLTNoPU:0.250 + ak4pfHLTNoPUl1:0.250 + ak4pfHLTNoPUl1l2:0.250 + ak4pfHLTNoPUl1l2l3:0.250 + ak5pfHLTl1:0.250 + ak5pfHLTl1l2:0.250 + ak5pfHLTl1l2l3:0.250 + ak5pfchsHLT:0.250 + ak5pfchsHLTl1:0.250 + ak5pfchsHLTl2l3:0.250 + ic5jpt:0.210 + sc5jpt:0.240 + ak5jpt:0.205 + ak7jpt:0.205 + ak5jptl1:0.205 + ak5jptl1off:0.205 + ak5jptl1l2l3:0.205 + ak7jptl1:0.205 + ak7jptl1off:0.205 + +binspt = 10 30 50 100 200 500 1000 5000 + +binseta = -5.000 -4.538 -4.363 -4.191 -4.013 -3.839 -3.664 + -3.489 -3.314 -3.139 -2.964 -2.853 -2.650 -2.500 -2.322 -2.172 + -2.043 -1.930 -1.830 -1.740 -1.653 -1.566 -1.479 -1.392 -1.305 + -1.218 -1.131 -1.044 -0.957 -0.879 -0.783 -0.696 -0.609 -0.522 + -0.435 -0.348 -0.261 -0.174 -0.087 + +0.000 + +0.087 +0.174 +0.261 +0.348 +0.435 +0.522 +0.609 +0.696 +0.783 + +0.879 +0.957 +1.044 +1.131 +1.218 +1.305 +1.392 +1.479 +1.566 + +1.653 +1.740 +1.830 +1.930 +2.043 +2.172 +2.322 +2.500 +2.650 + +2.853 +2.964 +3.139 +3.314 +3.489 +3.664 +3.839 +4.013 +4.191 + +4.363 +4.538 +5.000 + +binsphi = -3.141 -2.700 -2.100 -1.500 -0.900 -0.300 + +0.300 +0.900 +1.500 +2.100 +2.700 +3.141 + +binsTrueNPU = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 diff --git a/JetAnalyzers/config/jra_QCDflat.config b/JetAnalyzers/config/jra_QCDflat.config new file mode 100644 index 00000000..898b593c --- /dev/null +++ b/JetAnalyzers/config/jra_QCDflat.config @@ -0,0 +1,153 @@ +$ +$ jet_response_analyzer_x: define binning in pt & eta +$ ------------------------ as well as dr matching criteria +$ found to yield comparable +$ matching efficiencies +$ for jet performance studies +$ + +$ +$ algorithms [format: algorithm:drmax] +$ +algs = ic5calo:0.210 + ak5calo:0.250 + gk5calo:0.210 + sc5calo:0.240 + kt4calo:0.200 + kt5calo:0.240 + ca4calo:0.190 + ca5calo:0.220 + ak5calol1:0.250 + ak5calol1l2:0.250 + ak5calol1l2l3:0.250 + ak5calol1off:0.250 + ak5calol1offl2l3:0.250 + ic5calol2l3:0.210 + ak5calol2l3:0.205 + gk5calol2l3:0.210 + sc5calol2l3:0.240 + kt4calol2l3:0.200 + kt5calol2l3:0.240 + ca4calol2l3:0.190 + ca5calol2l3:0.220 + ak7calo:0.350 + gk7calo:0.290 + sc7calo:0.340 + kt6calo:0.275 + kt7calo:0.325 + ca6calo:0.250 + ca7calo:0.300 + ak7calol1:0.350 + ak7calol1off:0.350 + ak7calol2l3:0.280 + gk7calol2l3:0.290 + sc7calol2l3:0.340 + kt6calol2l3:0.275 + kt7calol2l3:0.325 + ca6calol2l3:0.250 + ca7calol2l3:0.300 + ak5caloHLT:0.250 + ak5caloHLTl1:0.250 + ak5caloHLTl1l2:0.250 + ak5caloHLTl1l2l3:0.250 + ak4caloHLT:0.250 + ak4caloHLTl1:0.250 + ak4caloHLTl1l2:0.250 + ak4caloHLTl1l2l3:0.250 + ak8caloHLT:0.250 + ak8caloHLTl1:0.250 + ak8caloHLTl1l2:0.250 + ak8caloHLTl1l2l3:0.250 + ic5pf:0.105 + ak5pf:0.250 + gk5pf:0.110 + sc5pf:0.135 + kt4pf:0.120 + kt5pf:0.145 + ca4pf:0.115 + ca5pf:0.125 + ak5pfl1:0.250 + ak5pfl1l2:0.250 + ak5pfl1l2l3:0.250 + ak5pfl1off:0.250 + ic5pfl2l3:0.105 + ak5pfl2l3:0.110 + gk5pfl2l3:0.110 + sc5pfl2l3:0.135 + kt4pfl2l3:0.120 + kt5pfl2l3:0.145 + ca4pfl2l3:0.115 + ca5pfl2l3:0.125 + ak7pf:0.350 + gk7pf:0.150 + sc7pf:0.180 + kt6pf:0.180 + kt7pf:0.210 + ca6pf:0.150 + ca7pf:0.190 + ak7pfl1:0.350 + ak7pfl1off:0.350 + ak7pfl2l3:0.150 + gk7pfl2l3:0.150 + sc7pfl2l3:0.180 + kt6pfl2l3:0.180 + kt7pfl2l3:0.210 + ca6pfl2l3:0.150 + ca7pfl2l3:0.190 + ak5pfchs:0.250 + ak5pfchsl1:0.250 + ak5pfchsl2l3:0.250 + ak5pfchsl1l2l3:0.250 + ak5pfchsl1off:0.250 + ak7pfchs:0.350 + ak7pfchsl1:0.350 + ak7pfchsl1off:0.350 + ak5pfHLT:0.250 + ak4pfHLT:0.250 + ak4pfHLTl1:0.250 + ak4pfHLTl1l2:0.250 + ak4pfHLTl1l2l3:0.250 + ak8pfHLT:0.250 + ak8pfHLTl1:0.250 + ak8pfHLTl1l2:0.250 + ak8pfHLTl1l2l3:0.250 + ak4pfHLTNoPU:0.250 + ak4pfHLTNoPUl1:0.250 + ak4pfHLTNoPUl1l2:0.250 + ak4pfHLTNoPUl1l2l3:0.250 + ak5pfHLTl1:0.250 + ak5pfHLTl1l2:0.250 + ak5pfHLTl1l2l3:0.250 + ak5pfchsHLT:0.250 + ak5pfchsHLTl1:0.250 + ak5pfchsHLTl2l3:0.250 + ic5jpt:0.210 + sc5jpt:0.240 + ak5jpt:0.205 + ak7jpt:0.205 + ak5jptl1:0.205 + ak5jptl1off:0.205 + ak5jptl1l2l3:0.205 + ak7jptl1:0.205 + ak7jptl1off:0.205 + +binspt = 10 10.5 11 11.5 12 12.5 13 13.5 14 15 17 + 20 25 30 35 40 45 60 75 90 120 150 + 200 300 400 550 750 1000 1500 2000 2500 3000 + 3500 4000 4500 5000 10000 + +binseta = -5.000 + -3.314 -3.139 -2.964 -2.853 -2.650 -2.500 -2.322 -2.172 + -2.043 -1.930 -1.830 -1.740 -1.653 -1.566 -1.479 -1.392 -1.305 + -1.218 -1.131 -1.044 -0.957 -0.879 -0.783 -0.696 -0.609 -0.522 + -0.435 -0.348 -0.261 -0.174 -0.087 + +0.000 + +0.087 +0.174 +0.261 +0.348 +0.435 +0.522 +0.609 +0.696 +0.783 + +0.879 +0.957 +1.044 +1.131 +1.218 +1.305 +1.392 +1.479 +1.566 + +1.653 +1.740 +1.830 +1.930 +2.043 +2.172 +2.322 +2.500 +2.650 + +2.853 +2.964 +3.139 +3.314 +5.000 + +binsphi = -3.141 -2.700 -2.100 -1.500 -0.900 -0.300 + +0.300 +0.900 +1.500 +2.100 +2.700 +3.141 + +binsTrueNPU = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 diff --git a/JetAnalyzers/config/jra_QCDflat_MergeEta.config b/JetAnalyzers/config/jra_QCDflat_MergeEta.config new file mode 100644 index 00000000..b6e0fae3 --- /dev/null +++ b/JetAnalyzers/config/jra_QCDflat_MergeEta.config @@ -0,0 +1,144 @@ +$ +$ jet_response_analyzer_x: define binning in pt & eta +$ ------------------------ as well as dr matching criteria +$ found to yield comparable +$ matching efficiencies +$ for jet performance studies +$ + +$ +$ algorithms [format: algorithm:drmax] +$ +algs = ic5calo:0.210 + ak5calo:0.250 + gk5calo:0.210 + sc5calo:0.240 + kt4calo:0.200 + kt5calo:0.240 + ca4calo:0.190 + ca5calo:0.220 + ak5calol1:0.250 + ak5calol1l2:0.250 + ak5calol1l2l3:0.250 + ak5calol1off:0.250 + ak5calol1offl2l3:0.250 + ic5calol2l3:0.210 + ak5calol2l3:0.205 + gk5calol2l3:0.210 + sc5calol2l3:0.240 + kt4calol2l3:0.200 + kt5calol2l3:0.240 + ca4calol2l3:0.190 + ca5calol2l3:0.220 + ak7calo:0.350 + gk7calo:0.290 + sc7calo:0.340 + kt6calo:0.275 + kt7calo:0.325 + ca6calo:0.250 + ca7calo:0.300 + ak7calol1:0.350 + ak7calol1off:0.350 + ak7calol2l3:0.280 + gk7calol2l3:0.290 + sc7calol2l3:0.340 + kt6calol2l3:0.275 + kt7calol2l3:0.325 + ca6calol2l3:0.250 + ca7calol2l3:0.300 + ak5caloHLT:0.250 + ak5caloHLTl1:0.250 + ak5caloHLTl1l2:0.250 + ak5caloHLTl1l2l3:0.250 + ak4caloHLT:0.250 + ak4caloHLTl1:0.250 + ak4caloHLTl1l2:0.250 + ak4caloHLTl1l2l3:0.250 + ak8caloHLT:0.250 + ak8caloHLTl1:0.250 + ak8caloHLTl1l2:0.250 + ak8caloHLTl1l2l3:0.250 + ic5pf:0.105 + ak5pf:0.250 + gk5pf:0.110 + sc5pf:0.135 + kt4pf:0.120 + kt5pf:0.145 + ca4pf:0.115 + ca5pf:0.125 + ak5pfl1:0.250 + ak5pfl1l2:0.250 + ak5pfl1l2l3:0.250 + ak5pfl1off:0.250 + ic5pfl2l3:0.105 + ak5pfl2l3:0.110 + gk5pfl2l3:0.110 + sc5pfl2l3:0.135 + kt4pfl2l3:0.120 + kt5pfl2l3:0.145 + ca4pfl2l3:0.115 + ca5pfl2l3:0.125 + ak7pf:0.350 + gk7pf:0.150 + sc7pf:0.180 + kt6pf:0.180 + kt7pf:0.210 + ca6pf:0.150 + ca7pf:0.190 + ak7pfl1:0.350 + ak7pfl1off:0.350 + ak7pfl2l3:0.150 + gk7pfl2l3:0.150 + sc7pfl2l3:0.180 + kt6pfl2l3:0.180 + kt7pfl2l3:0.210 + ca6pfl2l3:0.150 + ca7pfl2l3:0.190 + ak5pfchs:0.250 + ak5pfchsl1:0.250 + ak5pfchsl2l3:0.250 + ak5pfchsl1l2l3:0.250 + ak5pfchsl1off:0.250 + ak7pfchs:0.350 + ak7pfchsl1:0.350 + ak7pfchsl1off:0.350 + ak5pfHLT:0.250 + ak4pfHLT:0.250 + ak4pfHLTl1:0.250 + ak4pfHLTl1l2:0.250 + ak4pfHLTl1l2l3:0.250 + ak8pfHLT:0.250 + ak8pfHLTl1:0.250 + ak8pfHLTl1l2:0.250 + ak8pfHLTl1l2l3:0.250 + ak4pfHLTNoPU:0.250 + ak4pfHLTNoPUl1:0.250 + ak4pfHLTNoPUl1l2:0.250 + ak4pfHLTNoPUl1l2l3:0.250 + ak5pfHLTl1:0.250 + ak5pfHLTl1l2:0.250 + ak5pfHLTl1l2l3:0.250 + ak5pfchsHLT:0.250 + ak5pfchsHLTl1:0.250 + ak5pfchsHLTl2l3:0.250 + ic5jpt:0.210 + sc5jpt:0.240 + ak5jpt:0.205 + ak7jpt:0.205 + ak5jptl1:0.205 + ak5jptl1off:0.205 + ak5jptl1l2l3:0.205 + ak7jptl1:0.205 + ak7jptl1off:0.205 + +binspt = 10 10.5 11 11.5 12 12.5 13 13.5 14 15 17 + 20 25 30 35 40 45 60 75 90 120 150 + 200 300 400 550 750 1000 1500 2000 2500 3000 + 3500 4000 4500 5000 10000 + +binseta = -5.000 -3.000 -1.300 0.000 1.300 3.000 5.000 + +binsphi = -3.141 -2.700 -2.100 -1.500 -0.900 -0.300 + +0.300 +0.900 +1.500 +2.100 +2.700 +3.141 + +binsTrueNPU = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 diff --git a/JetAnalyzers/config/jra_QCDflat_MergePt.config b/JetAnalyzers/config/jra_QCDflat_MergePt.config new file mode 100644 index 00000000..0a924714 --- /dev/null +++ b/JetAnalyzers/config/jra_QCDflat_MergePt.config @@ -0,0 +1,150 @@ +$ +$ jet_response_analyzer_x: define binning in pt & eta +$ ------------------------ as well as dr matching criteria +$ found to yield comparable +$ matching efficiencies +$ for jet performance studies +$ + +$ +$ algorithms [format: algorithm:drmax] +$ +algs = ic5calo:0.210 + ak5calo:0.250 + gk5calo:0.210 + sc5calo:0.240 + kt4calo:0.200 + kt5calo:0.240 + ca4calo:0.190 + ca5calo:0.220 + ak5calol1:0.250 + ak5calol1l2:0.250 + ak5calol1l2l3:0.250 + ak5calol1off:0.250 + ak5calol1offl2l3:0.250 + ic5calol2l3:0.210 + ak5calol2l3:0.205 + gk5calol2l3:0.210 + sc5calol2l3:0.240 + kt4calol2l3:0.200 + kt5calol2l3:0.240 + ca4calol2l3:0.190 + ca5calol2l3:0.220 + ak7calo:0.350 + gk7calo:0.290 + sc7calo:0.340 + kt6calo:0.275 + kt7calo:0.325 + ca6calo:0.250 + ca7calo:0.300 + ak7calol1:0.350 + ak7calol1off:0.350 + ak7calol2l3:0.280 + gk7calol2l3:0.290 + sc7calol2l3:0.340 + kt6calol2l3:0.275 + kt7calol2l3:0.325 + ca6calol2l3:0.250 + ca7calol2l3:0.300 + ak5caloHLT:0.250 + ak5caloHLTl1:0.250 + ak5caloHLTl1l2:0.250 + ak5caloHLTl1l2l3:0.250 + ak4caloHLT:0.250 + ak4caloHLTl1:0.250 + ak4caloHLTl1l2:0.250 + ak4caloHLTl1l2l3:0.250 + ak8caloHLT:0.250 + ak8caloHLTl1:0.250 + ak8caloHLTl1l2:0.250 + ak8caloHLTl1l2l3:0.250 + ic5pf:0.105 + ak5pf:0.250 + gk5pf:0.110 + sc5pf:0.135 + kt4pf:0.120 + kt5pf:0.145 + ca4pf:0.115 + ca5pf:0.125 + ak5pfl1:0.250 + ak5pfl1l2:0.250 + ak5pfl1l2l3:0.250 + ak5pfl1off:0.250 + ic5pfl2l3:0.105 + ak5pfl2l3:0.110 + gk5pfl2l3:0.110 + sc5pfl2l3:0.135 + kt4pfl2l3:0.120 + kt5pfl2l3:0.145 + ca4pfl2l3:0.115 + ca5pfl2l3:0.125 + ak7pf:0.350 + gk7pf:0.150 + sc7pf:0.180 + kt6pf:0.180 + kt7pf:0.210 + ca6pf:0.150 + ca7pf:0.190 + ak7pfl1:0.350 + ak7pfl1off:0.350 + ak7pfl2l3:0.150 + gk7pfl2l3:0.150 + sc7pfl2l3:0.180 + kt6pfl2l3:0.180 + kt7pfl2l3:0.210 + ca6pfl2l3:0.150 + ca7pfl2l3:0.190 + ak5pfchs:0.250 + ak5pfchsl1:0.250 + ak5pfchsl2l3:0.250 + ak5pfchsl1l2l3:0.250 + ak5pfchsl1off:0.250 + ak7pfchs:0.350 + ak7pfchsl1:0.350 + ak7pfchsl1off:0.350 + ak5pfHLT:0.250 + ak4pfHLT:0.250 + ak4pfHLTl1:0.250 + ak4pfHLTl1l2:0.250 + ak4pfHLTl1l2l3:0.250 + ak8pfHLT:0.250 + ak8pfHLTl1:0.250 + ak8pfHLTl1l2:0.250 + ak8pfHLTl1l2l3:0.250 + ak4pfHLTNoPU:0.250 + ak4pfHLTNoPUl1:0.250 + ak4pfHLTNoPUl1l2:0.250 + ak4pfHLTNoPUl1l2l3:0.250 + ak5pfHLTl1:0.250 + ak5pfHLTl1l2:0.250 + ak5pfHLTl1l2l3:0.250 + ak5pfchsHLT:0.250 + ak5pfchsHLTl1:0.250 + ak5pfchsHLTl2l3:0.250 + ic5jpt:0.210 + sc5jpt:0.240 + ak5jpt:0.205 + ak7jpt:0.205 + ak5jptl1:0.205 + ak5jptl1off:0.205 + ak5jptl1l2l3:0.205 + ak7jptl1:0.205 + ak7jptl1off:0.205 + +binspt = 10 30 50 100 200 500 1000 5000 + +binseta = -5.000 + -3.314 -3.139 -2.964 -2.853 -2.650 -2.500 -2.322 -2.172 + -2.043 -1.930 -1.830 -1.740 -1.653 -1.566 -1.479 -1.392 -1.305 + -1.218 -1.131 -1.044 -0.957 -0.879 -0.783 -0.696 -0.609 -0.522 + -0.435 -0.348 -0.261 -0.174 -0.087 + +0.000 + +0.087 +0.174 +0.261 +0.348 +0.435 +0.522 +0.609 +0.696 +0.783 + +0.879 +0.957 +1.044 +1.131 +1.218 +1.305 +1.392 +1.479 +1.566 + +1.653 +1.740 +1.830 +1.930 +2.043 +2.172 +2.322 +2.500 +2.650 + +2.853 +2.964 +3.139 +3.314 +5.000 + +binsphi = -3.141 -2.700 -2.100 -1.500 -0.900 -0.300 + +0.300 +0.900 +1.500 +2.100 +2.700 +3.141 + +binsTrueNPU = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 diff --git a/JetAnalyzers/config/jra_QCDflat_MergePtEta.config b/JetAnalyzers/config/jra_QCDflat_MergePtEta.config new file mode 100644 index 00000000..9e907dd5 --- /dev/null +++ b/JetAnalyzers/config/jra_QCDflat_MergePtEta.config @@ -0,0 +1,141 @@ +$ +$ jet_response_analyzer_x: define binning in pt & eta +$ ------------------------ as well as dr matching criteria +$ found to yield comparable +$ matching efficiencies +$ for jet performance studies +$ + +$ +$ algorithms [format: algorithm:drmax] +$ +algs = ic5calo:0.210 + ak5calo:0.250 + gk5calo:0.210 + sc5calo:0.240 + kt4calo:0.200 + kt5calo:0.240 + ca4calo:0.190 + ca5calo:0.220 + ak5calol1:0.250 + ak5calol1l2:0.250 + ak5calol1l2l3:0.250 + ak5calol1off:0.250 + ak5calol1offl2l3:0.250 + ic5calol2l3:0.210 + ak5calol2l3:0.205 + gk5calol2l3:0.210 + sc5calol2l3:0.240 + kt4calol2l3:0.200 + kt5calol2l3:0.240 + ca4calol2l3:0.190 + ca5calol2l3:0.220 + ak7calo:0.350 + gk7calo:0.290 + sc7calo:0.340 + kt6calo:0.275 + kt7calo:0.325 + ca6calo:0.250 + ca7calo:0.300 + ak7calol1:0.350 + ak7calol1off:0.350 + ak7calol2l3:0.280 + gk7calol2l3:0.290 + sc7calol2l3:0.340 + kt6calol2l3:0.275 + kt7calol2l3:0.325 + ca6calol2l3:0.250 + ca7calol2l3:0.300 + ak5caloHLT:0.250 + ak5caloHLTl1:0.250 + ak5caloHLTl1l2:0.250 + ak5caloHLTl1l2l3:0.250 + ak4caloHLT:0.250 + ak4caloHLTl1:0.250 + ak4caloHLTl1l2:0.250 + ak4caloHLTl1l2l3:0.250 + ak8caloHLT:0.250 + ak8caloHLTl1:0.250 + ak8caloHLTl1l2:0.250 + ak8caloHLTl1l2l3:0.250 + ic5pf:0.105 + ak5pf:0.250 + gk5pf:0.110 + sc5pf:0.135 + kt4pf:0.120 + kt5pf:0.145 + ca4pf:0.115 + ca5pf:0.125 + ak5pfl1:0.250 + ak5pfl1l2:0.250 + ak5pfl1l2l3:0.250 + ak5pfl1off:0.250 + ic5pfl2l3:0.105 + ak5pfl2l3:0.110 + gk5pfl2l3:0.110 + sc5pfl2l3:0.135 + kt4pfl2l3:0.120 + kt5pfl2l3:0.145 + ca4pfl2l3:0.115 + ca5pfl2l3:0.125 + ak7pf:0.350 + gk7pf:0.150 + sc7pf:0.180 + kt6pf:0.180 + kt7pf:0.210 + ca6pf:0.150 + ca7pf:0.190 + ak7pfl1:0.350 + ak7pfl1off:0.350 + ak7pfl2l3:0.150 + gk7pfl2l3:0.150 + sc7pfl2l3:0.180 + kt6pfl2l3:0.180 + kt7pfl2l3:0.210 + ca6pfl2l3:0.150 + ca7pfl2l3:0.190 + ak5pfchs:0.250 + ak5pfchsl1:0.250 + ak5pfchsl2l3:0.250 + ak5pfchsl1l2l3:0.250 + ak5pfchsl1off:0.250 + ak7pfchs:0.350 + ak7pfchsl1:0.350 + ak7pfchsl1off:0.350 + ak5pfHLT:0.250 + ak4pfHLT:0.250 + ak4pfHLTl1:0.250 + ak4pfHLTl1l2:0.250 + ak4pfHLTl1l2l3:0.250 + ak8pfHLT:0.250 + ak8pfHLTl1:0.250 + ak8pfHLTl1l2:0.250 + ak8pfHLTl1l2l3:0.250 + ak4pfHLTNoPU:0.250 + ak4pfHLTNoPUl1:0.250 + ak4pfHLTNoPUl1l2:0.250 + ak4pfHLTNoPUl1l2l3:0.250 + ak5pfHLTl1:0.250 + ak5pfHLTl1l2:0.250 + ak5pfHLTl1l2l3:0.250 + ak5pfchsHLT:0.250 + ak5pfchsHLTl1:0.250 + ak5pfchsHLTl2l3:0.250 + ic5jpt:0.210 + sc5jpt:0.240 + ak5jpt:0.205 + ak7jpt:0.205 + ak5jptl1:0.205 + ak5jptl1off:0.205 + ak5jptl1l2l3:0.205 + ak7jptl1:0.205 + ak7jptl1off:0.205 + +binspt = 10 30 50 100 200 500 1000 5000 + +binseta = -5.000 -3.000 -1.300 0.000 1.300 3.000 5.000 + +binsphi = -3.141 -2.700 -2.100 -1.500 -0.900 -0.300 + +0.300 +0.900 +1.500 +2.100 +2.700 +3.141 + +binsTrueNPU = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 diff --git a/JetAnalyzers/config/jra_dr_finebinning.config b/JetAnalyzers/config/jra_dr_finebinning.config index 9b80ee60..48b52fce 100644 --- a/JetAnalyzers/config/jra_dr_finebinning.config +++ b/JetAnalyzers/config/jra_dr_finebinning.config @@ -10,7 +10,6 @@ $ $ algorithms [format: algorithm:drmax] $ algs = ic5calo:0.210 - ak4calo:0.200 ak5calo:0.250 gk5calo:0.210 sc5calo:0.240 @@ -19,10 +18,11 @@ algs = ic5calo:0.210 ca4calo:0.190 ca5calo:0.220 ak5calol1:0.250 + ak5calol1l2:0.250 + ak5calol1l2l3:0.250 ak5calol1off:0.250 ak5calol1offl2l3:0.250 ic5calol2l3:0.210 - ak4calol2l3:0.200 ak5calol2l3:0.205 gk5calol2l3:0.210 sc5calol2l3:0.240 @@ -48,6 +48,16 @@ algs = ic5calo:0.210 ca7calol2l3:0.300 ak5caloHLT:0.250 ak5caloHLTl1:0.250 + ak5caloHLTl1l2:0.250 + ak5caloHLTl1l2l3:0.250 + ak4caloHLT:0.250 + ak4caloHLTl1:0.250 + ak4caloHLTl1l2:0.250 + ak4caloHLTl1l2l3:0.250 + ak8caloHLT:0.250 + ak8caloHLTl1:0.250 + ak8caloHLTl1l2:0.250 + ak8caloHLTl1l2l3:0.250 ic5pf:0.105 ak5pf:0.250 gk5pf:0.110 @@ -57,10 +67,11 @@ algs = ic5calo:0.210 ca4pf:0.115 ca5pf:0.125 ak5pfl1:0.250 + ak5pfl1l2:0.250 ak5pfl1l2l3:0.250 ak5pfl1off:0.250 ic5pfl2l3:0.105 - ak5pfl2l3:0.250 + ak5pfl2l3:0.110 gk5pfl2l3:0.110 sc5pfl2l3:0.135 kt4pfl2l3:0.120 @@ -76,7 +87,7 @@ algs = ic5calo:0.210 ca7pf:0.190 ak7pfl1:0.350 ak7pfl1off:0.350 - ak7pfl2l3:0.350 + ak7pfl2l3:0.150 gk7pfl2l3:0.150 sc7pfl2l3:0.180 kt6pfl2l3:0.180 @@ -85,17 +96,31 @@ algs = ic5calo:0.210 ca7pfl2l3:0.190 ak5pfchs:0.250 ak5pfchsl1:0.250 - ak5pfchsl2l3:0.250 + ak5pfchsl2l3:0.250 ak5pfchsl1l2l3:0.250 ak5pfchsl1off:0.250 ak7pfchs:0.350 ak7pfchsl1:0.350 - ak7pfchsl2l3:0.350 ak7pfchsl1off:0.350 ak5pfHLT:0.250 + ak4pfHLT:0.250 + ak4pfHLTl1:0.250 + ak4pfHLTl1l2:0.250 + ak4pfHLTl1l2l3:0.250 + ak8pfHLT:0.250 + ak8pfHLTl1:0.250 + ak8pfHLTl1l2:0.250 + ak8pfHLTl1l2l3:0.250 + ak4pfHLTNoPU:0.250 + ak4pfHLTNoPUl1:0.250 + ak4pfHLTNoPUl1l2:0.250 + ak4pfHLTNoPUl1l2l3:0.250 ak5pfHLTl1:0.250 + ak5pfHLTl1l2:0.250 + ak5pfHLTl1l2l3:0.250 ak5pfchsHLT:0.250 ak5pfchsHLTl1:0.250 + ak5pfchsHLTl2l3:0.250 ic5jpt:0.210 sc5jpt:0.240 ak5jpt:0.205 @@ -105,122 +130,13 @@ algs = ic5calo:0.210 ak5jptl1l2l3:0.205 ak7jptl1:0.205 ak7jptl1off:0.205 - ak1pf:0.050 - ak2pf:0.100 - ak3pf:0.150 - ak4pf:0.200 - ak6pf:0.300 - ak8pf:0.400 - ak9pf:0.450 - ak10pf:0.500 - ak1pfl1:0.050 - ak2pfl1:0.100 - ak3pfl1:0.150 - ak4pfl1:0.200 - ak6pfl1:0.300 - ak8pfl1:0.400 - ak9pfl1:0.450 - ak10pfl1:0.500 - ak1pfl2l3:0.050 - ak2pfl2l3:0.100 - ak3pfl2l3:0.150 - ak4pfl2l3:0.200 - ak6pfl2l3:0.300 - ak8pfl2l3:0.400 - ak9pfl2l3:0.450 - ak10pfl2l3:0.500 - ak1pfl1l2l3:0.050 - ak2pfl1l2l3:0.100 - ak3pfl1l2l3:0.150 - ak4pfl1l2l3:0.200 - ak6pfl1l2l3:0.300 - ak8pfl1l2l3:0.400 - ak9pfl1l2l3:0.450 - ak10pfl1l2l3:0.500 - ak1pfchs:0.050 - ak2pfchs:0.100 - ak3pfchs:0.150 - ak4pfchs:0.200 - ak6pfchs:0.300 - ak8pfchs:0.400 - ak9pfchs:0.450 - ak10pfchs:0.500 - ak1pfchsl1:0.050 - ak2pfchsl1:0.100 - ak3pfchsl1:0.150 - ak4pfchsl1:0.200 - ak6pfchsl1:0.300 - ak8pfchsl1:0.400 - ak9pfchsl1:0.450 - ak10pfchsl1:0.500 - ak1pfchsl2l3:0.050 - ak2pfchsl2l3:0.100 - ak3pfchsl2l3:0.150 - ak4pfchsl2l3:0.200 - ak6pfchsl2l3:0.300 - ak8pfchsl2l3:0.400 - ak9pfchsl2l3:0.450 - ak10pfchsl2l3:0.500 - ak1pfchsl1l2l3:0.050 - ak2pfchsl1l2l3:0.100 - ak3pfchsl1l2l3:0.150 - ak4pfchsl1l2l3:0.200 - ak6pfchsl1l2l3:0.300 - ak8pfchsl1l2l3:0.400 - ak9pfchsl1l2l3:0.450 - ak10pfchsl1l2l3:0.500 - ak1puppi:0.050 - ak2puppi:0.100 - ak3puppi:0.150 - ak4puppi:0.200 - ak5puppi:0.250 - ak6puppi:0.300 - ak7puppi:0.350 - ak8puppi:0.400 - ak9puppi:0.450 - ak10puppi:0.500 - ak1puppil1:0.050 - ak2puppil1:0.100 - ak3puppil1:0.150 - ak4puppil1:0.200 - ak5puppil1:0.250 - ak6puppil1:0.300 - ak7puppil1:0.350 - ak8puppil1:0.400 - ak9puppil1:0.450 - ak10puppil1:0.500 - ak1puppil2l3:0.050 - ak2puppil2l3:0.100 - ak3puppil2l3:0.150 - ak4puppil2l3:0.200 - ak5puppil2l3:0.250 - ak6puppil2l3:0.300 - ak7puppil2l3:0.350 - ak8puppil2l3:0.400 - ak9puppil2l3:0.450 - ak10puppil2l3:0.500 - ak1puppil1l2l3:0.050 - ak2puppil1l2l3:0.100 - ak3puppil1l2l3:0.150 - ak4puppil1l2l3:0.200 - ak5puppil1l2l3:0.250 - ak6puppil1l2l3:0.300 - ak7puppil1l2l3:0.350 - ak8puppil1l2l3:0.400 - ak9puppil1l2l3:0.450 - ak10puppil1l2l3:0.500 -$binspt = 10 10.5 11 11.5 12 12.5 13 13.5 14 15 17 -$ 20 23 27 30 35 40 45 57 72 90 120 150 -$ 200 300 400 550 750 1000 1500 2000 2500 3000 -$ 3500 4000 4500 5000 10000 +binspt = 10 10.5 11 11.5 12 12.5 13 13.5 14 15 17 + 20 25 30 35 40 45 60 75 90 120 150 + 200 300 400 550 750 1000 1500 2000 2500 3000 + 3500 4000 4500 5000 10000 -binspt = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 17 - 20 23 27 30 35 40 45 57 72 90 120 150 - 200 300 400 550 750 1000 1500 2000 2500 3000 - 3500 4000 4500 5000 10000 - -binseta = -5.191 -4.889 -4.716 -4.538 -4.363 -4.191 -4.013 -3.839 -3.664 +binseta = -5.000 -4.538 -4.363 -4.191 -4.013 -3.839 -3.664 -3.489 -3.314 -3.139 -2.964 -2.853 -2.650 -2.500 -2.322 -2.172 -2.043 -1.930 -1.830 -1.740 -1.653 -1.566 -1.479 -1.392 -1.305 -1.218 -1.131 -1.044 -0.957 -0.879 -0.783 -0.696 -0.609 -0.522 @@ -230,7 +146,9 @@ binseta = -5.191 -4.889 -4.716 -4.538 -4.363 -4.191 -4.013 -3.839 -3.664 +0.879 +0.957 +1.044 +1.131 +1.218 +1.305 +1.392 +1.479 +1.566 +1.653 +1.740 +1.830 +1.930 +2.043 +2.172 +2.322 +2.500 +2.650 +2.853 +2.964 +3.139 +3.314 +3.489 +3.664 +3.839 +4.013 +4.191 - +4.363 +4.538 +4.716 +4.889 +5.191 + +4.363 +4.538 +5.000 binsphi = -3.141 -2.700 -2.100 -1.500 -0.900 -0.300 +0.300 +0.900 +1.500 +2.100 +2.700 +3.141 + +binsTrueNPU = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 diff --git a/JetAnalyzers/interface/JetResponseAnalyzer.hh b/JetAnalyzers/interface/JetResponseAnalyzer.hh index 8fe0e285..2379c174 100644 --- a/JetAnalyzers/interface/JetResponseAnalyzer.hh +++ b/JetAnalyzers/interface/JetResponseAnalyzer.hh @@ -89,6 +89,7 @@ private: edm::EDGetTokenT srcRef_; edm::EDGetTokenT srcJetToUncorJetMap_; edm::EDGetTokenT srcRefToJetMap_; + edm::EDGetTokenT srcJetUnMatch_; //////////UnMatched Reco Jet!!! edm::EDGetTokenT srcRefToPartonMap_; edm::EDGetTokenT > srcRhos_; edm::EDGetTokenT srcRho_; @@ -129,4 +130,4 @@ private: JRAEvent* JRAEvt_; }; -#endif \ No newline at end of file +#endif diff --git a/JetAnalyzers/python/JetReconstruction_cff.py b/JetAnalyzers/python/JetReconstruction_cff.py index d7600257..7ebc6ec4 100644 --- a/JetAnalyzers/python/JetReconstruction_cff.py +++ b/JetAnalyzers/python/JetReconstruction_cff.py @@ -45,6 +45,7 @@ ak7GenJets = ak5GenJets.clone ( rParam=0.7 ) ak7PUPPIJets = ak5PFJets.clone ( rParam=0.7, src = cms.InputTag('puppi')) ak8GenJets = ak5GenJets.clone ( rParam=0.8 ) +ak8CaloJets = ak5CaloJets.clone ( rParam=0.8 ) # for support HLT usage ak8PFJets = ak5PFJets.clone ( rParam=0.8 ) ak8PFchsJets = ak5PFchsJets.clone( rParam=0.8 ) ak8PUPPIJets = ak5PFJets.clone ( rParam=0.8, src = cms.InputTag('puppi')) @@ -57,6 +58,11 @@ ak10PFchsJets = ak5PFchsJets.clone( rParam=1.0 ) ak10PUPPIJets = ak5PFJets.clone ( rParam=1.0, src = cms.InputTag('puppi')) +# objects for HLT usage +ak4CaloHLTJets = ak4CaloJets.clone( src = 'hltAK4CaloJets' ) +ak4PFHLTJets = ak4PFJets.clone( src = 'hltAK4PFJets' ) +ak8CaloHLTJets = ak8CaloJets.clone( src = 'hltAK8CaloJets' ) +ak8PFHLTJets = ak8PFJets.clone( src = 'hltAK8PFJets' ) # sc & ic clones sc5GenJets = sisCone5GenJets.clone() diff --git a/JetAnalyzers/python/addAlgorithm.py b/JetAnalyzers/python/addAlgorithm.py index 2fe4f887..1513a4cb 100644 --- a/JetAnalyzers/python/addAlgorithm.py +++ b/JetAnalyzers/python/addAlgorithm.py @@ -4,11 +4,11 @@ ## filter final state partons (define globaly) ################################################################################ -partons = cms.EDProducer('PartonSelector', - src = cms.InputTag('genParticles'), - withLeptons = cms.bool(False), - skipFirstN = cms.uint32(0) -) +#partons = cms.EDProducer('PartonSelector', +# src = cms.InputTag('genParticles'), +# withLeptons = cms.bool(False), +# skipFirstN = cms.uint32(0) +#) ################################################################################ @@ -47,10 +47,12 @@ # 'ak3calo' : 'ak3GenJets', # 'ak4calo' : 'ak4GenJets', 'ak4calo' : 'ak4GenJets', + 'ak4caloHLT' : 'ak4GenJets', # for HLT usage 'ak5calo' : 'ak5GenJets', # 'ak6calo' : 'ak6GenJets', 'ak7calo' : 'ak7GenJets', # 'ak8calo' : 'ak8GenJets', + 'ak8caloHLT' : 'ak8GenJets', # for HLT usage # 'ak9calo' : 'ak9GenJets', # 'ak10calo' : 'ak10GenJets', 'kt4calo' : 'kt4GenJets', @@ -60,10 +62,12 @@ 'ak2pf' : 'ak2GenJets', 'ak3pf' : 'ak3GenJets', 'ak4pf' : 'ak4GenJets', + 'ak4pfHLT' : 'ak4GenJets', # for HLT usage 'ak5pf' : 'ak5GenJets', 'ak6pf' : 'ak6GenJets', 'ak7pf' : 'ak7GenJets', 'ak8pf' : 'ak8GenJets', + 'ak8pfHLT' : 'ak8GenJets', # for HLT usage 'ak9pf' : 'ak9GenJets', 'ak10pf' : 'ak10GenJets', 'kt4pf' : 'kt4GenJets', @@ -109,10 +113,12 @@ # 'ak3calo' : ('ak3GenJetsNoNu', ak3GenJetsNoNu), # 'ak4calo' : ('ak4GenJetsNoNu', ak4GenJetsNoNu), 'ak4calo' : ('ak4GenJetsNoNu', ak4GenJetsNoNu), #chaned to NoNu from NoMuNoNu + 'ak4caloHLT' : ('ak4GenJetsNoNu', ak4GenJetsNoNu), # for HLT usage 'ak5calo' : ('ak5GenJetsNoNu', ak5GenJetsNoNu), # 'ak6calo' : ('ak6GenJetsNoNu', ak6GenJetsNoNu), 'ak7calo' : ('ak7GenJetsNoNu', ak7GenJetsNoNu), # 'ak8calo' : ('ak8GenJetsNoNu', ak8GenJetsNoNu), + 'ak8caloHLT' : ('ak8GenJetsNoNu', ak8GenJetsNoNu), # 'ak9calo' : ('ak9GenJetsNoNu', ak9GenJetsNoNu), # 'ak10calo' : ('ak10GenJetsNoNu', ak10GenJetsNoNu), 'kt4calo' : ('kt4GenJetsNoNu', kt4GenJetsNoNu), @@ -122,10 +128,12 @@ 'ak2pf' : ('ak2GenJetsNoNu', ak2GenJetsNoNu), 'ak3pf' : ('ak3GenJetsNoNu', ak3GenJetsNoNu), 'ak4pf' : ('ak4GenJetsNoNu', ak4GenJetsNoNu), + 'ak4pfHLT' : ('ak4GenJetsNoNu', ak4GenJetsNoNu), 'ak5pf' : ('ak5GenJetsNoNu', ak5GenJetsNoNu), 'ak6pf' : ('ak6GenJetsNoNu', ak6GenJetsNoNu), 'ak7pf' : ('ak7GenJetsNoNu', ak7GenJetsNoNu), 'ak8pf' : ('ak8GenJetsNoNu', ak8GenJetsNoNu), + 'ak8pfHLT' : ('ak8GenJetsNoNu', ak8GenJetsNoNu), 'ak9pf' : ('ak9GenJetsNoNu', ak9GenJetsNoNu), 'ak10pf' : ('ak10GenJetsNoNu', ak10GenJetsNoNu), 'kt4pf' : ('kt4GenJetsNoNu', kt4GenJetsNoNu), @@ -160,22 +168,24 @@ # 'ak7jpt' : ('ak7GenJetsNoNu', ak7GenJetsNoNu), 'ak5tauHPSall' : ('tauGenJetsSelectorAllHadrons', tauGenJetsSelectorAllHadrons), # 'ak5tauTaNCall' : ('tauGenJetsSelectorAllHadrons', tauGenJetsSelectorAllHadrons) -} +} for tauDiscriminator_and_DecayMode in tauDiscriminators_and_DecayModes: if tauDiscriminator_and_DecayMode.find("HPS") != -1: genJetsDict[tauDiscriminator_and_DecayMode] = genJetsDict["ak5tauHPSall"] elif tauDiscriminator_and_DecayMode.find("TaNC") != -1: genJetsDict[tauDiscriminator_and_DecayMode] = genJetsDict["ak5tauTaNCall"] - + stdRecJetsDict = { # 'ak3calo' : 'ak3CaloJets', # 'ak4calo' : 'ak4CaloJets', 'ak4calo' : 'ak4CaloJets', + 'ak4caloHLT' : 'hltAK4CaloJets', # for HLT usage 'ak5calo' : 'ak5CaloJets', # 'ak6calo' : 'ak6CaloJets', 'ak7calo' : 'ak7CaloJets', # 'ak8calo' : 'ak8CaloJets', + 'ak8caloHLT' : 'hltAK8CaloJets', # for HLT usage # 'ak9calo' : 'ak9CaloJets', # 'ak10calo' : 'ak10CaloJets', 'kt4calo' : 'kt4CaloJets', @@ -185,10 +195,12 @@ 'ak2pf' : 'ak2PFJets', 'ak3pf' : 'ak3PFJets', 'ak4pf' : 'ak4PFJets', + 'ak4pfHLT' : 'hltAK4PFJets', # for HLT usage 'ak5pf' : 'ak5PFJets', 'ak6pf' : 'ak6PFJets', 'ak7pf' : 'ak7PFJets', 'ak8pf' : 'ak8PFJets', + 'ak8pfHLT' : 'hltAK8PFJets', # for HLT usage 'ak9pf' : 'ak9PFJets', 'ak10pf' : 'ak10PFJets', 'kt4pf' : 'kt4PFJets', @@ -232,10 +244,12 @@ # 'ak3calo' : ('ak3CaloJets', ak3CaloJets), # 'ak4calo' : ('ak4CaloJets', ak4CaloJets), 'ak4calo' : ('ak4CaloJets', ak4CaloJets), + 'ak4caloHLT' : ('ak4CaloHLTJets', ak4CaloHLTJets), # for HLT usage 'ak5calo' : ('ak5CaloJets', ak5CaloJets), # 'ak6calo' : ('ak6CaloJets', ak6CaloJets), 'ak7calo' : ('ak7CaloJets', ak7CaloJets), # 'ak8calo' : ('ak8CaloJets', ak8CaloJets), + 'ak8caloHLT' : ('ak8CaloHLTJets', ak8CaloHLTJets), # for HLT usage # 'ak9calo' : ('ak9CaloJets', ak9CaloJets), # 'ak10calo' : ('ak10CaloJets', ak10CaloJets), 'kt4calo' : ('kt4CaloJets', kt4CaloJets), @@ -245,10 +259,12 @@ 'ak2pf' : ('ak2PFJets', ak2PFJets), 'ak3pf' : ('ak3PFJets', ak3PFJets), 'ak4pf' : ('ak4PFJets', ak4PFJets), + 'ak4pfHLT' : ('ak4PFHLTJets', ak4PFHLTJets), # for HLT usage 'ak5pf' : ('ak5PFJets', ak5PFJets), 'ak6pf' : ('ak6PFJets', ak6PFJets), 'ak7pf' : ('ak7PFJets', ak7PFJets), 'ak8pf' : ('ak8PFJets', ak8PFJets), + 'ak8pfHLT' : ('ak8PFHLTJets', ak8PFHLTJets), # for HLT usage 'ak9pf' : ('ak9PFJets', ak9PFJets), 'ak10pf' : ('ak10PFJets', ak10PFJets), 'kt4pf' : ('kt4PFJets', kt4PFJets), @@ -262,7 +278,7 @@ 'ak7pfchs' : ('ak7PFchsJets', ak7PFchsJets), 'ak8pfchs' : ('ak8PFchsJets', ak8PFchsJets), 'ak9pfchs' : ('ak9PFchsJets', ak9PFchsJets), - 'ak10pfchs' : ('ak10PFchsJets', ak10PFchsJets), + 'ak10pfchs' : ('ak10PFchsJets', ak10PFchsJets), 'ak5pfHLT' : ('ak5PFHLTJets', ak5PFHLTJets), 'ak5pfchsHLT' : ('ak5PFchsHLTJets', ak5PFchsHLTJets), 'ak5trk' : ('ak5TrackJets', ak5TrackJets), @@ -321,13 +337,13 @@ 'ak1pfchsl1' : ('ak1PFchsJetsL1Fast', ak1PFchsJetsL1Fast), 'ak2pfchsl1' : ('ak2PFchsJetsL1Fast', ak2PFchsJetsL1Fast), 'ak3pfchsl1' : ('ak3PFchsJetsL1Fast', ak3PFchsJetsL1Fast), - 'ak4pfchsl1' : ('ak4PFchsJetsL1Fast', ak4PFchsJetsL1Fast), - 'ak5pfchsl1' : ('ak5PFchsJetsL1Fast', ak5PFchsJetsL1Fast), + 'ak4pfchsl1' : ('ak4PFchsJetsL1Fast', ak4PFchsJetsL1Fast), + 'ak5pfchsl1' : ('ak5PFchsJetsL1Fast', ak5PFchsJetsL1Fast), 'ak6pfchsl1' : ('ak6PFchsJetsL1Fast', ak6PFchsJetsL1Fast), 'ak7pfchsl1' : ('ak7PFchsJetsL1Fast', ak7PFchsJetsL1Fast), 'ak8pfchsl1' : ('ak8PFchsJetsL1Fast', ak8PFchsJetsL1Fast), 'ak9pfchsl1' : ('ak9PFchsJetsL1Fast', ak9PFchsJetsL1Fast), - 'ak10pfchsl1' : ('ak10PFchsJetsL1Fast', ak10PFchsJetsL1Fast), + 'ak10pfchsl1' : ('ak10PFchsJetsL1Fast', ak10PFchsJetsL1Fast), 'ak5pfHLTl1' : ('ak5PFHLTJetsL1Fast', ak5PFHLTJetsL1Fast), 'ak5pfHLTl1off' : ('ak5PFHLTJetsL1Off', ak5PFHLTJetsL1Off), 'ak5pfchsHLTl1' : ('ak5PFchsHLTJetsL1Fast', ak5PFchsHLTJetsL1Fast), @@ -416,7 +432,7 @@ ## addAlgorithm ################################################################################ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): - """ + """ addAlgorithm takes the following parameters: ============================================ process: the CMSSW process object @@ -430,7 +446,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): to kinematically select references and jets, select partons and match them to the references, match references and jets, and finally execute the JetResponseAnalyzer. - """ + """ ## deterine algorithm, size, type (Calo|PF|Track|JPT), and wether to apply jec alg_size = '' type = '' @@ -475,13 +491,13 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): alg_size_type = alg_size + 'tauTaNCall' else: for tauDiscriminator in tauDiscriminatorDict: - if tauDiscriminator in alg_size_type_corr: + if tauDiscriminator in alg_size_type_corr: alg_size_type = tauDiscriminator for tauDecayMode in tauDecayModeDict: if tauDecayModeDict[tauDecayMode] != "" and \ tauDecayMode in alg_size_type_corr: alg_size_type += tauDecayMode - + elif (alg_size_type_corr.find('jpt') > 0) : alg_size = alg_size_type_corr[0:alg_size_type_corr.find('jpt')] type = 'JPT' @@ -492,14 +508,14 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): alg_size_type = alg_size + 'trk' else: raise ValueError("Can't identify valid jet type: calo|caloHLT|pf|pfchs|pfHLT|jpt|trk|tau|puppi") - + if (alg_size_type_corr.find('l1') > 0): correctl1 = True if (alg_size_type_corr.find('l1off') > 0): correctl1off = True if not reco: raise ValueError("Can't subtract PU without reco!") - + if (alg_size_type_corr.find('l2l3') > 0): correctl2l3 = True @@ -510,7 +526,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): not reco and stdRecJetsDict.keys().index(alg_size_type) except ValueError: raise ValueError("Algorithm unavailable in standard format: " + alg_size_type) - + try: reco and genJetsDict.keys().index(alg_size_type) reco and recJetsDict.keys().index(alg_size_type) @@ -521,7 +537,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): correctl2l3 and corrJetsDict.keys().index(alg_size_type_corr) except ValueError: raise ValueError("Invalid jet correction: " + alg_size_type_corr) - + ## reference (genjet) kinematic selection refPtEta = cms.EDFilter('EtaPtMinCandViewRefSelector', Defaults.RefPtEta, @@ -539,7 +555,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): if not reco: jetPtEta.src = stdRecJetsDict[alg_size_type] setattr(process, alg_size_type_corr + 'PtEta', jetPtEta) - + ## create the sequence sequence = cms.Sequence(refPtEta * jetPtEta) @@ -559,27 +575,27 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): ## add pu density calculation if not correctl1 and not correctl1off: - if type == 'CaloHLT': #added 02/15/2012 - process.kt6CaloJets = kt6CaloJets - process.kt6CaloJets.doRhoFastjet = True - process.kt6CaloJets.Ghost_EtaMax = Defaults.kt6CaloJetParameters.Ghost_EtaMax.value() - process.kt6CaloJets.Rho_EtaMax = Defaults.kt6CaloJetParameters.Rho_EtaMax - sequence = cms.Sequence(process.kt6CaloJets * sequence) - elif type == 'PFchsHLT': - process.kt6PFJets = kt6PFJets - process.kt6PFJets.doRhoFastjet = True - process.kt6PFJets.Ghost_EtaMax = Defaults.kt6PFJetParameters.Ghost_EtaMax.value() - process.kt6PFJets.Rho_EtaMax = Defaults.kt6PFJetParameters.Rho_EtaMax - sequence = cms.Sequence(process.kt6PFJets * sequence) - elif type == 'PFHLT': +# if type == 'CaloHLT': #added 02/15/2012 +# process.kt6CaloJets = kt6CaloJets +# process.kt6CaloJets.doRhoFastjet = True +# process.kt6CaloJets.Ghost_EtaMax = Defaults.kt6CaloJetParameters.Ghost_EtaMax.value() +# process.kt6CaloJets.Rho_EtaMax = Defaults.kt6CaloJetParameters.Rho_EtaMax +# sequence = cms.Sequence(process.kt6CaloJets * sequence) + if type == 'PFchsHLT': # I have to keep this for compatibility while it makes no effect process.kt6PFJets = kt6PFJets process.kt6PFJets.doRhoFastjet = True process.kt6PFJets.Ghost_EtaMax = Defaults.kt6PFJetParameters.Ghost_EtaMax.value() process.kt6PFJets.Rho_EtaMax = Defaults.kt6PFJetParameters.Rho_EtaMax sequence = cms.Sequence(process.kt6PFJets * sequence) +# elif type == 'PFHLT': +# process.kt6PFJets = kt6PFJets +# process.kt6PFJets.doRhoFastjet = True +# process.kt6PFJets.Ghost_EtaMax = Defaults.kt6PFJetParameters.Ghost_EtaMax.value() +# process.kt6PFJets.Rho_EtaMax = Defaults.kt6PFJetParameters.Rho_EtaMax +# sequence = cms.Sequence(process.kt6PFJets * sequence) elif correctl1 and not correctl1off: #modified 10/10/2011 if type == 'CaloHLT': #added 02/15/2012 - process.kt6CaloJets = kt6CaloJets + process.kt6CaloJets = kt6CaloJets process.kt6CaloJets.doRhoFastjet = True process.kt6CaloJets.Ghost_EtaMax = Defaults.kt6PFJetParameters.Ghost_EtaMax.value() process.kt6CaloJets.Rho_EtaMax = Defaults.kt6PFJetParameters.Rho_EtaMax @@ -614,7 +630,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): process.kt6PFJets.Ghost_EtaMax = Defaults.kt6PFJetParameters.Ghost_EtaMax.value() process.kt6PFJets.Rho_EtaMax = Defaults.kt6PFJetParameters.Rho_EtaMax sequence = cms.Sequence(process.kt6PFJets * sequence) - + ## reconstruct jets if type == 'JPT': process.load('Configuration.Geometry.GeometryIdeal_cff') @@ -679,7 +695,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): # "hpsTancTausDiscriminationByDecayModeSelection" # ] tauDiscriminators.append(tauIsoDiscriminator) -# +# tauDiscriminatorConfigs = [] for tauDiscriminator in tauDiscriminators: tauDiscriminatorConfigs.append( @@ -688,7 +704,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): selectionCut = cms.double(0.5) ) ) -# +# selTauModule = pfTauSelector.clone( src = cms.InputTag(recLabel), discriminators = cms.VPSet(tauDiscriminatorConfigs) @@ -703,9 +719,9 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): selTauModuleName = alg_size_type + "Selected" setattr(process, selTauModuleName, selTauModule) tauRecoSequence += getattr(process, selTauModuleName) -# +# # jetPtEta.src = cms.InputTag(selTauModuleName) -# +# process.load("PhysicsTools.JetMCAlgos.TauGenJets_cfi") # sequence = cms.Sequence(tauRecoSequence * process.tauGenJets * sequence) @@ -714,7 +730,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): if reco: (genLabel, genJets) = genJetsDict[alg_size_type] setattr(process, genLabel, genJets) - + sequence.replace(refPtEta, genJets * refPtEta) if type == 'Calo': @@ -724,23 +740,23 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): setattr(process,'genParticlesForJetsNoNu',genParticlesForJetsNoNu) sequence = cms.Sequence(genParticlesForJetsNoNu * sequence) refPtEta.src = genJets.label() - + ## filter / map partons only if flavor information is requested - if Defaults.JetResponseParameters.doFlavor.value() : - setattr(process, 'partons', partons) - if reco: #added 02/29/2012 - jetsTag = cms.InputTag(genJetsDict[alg_size_type][0]) - else: - jetsTag = cms.InputTag(stdGenJetsDict[alg_size_type]) - genToParton = cms.EDProducer('JetPartonMatcher', - jets = jetsTag, - #jets = cms.InputTag(genJets.label()), #commented out on 02/29/2012 for line above. - coneSizeToAssociate = cms.double(0.3), - partons = cms.InputTag('partons') - ) - setattr(process, alg_size_type + 'GenToParton', genToParton) - sequence = cms.Sequence(sequence * partons * genToParton) - +# if Defaults.JetResponseParameters.doFlavor.value() : +# setattr(process, 'partons', partons) +# if reco: #added 02/29/2012 +# jetsTag = cms.InputTag(genJetsDict[alg_size_type][0]) +# else: +# jetsTag = cms.InputTag(stdGenJetsDict[alg_size_type]) +# genToParton = cms.EDProducer('JetPartonMatcher', +# jets = jetsTag, +# #jets = cms.InputTag(genJets.label()), #commented out on 02/29/2012 for line above. +# coneSizeToAssociate = cms.double(0.3), +# partons = cms.InputTag('partons') +# ) +# setattr(process, alg_size_type + 'GenToParton', genToParton) +# sequence = cms.Sequence(sequence * partons * genToParton) + ## reference to jet matching jetToRef = cms.EDProducer('MatchRecToGen', srcGen = cms.InputTag(refPtEta.label()), @@ -757,18 +773,19 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): setattr(process,alg_size_type_corr + 'JetToUncorJet', jetToUncorJet) sequence = cms.Sequence(sequence * jetToUncorJet) ############################## - + ## jet response analyzer jraAnalyzer = 'JetResponseAnalyzer' jra = cms.EDAnalyzer(jraAnalyzer, Defaults.JetResponseParameters, srcRefToJetMap = cms.InputTag(jetToRef.label(), 'gen2rec'), + srcJetUnMatch = cms.InputTag(jetToRef.label(), 'unmaprec'), srcRef = cms.InputTag(refPtEta.label()), jecLabel = cms.string(''), srcRhos = cms.InputTag(''), srcRho = cms.InputTag(''), srcRhoHLT = cms.InputTag(''), - srcVtx = cms.InputTag('offlinePrimaryVertices'), + srcVtx = cms.InputTag('hltPixelVertices'), srcJetToUncorJetMap = cms.InputTag(jetToUncorJet.label(), 'rec2gen'), srcPFCandidates = cms.InputTag('') ) @@ -788,13 +805,14 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): if type == 'CaloHLT': jra.srcRho = ak4CaloL1Fastjet.srcRho #added 02/15/2012 - jra.srcRhoHLT = ak5CaloHLTL1Fastjet.srcRho + #jra.srcRhoHLT = ak5CaloHLTL1Fastjet.srcRho + jra.srcRhoHLT = cms.InputTag('hltFixedGridRhoFastjetAllCalo') # for HLT usage elif type == 'Calo': jra.srcRho = ak4CaloL1Fastjet.srcRho #added 10/14/2011 elif type == 'PFchs': process.kt6PFchsJetsRhos = kt6PFJets.clone(src = 'pfNoPileUpJME', doFastJetNonUniform = cms.bool(True), - puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), + puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), puWidth = cms.double(.8), nExclude = cms.uint32(2)) sequence = cms.Sequence(process.kt6PFchsJetsRhos * sequence) @@ -803,14 +821,15 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): jra.srcPFCandidates = cms.InputTag('pfNoPileUpJME') elif type == 'PFHLT': jra.srcRho = ak4PFL1Fastjet.srcRho #added 02/15/2012 - jra.srcRhoHLT = ak5PFHLTL1Fastjet.srcRho + #jra.srcRhoHLT = ak5PFHLTL1Fastjet.srcRho + jra.srcRhoHLT = cms.InputTag('hltFixedGridRhoFastjetAll') # for HLT usage elif type == 'PFchsHLT': jra.srcRho = ak4PFchsL1Fastjet.srcRho #added 02/15/2012 jra.srcRhoHLT = ak5PFchsHLTL1Fastjet.srcRho elif type == 'PF': process.kt6PFJetsRhos = kt6PFJets.clone(doFastJetNonUniform = cms.bool(True), puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), - puWidth = cms.double(.8), + puWidth = cms.double(.8), nExclude = cms.uint32(2)) sequence = cms.Sequence(process.kt6PFJetsRhos * sequence) jra.srcRhos = cms.InputTag("kt6PFJetsRhos", "rhos") @@ -830,12 +849,12 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): if correctl1 or correctl2l3: jra.jecLabel = corrJets.correctors[0].replace("Corrector","") - if Defaults.JetResponseParameters.doFlavor.value(): - jra.srcRefToPartonMap = cms.InputTag(genToParton.label()) +# if Defaults.JetResponseParameters.doFlavor.value(): +# jra.srcRefToPartonMap = cms.InputTag(genToParton.label()) setattr(process,alg_size_type_corr,jra) sequence = cms.Sequence(sequence * jra) - + ## add chs to path is needed if type == 'PFchs': sequence = cms.Sequence(process.pfNoPileUpJMESequence * sequence) diff --git a/JetAnalyzers/src/JetResponseAnalyzer.cc b/JetAnalyzers/src/JetResponseAnalyzer.cc index bd34428b..17b65057 100644 --- a/JetAnalyzers/src/JetResponseAnalyzer.cc +++ b/JetAnalyzers/src/JetResponseAnalyzer.cc @@ -20,6 +20,7 @@ JetResponseAnalyzer::JetResponseAnalyzer(const edm::ParameterSet& iConfig) , srcRef_ (consumes(iConfig.getParameter ("srcRef"))) , srcJetToUncorJetMap_ (consumes(iConfig.getParameter("srcJetToUncorJetMap"))) , srcRefToJetMap_ (consumes(iConfig.getParameter ("srcRefToJetMap"))) + , srcJetUnMatch_ (consumes(iConfig.getParameter ("srcJetUnMatch"))) , srcRhos_ (consumes >(iConfig.getParameter ("srcRhos"))) , srcRho_ (consumes(iConfig.getParameter ("srcRho"))) , srcRhoHLT_ (consumes(iConfig.getParameter ("srcRhoHLT"))) @@ -126,6 +127,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, edm::Handle refs; edm::Handle jetToUncorJetMap; edm::Handle refToJetMap; + edm::Handle jetUnMatch; // unmatched reco-jet branch edm::Handle refToPartonMap; edm::Handle > rhos; edm::Handle rho; @@ -172,7 +174,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, if (iEvent.getByToken(srcVtx_,vtx)) { const reco::VertexCollection::const_iterator vtxEnd = vtx->end(); for (reco::VertexCollection::const_iterator vtxIter = vtx->begin(); vtxEnd != vtxIter; ++vtxIter) { - if (!vtxIter->isFake() && vtxIter->ndof()>=4 && fabs(vtxIter->z())<=24) { + if (!vtxIter->isFake() && vtxIter->ndof()>=1 && fabs(vtxIter->z())<=24) { // online with ndof>=1 instead of 4 for offline!!! ++(JRAEvt_->npv); JRAEvt_->refdzvtx->push_back(0);//fabs(vtxIter->z()-); } @@ -218,6 +220,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, iEvent.getByToken(srcRef_, refs); iEvent.getByToken(srcJetToUncorJetMap_, jetToUncorJetMap); iEvent.getByToken(srcRefToJetMap_,refToJetMap); + iEvent.getByToken(srcJetUnMatch_, jetUnMatch); /////Unmatched reco jet config!!! if (getFlavorFromMap_) iEvent.getByToken(srcRefToPartonMap_,refToPartonMap); if (doBalancing_&&refToJetMap->size()!=1) return; JRAEvt_->nref = 0; @@ -460,6 +463,17 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, JRAEvt_->nref++; } + + ////////////Unmatched reco jet config!!!!!!!!!!!!!! + reco::CandViewMatchMap::const_iterator itUnMatch; + JRAEvt_->nUnMatchJet = 0; + for(itUnMatch=jetUnMatch->begin();itUnMatch!=jetUnMatch->end();itUnMatch++) + { + reco::CandidateBaseRef unmatchrecojet = itUnMatch->val; + JRAEvt_->unmapjteta->push_back(unmatchrecojet->eta()); + JRAEvt_->unmapjtpt->push_back(unmatchrecojet->pt()); + JRAEvt_->nUnMatchJet++; + } tree_->Fill(); diff --git a/JetAnalyzers/test/run_JRA_hlt_cfg.py b/JetAnalyzers/test/run_JRA_hlt_cfg.py new file mode 100644 index 00000000..6239a25e --- /dev/null +++ b/JetAnalyzers/test/run_JRA_hlt_cfg.py @@ -0,0 +1,211 @@ +import FWCore.ParameterSet.Config as cms + +#! +#! JET & REFERENCE KINEMATIC CUTS +#! +import JetMETAnalysis.JetAnalyzers.Defaults_cff as Defaults + +Defaults.JetPtEta = cms.PSet( + etaMin = cms.double(-5.5), + etaMax = cms.double(5.5), + ptMin = cms.double(1.0) +) +Defaults.RefPtEta = cms.PSet( + etaMin = cms.double(-5.5), + etaMax = cms.double(5.5), + ptMin = cms.double(1.0) +) +Defaults.JetResponseParameters.doComposition = True +Defaults.JetResponseParameters.doHLT = True + +#! +#! PROCESS +#! +applyDBFile = False +era = "PHYS14_HLT_V1_MC" +#era = "PHYS14_V4_MC" +doProducer = False +process = cms.Process("JRA") +if doProducer: + process = cms.Process("JRAP") + + +#! +#! CHOOSE ALGORITHMS +#! + +algsizetype = {'ak':[4,8]} +#algsizetype = {'ak':[1,2,3,4,5,6,7,8,9,10]} +jettype = ['pfHLT','caloHLT'] +#jettype = ['pf','pfchs'] +#jettype = ['calo','pf','pfchs','puppi'] +corrs = [''] +#corrs = ['','l1','l2l3','l1l2l3'] + +algorithms = [] +jcr = cms.VPSet() + +loop = True + +if loop: + for k, v in algsizetype.iteritems(): + for s in v: + for j in jettype: + for c in corrs: + algorithms.append(str(k+str(s)+j+c)) + if applyDBFile: + upperAlg = str(k.upper()+str(s)+j.upper().replace("CHS","chs")) + jcr.append(cms.PSet(record = cms.string("JetCorrectionsRecord"), + tag = cms.string("JetCorrectorParametersCollection_"+era+"_"+upperAlg), + label= cms.untracked.string(upperAlg))) + +else: + # SAMPLE + algorithms.append('ak5calo') + + +#! +#! CONDITIONS (DELIVERING JEC BY DEFAULT!) +#! +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") + +#from Configuration.AlCa.GlobalTag import GlobalTag +#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:startup_GRun', '') +#process.GlobalTag.globaltag = "PHYS14_25_V1" +#process.GlobalTag.globaltag = "MCRUN2_74_V7" +#process.GlobalTag.globaltag = "74X_HLT_mcRun2_asymptotic_fromSpring15DR_v0" + +process.GlobalTag = cms.ESSource("PoolDBESSource", + BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), + DBParameters = cms.PSet( + authenticationPath = cms.untracked.string('.'), + connectionRetrialPeriod = cms.untracked.int32(10), + connectionRetrialTimeOut = cms.untracked.int32(60), + connectionTimeOut = cms.untracked.int32(0), + enableConnectionSharing = cms.untracked.bool(True), + enablePoolAutomaticCleanUp = cms.untracked.bool(False), + enableReadOnlySessionOnUpdateConnection = cms.untracked.bool(False), + idleConnectionCleanupPeriod = cms.untracked.int32(10), + messageLevel = cms.untracked.int32(0) + ), + DumpStat = cms.untracked.bool(False), + ReconnectEachRun = cms.untracked.bool(False), + RefreshAlways = cms.untracked.bool(False), + RefreshEachRun = cms.untracked.bool(False), + RefreshOpenIOVs = cms.untracked.bool(False), + connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'), + globaltag = cms.string('80X_mcRun2_asymptotic_ForTSGStudies_v0'), + pfnPrefix = cms.untracked.string('frontier://FrontierProd/'), + snapshotTime = cms.string('9999-12-31 23:59:59.000'), + toGet = cms.VPSet() +) + +if applyDBFile: + from CondCore.DBCommon.CondDBSetup_cfi import * + process.jec = cms.ESSource("PoolDBESSource",CondDBSetup, + connect = cms.string('sqlite_file:DBFiles/'+era+'.db'), + #cms.string("frontier://FrontierPrep/CMS_COND_PHYSICSTOOLS"), + toGet = cms.VPSet(jcr)) + process.es_prefer_jec = cms.ESPrefer("PoolDBESSource","jec") + + +#! +#! INPUT +#! +qcdFiles = cms.untracked.vstring( +################### +# Upgrade with PU # +################### + '/store/group/phys_jetmet/kirschen/HLTJEC2016/QCD/QCD_Pt-15to3000_TuneCUETP8M1_Flat_13TeV_pythia8/crab_JECFall15_PUFlat0to50_withPFCalib_QCD/160222_213430/0000/outputA_5.root' +###################### +# Upgrade without PU # +###################### + +########################### +# RelVal CMSSW_7_4_0_pre9 # +########################### +# '/store/relval/CMSSW_7_4_0_pre9/RelValQCD_FlatPt_15_3000_13/GEN-SIM-DIGI-RECO/MCRUN2_74_V7_FastSim-v1/00000/EEC9F0EF-10D4-E411-A6E7-0025905A48D0.root' + ) +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(100)) +process.source = cms.Source("PoolSource", fileNames = qcdFiles ) + + +#! +#! SERVICES +#! +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 5000 +if not doProducer: + process.load('CommonTools.UtilAlgos.TFileService_cfi') + process.TFileService.fileName=cms.string('JRA.root') + + +#! +#! NEEDED FOR PFCHS (last two lines needed for 44X and up) +#! +#process.load('CommonTools.ParticleFlow.pfNoPileUp_cff') +#process.pfPileUp.PFCandidates = 'particleFlow' +#process.pfNoPileUp.bottomCollection = 'particleFlow' +process.load('CommonTools.ParticleFlow.pfNoPileUpJME_cff') +process.pfPileUp.checkClosestZVertex = False + + +#! +#! RUN JET RESPONSE ANALYZER +#! + +# set to False to use jets from the input file (NOT RECOMMENDED) +doJetReco = True +outCom = cms.untracked.vstring('drop *') +from JetMETAnalysis.JetAnalyzers.addAlgorithm import addAlgorithm +for algorithm in algorithms: + if (algorithm.find('HLT') > 0) : + #process.load("Configuration.StandardSequences.Geometry_cff") + process.load("Configuration.StandardSequences.MagneticField_cff") + addAlgorithm(process,algorithm,Defaults,False,doProducer) + else: + addAlgorithm(process,algorithm,Defaults,doJetReco,doProducer) + outCom.extend(['keep *_'+algorithm+'_*_*']) + +#process.ak5CaloJets.jetPtMin = 1.0 +#process.ak5PFJets.jetPtMin = 1.0 +#process.ak7CaloJets.jetPtMin = 1.0 +#process.ak7PFJets.jetPtMin = 1.0 +#process.ak5PFchsJets.jetPtMin = 1.0 +#process.ak7PFchsJets.jetPtMin = 1.0 + + +#! +#! Check the keep and drop commands being added to the outputCommamnds +#! +#for oc in outCom: +# print oc + + +#! +#! Output +#! +if doProducer: + process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('JRAP.root'), + outputCommands = outCom + # outputCommands = cms.untracked.vstring( + # "drop *", + # "keep *_ak5pf_*_*" + # ) + ) + process.e = cms.EndPath(process.out) + + +#! +#! THAT'S ALL! CAN YOU BELIEVE IT? :-D +#! + +#Not sure what this does +#processDumpFile = open('runJRA.dump' , 'w') +#print >> processDumpFile, process.dumpPython() +#process.options.wantSummary = True +#process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) ) +process.options = cms.untracked.PSet( + SkipEvent = cms.untracked.vstring('ProductNotFound') + ) diff --git a/JetAnalyzers/test/sanity/CaloCorFactor.cc b/JetAnalyzers/test/sanity/CaloCorFactor.cc new file mode 100644 index 00000000..15139ec2 --- /dev/null +++ b/JetAnalyzers/test/sanity/CaloCorFactor.cc @@ -0,0 +1,60 @@ +#include +#include +#include +#include +using namespace std; + +void Corrfunction(){ + + double tmp = 0; + double etalow = 0; + double etahigh = 0; + double ptlow = 0; + double pthigh = 0; + vector para; + + //ifstream input("EcalMultifitHCALMethod3_L2Relative_AK4CaloHLTl1.txt"); + ifstream input("EcalMultifitHCALMethod3_L2Relative_AK8CaloHLTl1.txt"); + //ofstream output("CaloFactor_AK4.txt",ios::out); + ofstream output("CaloFactor_AK8.txt",ios::out); + + TF1* fun = new TF1("fun","[0]+([1]/((log10(x)^[2])+[3]))", 0, 3500); + // ===================== validate PF Jet correction factor ======================= + for(int i=1;i<=702;i++){ + input >> tmp; + + if((i-1)%9 == 0) etalow = tmp; + else if((i-2)%9 == 0) etahigh = tmp; + else if((i-3)%9 == 0) continue; + else if((i-4)%9 == 0) ptlow = tmp; + else if((i-5)%9 == 0) pthigh = tmp; + else{ + para.push_back(tmp); + } + + fun->SetRange(ptlow,pthigh); + + if(i >= 9 && (i-9)%9 == 0){ + for(int j=0;j<4;j++){ + fun->SetParameter(j,para[j]); + } + + fun->SetNpx(1000); + if(fabs(fun->GetMinimum())<0.8 || fabs(fun->GetMaximum())>3.5) + output << "Eta: " << etalow << " " << etahigh + << " Pt: " << ptlow << " " << pthigh + << " Minimum: " << fun->GetMinimum() + << " Maximum: " << fun->GetMaximum() << endl; + + if(fabs(fun->GetMinimum())>100 || fabs(fun->GetMaximum())>100) + cout << "******Crazy bin****** " << endl + << "Eta: " << etalow << " " << etahigh + << "Pt: " << ptlow << " " << pthigh + << "Minimum: " << fun->GetMinimum() + << "Maximum: " << fun->GetMaximum() << endl; + + para.clear(); + } + } + +} diff --git a/JetAnalyzers/test/sanity/PFCorFactor.cc b/JetAnalyzers/test/sanity/PFCorFactor.cc new file mode 100644 index 00000000..89fb7b11 --- /dev/null +++ b/JetAnalyzers/test/sanity/PFCorFactor.cc @@ -0,0 +1,61 @@ +#include +#include +#include +#include +using namespace std; + +void Corrfunction(){ + + double tmp = 0; + double etalow = 0; + double etahigh = 0; + double ptlow = 0; + double pthigh = 0; + vector para; + + //ifstream input("EcalMultifitHCALMethod3_L2Relative_AK4PFHLTl1.txt"); + ifstream input("EcalMultifitHCALMethod3_L2Relative_AK8PFHLTl1.txt"); + //ofstream output("PFFactor_AK4.txt",ios::out); + ofstream output("PFFactor_AK8.txt",ios::out); + + TF1* fun = new TF1("fun","((x>=[6])*(([0]+([1]/((log10(x)^2)+[2])))+([3]*exp(-([4]*((log10(x)-[5])*(log10(x)-[5])))))))+((x<[6])*[7])", 0, 3500); + + // ===================== validate PF Jet correction factor ======================= + for(int i=1;i<=1014;i++){ + input >> tmp; + + if((i-1)%13 == 0) etalow = tmp; + else if((i-2)%13 == 0) etahigh = tmp; + else if((i-3)%13 == 0) continue; + else if((i-4)%13 == 0) ptlow = tmp; + else if((i-5)%13 == 0) pthigh = tmp; + else{ + para.push_back(tmp); + } + + fun->SetRange(ptlow,pthigh); + + if(i >= 13 && (i-13)%13 == 0){ + for(int j=0;j<8;j++){ + fun->SetParameter(j,para[j]); + } + + fun->SetNpx(1000); + if(fabs(fun->GetMinimum())<0.8 || fabs(fun->GetMaximum())>2.5) + output << "Eta: " << etalow << " " << etahigh + << " Pt: " << ptlow << " " << pthigh + << " Minimum: " << fun->GetMinimum() + << " Maximum: " << fun->GetMaximum() << endl; + + if(fabs(fun->GetMinimum())>5 || fabs(fun->GetMaximum())>5) + cout << "******Crazy bin****** " << endl + << "Eta: " << etalow << " " << etahigh + << "Pt: " << ptlow << " " << pthigh + << "Minimum: " << fun->GetMinimum() + << "Maximum: " << fun->GetMaximum() << endl; + + para.clear(); + } + } + +} diff --git a/JetUtilities/Makefile b/JetUtilities/Makefile index 5bd87766..02741569 100644 --- a/JetUtilities/Makefile +++ b/JetUtilities/Makefile @@ -56,7 +56,7 @@ setup: lib: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) $(ROOTLIBS) -o $(LIBDIR)/$(LIB) -bin: jet_inspect_profiles jet_inspect_histos jet_inspect_graphs +bin: jet_inspect_profiles jet_inspect_histos jet_inspect_graphs jet_inspect_multigraphs jet_inspect_profiles: $(CXX) $(CXXFLAGS) bin/jet_inspect_profiles_x.cc $(LIBS) $(ROOTLIBS) \ @@ -70,12 +70,16 @@ jet_inspect_graphs: $(CXX) $(CXXFLAGS) bin/jet_inspect_graphs_x.cc $(LIBS) $(ROOTLIBS) \ -o $(BINDIR)/jet_inspect_graphs_x +jet_inspect_multigraphs: + $(CXX) $(CXXFLAGS) bin/jet_inspect_multigraphs_x.cc $(LIBS) $(ROOTLIBS) \ + -o $(BINDIR)/jet_inspect_multigraphs_x clean: rm -rf $(OBJS) $(LIBDIR)/$(LIB) JetMETAnalysis \ $(BINDIR)/jet_inspect_profiles_x \ $(BINDIR)/jet_inspect_histos_x \ - $(BINDIR)/jet_inspect_graphs_x + $(BINDIR)/jet_inspect_graphs_x \ + $(BINDIR)/jet_inspect_multigraphs_x ################################################################################ diff --git a/JetUtilities/bin/BuildFile.xml b/JetUtilities/bin/BuildFile.xml index ed9ccd95..0e176feb 100644 --- a/JetUtilities/bin/BuildFile.xml +++ b/JetUtilities/bin/BuildFile.xml @@ -8,3 +8,5 @@ + + diff --git a/JetUtilities/bin/jet_inspect_graphs_x.cc b/JetUtilities/bin/jet_inspect_graphs_x.cc index 78d34d7e..f2ef1ea7 100644 --- a/JetUtilities/bin/jet_inspect_graphs_x.cc +++ b/JetUtilities/bin/jet_inspect_graphs_x.cc @@ -10,7 +10,6 @@ #include "JetMETAnalysis/JetUtilities/interface/CommandLine.h" #include "JetMETAnalysis/JetUtilities/interface/ObjectLoader.h" #include "JetMETAnalysis/JetUtilities/interface/RootStyle.h" -#include "JetMETAnalysis/JetUtilities/interface/Style.h" #include #include @@ -24,10 +23,7 @@ #include #include #include -#include -#include -#include - +#include #include #include #include @@ -49,43 +45,42 @@ using namespace std; void draw_range(const string& range,const int residual=-1); string get_range(const ObjectLoader& gl, - const vector& indices, - bool addFixedVars=true,string refpt=""); + const vector& indices, + bool addFixedVars=true,string refpt=""); string get_legend_label_from_alg(const string& alg); string get_legend_label_from_input(const string& input); void set_graph_style(TGraphErrors* g,unsigned int ngraph,bool nocolor, - const vector& vcolors, - const vector& vmarkers, - const vector& vlstyles, - const vector& vsizes, - const vector& vlsizes); + const vector& vcolors, + const vector& vmarkers, + const vector& vlstyles, + const vector& vsizes, + const vector& vlsizes); void set_axis_titles(TH1*h,const string& quantity,float ymin,float ymax, - string xtitle,string ytitle,string refpt="",bool tdr=false); + string xtitle,string ytitle,string refpt=""); void draw_graph_residual(TPad* pad,TMultiGraph* mg, - const int errMode, - const bool resmcdata, - const vector& defmcdata, - const float yresmax=-1., - const string& restitle="", - const float restitlesize=.11, - float xmin=-1., - float xmax=-1., - float ymin=-1., - float ymax=-1., - int fullfit=-1, - bool tdr=false); + const int errMode, + const bool resmcdata, + const vector& defmcdata, + const float yresmax=-1., + const string& restitle="", + const float restitlesize=.11, + float xmin=-1., + float xmax=-1., + float ymin=-1., + float ymax=-1., + int fullfit=-1); TH1F* set_axis_range(TMultiGraph* mg, - float xmin=-1., float xmax=-1., - float ymin=-1., float ymax=-1.); + float xmin=-1., float xmax=-1., + float ymin=-1., float ymax=-1.); -void draw_zline(TH1* h1,float xmin=-1.,float xmax=-1.,float y=0.); +void draw_zline(TH1* h1,float xmin=-1.,float xmax=-1.); void draw_extrapolation(TMultiGraph* mg,int fullfit=-1, - float xmin=-1.,float xmax=-1.); + float xmin=-1.,float xmax=-1.); void draw_labels(const vector& labels,bool leginplot,bool tdrautobins); @@ -96,632 +91,444 @@ void draw_labels(const vector& labels,bool leginplot,bool tdrautobins); //______________________________________________________________________________ int main(int argc,char** argv) { - CommandLine cl; - if (!cl.parse(argc,argv)) return 0; - - vector inputs = cl.getVector("inputs"); - vector algs = cl.getVector("algs", "ak5calo"); - vector variables = cl.getVector("variables","RelRspVsRefPt"); - - vector leglabels = cl.getVector("leglabels", ""); - - vector tdrlabels = cl.getVector("tdrlabels", ""); - bool tdrautobins=cl.getValue ("tdrautobins", false); - bool drawrange = cl.getValue ("drawrange", true); - - - bool leginplot = cl.getValue ("leginplot", true); - - bool drawlegend= cl.getValue ("drawlegend", true); - double legx = cl.getValue ("legx", 0.5); - double legy = cl.getValue ("legy", 0.9); - double legw = cl.getValue ("legw", 0.4); - int extraleglabels = cl.getValue("extraleglabels", 0); - - string xtitle = cl.getValue ("xtitle", ""); - string ytitle = cl.getValue ("ytitle", ""); - string refpt = cl.getValue ("refpt", ""); - - vectorcolors = cl.getVector("colors", ""); - vectormarkers= cl.getVector("markers", ""); - vectorlstyles= cl.getVector("lstyles", ""); - vector sizes = cl.getVector ("sizes", ""); - vector lsizes = cl.getVector ("lsizes", ""); - - - string text = cl.getValue ("text", ""); - bool logx = cl.getValue ("logx", false); - bool logy = cl.getValue ("logy", false); - float ymin = cl.getValue ("ymin", -1.0); - float ymax = cl.getValue ("ymax", -1.0); - bool nocolor = cl.getValue ("nocolor", false); - bool overlay = cl.getValue ("overlay", true); - int fullfit = cl.getValue ("fullfit", -1); - string prefix = cl.getValue ("prefix", ""); - string suffix = cl.getValue ("suffix", ""); - string opath = cl.getValue ("opath", ""); - vector formats = cl.getVector("formats", ""); - bool batch = cl.getValue ("batch", false); - bool latex = cl.getValue ("latex", false); - bool latexcndf = cl.getValue ("latexcndf", true); - bool fittofile = cl.getValue ("fittofile", false); - - int residual = cl.getValue ("residual", -1); - string restitle = cl.getValue ("restitle", ""); - float restitlesize=cl.getValue ("restitlesize", .11); - float yresmax = cl.getValue ("yresmax", -1); - bool resmcdata = cl.getValue ("resmcdata", false); - vector defmcdata = cl.getVector ("defmcdata", ""); - - float xmin = cl.getValue ("xmin", -1.0); - float xmax = cl.getValue ("xmax", -1.0); - string mgname = cl.getValue ("mgname", ""); - bool verbose = cl.getValue ("verbose", false); - bool tdr = cl.getValue ("tdr", false); - bool doFlavor = cl.getValue ("doFlavor", false); - bool override = cl.getValue ("override", false); - bool removeFit = cl.getValue ("removeFit", false); - bool useSpline = cl.getValue ("useSpline", false); - - - if (!cl.check()) return 0; - cl.print(); - - // sanity check - if (!override && ((inputs.size()>1&&algs.size()>1)|| - (algs.size()>1&&variables.size()>1)|| - (inputs.size()>1&&variables.size()>1))) { - cout<<"Provide more than one value only for one of inputs/algs/variables!" - < inputs = cl.getVector("inputs"); + vector algs = cl.getVector("algs", "ak5calo"); + vector variables = cl.getVector("variables","RelRspVsRefPt"); + + vector leglabels = cl.getVector("leglabels", ""); + + vector tdrlabels = cl.getVector("tdrlabels", ""); + bool tdrautobins=cl.getValue ("tdrautobins", false); + bool drawrange = cl.getValue ("drawrange", true); + + + bool leginplot = cl.getValue ("leginplot", true); + + bool drawlegend= cl.getValue ("drawlegend", true); + double legx = cl.getValue ("legx", 0.55); + double legy = cl.getValue ("legy", 0.9); + double legw = cl.getValue ("legw", 0.35); + + string xtitle = cl.getValue ("xtitle", ""); + string ytitle = cl.getValue ("ytitle", ""); + string refpt = cl.getValue ("refpt", ""); + + vectorcolors = cl.getVector("colors", ""); + vectormarkers= cl.getVector("markers", ""); + vectorlstyles= cl.getVector("lstyles", ""); + vector sizes = cl.getVector ("sizes", ""); + vector lsizes = cl.getVector ("lsizes", ""); + + + string text = cl.getValue ("text", ""); + bool logx = cl.getValue ("logx", false); + bool logy = cl.getValue ("logy", false); + float ymin = cl.getValue ("ymin", -1.0); + float ymax = cl.getValue ("ymax", -1.0); + bool nocolor = cl.getValue ("nocolor", false); + bool overlay = cl.getValue ("overlay", true); + int fullfit = cl.getValue ("fullfit", -1); + string prefix = cl.getValue ("prefix", ""); + string suffix = cl.getValue ("suffix", ""); + string opath = cl.getValue ("opath", ""); + vector formats = cl.getVector("formats", "pdf"); + bool batch = cl.getValue ("batch", true); + bool latex = cl.getValue ("latex", false); + bool latexcndf = cl.getValue ("latexcndf", true); + bool fittofile = cl.getValue ("fittofile", false); + + int residual = cl.getValue ("residual", -1); + string restitle = cl.getValue ("restitle", ""); + float restitlesize=cl.getValue ("restitlesize", .11); + float yresmax = cl.getValue ("yresmax", -1); + bool resmcdata = cl.getValue ("resmcdata", false); + vector defmcdata = cl.getVector ("defmcdata", ""); + + float xmin = cl.getValue ("xmin", -1.0); + float xmax = cl.getValue ("xmax", -1.0); + + + + if (!cl.check()) return 0; + cl.print(); + + // sanity check + if ((inputs.size()>1&&algs.size()>1)|| + (algs.size()>1&&variables.size()>1)|| + (inputs.size()>1&&variables.size()>1)) { + cout<<"Provide more than one value only for one of inputs/algs/variables!" + <SetOptStat(0); - gStyle->SetOptFit(0); - } - else { set_root_style(); - + gStyle->SetOptStat(0); gStyle->SetOptFit(0); - } - - // is the *same* quantity compared for several (e.g. eta-) ranges? - set quantities; - for (unsigned int i=0;i1) { - if (leglabels.size()>0) { - if (leglabels.size()-extraleglabels!=algs.size()) { - cout<<"ERROR: leglabels / algs mismatch!"<1) { - if (leglabels.size()>0) { - if (leglabels.size()-extraleglabels!=inputs.size()) { - cout<<"ERROR: leglabels / inputs mismatch!"<1) { - if (leglabels.size()>0) { - if (leglabels.size()-extraleglabels!=variables.size()) { - cout<<"ERROR: leglabels / variables mismatch!"< quantities; + for (unsigned int i=0;i graphs; - vector ranges; - string quantity=(*quantities.begin()); - - /// LOOP OVER FILES - for (unsigned int iinput=0;iinputIsOpen()) {cout<<"Can't open "<GetName()<Get(alg.c_str()); - if (0==dir) { cout<<"No dir "< gl; - gl.load_objects(dir,variable); - if (verbose) - cout << "\tNumber of TGraphErrors loaded = " << gl.nobjects() << endl; - - gl.begin_loop(); - vector indices; - TGraphErrors* g(0); - while ((g=gl.next_object(indices))) { - - graphs.push_back(g); - ranges.push_back(get_range(gl,indices,variables.size()==1,refpt)); - - if (0==mg) { - stringstream sscname; - if (!prefix.empty()) sscname<1&&gl.nobjects(i)==1) continue; //?? - sscname<<"_"<0)?leglabels.size():variables.size(); - if (mgname.empty()) mgname = sscname.str(); - //mg=new TMultiGraph(sscname.str().c_str(),""); - mg=new TMultiGraph(mgname.c_str(),""); - - //double ymax=(quantity.find("Rsp")==string::npos)?0.85:0.4; - - double legxmin = (leginplot) ? legx : 0.825; - double legymin = (residual>=0) ? legy-0.045 : legy; - if(residual>=0 && tdr) legymin += 0.03; - double legxmax = (leginplot) ? legx+legw : 1.03; - double legymax = (override && algs.size()>1 && variables.size()>1) ? - legymin - (nleglabels)*0.075 : legymin - (nleglabels)*0.055; - - leg = new TLegend(legxmin,legymin,legxmax,legymax); - //leg->SetFillColor(10); leg->SetLineColor(10); leg->SetBorderSize(0); - leg->SetFillColor(0); leg->SetLineColor(0); leg->SetBorderSize(0); - if(override && algs.size()>1 && variables.size()>1) { - leg2 = new TLegend(legxmin-0.08,legymin,legxmax-0.08,legymax); - leg2->SetFillColor(0); leg2->SetLineColor(0); leg2->SetBorderSize(0); - } - for(int el=0; elAddEntry((TObject*)0,leglabels[el].c_str(),""); - } - - //leg=new TLegend(0.5,ymax,0.9,ymax-nleglabels*0.06); - //range=get_range(gl,indices,variables.size()==1); - } - - //cout<<"indices back: "<1) ? - iinput : (algs.size()>1) ? - ialg : (variables.size()>1) ? - ivar : (indices.size()>0) ? indices.back() : 0; - ilabel+=extraleglabels; - string label=(variables.size()>1&&leglabels.size()==0) ? - get_range(gl,indices,true,refpt) : (leglabels.size()>(unsigned)ilabel) ? - leglabels[ilabel] : "error"; - - mg->Add(g); - set_graph_style(g,overlay*(graphs.size()-1),nocolor,colors,markers,lstyles,sizes,lsizes); - if(override && algs.size()>1 && variables.size()>1) { - TString header = variables[ivar].substr(0,3); - header.ToLower(); - if(header.EqualTo("eta") || header.EqualTo("phi")) { - header = "#kern[0.3]{ #" + header+"}"; - } - - if(!leg->GetHeader() && ivar==0) - leg->SetHeader(header); - if(!leg2->GetHeader() && ivar==1) - leg2->SetHeader(header); - - if(ivar==0) - leg->AddEntry(g,label.c_str(),"lp"); - else - leg2->AddEntry(g," ","lp"); + if (quantities.size()!=1) { + cout<<"ERROR: don't try to compare different quantities!"<AddEntry(g,label.c_str(),"lp"); - - // print fit parameters - TF1* fitfnc = (TF1*)g->GetFunction("fit"); - if (0!=fitfnc) { - for (int ipar=0;iparGetNpar();ipar++) - cout<GetParameter(ipar)<<" +- " - <GetParError(ipar)<Chi2/NDF: " - <GetChisquare()<<"/" - <GetNDF()<GetName()<<".tex"; - texfile.open(texfilename.str().c_str(),ofstream::trunc); - if (!texfile.is_open()) { - cout<<"tex-ERROR: Could not create "<GetExpFormula()<GetNpar()-1;ipar++) { - texinput<<"$ ("<GetParameter(ipar) - <<" $ & $ \\pm $ & " - <<"$ "<GetParError(ipar)<<") $ & "; - } - texinput<<"$ ("<GetParameter(fitfnc->GetNpar()-1) - <<" $ & $ \\pm $ & " - <<"$ "<GetParError(fitfnc->GetNpar()-1)<<") $"; - //...last not least chi2/ndf - if (latexcndf) { - texinput<<" & $ ("<GetChisquare() - <<"/" - <GetNDF()<<") $"; - } - texfile<GetName()<<".txt"; - fitfile.open(fitfilename.str().c_str(),ofstream::trunc); - if (!fitfile.is_open()) { - cout<<"txt-ERROR: Could not create "<GetExpFormula()<<" "<GetNpar()<GetNpar();ipar++) { - fitinput<GetParameter(ipar)<<" "; - } - fitinput<GetXaxis()->SetLimits(xmin,xmax); - frame->GetXaxis()->SetMoreLogLabels(logx); - frame->GetXaxis()->SetNoExponent(logx); - frame->GetYaxis()->SetRangeUser(ymin,ymax); - set_axis_titles(frame,quantity,ymin,ymax,xtitle,ytitle,refpt,tdr); - TH1D* frameRatio = new TH1D(); - frameRatio->GetXaxis()->SetLimits(xmin,xmax); - frameRatio->GetXaxis()->SetMoreLogLabels(logx); - frameRatio->GetXaxis()->SetNoExponent(logx); - int ratioMin = 0; - int ratioMax = 2; - frameRatio->GetYaxis()->SetRangeUser(-ratioMin,ratioMax); - set_axis_titles(frameRatio,quantity,-ratioMin,ratioMax,xtitle,restitle,refpt,tdr); - frameRatio->GetYaxis()->SetTitleSize(0.049); - - if(residual>=0) { - c = tdrDiCanvas(mg->GetName(),frame,frameRatio,14,11); - frameRatio->GetYaxis()->SetRangeUser(-ratioMin,ratioMax); - c->GetPad(1)->SetLogx(logx); - c->GetPad(1)->SetLogy(logy); - c->GetPad(2)->SetLogx(logx); - } - else { - c = tdrCanvas(mg->GetName(),frame,14,0,true); - frame->GetXaxis()->SetTitleOffset(frame->GetXaxis()->GetTitleOffset()+0.05); - if(TString(variables[0]).Contains("RelResVsRefPt")) - frame->GetYaxis()->SetTitleOffset(1.16); - c->GetPad(0)->SetLogx(logx); - c->GetPad(0)->SetLogy(logy); - } - - //This is a hack because TMultiGraph will always clear the pad - c->cd(1); - TGraphErrors *bounds = 0; - TSpline3* spline = 0; - int ngraphs = mg->GetListOfGraphs()->GetSize(); - for(int i=0;iGetListOfGraphs()->At(i); - if(residual<0 && removeFit) { - tmp->GetListOfFunctions()->Clear(); - } - // This is a hack to reduce the x-axis range for calo to pT>30 GeV - // It requires removing all of the points less than 30 GeV - //if(algs.size()>1 && variables.size()==1 && - // mg->GetListOfGraphs()->GetSize()==int(algs.size()) && - // TString(algs[i]).Contains("calo",TString::kIgnoreCase) && - // TString(variables[0]).Contains("VsRefPt")) { - if( - (algs.size()>1 && variables.size()==1 && - mg->GetListOfGraphs()->GetSize()==int(algs.size()) && - TString(algs[i]).Contains("calo",TString::kIgnoreCase) && - TString(variables[0]).Contains("VsRefPt")) || - (algs.size()>1 && variables.size()>1 && override && i<2 && - TString(tmp->GetName()).Contains("VsRefPt")) - ) { - Double_t* xVals = tmp->GetX(); - int nPoints = tmp->GetN(); - cout << "***SPECIAL CASE***" << endl - << "alg=" << algs[i] << endl - << "variable=" << variables[0] << endl; - for(int ipoint=0; ipointGetName()),tmp); - spline->SetLineColor(tmp->GetLineColor()); - //spline->SetLineWidth(tmp->GetLineWidth()); - spline->SetLineWidth(1.0); + else { + for (unsigned int ialg=0;ialgGetN(); - TGraphErrors* tmpEnd = (TGraphErrors*)mg->GetListOfGraphs()->At(ngraphs-1); - bounds = new TGraphErrors(n*2); - Double_t* xVals = tmp->GetX(); - Double_t* yVals = tmp->GetY(); - Double_t* xValsEnd = tmpEnd->GetX(); - Double_t* yValsEnd = tmpEnd->GetY(); - for(int ipoint=0; ipointGetN(); ipoint++) { - bounds->SetPoint(ipoint,xVals[ipoint],yVals[ipoint]); - bounds->SetPoint(n+ipoint,xValsEnd[n-ipoint-1],yValsEnd[n-ipoint-1]); + } + else if (inputs.size()>1) { + if (leglabels.size()>0) { + if (leglabels.size()!=inputs.size()) { + cout<<"ERROR: leglabels / inputs mismatch!"<AddEntry(bounds,"qg","f"); } else { - if(useSpline) { - spline->Draw("same"); - } - tdrDraw(tmp,"P",tmp->GetMarkerStyle(),tmp->GetMarkerColor(), - tmp->GetLineStyle(),tmp->GetLineColor()); - draw_extrapolation(mg,fullfit,xmin,xmax); + for (unsigned int iinput=0;iinput1) { + if (leglabels.size()>0) { + if (leglabels.size()!=variables.size()) { + cout<<"ERROR: leglabels / variables mismatch!"<=0) { - draw_extrapolation(mg,fullfit,xmin,xmax); - c->cd(2); - draw_zline(frameRatio,xmin,xmax,1.0); - draw_graph_residual(c,mg,residual, - resmcdata,defmcdata,yresmax,restitle,restitlesize, - xmin,xmax,ymin,ymax,fullfit,tdr); - } - - c->cd(1); - for(int i=0;iGetListOfGraphs()->GetSize(); i++) { - TGraphErrors* tmp = (TGraphErrors*)mg->GetListOfGraphs()->At(i); - gPad->Modified(); gPad->Update(); // make sure it's (re)drawn - TPaveStats *s = ((TPaveStats *)(tmp->FindObject("stats"))); - if (s) { s->SetX1NDC(-1); s->SetX2NDC(-1); } // get out of sight - gPad->Modified(); gPad->Update(); // make sure it's (re)drawn - } - - if(override && drawlegend) { - leg2->SetLineColor(0); - leg2->SetFillColor(0); - leg2->SetBorderSize(0); - leg2->SetTextSize(0.045); - leg2->Draw(); - } - leg->SetLineColor(0); - leg->SetFillColor(0); - leg->SetBorderSize(0); - leg->SetTextSize(0.045); - if (drawlegend) leg->Draw(); - if (drawrange) draw_range(ranges.front(),residual); - if (tdrautobins) tdrlabels.push_back(ranges.front()); - draw_labels(tdrlabels,leginplot,tdrautobins); - if (tdrautobins) tdrlabels.pop_back(); - - c->Update(); - fixOverlay(); } else { - c = new TCanvas(mg->GetName(),mg->GetName(),600,600); - gPad->SetLeftMargin(0.18); - gPad->SetRightMargin(0.05); - gPad->SetTopMargin(0.08); - gPad->SetBottomMargin(0.14); - gPad->SetLogx(logx); - gPad->SetLogy(logy); - - mg->Draw("AP"); - set_axis_titles(mg->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt,tdr); - - if (0!=mg->GetHistogram()) { - mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(logx); - mg->GetHistogram()->GetXaxis()->SetNoExponent(logx); - } - - set_axis_range(mg,xmin,xmax,ymin,ymax); - draw_extrapolation(mg,fullfit,xmin,xmax); - draw_graph_residual((TPad*)gPad,mg,residual, - resmcdata,defmcdata,yresmax,restitle,restitlesize, - xmin,xmax,ymin,ymax,fullfit,tdr); - - //leg->SetLineColor(10); - leg->SetLineColor(0); - //leg->SetFillColor(10); - leg->SetFillColor(0); - leg->SetBorderSize(0); - if (drawlegend) leg->Draw(); - if (drawrange) draw_range(ranges.front(),residual); - if (tdrautobins) tdrlabels.push_back(ranges.front()); - draw_labels(tdrlabels,leginplot,tdrautobins); - if (tdrautobins) tdrlabels.pop_back(); + leglabels.push_back(get_legend_label_from_alg(algs[0])); } - } - else { - c = new TCanvas(mg->GetName(),mg->GetName(),600,600); - unsigned nx = (unsigned)std::sqrt((float)graphs.size()); - unsigned ny = nx; - if (nx*nyDivide(nx,ny); - for (unsigned i=0;icd(i+1); - gPad->SetLeftMargin(0.18); - gPad->SetRightMargin(0.05); - gPad->SetTopMargin(0.08); - gPad->SetBottomMargin(0.14); - gPad->SetLogx(logx); - gPad->SetLogy(logy); - - stringstream ssmgindname; - ssmgindname<<"ind_"<GetName(); - TMultiGraph* mgind = new TMultiGraph(ssmgindname.str().c_str(), - ssmgindname.str().c_str()); - mgind->Add(graphs[i]); - //graphs[i]->Draw("AP"); - mgind->Draw("AP"); - //set_axis_titles(graphs[i]->GetHistogram(),quantity,ymin,ymax); - set_axis_titles(mgind->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt,tdr); - - if (0!=mg->GetHistogram()) { - mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(logx); - mg->GetHistogram()->GetXaxis()->SetNoExponent(logx); - } - - set_axis_range(mgind,xmin,xmax,ymin,ymax); - draw_extrapolation(mgind,fullfit,xmin,xmax); - draw_graph_residual((TPad*)gPad,mgind,residual, - resmcdata,defmcdata,yresmax,restitle,restitlesize, - xmin,xmax,ymin,ymax,fullfit,tdr); - - if (drawrange) draw_range(ranges[i],residual); - if (tdrautobins) tdrlabels.push_back(ranges[i]); - draw_labels(tdrlabels,leginplot,tdrautobins); - if (tdrautobins) tdrlabels.pop_back(); - set_axis_titles(graphs[i]->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt,tdr); - - if (algs.size()>1||inputs.size()>1) { - TLatex tex; - tex.SetNDC(); - tex.SetTextFont(42); - tex.SetTextSize(0.05); - string txt = (algs.size()>1) ? - get_legend_label_from_alg(algs[i]) : - get_legend_label_from_input(inputs[i]); - tex.DrawLatex(0.6,0.85,txt.c_str()); - } + TMultiGraph* mg(0); + TLegend* leg(0); + vector graphs; + vector ranges; + string quantity=(*quantities.begin()); + + /// LOOP OVER FILES + for (unsigned int iinput=0;iinputIsOpen()) {cout<<"Can't open "<GetName()<Get(alg.c_str()); + if (0==dir) { cout<<"No dir "< gl; + gl.load_objects(dir,variable); + + gl.begin_loop(); + vector indices; + TGraphErrors* g(0); + while ((g=gl.next_object(indices))) { + + graphs.push_back(g); + ranges.push_back(get_range(gl,indices,variables.size()==1,refpt)); + + if (0==mg) { + stringstream sscname; + if (!prefix.empty()) sscname<1&&gl.nobjects(i)==1) continue; //?? + sscname<<"_"<0)?leglabels.size():variables.size(); + mg=new TMultiGraph(sscname.str().c_str(),""); + + //double ymax=(quantity.find("Rsp")==string::npos)?0.85:0.4; + + double legxmin = (leginplot) ? legx : 0.825; + double legymin = legy; + double legxmax = (leginplot) ? legx+legw : 1.03; + double legymax = legymin - (nleglabels)*0.065; + + leg = new TLegend(legxmin,legymin,legxmax,legymax); + leg->SetFillColor(10); leg->SetLineColor(10); leg->SetBorderSize(0); + + //leg=new TLegend(0.5,ymax,0.9,ymax-nleglabels*0.06); + //range=get_range(gl,indices,variables.size()==1); + } + + //cout<<"indices back: "<1) ? + iinput : (algs.size()>1) ? + ialg : (variables.size()>1) ? + ivar : (indices.size()>0) ? indices.back() : 0; + + string label=(variables.size()>1&&leglabels.size()==0) ? + get_range(gl,indices,true,refpt) : (leglabels.size()>(unsigned)ilabel) ? + leglabels[ilabel] : "error"; + + mg->Add(g); + set_graph_style(g,overlay*(graphs.size()-1),nocolor,colors,markers,lstyles,sizes,lsizes); + leg->AddEntry(g,label.c_str(),"lp"); + + // print fit parameters + TF1* fitfnc = (TF1*)g->GetFunction("fit"); + if (0!=fitfnc) { + for (int ipar=0;iparGetNpar();ipar++) + cout<GetParameter(ipar)<<" +- " + <GetParError(ipar)<Chi2/NDF: " + <GetChisquare()<<"/" + <GetNDF()<GetName()<<".tex"; + texfile.open(texfilename.str().c_str(),ofstream::trunc); + if (!texfile.is_open()) { + cout<<"tex-ERROR: Could not create "<GetExpFormula()<GetNpar()-1;ipar++) { + texinput<<"$ ("<GetParameter(ipar) + <<" $ & $ \\pm $ & " + <<"$ "<GetParError(ipar)<<") $ & "; + } + texinput<<"$ ("<GetParameter(fitfnc->GetNpar()-1) + <<" $ & $ \\pm $ & " + <<"$ "<GetParError(fitfnc->GetNpar()-1)<<") $"; + //...last not least chi2/ndf + if (latexcndf) { + texinput<<" & $ ("<GetChisquare() + <<"/" + <GetNDF()<<") $"; + } + texfile<GetName()<<".txt"; + fitfile.open(fitfilename.str().c_str(),ofstream::trunc); + if (!fitfile.is_open()) { + cout<<"txt-ERROR: Could not create "<GetExpFormula()<<" "<GetNpar()<GetNpar();ipar++) { + fitinput<GetParameter(ipar)<<" "; + } + fitinput<GetName(),mg->GetName(),1000,800); + gPad->SetLeftMargin(0.18); + gPad->SetRightMargin(0.05); + gPad->SetTopMargin(0.08); + gPad->SetBottomMargin(0.14); + gPad->SetLogx(logx); + gPad->SetLogy(logy); + + mg->Draw("AP"); + set_axis_titles(mg->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt); + + if (0!=mg->GetHistogram()) { + mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(logx); + mg->GetHistogram()->GetXaxis()->SetNoExponent(logx); + } + + set_axis_range(mg,xmin,xmax,ymin,ymax); + draw_extrapolation(mg,fullfit,xmin,xmax); + draw_graph_residual((TPad*)gPad,mg,residual, + resmcdata,defmcdata,yresmax,restitle,restitlesize, + xmin,xmax,ymin,ymax,fullfit); + + leg->SetLineColor(10); + leg->SetFillColor(10); + leg->SetBorderSize(0); + if (drawlegend) leg->Draw(); + + TLatex *beautify1 = new TLatex(0.25,0.86,"2015, 13TeV"); + TLatex *beautify2 = new TLatex(0.25,0.81,"CMS"); + TLatex *beautify3 = new TLatex(0.25,0.76,"Simulation"); + + beautify1->SetNDC(); + beautify2->SetNDC(); + beautify3->SetNDC(); + + beautify1->SetTextFont(22); + beautify2->SetTextFont(62); + beautify3->SetTextFont(52); + + beautify1->SetTextSize(0.04); + beautify2->SetTextSize(0.04); + beautify3->SetTextSize(0.04); + + beautify1->Draw("same"); + beautify2->Draw("same"); + beautify3->Draw("same"); + + if (drawrange) draw_range(ranges.front(),residual); + if (tdrautobins) tdrlabels.push_back(ranges.front()); + draw_labels(tdrlabels,leginplot,tdrautobins); + if (tdrautobins) tdrlabels.pop_back(); + + } + else { + c = new TCanvas(mg->GetName(),mg->GetName(),1000,800); + unsigned nx = (unsigned)std::sqrt((float)graphs.size()); + unsigned ny = nx; + if (nx*nyDivide(nx,ny); + for (unsigned i=0;icd(i+1); + gPad->SetLeftMargin(0.18); + gPad->SetRightMargin(0.05); + gPad->SetTopMargin(0.08); + gPad->SetBottomMargin(0.14); + gPad->SetLogx(logx); + gPad->SetLogy(logy); + + stringstream ssmgindname; + ssmgindname<<"ind_"<GetName(); + TMultiGraph* mgind = new TMultiGraph(ssmgindname.str().c_str(), + ssmgindname.str().c_str()); + mgind->Add(graphs[i]); + //graphs[i]->Draw("AP"); + mgind->Draw("AP"); + //set_axis_titles(graphs[i]->GetHistogram(),quantity,ymin,ymax); + set_axis_titles(mgind->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt); + + if (0!=mg->GetHistogram()) { + mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(logx); + mg->GetHistogram()->GetXaxis()->SetNoExponent(logx); + } + + set_axis_range(mgind,xmin,xmax,ymin,ymax); + draw_extrapolation(mgind,fullfit,xmin,xmax); + draw_graph_residual((TPad*)gPad,mgind,residual, + resmcdata,defmcdata,yresmax,restitle,restitlesize, + xmin,xmax,ymin,ymax,fullfit); + + if (drawrange) draw_range(ranges[i],residual); + if (tdrautobins) tdrlabels.push_back(ranges[i]); + draw_labels(tdrlabels,leginplot,tdrautobins); + if (tdrautobins) tdrlabels.pop_back(); + set_axis_titles(graphs[i]->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt); + + if (algs.size()>1||inputs.size()>1) { + TLatex tex; + tex.SetNDC(); + tex.SetTextFont(42); + tex.SetTextSize(0.05); + string txt = (algs.size()>1) ? + get_legend_label_from_alg(algs[i]) : + get_legend_label_from_input(inputs[i]); + tex.DrawLatex(0.6,0.85,txt.c_str()); + } + + } } - } - - string output = c->GetName(); - if (!opath.empty()) output = opath + "/" + output; - for (unsigned int iformat=0;iformatPrint((output+"."+formats[iformat]).c_str()); - - - if (!batch) app->Run(); - - return 0; + + string output = c->GetName(); + if (!opath.empty()) output = opath + "/" + output; + for (unsigned int iformat=0;iformatPrint((output+"."+formats[iformat]).c_str()); + + + if (!batch) app->Run(); + + return 0; } @@ -732,349 +539,338 @@ int main(int argc,char** argv) void draw_labels(const vector& labels,bool leginplot,bool tdrautobins) { - for (unsigned ilabel=0;ilabel0&&(ilabel==labels.size()-1)) tmp=labels[ilabel-1]; - pos = tmp.find(':'); assert(pos!=string::npos); - string x_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); - pos = tmp.find(':'); assert(pos!=string::npos); - string y_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); - pos = tmp.find(':'); - string font_as_str; - string size_as_str; - string text; - if (pos==string::npos) { - font_as_str = "42"; - size_as_str = "0.04"; - text = tmp; - } - else { - font_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); - pos = tmp.find(':'); - if (pos==string::npos) { - size_as_str = "0.04"; - text = tmp; - } - else { - size_as_str = tmp.substr(0,pos); - text = tmp.substr(pos+1); - } - } - - stringstream ssx; ssx<>x; - stringstream ssy; ssy<>y; - stringstream ssf; ssf<>f; - stringstream sss; sss<>s; - - if (tdrautobins&&ilabel>0&&(ilabel==labels.size()-1)) { - y -= 0.05; - text = labels[labels.size()-1]; - } - - if (!leginplot) { double scale = 800.0*0.93/1000./0.82; x *= scale; } + for (unsigned ilabel=0;ilabel0&&(ilabel==labels.size()-1)) tmp=labels[ilabel-1]; + pos = tmp.find(':'); assert(pos!=string::npos); + string x_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); + pos = tmp.find(':'); assert(pos!=string::npos); + string y_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); + pos = tmp.find(':'); + string font_as_str; + string size_as_str; + string text; + if (pos==string::npos) { + font_as_str = "42"; + size_as_str = "0.04"; + text = tmp; + } + else { + font_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); + pos = tmp.find(':'); + if (pos==string::npos) { + size_as_str = "0.04"; + text = tmp; + } + else { + size_as_str = tmp.substr(0,pos); + text = tmp.substr(pos+1); + } + } - TLatex tex; - tex.SetTextSize(s); - tex.SetTextFont(f); - tex.SetNDC(true); - tex.DrawLatex(x,y,text.c_str()); - } + stringstream ssx; ssx<>x; + stringstream ssy; ssy<>y; + stringstream ssf; ssf<>f; + stringstream sss; sss<>s; + + if (tdrautobins&&ilabel>0&&(ilabel==labels.size()-1)) { + y -= 0.05; + text = labels[labels.size()-1]; + } + + if (!leginplot) { double scale = 800.0*0.93/1000./0.82; x *= scale; } + + TLatex tex; + tex.SetTextSize(s); + tex.SetTextFont(f); + tex.SetNDC(true); + tex.DrawLatex(x,y,text.c_str()); + } } //______________________________________________________________________________ void draw_extrapolation(TMultiGraph* mg,int fullfit,float xmin,float xmax) { - if (fullfit<1||fullfit>3) return; - TIter next(mg->GetListOfGraphs()); - TGraphErrors* g(0);vector vg;vectorvf; - - while (( g = (TGraphErrors*)next() )) { - vg.push_back(g); - vf.push_back((TF1*)g->GetListOfFunctions()->Last()); - } - assert (vg.size()==vf.size()); - - if (0==vf.size()) return; - - - - for (unsigned i(0);iGetRange(ffmin,ffmax); - - if (1==fullfit||2==fullfit) - ffmin = (xmin!=-1.) ? xmin : mg->GetHistogram()->GetXaxis()->GetXmin(); - if (1==fullfit||3==fullfit) - ffmax = (xmax!=-1.) ? xmax : mg->GetHistogram()->GetXaxis()->GetXmax(); - - stringstream ssffname; - ssffname<<"ff_"<GetName()<<"_"<Clone(ssffname.str().c_str()); - - ff->SetRange(ffmin,ffmax); - ff->SetLineColor(vf[i]->GetLineColor()); - ff->SetLineStyle(kDashed); - ff->SetLineWidth(1); - ff->Draw("SAME"); - } + if (fullfit<1||fullfit>3) return; + TIter next(mg->GetListOfGraphs()); + TGraphErrors* g(0);vector vg;vectorvf; + + while (( g = (TGraphErrors*)next() )) { + vg.push_back(g); + vf.push_back((TF1*)g->GetListOfFunctions()->Last()); + } + assert (vg.size()==vf.size()); + + if (0==vf.size()) return; + + + + for (unsigned i(0);iGetRange(ffmin,ffmax); + + if (1==fullfit||2==fullfit) + ffmin = (xmin!=-1.) ? xmin : mg->GetHistogram()->GetXaxis()->GetXmin(); + if (1==fullfit||3==fullfit) + ffmax = (xmax!=-1.) ? xmax : mg->GetHistogram()->GetXaxis()->GetXmax(); + + stringstream ssffname; + ssffname<<"ff_"<GetName()<<"_"<Clone(ssffname.str().c_str()); + + ff->SetRange(ffmin,ffmax); + ff->SetLineColor(vf[i]->GetLineColor()); + ff->SetLineStyle(kDashed); + ff->SetLineWidth(1); + ff->Draw("SAME"); + } } //______________________________________________________________________________ TH1F* set_axis_range(TMultiGraph* mg, - float xmin, float xmax, - float ymin, float ymax) + float xmin, float xmax, + float ymin, float ymax) { - if (0==mg) return 0; - if (0==mg->GetHistogram()) return 0; - - TH1F* holdaxis = mg->GetHistogram(); TH1F* hnewaxis(0); - if (xmin==-1.&&xmax==-1.&&ymin==-1.&&ymax==-1.) return holdaxis; - - vector borders; - borders.push_back(holdaxis->GetXaxis()->GetXmin()); - borders.push_back(holdaxis->GetMinimum()); - borders.push_back(holdaxis->GetXaxis()->GetXmax()); - borders.push_back(holdaxis->GetMaximum()); - - if (xmin!=-1.0) borders[0]=xmin; - if (ymin!=-1.0) borders[1]=ymin; - if (xmax!=-1.0) borders[2]=xmax; - if (ymax!=-1.0) borders[3]=ymax; - - if (xmin!=-1.0 || xmax!=-1.0 || ymin!=-1.0 || ymax!=-1.0) - hnewaxis = gPad->DrawFrame(borders[0],borders[1],borders[2],borders[3]); - - // copy settings - - hnewaxis->SetTitle(holdaxis->GetTitle()); - - hnewaxis->SetXTitle(holdaxis->GetXaxis()->GetTitle()); - hnewaxis->GetXaxis()->CenterTitle(holdaxis->GetXaxis()->GetCenterTitle()); - hnewaxis->GetXaxis()->SetTitleSize(holdaxis->GetXaxis()->GetTitleSize()); - hnewaxis->GetXaxis()->SetLabelSize(holdaxis->GetXaxis()->GetLabelSize()); - hnewaxis->GetXaxis()->SetTitleOffset(holdaxis->GetXaxis()->GetTitleOffset()); - hnewaxis->GetXaxis()->SetLabelOffset(holdaxis->GetXaxis()->GetLabelOffset()); - hnewaxis->GetXaxis()->SetNdivisions(holdaxis->GetXaxis()->GetNdivisions()); - hnewaxis->GetXaxis()->SetTickLength(holdaxis->GetXaxis()->GetTickLength()); - hnewaxis->GetXaxis()->SetMoreLogLabels(holdaxis->GetXaxis()->GetMoreLogLabels()); - hnewaxis->GetXaxis()->SetNoExponent(holdaxis->GetXaxis()->GetNoExponent()); - hnewaxis->GetXaxis()->SetLabelSize(holdaxis->GetXaxis()->GetLabelSize()); - hnewaxis->GetXaxis()->SetLabelOffset(holdaxis->GetXaxis()->GetLabelOffset()); - - hnewaxis->SetYTitle(holdaxis->GetYaxis()->GetTitle()); - hnewaxis->GetYaxis()->CenterTitle(holdaxis->GetYaxis()->GetCenterTitle()); - hnewaxis->GetYaxis()->SetTitleSize(holdaxis->GetYaxis()->GetTitleSize()); - hnewaxis->GetYaxis()->SetLabelSize(holdaxis->GetYaxis()->GetLabelSize()); - hnewaxis->GetYaxis()->SetTitleOffset(holdaxis->GetYaxis()->GetTitleOffset()); - hnewaxis->GetYaxis()->SetLabelOffset(holdaxis->GetYaxis()->GetLabelOffset()); - hnewaxis->GetYaxis()->SetNdivisions(holdaxis->GetYaxis()->GetNdivisions()); - hnewaxis->GetYaxis()->SetTickLength(holdaxis->GetYaxis()->GetTickLength()); - hnewaxis->GetYaxis()->SetMoreLogLabels(holdaxis->GetYaxis()->GetMoreLogLabels()); - hnewaxis->GetYaxis()->SetNoExponent(holdaxis->GetYaxis()->GetNoExponent()); - hnewaxis->GetYaxis()->SetLabelSize(holdaxis->GetYaxis()->GetLabelSize()); - hnewaxis->GetYaxis()->SetLabelOffset(holdaxis->GetYaxis()->GetLabelOffset()); - - mg->Draw("P"); - return hnewaxis; + if (0==mg) return 0; + if (0==mg->GetHistogram()) return 0; + + TH1F* holdaxis = mg->GetHistogram(); TH1F* hnewaxis(0); + if (xmin==-1.&&xmax==-1.&&ymin==-1.&&ymax==-1.) return holdaxis; + + vector borders; + borders.push_back(holdaxis->GetXaxis()->GetXmin()); + borders.push_back(holdaxis->GetMinimum()); + borders.push_back(holdaxis->GetXaxis()->GetXmax()); + borders.push_back(holdaxis->GetMaximum()); + + if (xmin!=-1.0) borders[0]=xmin; + if (ymin!=-1.0) borders[1]=ymin; + if (xmax!=-1.0) borders[2]=xmax; + if (ymax!=-1.0) borders[3]=ymax; + + if (xmin!=-1.0 || xmax!=-1.0 || ymin!=-1.0 || ymax!=-1.0) + hnewaxis = gPad->DrawFrame(borders[0],borders[1],borders[2],borders[3]); + + // copy settings + + hnewaxis->SetTitle(holdaxis->GetTitle()); + + hnewaxis->SetXTitle(holdaxis->GetXaxis()->GetTitle()); + hnewaxis->GetXaxis()->CenterTitle(holdaxis->GetXaxis()->GetCenterTitle()); + hnewaxis->GetXaxis()->SetTitleSize(holdaxis->GetXaxis()->GetTitleSize()); + hnewaxis->GetXaxis()->SetLabelSize(holdaxis->GetXaxis()->GetLabelSize()); + hnewaxis->GetXaxis()->SetTitleOffset(holdaxis->GetXaxis()->GetTitleOffset()); + hnewaxis->GetXaxis()->SetLabelOffset(holdaxis->GetXaxis()->GetLabelOffset()); + hnewaxis->GetXaxis()->SetNdivisions(holdaxis->GetXaxis()->GetNdivisions()); + hnewaxis->GetXaxis()->SetTickLength(holdaxis->GetXaxis()->GetTickLength()); + hnewaxis->GetXaxis()->SetMoreLogLabels(holdaxis->GetXaxis()->GetMoreLogLabels()); + hnewaxis->GetXaxis()->SetNoExponent(holdaxis->GetXaxis()->GetNoExponent()); + hnewaxis->GetXaxis()->SetLabelSize(holdaxis->GetXaxis()->GetLabelSize()); + hnewaxis->GetXaxis()->SetLabelOffset(holdaxis->GetXaxis()->GetLabelOffset()); + + hnewaxis->SetYTitle(holdaxis->GetYaxis()->GetTitle()); + hnewaxis->GetYaxis()->CenterTitle(holdaxis->GetYaxis()->GetCenterTitle()); + hnewaxis->GetYaxis()->SetTitleSize(holdaxis->GetYaxis()->GetTitleSize()); + hnewaxis->GetYaxis()->SetLabelSize(holdaxis->GetYaxis()->GetLabelSize()); + hnewaxis->GetYaxis()->SetTitleOffset(holdaxis->GetYaxis()->GetTitleOffset()); + hnewaxis->GetYaxis()->SetLabelOffset(holdaxis->GetYaxis()->GetLabelOffset()); + hnewaxis->GetYaxis()->SetNdivisions(holdaxis->GetYaxis()->GetNdivisions()); + hnewaxis->GetYaxis()->SetTickLength(holdaxis->GetYaxis()->GetTickLength()); + hnewaxis->GetYaxis()->SetMoreLogLabels(holdaxis->GetYaxis()->GetMoreLogLabels()); + hnewaxis->GetYaxis()->SetNoExponent(holdaxis->GetYaxis()->GetNoExponent()); + hnewaxis->GetYaxis()->SetLabelSize(holdaxis->GetYaxis()->GetLabelSize()); + hnewaxis->GetYaxis()->SetLabelOffset(holdaxis->GetYaxis()->GetLabelOffset()); + + mg->Draw("P"); + return hnewaxis; } //______________________________________________________________________________ void draw_graph_residual(TPad* pad,TMultiGraph* mg, - const int errMode, - const bool resmcdata,const vector& defmcdata, - const float yresmax, const string& restitle, - const float restitlesize, - float xmin,float xmax,float ymin,float ymax, - int fullfit, bool tdr) + const int errMode, + const bool resmcdata,const vector& defmcdata, + const float yresmax, const string& restitle, + const float restitlesize, + float xmin,float xmax,float ymin,float ymax, + int fullfit) { - if (errMode<0) return; - else if (errMode>5){ - cout<<"ERROR: draw_graph_residual() invalid error mode"<GetListOfGraphs()); - TGraphErrors* g(0);vector vg;vectorvf; - - while (( g = (TGraphErrors*)next() )) { - vg.push_back(g); - vf.push_back((TF1*)g->GetListOfFunctions()->Last()); - } - assert (vg.size()==vf.size()); - - bool nofits = true; - for (unsigned i=0;i3){ + cout<<"ERROR: draw_graph_residual() invalid error mode"< skipping!"<GetListOfGraphs()); + TGraphErrors* g(0);vector vg;vectorvf; + + while (( g = (TGraphErrors*)next() )) { + vg.push_back(g); + vf.push_back((TF1*)g->GetListOfFunctions()->Last()); } + assert (vg.size()==vf.size()); - if (0==vg[defmcdata[0]]) { - cout<<"DAMN: the MC-graph defined in defmcdata[0] does not have a fit -> skipping!"<GetListOfFunctions()->Last(); - vf.push_back(mcfit); - - mcfit = 0; - for (unsigned i=defmcdata[1]+1;iGetName(); - TMultiGraph* rmg = new TMultiGraph(rmgname.str().c_str(), - rmgname.str().c_str()); - - //vector vrGraph; - - for (unsigned i(0);iDivide(1,2,0.01,0.0); - - // make default settings - if (0==i) pad->GetPad( 1 )->SetFillColor( 0 ); - if (0==i) pad->GetPad( 2 )->SetFillColor( 0 ); - if (0==i) pad->GetPad( 1 )->SetPad( 0.0,0.25,1.0, 1.0 ); - if (0==i) pad->GetPad( 2 )->SetPad( 0.0, 0.0,1.0,0.25 ); - - if (0==i) pad->cd(1); - if (0==i && pad->GetLogx()) gPad->SetLogx(); - if (0==i && pad->GetLogy()) gPad->SetLogy(); - if (0==i) gPad->SetTopMargin(0.1); - if (0==i) gPad->SetLeftMargin(0.15); - if (0==i) gPad->SetRightMargin(0.05); - - if (0==i) pad->cd(2); - if (0==i && pad->GetLogx())gPad->SetLogx(); - if (0==i) gPad->SetBottomMargin(0.375); - if (0==i) gPad->SetLeftMargin(0.15); - if (0==i) gPad->SetRightMargin(0.05); + if (resmcdata) { + + if (defmcdata.size()!=2) { + cout<<"DAMN: resmcdata==1, but defmcdata.size()!=2 -> skipping!"< skipping!"<GetListOfFunctions()->Last(); + vf.push_back(mcfit); + + mcfit = 0; + for (unsigned i=defmcdata[1]+1;iGetName(); + TMultiGraph* rmg = new TMultiGraph(rmgname.str().c_str(), + rmgname.str().c_str()); + + //vector vrGraph; + + for (unsigned i(0);iGetN();ip++) { + //divide this pad + if (0==i) pad->Divide(1,2,0.01,0.0); - double y = vg[i]->GetY()[ip]; - double ey = vg[i]->GetEY()[ip]; + // make default settings + if (0==i) pad->GetPad( 1 )->SetFillColor( 0 ); + if (0==i) pad->GetPad( 2 )->SetFillColor( 0 ); + if (0==i) pad->GetPad( 1 )->SetPad( 0.0,0.25,1.0, 1.0 ); + if (0==i) pad->GetPad( 2 )->SetPad( 0.0, 0.0,1.0,0.25 ); - double x = vg[i]->GetX()[ip]; - double ex = vg[i]->GetEX()[ip]; - - double ffxmin(0.0),ffxmax(0.0); + if (0==i) pad->cd(1); + if (0==i && pad->GetLogx()) gPad->SetLogx(); + if (0==i && pad->GetLogy()) gPad->SetLogy(); + if (0==i) gPad->SetTopMargin(0.1); + if (0==i) gPad->SetLeftMargin(0.15); + if (0==i) gPad->SetRightMargin(0.05); - if (0==vf[i]) continue; - vf[i]->GetRange(ffxmin,ffxmax); - if (xffxmax) continue; + if (0==i) pad->cd(2); + if (0==i && pad->GetLogx())gPad->SetLogx(); + if (0==i) gPad->SetBottomMargin(0.375); + if (0==i) gPad->SetLeftMargin(0.15); + if (0==i) gPad->SetRightMargin(0.05); - double fy = (0==vf[i]) ? 0.0 : vf[i]->Eval(x); + // define residual graph - double resy(0.0),resey(0.0); + TGraphErrors* rGraph = new TGraphErrors(0); - if (0==y) continue; - - if (errMode==3) { - resy = (y-fy)/y*100.; - resey = fy/y/y*ey*100.; - } - else if (errMode==0) { - resy = (y-fy)/sqrt(y)*100.; - } - else if (errMode==4) { - resy = (y-fy)/fy*100.; - resey = 1.0/fy*ey*100.; - } - else if (errMode==5) { - resy = (y)/(fy); - resey = 1.0/fy*ey; - } + // Go through all points now... - int n = rGraph->GetN(); + for(int ip(0);ipGetN();ip++) { - rGraph->SetPoint(n,x,resy); - rGraph->SetPointError(n,ex,resey); + double y = vg[i]->GetY()[ip]; + double ey = vg[i]->GetEY()[ip]; + + double x = vg[i]->GetX()[ip]; + double ex = vg[i]->GetEX()[ip]; + + double ffxmin(0.0),ffxmax(0.0); + + if (0==vf[i]) continue; + vf[i]->GetRange(ffxmin,ffxmax); + if (xffxmax) continue; + + double fy = (0==vf[i]) ? 0.0 : vf[i]->Eval(x); + + double resy(0.0),resey(0.0); + + if (0==y) continue; + + if (errMode==3) { + resy = (y-fy)/y*100.; + resey = fy/y/y*ey*100.; + } + else if (errMode==0) { + resy = (y-fy)/sqrt(y)*100.; + } + + int n = rGraph->GetN(); + + rGraph->SetPoint(n,x,resy); + rGraph->SetPointError(n,ex,resey); + } + + rGraph->SetTitle(""); + if (errMode==3) rGraph->SetMarkerStyle(20); else rGraph->SetMarkerStyle(2); + if (errMode==3) rGraph->SetMarkerSize(.75); else rGraph->SetMarkerSize(1.); + if (0!=vf[i]) rGraph->SetMarkerColor(vf[i]->GetLineColor()); + if (0!=vf[i]) rGraph->SetLineColor(vf[i]->GetLineColor()); + if (resmcdata) rGraph->SetMarkerColor(vg[defmcdata[1]]->GetLineColor()); + if (resmcdata) rGraph->SetLineColor(vg[defmcdata[1]]->GetLineColor()); + + rGraph->SetLineWidth(1); + + if (rGraph->GetN()!=0) rmg->Add(rGraph); } - rGraph->SetTitle(""); - if (errMode==3 || errMode==4 || errMode==5) rGraph->SetMarkerStyle(20); else rGraph->SetMarkerStyle(2); - if (errMode==3 || errMode==4 || errMode==5) rGraph->SetMarkerSize(.75); else rGraph->SetMarkerSize(1.); - if (0!=vf[i]) rGraph->SetMarkerColor(vf[i]->GetLineColor()); - if (0!=vf[i]) rGraph->SetLineColor(vf[i]->GetLineColor()); - if (resmcdata) rGraph->SetMarkerColor(vg[defmcdata[1]]->GetLineColor()); - if (resmcdata) rGraph->SetLineColor(vg[defmcdata[1]]->GetLineColor()); - - rGraph->SetLineWidth(1); - - if (rGraph->GetN()!=0) rmg->Add(rGraph); - } - - if(!tdr) { + pad->cd(1); mg->Draw("AP"); mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.2); if (0!=mg->GetHistogram()) { - mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(pad->GetLogx()); - mg->GetHistogram()->GetXaxis()->SetNoExponent(pad->GetLogx()); - mg->GetHistogram()->GetXaxis()->SetLabelSize( 0.15 ); - mg->GetHistogram()->GetXaxis()->SetLabelOffset( 0.005 ); + mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(pad->GetLogx()); + mg->GetHistogram()->GetXaxis()->SetNoExponent(pad->GetLogx()); + mg->GetHistogram()->GetXaxis()->SetLabelSize( 0.15 ); + mg->GetHistogram()->GetXaxis()->SetLabelOffset( 0.005 ); } - if(!tdr) set_axis_range(mg,xmin,xmax,ymin,ymax); + set_axis_range(mg,xmin,xmax,ymin,ymax); draw_extrapolation(mg,fullfit,xmin,xmax); xmin = (xmin!=-1.) ? xmin: mg->GetHistogram()->GetXaxis()->GetXmin(); xmax = (xmax!=-1.) ? xmax: mg->GetHistogram()->GetXaxis()->GetXmax(); - } - pad->cd(2); - // rmg->SaveAs("residual.root"); + pad->cd(2); + + // rmg->SaveAs("residual.root"); - if(!tdr) { rmg->Draw("AP"); float rmgymax = std::max(TMath::Abs(rmg->GetHistogram()->GetMinimum()), - TMath::Abs(rmg->GetHistogram()->GetMaximum())); + TMath::Abs(rmg->GetHistogram()->GetMaximum())); rmgymax = (rmgymax>50.) ? 50. : rmgymax; rmgymax = (yresmax>0. ) ? yresmax : (rmgymax*1.15); @@ -1103,309 +899,296 @@ void draw_graph_residual(TPad* pad,TMultiGraph* mg, rmg->GetHistogram()->GetXaxis()->SetLabelSize( 0.15 ); rmg->GetHistogram()->GetXaxis()->SetLabelOffset( 0.005 ); - if (restitle.empty()){ - if (!resmcdata) { - if ( errMode == 0 ) - rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{#sqrt{point}} [%]" ); - else if ( errMode == 1 ) - rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{#sqrt{fit}} [%]" ); - else if (errMode == 2) - rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{binerror} [%]" ); - else if (errMode == 4) - rmg->GetHistogram()->SetYTitle( "#frac{(point-fit)}{fit} [%]" ); - else - rmg->GetHistogram()->SetYTitle( "#frac{(point-fit)}{point} [%]" ); - } - else { - if ( errMode == 0 ) - rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{#sqrt{data}} [%]" ); - else if ( errMode == 1 ) - rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{#sqrt{MC}} [%]" ); - else if (errMode == 2) - rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{binerror} [%]" ); - else if (errMode == 4) - rmg->GetHistogram()->SetYTitle( "#frac{(data-MC)}{MC} [%]" ); - else if (errMode == 5) - rmg->GetHistogram()->SetYTitle( "#frac{data}{MC}" ); - else - rmg->GetHistogram()->SetYTitle( "#frac{(data-MC)}{data} [%]" ); - } + if (restitle.empty()){ + if (!resmcdata) { + if ( errMode == 0 ) + rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{#sqrt{point}} [%]" ); + else if ( errMode == 1 ) + rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{#sqrt{fit}} [%]" ); + else if (errMode == 2) + rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{binerror} [%]" ); + else + rmg->GetHistogram()->SetYTitle( "#frac{(point-fit)}{point} [%]" ); + } + else { + if ( errMode == 0 ) + rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{#sqrt{data}} [%]" ); + else if ( errMode == 1 ) + rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{#sqrt{MC}} [%]" ); + else if (errMode == 2) + rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{binerror} [%]" ); + else + rmg->GetHistogram()->SetYTitle( "#frac{(data-MC)}{data} [%]" ); + } } - else rmg->GetHistogram()->SetYTitle( restitle.c_str() ); - } - else { - for(int i=0;iGetListOfGraphs()->GetSize(); i++) { - TGraphErrors* tmp = (TGraphErrors*)rmg->GetListOfGraphs()->At(i); - tdrDraw(tmp,"P",tmp->GetMarkerStyle(),tmp->GetMarkerColor(), - tmp->GetLineStyle(),tmp->GetLineColor()); - } - } - - if(!tdr) set_axis_range(rmg,xmin,xmax); - draw_zline(rmg->GetHistogram(),xmin,xmax,0); - - pad->cd(1); + else rmg->GetHistogram()->SetYTitle( restitle.c_str() ); + + + + set_axis_range(rmg,xmin,xmax); + draw_zline(rmg->GetHistogram(),xmin,xmax); + + pad->cd(1); } //______________________________________________________________________________ -void draw_zline(TH1* h1,float xmin,float xmax,float y) +void draw_zline(TH1* h1,float xmin,float xmax) { - if (0==h1) return; - float min = (xmin!=-1.) ? xmin : h1->GetXaxis()->GetXmin(); - float max = (xmax!=-1.) ? xmax : h1->GetXaxis()->GetXmax(); - - TLine* zline = new TLine(min,y,max,y); - zline->SetLineStyle(kDashed); - zline->SetLineWidth(1); - zline->Draw("SAME"); + if (0==h1) return; + float min = (xmin!=-1.) ? xmin : h1->GetXaxis()->GetXmin(); + float max = (xmax!=-1.) ? xmax : h1->GetXaxis()->GetXmax(); + + TLine* zline = new TLine(min,0,max,0); + zline->SetLineStyle(kDashed); + zline->SetLineWidth(1); + zline->Draw("SAME"); } //______________________________________________________________________________ void draw_range(const string& range, const int residual) { - TLatex tex; - tex.SetNDC(true); - tex.SetTextAlign(13); - tex.SetTextSize(0.055); - tex.SetTextFont(42); - if (residual<0) tex.DrawLatex(0.18,0.98,range.c_str()); - else tex.DrawLatex(0.15,0.96,range.c_str()); + TLatex tex; + tex.SetNDC(true); + tex.SetTextAlign(13); + tex.SetTextSize(0.055); + tex.SetTextFont(42); + if (residual<0) tex.DrawLatex(0.18,0.98,range.c_str()); + else tex.DrawLatex(0.15,0.96,range.c_str()); } //______________________________________________________________________________ string get_range(const ObjectLoader& gl, - const vector& indices, - bool addFixedVars, string refpt) + const vector& indices, + bool addFixedVars, string refpt) { - string varnameEta = "#eta"; - for (unsigned int i=0;i=0) varnameEta="|#eta|"; - - string varnameY = "y"; - for (unsigned int i=0;i=0) varnameY="|y|"; - - - stringstream ssrange; - - for (unsigned int i=0;i=0) varnameEta="|#eta|"; + + string varnameY = "y"; + for (unsigned int i=0;i=0) varnameY="|y|"; + + + stringstream ssrange; + + for (unsigned int i=0;i>jet_size; - jet_size/=10.0; stringstream ss2; ss2<>jet_size; + jet_size/=10.0; stringstream ss2; ss2<& vcolors, - const vector& vmarkers, - const vector& vlstyles, - const vector& vsizes, - const vector& vlsizes) + const vector& vcolors, + const vector& vmarkers, + const vector& vlstyles, + const vector& vsizes, + const vector& vlsizes) { - Color_t colors[10] = { - kBlue+1,kRed+1,kGreen+2,kMagenta+2,kCyan+3, - kViolet+4,kOrange+1,kGreen-1,kMagenta-4,kCyan-2 - }; - Style_t lines[10] = { - 1,1,1,1,1,1,1,1,1,1 - }; - Style_t markers[10] = + Color_t colors[10] = { + kBlue+1,kRed+1,kGreen+2,kMagenta+2,kCyan+3, + kViolet+4,kOrange+1,kGreen-1,kMagenta-4,kCyan-2 + }; + Style_t lines[10] = { + 1,1,1,1,1,1,1,1,1,1 + }; + Style_t markers[10] = { kOpenCircle,kOpenSquare,kOpenTriangleUp,kOpenDiamond,kOpenCross, - kOpenStar,kFullCircle,kFullSquare,kFullTriangleUp,kFullTriangleDown + kOpenStar,kFullCircle,kFullSquare,kFullTriangleUp,kFullTriangleDown }; - - if (nocolor) { - markers[0]=kFullCircle; markers[1]=kOpenCircle; - markers[2]=kFullSquare; markers[3]=kOpenSquare; - markers[4]=kFullTriangleUp; markers[5]=kOpenTriangleUp; - markers[6]=kFullStar; markers[7]=kOpenStar; - markers[8]=kFullTriangleDown; markers[9]=kOpenCross; - } - - Color_t color = colors[std::min(ngraph,(unsigned)9)]; - Style_t line = lines[std::min(ngraph,(unsigned)9)]; - Style_t marker = markers[std::min(ngraph,(unsigned)9)]; - Float_t msize (0.8); - - if (ngraphSetLineColor(color); - g->SetMarkerColor(color); - g->SetMarkerStyle(marker); - if (ngraphSetMarkerStyle(vmarkers[ngraph]); - g->SetMarkerSize(msize); - - TF1* f(0); - if (g->GetListOfFunctions()->GetEntries()>0) { - for(int i=0; iGetListOfFunctions()->GetEntries(); i++) { - //f=(TF1*)(g->GetListOfFunctions()->At(0)); - f=(TF1*)(g->GetListOfFunctions()->At(i)); - f->SetLineColor(color); - f->SetLineStyle(line); - if (ngraphSetLineStyle(vlstyles[ngraph]); - f->SetLineWidth(1); - if (ngraphSetLineWidth((Width_t)vlsizes[ngraph]); + + if (nocolor) { + markers[0]=kFullCircle; markers[1]=kOpenCircle; + markers[2]=kFullSquare; markers[3]=kOpenSquare; + markers[4]=kFullTriangleUp; markers[5]=kOpenTriangleUp; + markers[6]=kFullStar; markers[7]=kOpenStar; + markers[8]=kFullTriangleDown; markers[9]=kOpenCross; + } + + Color_t color = colors[std::min(ngraph,(unsigned)9)]; + Style_t line = lines[std::min(ngraph,(unsigned)9)]; + Style_t marker = markers[std::min(ngraph,(unsigned)9)]; + Float_t msize (1.5); + + if (ngraphSetLineColor(color); + g->SetMarkerColor(color); + g->SetMarkerStyle(marker); + if (ngraphSetMarkerStyle(vmarkers[ngraph]); + g->SetMarkerSize(msize); + + TF1* f(0); + if (g->GetListOfFunctions()->GetEntries()>0) { + f=(TF1*)(g->GetListOfFunctions()->At(0)); + f->SetLineColor(color); + f->SetLineStyle(line); + if (ngraphSetLineStyle(vlstyles[ngraph]); + f->SetLineWidth(0); + if (ngraphSetLineWidth((Width_t)vlsizes[ngraph]); } - } - - return; + + return; } //______________________________________________________________________________ void set_axis_titles(TH1* h,const string& quantity,float ymin,float ymax, - string xtitle,string ytitle,string refpt,bool tdr) + string xtitle,string ytitle,string refpt) { - if (0==h) { - cout<<"set_axis_title ERROR: h is NULL!"<SetTitle(""); - - ymin = (ymin<0.0) ? 0.0 : ymin; - h->SetMinimum(ymin); - - //string xtitle(""); - //string ytitle(""); - size_t pos = quantity.find("Vs"); - if (pos!=string::npos) { - - if (ytitle.empty()) { - string ystr=quantity.substr(0,pos); - if (ystr=="Rsp"||ystr=="RelRsp"||ystr=="AbsRsp") { - ytitle=refpt.empty() ? "p_{T} / p_{T}^{REF}" : ("p_{T} / "+refpt).c_str(); - ymax = (ymax<0.0) ? 1.2 : ymax; - h->SetMaximum(ymax); - } - else if (ystr=="Res"||ystr=="RelRes"||ystr=="AbsRes") { - ytitle= refpt.empty() ? "#sigma(p_{T}/p_{T}^{REF}) / " : - ("#sigma(p_{T}/"+refpt+") / ").c_str(); - if (ymax>0.0) h->SetMaximum(ymax); - } - else if (ystr=="Asym") { - ytitle="#sqrt{2}#sigma_{A}"; - ymax = (ymax<0.0) ? 1.3*h->GetMaximum() : ymax; - h->SetMaximum(ymax); - } - else if (ystr=="AbsSlb") { - ytitle="p^{(e/#mu)}_{T,jet}/p^{(e/#mu+#nu)}_{T,jet}"; - ymax = (ymax<0.0) ? 1.2 : ymax; - h->SetMaximum(ymax); - } - else if (ystr=="Aone") { - ytitle="a_{1}"; - } - else if (ystr=="Atwo") { - ytitle="a_{2}"; - } - else if (ystr=="Pone") { - ytitle="p_{1}"; - } - else if (ystr=="Ptwo") { - ytitle="p_{2}"; - } + if (0==h) { + cout<<"set_axis_title ERROR: h is NULL!"<SetTitle(""); + + ymin = (ymin<0.0) ? 0.0 : ymin; + h->SetMinimum(ymin); + + //string xtitle(""); + //string ytitle(""); + size_t pos = quantity.find("Vs"); + if (pos!=string::npos) { + + if (ytitle.empty()) { + string ystr=quantity.substr(0,pos); + if (ystr=="Rsp"||ystr=="RelRsp"||ystr=="AbsRsp") { + ytitle=refpt.empty() ? "p_{T} / p_{T}^{REF}" : ("p_{T} / "+refpt).c_str(); + ymax = (ymax<0.0) ? 1.2 : ymax; + h->SetMaximum(ymax); + } + else if (ystr=="Res"||ystr=="RelRes"||ystr=="AbsRes") { + ytitle= refpt.empty() ? "#sigma(p_{T}/p_{T}^{REF}) / " : + ("#sigma(p_{T}/"+refpt+") / ").c_str(); + if (ymax>0.0) h->SetMaximum(ymax); + } + else if (ystr=="Asym") { + ytitle="#sqrt{2}#sigma_{A}"; + ymax = (ymax<0.0) ? 1.3*h->GetMaximum() : ymax; + h->SetMaximum(ymax); + } + else if (ystr=="AbsSlb") { + ytitle="p^{(e/#mu)}_{T,jet}/p^{(e/#mu+#nu)}_{T,jet}"; + ymax = (ymax<0.0) ? 1.2 : ymax; + h->SetMaximum(ymax); + } + else if (ystr=="Aone") { + ytitle="a_{1}"; + } + else if (ystr=="Atwo") { + ytitle="a_{2}"; + } + else if (ystr=="Pone") { + ytitle="p_{1}"; + } + else if (ystr=="Ptwo") { + ytitle="p_{2}"; + } + } - if (xtitle.empty()) { - string xstr=quantity.substr(pos+2); - if (xstr=="RefPt") xtitle=refpt.empty() ? "p_{T}^{REF} [GeV]" : (refpt+" [GeV]").c_str(); - if (xstr=="JetPt") xtitle="p_{T} [GeV]"; - if (xstr=="JetEta") xtitle="#eta"; - if (xstr=="JetPhi") xtitle="#varphi"; - if (xstr=="JetY") xtitle="y"; - if (xstr=="PtRel") xtitle="p_{T}^{rel} [GeV]"; - if (xstr=="RelLepPt") xtitle="p_{T}^{(e/#mu)} / p_{T,jet}^{(e/#mu)}"; - if (xstr=="ThreshPt") xtitle="p_{T,max}^{3^{rd}}"; + if (xtitle.empty()) { + string xstr=quantity.substr(pos+2); + if (xstr=="RefPt") xtitle=refpt.empty() ? "p_{T}^{REF} [GeV]" : (refpt+" [GeV]").c_str(); + if (xstr=="JetPt") xtitle="p_{T} [GeV]"; + if (xstr=="JetEta") xtitle="#eta"; + if (xstr=="JetPhi") xtitle="#varphi"; + if (xstr=="JetY") xtitle="y"; + if (xstr=="PtRel") xtitle="p_{T}^{rel} [GeV]"; + if (xstr=="RelLepPt") xtitle="p_{T}^{(e/#mu)} / p_{T,jet}^{(e/#mu)}"; + if (xstr=="ThreshPt") xtitle="p_{T,max}^{3^{rd}}"; + if (xstr=="npv") xtitle="NPV"; + if (xstr=="NPU") xtitle="NPU"; + if (xstr=="TrueNPU") xtitle="TrueNPU"; + } } - } - - h->SetXTitle(xtitle.c_str()); - h->SetYTitle(ytitle.c_str()); - if(!tdr) { + + h->SetXTitle(xtitle.c_str()); + h->SetYTitle(ytitle.c_str()); h->GetXaxis()->SetTitleOffset(1.1); h->GetYaxis()->SetTitleOffset(1.4); h->GetYaxis()->CenterTitle(); - } - h->GetYaxis()->SetNdivisions(505); - return; + h->GetYaxis()->SetNdivisions(505); + return; } diff --git a/JetUtilities/bin/jet_inspect_multigraphs_x.cc b/JetUtilities/bin/jet_inspect_multigraphs_x.cc new file mode 100644 index 00000000..f45049db --- /dev/null +++ b/JetUtilities/bin/jet_inspect_multigraphs_x.cc @@ -0,0 +1,1224 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// jet_inspect_graphs_x +// -------------------- +// +// 07/20/2009 Philipp Schieferdecker +//////////////////////////////////////////////////////////////////////////////// + + +#include "JetMETAnalysis/JetUtilities/interface/CommandLine.h" +#include "JetMETAnalysis/JetUtilities/interface/ObjectLoader.h" +#include "JetMETAnalysis/JetUtilities/interface/RootStyle.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +using namespace std; + + +//////////////////////////////////////////////////////////////////////////////// +// declare local functions +//////////////////////////////////////////////////////////////////////////////// +void draw_range(const string& range,const int residual=-1); + +string get_range(const ObjectLoader& gl, + const vector& indices, + bool addFixedVars=true,string refpt=""); +string get_legend_label_from_alg(const string& alg); +string get_legend_label_from_input(const string& input); +string get_legend_label_from_input_and_alg(const string& input,const string& alg); +void set_graph_style(TGraphErrors* g,unsigned int ngraph,bool nocolor, + const vector& vcolors, + const vector& vmarkers, + const vector& vlstyles, + const vector& vsizes, + const vector& vlsizes); + +void set_axis_titles(TH1*h,const string& quantity,float ymin,float ymax, + string xtitle,string ytitle,string refpt=""); + +void draw_graph_residual(TPad* pad,TMultiGraph* mg, + const int errMode, + const bool resmcdata, + const vector& defmcdata, + const float yresmax=-1., + const string& restitle="", + const float restitlesize=.11, + float xmin=-1., + float xmax=-1., + float ymin=-1., + float ymax=-1., + int fullfit=-1); + +TH1F* set_axis_range(TMultiGraph* mg, + float xmin=-1., float xmax=-1., + float ymin=-1., float ymax=-1.); + + +void draw_zline(TH1* h1,float xmin=-1.,float xmax=-1.); + +void draw_extrapolation(TMultiGraph* mg,int fullfit=-1, + float xmin=-1.,float xmax=-1.); + +void draw_labels(const vector& labels,bool leginplot,bool tdrautobins); + +//////////////////////////////////////////////////////////////////////////////// +// main +//////////////////////////////////////////////////////////////////////////////// + +//______________________________________________________________________________ +int main(int argc,char** argv) +{ + CommandLine cl; + if (!cl.parse(argc,argv)) return 0; + + vector inputs = cl.getVector("inputs"); + vector algs = cl.getVector("algs", "ak5calo"); + vector variables = cl.getVector("variables","RelRspVsRefPt"); + + vector leglabels = cl.getVector("leglabels", ""); + + vector tdrlabels = cl.getVector("tdrlabels", ""); + bool tdrautobins=cl.getValue ("tdrautobins", false); + bool drawrange = cl.getValue ("drawrange", true); + + + bool leginplot = cl.getValue ("leginplot", true); + + bool drawlegend= cl.getValue ("drawlegend", true); + double legx = cl.getValue ("legx", 0.35); + double legy = cl.getValue ("legy", 0.9); + double legw = cl.getValue ("legw", 0.55); + + string xtitle = cl.getValue ("xtitle", ""); + string ytitle = cl.getValue ("ytitle", ""); + string refpt = cl.getValue ("refpt", ""); + + vectorcolors = cl.getVector("colors", ""); + vectormarkers= cl.getVector("markers", ""); + vectorlstyles= cl.getVector("lstyles", ""); + vector sizes = cl.getVector ("sizes", ""); + vector lsizes = cl.getVector ("lsizes", ""); + + + string text = cl.getValue ("text", ""); + bool logx = cl.getValue ("logx", false); + bool logy = cl.getValue ("logy", false); + float ymin = cl.getValue ("ymin", -1.0); + float ymax = cl.getValue ("ymax", -1.0); + bool nocolor = cl.getValue ("nocolor", false); + bool overlay = cl.getValue ("overlay", true); + int fullfit = cl.getValue ("fullfit", -1); + string prefix = cl.getValue ("prefix", ""); + string suffix = cl.getValue ("suffix", ""); + string opath = cl.getValue ("opath", ""); + vector formats = cl.getVector("formats", "png"); + bool batch = cl.getValue ("batch", true); + bool latex = cl.getValue ("latex", false); + bool latexcndf = cl.getValue ("latexcndf", true); + bool fittofile = cl.getValue ("fittofile", false); + + int residual = cl.getValue ("residual", -1); + string restitle = cl.getValue ("restitle", ""); + float restitlesize=cl.getValue ("restitlesize", .11); + float yresmax = cl.getValue ("yresmax", -1); + bool resmcdata = cl.getValue ("resmcdata", false); + vector defmcdata = cl.getVector ("defmcdata", ""); + + float xmin = cl.getValue ("xmin", -1.0); + float xmax = cl.getValue ("xmax", -1.0); + + + + if (!cl.check()) return 0; + cl.print(); + + // sanity check + /* if ((inputs.size()>1&&algs.size()>1)|| + (algs.size()>1&&variables.size()>1)|| + (inputs.size()>1&&variables.size()>1)) { + cout<<"Provide more than one value only for one of inputs/algs/variables!" + <1&&variables.size()>1)|| + (inputs.size()>1&&variables.size()>1)) { + cout<<"Provide more than one value only for one of inputs/algs/variables!" + <SetOptStat(0); + gStyle->SetOptFit(0); + + // is the *same* quantity compared for several (e.g. eta-) ranges? + set quantities; + for (unsigned int i=0;i1 && inputs.size()<1) { + if (leglabels.size()>0) { + if (leglabels.size()!=algs.size()) { + cout<<"ERROR: leglabels / algs mismatch!"<1 && algs.size()<1) { + if (leglabels.size()>0) { + if (leglabels.size()!=inputs.size()) { + cout<<"ERROR: leglabels / inputs mismatch!"<1) { + if (leglabels.size()>0) { + if (leglabels.size()!=variables.size()) { + cout<<"ERROR: leglabels / variables mismatch!"< graphs; + vector ranges; + string quantity=(*quantities.begin()); + + /// LOOP OVER FILES + for (unsigned int iinput=0;iinputIsOpen()) {cout<<"Can't open "<GetName()<Get(alg.c_str()); + if (0==dir) { cout<<"No dir "< gl; + gl.load_objects(dir,variable); + + gl.begin_loop(); + vector indices; + TGraphErrors* g(0); + while ((g=gl.next_object(indices))) { + + graphs.push_back(g); + ranges.push_back(get_range(gl,indices,variables.size()==1,refpt)); + + if (0==mg) { + stringstream sscname; + if (!prefix.empty()) sscname<1&&gl.nobjects(i)==1) continue; //?? + sscname<<"_"<0)?leglabels.size():variables.size(); + mg=new TMultiGraph(sscname.str().c_str(),""); + + //double ymax=(quantity.find("Rsp")==string::npos)?0.85:0.4; + + double legxmin = (leginplot) ? legx : 0.825; + double legymin = legy; + double legxmax = (leginplot) ? legx+legw : 1.03; + double legymax = legymin - (nleglabels)*0.065; + + leg = new TLegend(legxmin,legymin,legxmax,legymax); + leg->SetFillColor(10); leg->SetLineColor(10); leg->SetBorderSize(0); + + //leg=new TLegend(0.5,ymax,0.9,ymax-nleglabels*0.06); + //range=get_range(gl,indices,variables.size()==1); + } + + //cout<<"indices back: "<1 && algs.size()>1) ? + (iinput*algs.size()+ialg) : (inputs.size()>1 && algs.size()<1) ? + iinput : (algs.size()>1 && inputs.size()<1) ? + ialg : (variables.size()>1) ? + ivar : (indices.size()>0) ? indices.back() : 0; + + string label=(variables.size()>1&&leglabels.size()==0) ? + get_range(gl,indices,true,refpt) : (leglabels.size()>(unsigned)ilabel) ? + leglabels[ilabel] : "error"; + + mg->Add(g); + set_graph_style(g,overlay*(graphs.size()-1),nocolor,colors,markers,lstyles,sizes,lsizes); + leg->AddEntry(g,label.c_str(),"lp"); + + // print fit parameters + TF1* fitfnc = (TF1*)g->GetFunction("fit"); + if (0!=fitfnc) { + for (int ipar=0;iparGetNpar();ipar++) + cout<GetParameter(ipar)<<" +- " + <GetParError(ipar)<Chi2/NDF: " + <GetChisquare()<<"/" + <GetNDF()<GetName()<<".tex"; + texfile.open(texfilename.str().c_str(),ofstream::trunc); + if (!texfile.is_open()) { + cout<<"tex-ERROR: Could not create "<GetExpFormula()<GetNpar()-1;ipar++) { + texinput<<"$ ("<GetParameter(ipar) + <<" $ & $ \\pm $ & " + <<"$ "<GetParError(ipar)<<") $ & "; + } + texinput<<"$ ("<GetParameter(fitfnc->GetNpar()-1) + <<" $ & $ \\pm $ & " + <<"$ "<GetParError(fitfnc->GetNpar()-1)<<") $"; + //...last not least chi2/ndf + if (latexcndf) { + texinput<<" & $ ("<GetChisquare() + <<"/" + <GetNDF()<<") $"; + } + texfile<GetName()<<".txt"; + fitfile.open(fitfilename.str().c_str(),ofstream::trunc); + if (!fitfile.is_open()) { + cout<<"txt-ERROR: Could not create "<GetExpFormula()<<" "<GetNpar()<GetNpar();ipar++) { + fitinput<GetParameter(ipar)<<" "; + } + fitinput<GetName(),mg->GetName(),1000,800); + gPad->SetLeftMargin(0.18); + gPad->SetRightMargin(0.05); + gPad->SetTopMargin(0.08); + gPad->SetBottomMargin(0.14); + gPad->SetLogx(logx); + gPad->SetLogy(logy); + + mg->Draw("AP"); + set_axis_titles(mg->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt); + + if (0!=mg->GetHistogram()) { + mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(logx); + mg->GetHistogram()->GetXaxis()->SetNoExponent(logx); + } + + set_axis_range(mg,xmin,xmax,ymin,ymax); + draw_extrapolation(mg,fullfit,xmin,xmax); + draw_graph_residual((TPad*)gPad,mg,residual, + resmcdata,defmcdata,yresmax,restitle,restitlesize, + xmin,xmax,ymin,ymax,fullfit); + + leg->SetLineColor(10); + leg->SetFillColor(10); + leg->SetBorderSize(0); + if (drawlegend) leg->Draw(); + if (drawrange) draw_range(ranges.front(),residual); + if (tdrautobins) tdrlabels.push_back(ranges.front()); + draw_labels(tdrlabels,leginplot,tdrautobins); + if (tdrautobins) tdrlabels.pop_back(); + + } + else { + c = new TCanvas(mg->GetName(),mg->GetName(),1000,800); + unsigned nx = (unsigned)std::sqrt((float)graphs.size()); + unsigned ny = nx; + if (nx*nyDivide(nx,ny); + for (unsigned i=0;icd(i+1); + gPad->SetLeftMargin(0.18); + gPad->SetRightMargin(0.05); + gPad->SetTopMargin(0.08); + gPad->SetBottomMargin(0.14); + gPad->SetLogx(logx); + gPad->SetLogy(logy); + + stringstream ssmgindname; + ssmgindname<<"ind_"<GetName(); + TMultiGraph* mgind = new TMultiGraph(ssmgindname.str().c_str(), + ssmgindname.str().c_str()); + mgind->Add(graphs[i]); + //graphs[i]->Draw("AP"); + mgind->Draw("AP"); + //set_axis_titles(graphs[i]->GetHistogram(),quantity,ymin,ymax); + set_axis_titles(mgind->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt); + + if (0!=mg->GetHistogram()) { + mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(logx); + mg->GetHistogram()->GetXaxis()->SetNoExponent(logx); + } + + set_axis_range(mgind,xmin,xmax,ymin,ymax); + draw_extrapolation(mgind,fullfit,xmin,xmax); + draw_graph_residual((TPad*)gPad,mgind,residual, + resmcdata,defmcdata,yresmax,restitle,restitlesize, + xmin,xmax,ymin,ymax,fullfit); + + if (drawrange) draw_range(ranges[i],residual); + if (tdrautobins) tdrlabels.push_back(ranges[i]); + draw_labels(tdrlabels,leginplot,tdrautobins); + if (tdrautobins) tdrlabels.pop_back(); + set_axis_titles(graphs[i]->GetHistogram(),quantity,ymin,ymax,xtitle,ytitle,refpt); + + if (algs.size()>1 || inputs.size()>1) { + TLatex tex; + tex.SetNDC(); + tex.SetTextFont(42); + tex.SetTextSize(0.05); + string txt = (algs.size()>1) ? + get_legend_label_from_alg(algs[i]) : + get_legend_label_from_input(inputs[i]); + tex.DrawLatex(0.6,0.85,txt.c_str()); + } + + } + } + + string output = c->GetName(); + if (!opath.empty()) output = opath + "/" + output; + for (unsigned int iformat=0;iformatPrint((output+"."+formats[iformat]).c_str()); + + + if (!batch) app->Run(); + + return 0; +} + + +//////////////////////////////////////////////////////////////////////////////// +// implement local functions +//////////////////////////////////////////////////////////////////////////////// +//______________________________________________________________________________ + +void draw_labels(const vector& labels,bool leginplot,bool tdrautobins) +{ + for (unsigned ilabel=0;ilabel0&&(ilabel==labels.size()-1)) tmp=labels[ilabel-1]; + pos = tmp.find(':'); assert(pos!=string::npos); + string x_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); + pos = tmp.find(':'); assert(pos!=string::npos); + string y_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); + pos = tmp.find(':'); + string font_as_str; + string size_as_str; + string text; + if (pos==string::npos) { + font_as_str = "42"; + size_as_str = "0.04"; + text = tmp; + } + else { + font_as_str = tmp.substr(0,pos); tmp = tmp.substr(pos+1); + pos = tmp.find(':'); + if (pos==string::npos) { + size_as_str = "0.04"; + text = tmp; + } + else { + size_as_str = tmp.substr(0,pos); + text = tmp.substr(pos+1); + } + } + + stringstream ssx; ssx<>x; + stringstream ssy; ssy<>y; + stringstream ssf; ssf<>f; + stringstream sss; sss<>s; + + if (tdrautobins&&ilabel>0&&(ilabel==labels.size()-1)) { + y -= 0.05; + text = labels[labels.size()-1]; + } + + if (!leginplot) { double scale = 800.0*0.93/1000./0.82; x *= scale; } + + TLatex tex; + tex.SetTextSize(s); + tex.SetTextFont(f); + tex.SetNDC(true); + tex.DrawLatex(x,y,text.c_str()); + } +} + + +//______________________________________________________________________________ +void draw_extrapolation(TMultiGraph* mg,int fullfit,float xmin,float xmax) +{ + if (fullfit<1||fullfit>3) return; + TIter next(mg->GetListOfGraphs()); + TGraphErrors* g(0);vector vg;vectorvf; + + while (( g = (TGraphErrors*)next() )) { + vg.push_back(g); + vf.push_back((TF1*)g->GetListOfFunctions()->Last()); + } + assert (vg.size()==vf.size()); + + if (0==vf.size()) return; + + + + for (unsigned i(0);iGetRange(ffmin,ffmax); + + if (1==fullfit||2==fullfit) + ffmin = (xmin!=-1.) ? xmin : mg->GetHistogram()->GetXaxis()->GetXmin(); + if (1==fullfit||3==fullfit) + ffmax = (xmax!=-1.) ? xmax : mg->GetHistogram()->GetXaxis()->GetXmax(); + + stringstream ssffname; + ssffname<<"ff_"<GetName()<<"_"<Clone(ssffname.str().c_str()); + + ff->SetRange(ffmin,ffmax); + ff->SetLineColor(vf[i]->GetLineColor()); + ff->SetLineStyle(kDashed); + ff->SetLineWidth(1); + ff->Draw("SAME"); + } +} + +//______________________________________________________________________________ +TH1F* set_axis_range(TMultiGraph* mg, + float xmin, float xmax, + float ymin, float ymax) +{ + if (0==mg) return 0; + if (0==mg->GetHistogram()) return 0; + + TH1F* holdaxis = mg->GetHistogram(); TH1F* hnewaxis(0); + if (xmin==-1.&&xmax==-1.&&ymin==-1.&&ymax==-1.) return holdaxis; + + vector borders; + borders.push_back(holdaxis->GetXaxis()->GetXmin()); + borders.push_back(holdaxis->GetMinimum()); + borders.push_back(holdaxis->GetXaxis()->GetXmax()); + borders.push_back(holdaxis->GetMaximum()); + + if (xmin!=-1.0) borders[0]=xmin; + if (ymin!=-1.0) borders[1]=ymin; + if (xmax!=-1.0) borders[2]=xmax; + if (ymax!=-1.0) borders[3]=ymax; + + if (xmin!=-1.0 || xmax!=-1.0 || ymin!=-1.0 || ymax!=-1.0) + hnewaxis = gPad->DrawFrame(borders[0],borders[1],borders[2],borders[3]); + + // copy settings + + hnewaxis->SetTitle(holdaxis->GetTitle()); + + hnewaxis->SetXTitle(holdaxis->GetXaxis()->GetTitle()); + hnewaxis->GetXaxis()->CenterTitle(holdaxis->GetXaxis()->GetCenterTitle()); + hnewaxis->GetXaxis()->SetTitleSize(holdaxis->GetXaxis()->GetTitleSize()); + hnewaxis->GetXaxis()->SetLabelSize(holdaxis->GetXaxis()->GetLabelSize()); + hnewaxis->GetXaxis()->SetTitleOffset(holdaxis->GetXaxis()->GetTitleOffset()); + hnewaxis->GetXaxis()->SetLabelOffset(holdaxis->GetXaxis()->GetLabelOffset()); + hnewaxis->GetXaxis()->SetNdivisions(holdaxis->GetXaxis()->GetNdivisions()); + hnewaxis->GetXaxis()->SetTickLength(holdaxis->GetXaxis()->GetTickLength()); + hnewaxis->GetXaxis()->SetMoreLogLabels(holdaxis->GetXaxis()->GetMoreLogLabels()); + hnewaxis->GetXaxis()->SetNoExponent(holdaxis->GetXaxis()->GetNoExponent()); + hnewaxis->GetXaxis()->SetLabelSize(holdaxis->GetXaxis()->GetLabelSize()); + hnewaxis->GetXaxis()->SetLabelOffset(holdaxis->GetXaxis()->GetLabelOffset()); + + hnewaxis->SetYTitle(holdaxis->GetYaxis()->GetTitle()); + hnewaxis->GetYaxis()->CenterTitle(holdaxis->GetYaxis()->GetCenterTitle()); + hnewaxis->GetYaxis()->SetTitleSize(holdaxis->GetYaxis()->GetTitleSize()); + hnewaxis->GetYaxis()->SetLabelSize(holdaxis->GetYaxis()->GetLabelSize()); + hnewaxis->GetYaxis()->SetTitleOffset(holdaxis->GetYaxis()->GetTitleOffset()); + hnewaxis->GetYaxis()->SetLabelOffset(holdaxis->GetYaxis()->GetLabelOffset()); + hnewaxis->GetYaxis()->SetNdivisions(holdaxis->GetYaxis()->GetNdivisions()); + hnewaxis->GetYaxis()->SetTickLength(holdaxis->GetYaxis()->GetTickLength()); + hnewaxis->GetYaxis()->SetMoreLogLabels(holdaxis->GetYaxis()->GetMoreLogLabels()); + hnewaxis->GetYaxis()->SetNoExponent(holdaxis->GetYaxis()->GetNoExponent()); + hnewaxis->GetYaxis()->SetLabelSize(holdaxis->GetYaxis()->GetLabelSize()); + hnewaxis->GetYaxis()->SetLabelOffset(holdaxis->GetYaxis()->GetLabelOffset()); + + mg->Draw("P"); + return hnewaxis; +} + + +//______________________________________________________________________________ +void draw_graph_residual(TPad* pad,TMultiGraph* mg, + const int errMode, + const bool resmcdata,const vector& defmcdata, + const float yresmax, const string& restitle, + const float restitlesize, + float xmin,float xmax,float ymin,float ymax, + int fullfit) +{ + if (errMode<0) return; + else if (errMode>3){ + cout<<"ERROR: draw_graph_residual() invalid error mode"<GetListOfGraphs()); + TGraphErrors* g(0);vector vg;vectorvf; + + while (( g = (TGraphErrors*)next() )) { + vg.push_back(g); + vf.push_back((TF1*)g->GetListOfFunctions()->Last()); + } + assert (vg.size()==vf.size()); + + bool nofits = true; + for (unsigned i=0;i skipping!"< skipping!"<GetListOfFunctions()->Last(); + vf.push_back(mcfit); + + mcfit = 0; + for (unsigned i=defmcdata[1]+1;iGetName(); + TMultiGraph* rmg = new TMultiGraph(rmgname.str().c_str(), + rmgname.str().c_str()); + + //vector vrGraph; + + for (unsigned i(0);iDivide(1,2,0.01,0.0); + + // make default settings + if (0==i) pad->GetPad( 1 )->SetFillColor( 0 ); + if (0==i) pad->GetPad( 2 )->SetFillColor( 0 ); + if (0==i) pad->GetPad( 1 )->SetPad( 0.0,0.25,1.0, 1.0 ); + if (0==i) pad->GetPad( 2 )->SetPad( 0.0, 0.0,1.0,0.25 ); + + if (0==i) pad->cd(1); + if (0==i && pad->GetLogx()) gPad->SetLogx(); + if (0==i && pad->GetLogy()) gPad->SetLogy(); + if (0==i) gPad->SetTopMargin(0.1); + if (0==i) gPad->SetLeftMargin(0.15); + if (0==i) gPad->SetRightMargin(0.05); + + if (0==i) pad->cd(2); + if (0==i && pad->GetLogx())gPad->SetLogx(); + if (0==i) gPad->SetBottomMargin(0.375); + if (0==i) gPad->SetLeftMargin(0.15); + if (0==i) gPad->SetRightMargin(0.05); + + // define residual graph + + TGraphErrors* rGraph = new TGraphErrors(0); + + // Go through all points now... + + for(int ip(0);ipGetN();ip++) { + + double y = vg[i]->GetY()[ip]; + double ey = vg[i]->GetEY()[ip]; + + double x = vg[i]->GetX()[ip]; + double ex = vg[i]->GetEX()[ip]; + + double ffxmin(0.0),ffxmax(0.0); + + if (0==vf[i]) continue; + vf[i]->GetRange(ffxmin,ffxmax); + if (xffxmax) continue; + + double fy = (0==vf[i]) ? 0.0 : vf[i]->Eval(x); + + double resy(0.0),resey(0.0); + + if (0==y) continue; + + if (errMode==3) { + resy = (y-fy)/y*100.; + resey = fy/y/y*ey*100.; + } + else if (errMode==0) { + resy = (y-fy)/sqrt(y)*100.; + } + + int n = rGraph->GetN(); + + rGraph->SetPoint(n,x,resy); + rGraph->SetPointError(n,ex,resey); + } + + rGraph->SetTitle(""); + if (errMode==3) rGraph->SetMarkerStyle(20); else rGraph->SetMarkerStyle(2); + if (errMode==3) rGraph->SetMarkerSize(.75); else rGraph->SetMarkerSize(1.); + if (0!=vf[i]) rGraph->SetMarkerColor(vf[i]->GetLineColor()); + if (0!=vf[i]) rGraph->SetLineColor(vf[i]->GetLineColor()); + if (resmcdata) rGraph->SetMarkerColor(vg[defmcdata[1]]->GetLineColor()); + if (resmcdata) rGraph->SetLineColor(vg[defmcdata[1]]->GetLineColor()); + + rGraph->SetLineWidth(1); + + if (rGraph->GetN()!=0) rmg->Add(rGraph); + } + + + pad->cd(1); + mg->Draw("AP"); + + mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.2); + if (0!=mg->GetHistogram()) { + mg->GetHistogram()->GetXaxis()->SetMoreLogLabels(pad->GetLogx()); + mg->GetHistogram()->GetXaxis()->SetNoExponent(pad->GetLogx()); + mg->GetHistogram()->GetXaxis()->SetLabelSize( 0.15 ); + mg->GetHistogram()->GetXaxis()->SetLabelOffset( 0.005 ); + } + set_axis_range(mg,xmin,xmax,ymin,ymax); + draw_extrapolation(mg,fullfit,xmin,xmax); + + xmin = (xmin!=-1.) ? xmin: mg->GetHistogram()->GetXaxis()->GetXmin(); + xmax = (xmax!=-1.) ? xmax: mg->GetHistogram()->GetXaxis()->GetXmax(); + + pad->cd(2); + + // rmg->SaveAs("residual.root"); + + rmg->Draw("AP"); + + float rmgymax = std::max(TMath::Abs(rmg->GetHistogram()->GetMinimum()), + TMath::Abs(rmg->GetHistogram()->GetMaximum())); + + rmgymax = (rmgymax>50.) ? 50. : rmgymax; + rmgymax = (yresmax>0. ) ? yresmax : (rmgymax*1.15); + + rmg->GetHistogram()->SetMinimum(-1.*rmgymax); + rmg->GetHistogram()->SetMaximum( 1.*rmgymax); + + rmg->GetHistogram()->SetTitle(""); + + rmg->GetHistogram()->GetYaxis()->CenterTitle(1); + rmg->GetHistogram()->GetYaxis()->SetTitleSize( restitlesize ); + rmg->GetHistogram()->GetYaxis()->SetTitleOffset( 0.6 ); + rmg->GetHistogram()->GetYaxis()->SetLabelSize( 0.13 ); + rmg->GetHistogram()->GetYaxis()->SetNdivisions( 505 ); + + rmg->GetHistogram()->SetXTitle(mg->GetHistogram()->GetXaxis()->GetTitle()); + rmg->GetHistogram()->GetXaxis()->SetTitleSize( 0.16 ); + rmg->GetHistogram()->GetXaxis()->SetLabelSize( 0.16 ); + rmg->GetHistogram()->GetXaxis()->SetTitleOffset( 1 ); + rmg->GetHistogram()->GetXaxis()->SetLabelOffset( 0.006 ); + rmg->GetHistogram()->GetXaxis()->SetNdivisions( 505 ); + rmg->GetHistogram()->GetXaxis()->SetTickLength(mg->GetHistogram()->GetXaxis()->GetTickLength()*3.); + + rmg->GetHistogram()->GetXaxis()->SetMoreLogLabels(pad->GetLogx()); + rmg->GetHistogram()->GetXaxis()->SetNoExponent(pad->GetLogx()); + rmg->GetHistogram()->GetXaxis()->SetLabelSize( 0.15 ); + rmg->GetHistogram()->GetXaxis()->SetLabelOffset( 0.005 ); + + if (restitle.empty()){ + if (!resmcdata) { + if ( errMode == 0 ) + rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{#sqrt{point}} [%]" ); + else if ( errMode == 1 ) + rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{#sqrt{fit}} [%]" ); + else if (errMode == 2) + rmg->GetHistogram()->SetYTitle( "#frac{(point - fit)}{binerror} [%]" ); + else + rmg->GetHistogram()->SetYTitle( "#frac{(point-fit)}{point} [%]" ); + } + else { + if ( errMode == 0 ) + rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{#sqrt{data}} [%]" ); + else if ( errMode == 1 ) + rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{#sqrt{MC}} [%]" ); + else if (errMode == 2) + rmg->GetHistogram()->SetYTitle( "#frac{(data - MC)}{binerror} [%]" ); + else + rmg->GetHistogram()->SetYTitle( "#frac{(data-MC)}{data} [%]" ); + } + } + else rmg->GetHistogram()->SetYTitle( restitle.c_str() ); + + + + set_axis_range(rmg,xmin,xmax); + draw_zline(rmg->GetHistogram(),xmin,xmax); + + pad->cd(1); +} + +//______________________________________________________________________________ +void draw_zline(TH1* h1,float xmin,float xmax) +{ + if (0==h1) return; + float min = (xmin!=-1.) ? xmin : h1->GetXaxis()->GetXmin(); + float max = (xmax!=-1.) ? xmax : h1->GetXaxis()->GetXmax(); + + TLine* zline = new TLine(min,0,max,0); + zline->SetLineStyle(kDashed); + zline->SetLineWidth(1); + zline->Draw("SAME"); +} + + +//______________________________________________________________________________ +void draw_range(const string& range, const int residual) +{ + TLatex tex; + tex.SetNDC(true); + tex.SetTextAlign(13); + tex.SetTextSize(0.055); + tex.SetTextFont(42); + if (residual<0) tex.DrawLatex(0.18,0.98,range.c_str()); + else tex.DrawLatex(0.15,0.96,range.c_str()); +} + + +//______________________________________________________________________________ +string get_range(const ObjectLoader& gl, + const vector& indices, + bool addFixedVars, string refpt) +{ + string varnameEta = "#eta"; + for (unsigned int i=0;i=0) varnameEta="|#eta|"; + + string varnameY = "y"; + for (unsigned int i=0;i=0) varnameY="|y|"; + + + stringstream ssrange; + + for (unsigned int i=0;i>jet_size; + jet_size/=10.0; stringstream ss2; ss2<>jet_size; + jet_size/=10.0; stringstream ss2; ss2<& vcolors, + const vector& vmarkers, + const vector& vlstyles, + const vector& vsizes, + const vector& vlsizes) +{ + Color_t colors[10] = { + kBlue+1,kRed+1,kGreen+2,kMagenta+2,kCyan+3, + kViolet+4,kOrange+1,kGreen-1,kMagenta-4,kCyan-2 + }; + Style_t lines[10] = { + 1,1,1,1,1,1,1,1,1,1 + }; + Style_t markers[10] = + { kOpenCircle,kOpenSquare,kOpenTriangleUp,kOpenDiamond,kOpenCross, + kOpenStar,kFullCircle,kFullSquare,kFullTriangleUp,kFullTriangleDown + }; + + if (nocolor) { + markers[0]=kFullCircle; markers[1]=kOpenCircle; + markers[2]=kFullSquare; markers[3]=kOpenSquare; + markers[4]=kFullTriangleUp; markers[5]=kOpenTriangleUp; + markers[6]=kFullStar; markers[7]=kOpenStar; + markers[8]=kFullTriangleDown; markers[9]=kOpenCross; + } + + Color_t color = colors[std::min(ngraph,(unsigned)9)]; + Style_t line = lines[std::min(ngraph,(unsigned)9)]; + Style_t marker = markers[std::min(ngraph,(unsigned)9)]; + Float_t msize (1.5); + + if (ngraphSetLineColor(color); + g->SetMarkerColor(color); + g->SetMarkerStyle(marker); + if (ngraphSetMarkerStyle(vmarkers[ngraph]); + g->SetMarkerSize(msize); + + TF1* f(0); + if (g->GetListOfFunctions()->GetEntries()>0) { + f=(TF1*)(g->GetListOfFunctions()->At(0)); + f->SetLineColor(color); + f->SetLineStyle(line); + if (ngraphSetLineStyle(vlstyles[ngraph]); + f->SetLineWidth(3); + if (ngraphSetLineWidth((Width_t)vlsizes[ngraph]); + } + + return; +} + + +//______________________________________________________________________________ +void set_axis_titles(TH1* h,const string& quantity,float ymin,float ymax, + string xtitle,string ytitle,string refpt) +{ + if (0==h) { + cout<<"set_axis_title ERROR: h is NULL!"<SetTitle(""); + + ymin = (ymin<0.0) ? 0.0 : ymin; + h->SetMinimum(ymin); + + //string xtitle(""); + //string ytitle(""); + size_t pos = quantity.find("Vs"); + if (pos!=string::npos) { + + if (ytitle.empty()) { + string ystr=quantity.substr(0,pos); + if (ystr=="Rsp"||ystr=="RelRsp"||ystr=="AbsRsp") { + ytitle=refpt.empty() ? "p_{T} / p_{T}^{REF}" : ("p_{T} / "+refpt).c_str(); + ymax = (ymax<0.0) ? 1.2 : ymax; + h->SetMaximum(ymax); + } + else if (ystr=="Res"||ystr=="RelRes"||ystr=="AbsRes") { + ytitle= refpt.empty() ? "#sigma(p_{T}/p_{T}^{REF}) / " : + ("#sigma(p_{T}/"+refpt+") / ").c_str(); + if (ymax>0.0) h->SetMaximum(ymax); + } + else if (ystr=="Asym") { + ytitle="#sqrt{2}#sigma_{A}"; + ymax = (ymax<0.0) ? 1.3*h->GetMaximum() : ymax; + h->SetMaximum(ymax); + } + else if (ystr=="AbsSlb") { + ytitle="p^{(e/#mu)}_{T,jet}/p^{(e/#mu+#nu)}_{T,jet}"; + ymax = (ymax<0.0) ? 1.2 : ymax; + h->SetMaximum(ymax); + } + else if (ystr=="Aone") { + ytitle="a_{1}"; + } + else if (ystr=="Atwo") { + ytitle="a_{2}"; + } + else if (ystr=="Pone") { + ytitle="p_{1}"; + } + else if (ystr=="Ptwo") { + ytitle="p_{2}"; + } + } + + if (xtitle.empty()) { + string xstr=quantity.substr(pos+2); + if (xstr=="RefPt") xtitle=refpt.empty() ? "p_{T}^{REF} [GeV]" : (refpt+" [GeV]").c_str(); + if (xstr=="JetPt") xtitle="p_{T} [GeV]"; + if (xstr=="JetEta") xtitle="#eta"; + if (xstr=="JetPhi") xtitle="#varphi"; + if (xstr=="JetY") xtitle="y"; + if (xstr=="PtRel") xtitle="p_{T}^{rel} [GeV]"; + if (xstr=="RelLepPt") xtitle="p_{T}^{(e/#mu)} / p_{T,jet}^{(e/#mu)}"; + if (xstr=="ThreshPt") xtitle="p_{T,max}^{3^{rd}}"; + if (xstr=="npv") xtitle="NPV"; + if (xstr=="NPU") xtitle="NPU"; + if (xstr=="TrueNPU") xtitle="TrueNPU"; + } + } + + h->SetXTitle(xtitle.c_str()); + h->SetYTitle(ytitle.c_str()); + h->GetXaxis()->SetTitleOffset(1.1); + h->GetYaxis()->SetTitleOffset(1.4); + h->GetYaxis()->CenterTitle(); + h->GetYaxis()->SetNdivisions(505); + return; +} diff --git a/JetUtilities/interface/JRAEvent.h b/JetUtilities/interface/JRAEvent.h index e7a3e8d3..d4e1d69c 100644 --- a/JetUtilities/interface/JRAEvent.h +++ b/JetUtilities/interface/JRAEvent.h @@ -106,6 +106,9 @@ public : vector* pfcand_e; vector* pfcand_id; vector* refdzvtx; + Long64_t nUnMatchJet; //Branch for un-matched reco jets + vector* unmapjteta; //Branch for un-matched reco jets + vector* unmapjtpt; //Branch for un-matched reco jets // List of branches TBranch *b_npus; //! @@ -163,6 +166,9 @@ public : TBranch *b_pfcand_e; //! TBranch *b_pfcand_id; //! TBranch *b_refdzvtx; //! + TBranch *b_nUnMatchJet; //Branch for un-matched reco jets + TBranch *b_unmapjteta; //Branch for un-matched reco jets + TBranch *b_unmapjtpt; //Branch for un-matched reco jets JRAEvent(TTree *tree = 0, bitset<8> b = 0); virtual ~JRAEvent(); diff --git a/JetUtilities/plugins/MatchRecToGen.cc b/JetUtilities/plugins/MatchRecToGen.cc index 0c14eadd..94ef4c8c 100644 --- a/JetUtilities/plugins/MatchRecToGen.cc +++ b/JetUtilities/plugins/MatchRecToGen.cc @@ -106,6 +106,7 @@ MatchRecToGen::MatchRecToGen(const edm::ParameterSet& iConfig) { produces("rec2gen"); produces("gen2rec"); + produces("unmaprec"); /// for the reco-jets not matched } @@ -119,6 +120,7 @@ void MatchRecToGen::produce(edm::Event& iEvent,const edm::EventSetup& iSetup) unsigned int nRec(0); unsigned int nGen(0); unsigned int nMatched(0); + unsigned int nUnMatched(0); /// for the reco-jets not matched edm::Handle rec_; edm::Handle gen_; @@ -151,6 +153,7 @@ void MatchRecToGen::produce(edm::Event& iEvent,const edm::EventSetup& iSetup) // refToBaseProd). Otherwise make and fill the map normally. auto_ptr recToGenMap; auto_ptr genToRecMap; + auto_ptr unMatchreco; /// for reco-jet not matched if(nRec==0 || nGen==0) { recToGenMap.reset(new CandViewMatchMap()); genToRecMap.reset(new CandViewMatchMap()); @@ -181,10 +184,28 @@ void MatchRecToGen::produce(edm::Event& iEvent,const edm::EventSetup& iSetup) ++it; } - + + if(iRecSet.size()>0) + { + unMatchreco.reset(new CandViewMatchMap( + edm::makeRefToBaseProdFrom(rec_->refAt(0), iEvent), + edm::makeRefToBaseProdFrom(rec_->refAt(0), iEvent))); + for(unsigned i=0;iinsert(rec_->refAt(i),rec_->refAt(i)); + nUnMatched++; + } + } + + else{ + unMatchreco.reset(new CandViewMatchMap()); + } + iEvent.put(recToGenMap,"rec2gen"); iEvent.put(genToRecMap,"gen2rec"); - + iEvent.put(unMatchreco,"unmaprec"); + nRecTot_ += nRec; nGenTot_ += nGen; nMatchedTot_ += nMatched; @@ -194,16 +215,16 @@ void MatchRecToGen::produce(edm::Event& iEvent,const edm::EventSetup& iSetup) //______________________________________________________________________________ void MatchRecToGen::endJob() { - stringstream ss; - ss<<"nMatched = "<Branch("pfcand_id", "vector", &pfcand_id); } fChain->Branch("refdzvtx", "vector", &refdzvtx); + ///////////////Unmatched Jet config!!!!!!!!!!!!!!!!! + fChain->Branch("nUnMatchJet", &nUnMatchJet, "nUnMatchJet/L"); + fChain->Branch("unmapjtpt", "vector", &unmapjtpt); + fChain->Branch("unmapjteta", "vector", &unmapjteta); Notify(); } @@ -226,6 +230,10 @@ void JRAEvent::Init(TTree *tree) fChain->SetBranchAddress("pfcand_id", &pfcand_id, &b_pfcand_id); } fChain->SetBranchAddress("refdzvtx", &refdzvtx, &b_refdzvtx); + ///////////////Unmatched Jet config!!!!!!! + fChain->SetBranchAddress("nUnMatchJet", &nUnMatchJet, &b_nUnMatchJet); + fChain->SetBranchAddress("unmapjtpt", &unmapjtpt, &b_unmapjtpt); + fChain->SetBranchAddress("unmapjteta", &unmapjteta, &b_unmapjteta); Notify(); } @@ -316,6 +324,9 @@ void JRAEvent::MakeVectors() pfcand_id = new vector; } refdzvtx = new vector; + ///////////////Unmatched Jet config!! + unmapjtpt = new vector; + unmapjteta = new vector; } void JRAEvent::clear() @@ -378,6 +389,9 @@ void JRAEvent::clear() pfcand_id->clear(); } refdzvtx->clear(); + ///////////////Unmatched Jet config!! + unmapjtpt->clear(); + unmapjteta->clear(); } void JRAEvent::Loop() diff --git a/JetUtilities/src/L2Creator.cc b/JetUtilities/src/L2Creator.cc index 27474a23..bbc54ef1 100644 --- a/JetUtilities/src/L2Creator.cc +++ b/JetUtilities/src/L2Creator.cc @@ -20,7 +20,7 @@ L2Creator::L2Creator() { l2l3 = true; l2calofit = "standard"; l2pffit = "standard"; - mpv = false; + mpv = true; delphes = false; maxFitIter = 30; } @@ -40,7 +40,7 @@ L2Creator::L2Creator(CommandLine& cl) { l2l3 = cl.getValue ("l2l3", true); l2calofit = cl.getValue ("l2calofit", "standard"); l2pffit = cl.getValue ("l2pffit", "standard"); - mpv = cl.getValue ("mpv", false); + mpv = cl.getValue ("mpv", true); delphes = cl.getValue ("delphes", false); maxFitIter = cl.getValue ("maxFitIter", 30); @@ -311,6 +311,12 @@ void L2Creator::loopOverEtaBins() { // if(alg.find("HLT")!=string::npos){ fabscor=new TF1("fit","(x>=[6])*([0]+[1]/(pow(log10(x),2)+[2])+[3]*exp(-[4]*(log10(x)-[5])*(log10(x)-[5])))+(x<[6])*[7]",xmin,xmax); + fabscor->SetParameter(0,0.5); + fabscor->SetParameter(1,9.0); + fabscor->SetParameter(2,8.0); + fabscor->SetParameter(3,-0.3); + fabscor->SetParameter(4,0.6); + fabscor->SetParameter(5,1.0); fabscor->FixParameter(6,xmin); fabscor->FixParameter(7,0.0); } diff --git a/JetUtilities/src/classes_def.xml b/JetUtilities/src/classes_def.xml index 75996c66..9e615814 100755 --- a/JetUtilities/src/classes_def.xml +++ b/JetUtilities/src/classes_def.xml @@ -2,7 +2,8 @@ - + + From 367e7bb5427258f4fa92568d7dd0c91fbd8d8308 Mon Sep 17 00:00:00 2001 From: Fengwangdong Date: Sat, 21 Jan 2017 04:45:04 +0100 Subject: [PATCH 2/4] the latest code for the JEC HLT --- .gitignore | 11 + JetAnalyzers/bin/jet_apply_jec_x.cc | 2 +- JetAnalyzers/bin/jet_synchfit_x.cc | 4 +- JetAnalyzers/bin/jet_synchtest_x.cc | 74 +-- JetAnalyzers/test/Scripts/L1Hadd.sh | 59 +++ JetAnalyzers/test/Scripts/L1batch.sh | 60 +++ JetAnalyzers/test/Scripts/L2batch.sh | 37 ++ JetAnalyzers/test/Scripts/L3batch.sh | 60 +++ JetAnalyzers/test/Scripts/MergeEta.sh | 3 + JetAnalyzers/test/Scripts/MergePt.sh | 3 + JetAnalyzers/test/Scripts/MultiGraph.sh | 29 + JetAnalyzers/test/Scripts/PreL1batch.sh | 63 +++ JetAnalyzers/test/Scripts/PrejraHadd.sh | 57 ++ JetAnalyzers/test/Scripts/deterjec.sh | 17 + JetAnalyzers/test/Scripts/jraHadd.sh | 57 ++ JetAnalyzers/test/Scripts/jrabatch.sh | 40 ++ JetAnalyzers/test/Scripts/prolist.sh | 61 +++ JetAnalyzers/test/crab.py | 16 + JetAnalyzers/test/runJRAtauNtupleProd_cfg.py | 89 ---- JetAnalyzers/test/runJRAtauWorkflow.py | 526 ------------------- JetAnalyzers/test/run_JRA_cfg.py | 2 +- JetAnalyzers/test/run_JRA_hlt_cfg.py | 12 +- JetAnalyzers/test/sanity/CaloCorFactor.cc | 8 +- JetAnalyzers/test/sanity/PFCorFactor.cc | 8 +- JetUtilities/bin/jet_inspect_graphs_x.cc | 30 +- JetUtilities/src/JRAEvent.cc | 14 +- 26 files changed, 654 insertions(+), 688 deletions(-) create mode 100644 .gitignore create mode 100755 JetAnalyzers/test/Scripts/L1Hadd.sh create mode 100755 JetAnalyzers/test/Scripts/L1batch.sh create mode 100755 JetAnalyzers/test/Scripts/L2batch.sh create mode 100755 JetAnalyzers/test/Scripts/L3batch.sh create mode 100644 JetAnalyzers/test/Scripts/MergeEta.sh create mode 100644 JetAnalyzers/test/Scripts/MergePt.sh create mode 100644 JetAnalyzers/test/Scripts/MultiGraph.sh create mode 100755 JetAnalyzers/test/Scripts/PreL1batch.sh create mode 100755 JetAnalyzers/test/Scripts/PrejraHadd.sh create mode 100644 JetAnalyzers/test/Scripts/deterjec.sh create mode 100755 JetAnalyzers/test/Scripts/jraHadd.sh create mode 100755 JetAnalyzers/test/Scripts/jrabatch.sh create mode 100644 JetAnalyzers/test/Scripts/prolist.sh create mode 100644 JetAnalyzers/test/crab.py delete mode 100644 JetAnalyzers/test/runJRAtauNtupleProd_cfg.py delete mode 100755 JetAnalyzers/test/runJRAtauWorkflow.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..a7685b9f --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# git will ignore these files: +*.pyc +*.txt +*_cc.d +*_cc.so +*.pcm +__init__.py + +# git will not consider these directories: +*HLTBX25JEC* +*L1Calibration* diff --git a/JetAnalyzers/bin/jet_apply_jec_x.cc b/JetAnalyzers/bin/jet_apply_jec_x.cc index c6671029..c39eed88 100644 --- a/JetAnalyzers/bin/jet_apply_jec_x.cc +++ b/JetAnalyzers/bin/jet_apply_jec_x.cc @@ -183,7 +183,7 @@ int main(int argc,char**argv) int nevt = (debug) ? 10000 : itree->GetEntries(); for (int ievt=0;ievtGetEntry(ievt); for (unsigned int ijt=0;ijtnref;ijt++) { corrector->setJetPt(JRAEvt->jtpt->at(ijt)); diff --git a/JetAnalyzers/bin/jet_synchfit_x.cc b/JetAnalyzers/bin/jet_synchfit_x.cc index 1a022ce8..e4863519 100644 --- a/JetAnalyzers/bin/jet_synchfit_x.cc +++ b/JetAnalyzers/bin/jet_synchfit_x.cc @@ -337,8 +337,8 @@ int main(int argc,char**argv){ CommandLine cl; if (!cl.parse(argc,argv)) return 0; - string aalgo1 = cl.getValue ("algo1", "ak5pf"); - string aalgo2 = cl.getValue ("algo2", "ak5pf"); + string aalgo1 = cl.getValue ("algo1", "ak4pfHLT"); + string aalgo2 = cl.getValue ("algo2", "ak4pfHLT"); bool highPU = cl.getValue ("highPU", false); bool logPol = cl.getValue ("logPol", true); bool useNPU = cl.getValue ("useNPU", false); diff --git a/JetAnalyzers/bin/jet_synchtest_x.cc b/JetAnalyzers/bin/jet_synchtest_x.cc index 61a77714..c4e8ba20 100644 --- a/JetAnalyzers/bin/jet_synchtest_x.cc +++ b/JetAnalyzers/bin/jet_synchtest_x.cc @@ -56,8 +56,8 @@ class MatchEventsAndJets { void MakeMatchedEventsMaps(TString treeName); map, evtid> fillMap(bool noPU, TString treeName); void GetNtuples(TString treeName = "t"); - void OpenOutputFile(TString outputPath = "./"); - void SetJEC(TString JECPar = "parameters_ak5pf.txt"); + void OpenOutputFile(TString outputPath = "./", TString order1 = "0", TString order2 = "0"); + void SetJEC(TString JECPar = "parameters_ak4pfHLT.txt"); void SetNpvRhoNpuValues(int NBins, int Width) {NBinsNpvRhoNpu=NBins; npvRhoNpuBinWidth=Width;} void SetVptBins(vector vptb) {vptBins = vptb;} void DeclareHistograms(bool reduceHistograms); @@ -239,21 +239,23 @@ map, evtid> MatchEventsAndJets::fillMap(bool noP //______________________________________________________________________________ void MatchEventsAndJets::GetNtuples(TString treeName) { - int algo1_bit_number = (algo1JetInfo.jetType.Contains("calo",TString::kIgnoreCase)) ? 53 : 85; - int algo2_bit_number = (algo2JetInfo.jetType.Contains("calo",TString::kIgnoreCase)) ? 53 : 85; + //int algo1_bit_number = (algo1JetInfo.jetType.Contains("calo",TString::kIgnoreCase)) ? 53 : 85; + //int algo2_bit_number = (algo2JetInfo.jetType.Contains("calo",TString::kIgnoreCase)) ? 53 : 85; fpu->cd(algo1); - tpu = new JRAEvent((TTree*) fpu->Get(algo1+"/"+treeName),algo1_bit_number); + tpu = new JRAEvent((TTree*) fpu->Get(algo1+"/"+treeName)); + //tpu = new JRAEvent((TTree*) fpu->Get(algo1+"/"+treeName),algo1_bit_number); fnopu->cd(algo2); - tnopu = new JRAEvent((TTree*) fnopu->Get(algo2+"/"+treeName),algo2_bit_number); + tnopu = new JRAEvent((TTree*) fnopu->Get(algo2+"/"+treeName)); + //tnopu = new JRAEvent((TTree*) fnopu->Get(algo2+"/"+treeName),algo2_bit_number); } //______________________________________________________________________________ -void MatchEventsAndJets::OpenOutputFile(TString outputPath) { - TString outputFilename = "output_"+algo1+"_"+algo2+".root"; +void MatchEventsAndJets::OpenOutputFile(TString outputPath, TString order1, TString order2) { + TString outputFilename = "output_"+algo1+"_"+algo2+"_"+order1+"_"+order2+".root"; if (algo1.EqualTo(algo2)) - outputFilename = "output_"+algo1+".root"; + outputFilename = "output_"+algo1+"_"+order1+"_"+order2+".root"; outputFilename = outputPath+outputFilename; fout = new TFile(outputFilename,"RECREATE"); } @@ -582,7 +584,7 @@ void MatchEventsAndJets::LoopOverEvents(bool verbose, bool reduceHistograms) { if (iftest && nevs >= maxEvts) return; - if (nevs%10000==0) cout << "\t"<first) == mapTreeNoPU.end()) { @@ -662,7 +664,7 @@ bool MatchEventsAndJets::FillHistograms(bool reduceHistograms) { if(!reduceHistograms) { histograms["g_nj"] ->Fill(tpu->nref,tnopu->nref); // njet distributions histograms["g_npv"] ->Fill(tpu->npv,tnopu->npv); // npv dist. - histograms["g_rho"] ->Fill(tpu->rho,tnopu->rho); // rho dist + histograms["g_rho"] ->Fill(tpu->rho_hlt,tnopu->rho_hlt); // rho dist histograms["g_pthat"] ->Fill(tpu->pthat,tnopu->pthat); // pthat distributions histograms["g_deltaNpv"] ->Fill(tpu->npv,tpu->npv - tnopu->npv); // Does the number of NPV change? histograms["m_deltaPthat"]->Fill(tpu->pthat,tpu->pthat-tnopu->pthat); // pthat sanity check @@ -701,7 +703,7 @@ bool MatchEventsAndJets::FillHistograms(bool reduceHistograms) { JetCorrector->setJetEta(tpu->jteta->at(j1)); JetCorrector->setJetPt(tpu->jtpt->at(j1)); JetCorrector->setJetA(tpu->jtarea->at(j1)); - JetCorrector->setRho(tpu->rho); + JetCorrector->setRho(tpu->rho_hlt); double correction = JetCorrector->getCorrection(); //cout <jtpt->at(j1); tpu_jtpt_raw.push_back(tpu->jtpt->at(j1)); @@ -879,7 +881,7 @@ bool MatchEventsAndJets::FillHistograms(bool reduceHistograms) { if(!reduceHistograms) { dynamic_cast(histograms["p_off_etaVsNpv"]) ->Fill(tpu->jteta->at(jpu),tpu->npv,offset); - dynamic_cast(histograms["p_off_etaVsRho"]) ->Fill(tpu->jteta->at(jpu),tpu->rho,offset); + dynamic_cast(histograms["p_off_etaVsRho"]) ->Fill(tpu->jteta->at(jpu),tpu->rho_hlt,offset); dynamic_cast(histograms["p_off_etaVspueff"]) ->Fill(tpu->jteta->at(jpu),PUEff,offset); dynamic_cast(histograms["p_off_etaVsGenSumPtOA"]) ->Fill(tpu->jteta->at(jpu),GenSumPtOA,offset); dynamic_cast(histograms["p_off_etaVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->jtpt->at(jpu),offset); @@ -890,7 +892,7 @@ bool MatchEventsAndJets::FillHistograms(bool reduceHistograms) { //TNPU dynamic_cast(histograms["p_offOverA_etaVsTnpusVsJetPt"])->Fill(tpu->jteta->at(jpu),tpu->tnpus->at(iIT),tpu->refpt->at(jpu),offsetOA); dynamic_cast(histograms["p_PtAve_etaVsTnpusVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->tnpus->at(iIT),tpu->refpt->at(jpu),tpu->jtpt->at(jpu)); - dynamic_cast(histograms["p_RhoAve_etaVsTnpusVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->tnpus->at(iIT),tpu->refpt->at(jpu),tpu->rho); + dynamic_cast(histograms["p_RhoAve_etaVsTnpusVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->tnpus->at(iIT),tpu->refpt->at(jpu),tpu->rho_hlt); //NPU //dynamic_cast(histograms["p_offOverA_etaVsNpusVsJetPt"])->Fill(tpu->jteta->at(jpu),tpu->npus->at(iIT),tpu->refpt->at(jpu),offsetOA,1.0/TMath::Gaus(tpu->npus->at(iIT),20,sqrt(20))); @@ -898,22 +900,22 @@ bool MatchEventsAndJets::FillHistograms(bool reduceHistograms) { //dynamic_cast(histograms["p_RhoAve_etaVsNpusVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->npus->at(iIT),tpu->refpt->at(jpu),tpu->rho,1.0/TMath::Gaus(tpu->npus->at(iIT),20,sqrt(20))); dynamic_cast(histograms["p_offOverA_etaVsNpusVsJetPt"])->Fill(tpu->jteta->at(jpu),tpu->npus->at(iIT),tpu->refpt->at(jpu),offsetOA); dynamic_cast(histograms["p_PtAve_etaVsNpusVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->npus->at(iIT),tpu->refpt->at(jpu),tpu->jtpt->at(jpu)); - dynamic_cast(histograms["p_RhoAve_etaVsNpusVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->npus->at(iIT),tpu->refpt->at(jpu),tpu->rho); + dynamic_cast(histograms["p_RhoAve_etaVsNpusVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->npus->at(iIT),tpu->refpt->at(jpu),tpu->rho_hlt); //Rho - dynamic_cast(histograms["p_offOverA_etaVsRhoVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->rho,tpu->refpt->at(jpu),offsetOA); - dynamic_cast(histograms["p_RhoAve_etaVsRhoVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->rho,tpu->refpt->at(jpu),tpu->rho); - dynamic_cast(histograms["p_PtAve_etaVsRhoVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->rho,tpu->refpt->at(jpu),tpu->jtpt->at(jpu)); + dynamic_cast(histograms["p_offOverA_etaVsRhoVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->rho_hlt,tpu->refpt->at(jpu),offsetOA); + dynamic_cast(histograms["p_RhoAve_etaVsRhoVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->rho_hlt,tpu->refpt->at(jpu),tpu->rho_hlt); + dynamic_cast(histograms["p_PtAve_etaVsRhoVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->rho_hlt,tpu->refpt->at(jpu),tpu->jtpt->at(jpu)); //NPV dynamic_cast(histograms["p_offOverA_etaVsNPVVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->npv,tpu->refpt->at(jpu),offsetOA); - dynamic_cast(histograms["p_RhoAve_etaVsNPVVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->npv,tpu->refpt->at(jpu),tpu->rho); + dynamic_cast(histograms["p_RhoAve_etaVsNPVVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->npv,tpu->refpt->at(jpu),tpu->rho_hlt); dynamic_cast(histograms["p_PtAve_etaVsNPVVsJetPt"]) ->Fill(tpu->jteta->at(jpu),tpu->npv,tpu->refpt->at(jpu),tpu->jtpt->at(jpu)); if(!reduceHistograms) { //NPV+Rho - dynamic_cast(histograms["p_offOverA_etaVsN_RVsJetPt"]) ->Fill(tpu->jteta->at(jpu),(tpu->rho+tpu->npv)/2.,tpu->refpt->at(jpu),offsetOA); - dynamic_cast(histograms["p_PtAve_etaVsN_RVsJetPt"]) ->Fill(tpu->jteta->at(jpu),(tpu->rho+tpu->npv)/2,tpu->refpt->at(jpu),tpu->jtpt->at(jpu)); + dynamic_cast(histograms["p_offOverA_etaVsN_RVsJetPt"]) ->Fill(tpu->jteta->at(jpu),(tpu->rho_hlt+tpu->npv)/2.,tpu->refpt->at(jpu),offsetOA); + dynamic_cast(histograms["p_PtAve_etaVsN_RVsJetPt"]) ->Fill(tpu->jteta->at(jpu),(tpu->rho_hlt+tpu->npv)/2,tpu->refpt->at(jpu),tpu->jtpt->at(jpu)); histograms["p_areaVsrefpt"]->Fill(tpu->refpt->at(jpu),areaDiff); if (tpu->refpt->at(jpu)>1000) histograms["p_areaVsoffset_1000"]->Fill(offset,areaDiff); @@ -925,10 +927,10 @@ bool MatchEventsAndJets::FillHistograms(bool reduceHistograms) { histograms["m_refpdgid_diff"]->Fill(diff_pdgid); //2D histo npv vs. rho with 15 15 && offset < 15.5) histograms["p_npvVsRho_offset_15_15h"]->Fill(tpu->rho,tpu->npv); + if (offset > 15 && offset < 15.5) histograms["p_npvVsRho_offset_15_15h"]->Fill(tpu->rho_hlt,tpu->npv); if (idet == 0) { - dynamic_cast(histograms["p_rho_npv_refpt_BB"]) ->Fill(tpu->rho,tpu->npv,tpu->refpt->at(jpu)); - dynamic_cast(histograms["p_offsetOA_rho_npv_refpt_BB"])->Fill(tpu->rho,tpu->npv,tpu->refpt->at(jpu),offsetOA); + dynamic_cast(histograms["p_rho_npv_refpt_BB"]) ->Fill(tpu->rho_hlt,tpu->npv,tpu->refpt->at(jpu)); + dynamic_cast(histograms["p_offsetOA_rho_npv_refpt_BB"])->Fill(tpu->rho_hlt,tpu->npv,tpu->refpt->at(jpu),offsetOA); } } @@ -1028,13 +1030,13 @@ bool MatchEventsAndJets::FillHistograms(bool reduceHistograms) { hname = Form("p_npvVsOff_%s",detectorAbbreviation.Data()); histograms[hname]->Fill(avg_offset_det[det],tpu->npv); hname = Form("p_rhoVsOff_%s",detectorAbbreviation.Data()); - histograms[hname]->Fill(avg_offset_det[det],tpu->rho); + histograms[hname]->Fill(avg_offset_det[det],tpu->rho_hlt); } } if(!reduceHistograms) { histograms["p_npvVsoff"] ->Fill(avg_offset,tpu->npv); - histograms["p_rhoVsoff"] ->Fill(avg_offset,tpu->rho); - histograms["p_rhoVsRho"] ->Fill(tpu->rho,tpu->rho); + histograms["p_rhoVsoff"] ->Fill(avg_offset,tpu->rho_hlt); + histograms["p_rhoVsRho"] ->Fill(tpu->rho_hlt,tpu->rho_hlt); histograms["p_npvVsNpv"] ->Fill(tpu->npv,tpu->npv); histograms["p_tnpuVsTnpu"] ->Fill(tpu->tnpus->at(iIT),tpu->tnpus->at(iIT)); histograms["p_npuVsNpu"] ->Fill(tpu->npus->at(iIT),tpu->npus->at(iIT)); @@ -1075,22 +1077,24 @@ int main(int argc,char**argv) { CommandLine cl; if (!cl.parse(argc,argv)) return 0; - TString samplePU = cl.getValue ("samplePU"); - TString sampleNoPU = cl.getValue ("sampleNoPU"); - TString basepath = cl.getValue ("basepath", "/fdata/hepx/store/user/aperloff/"); - TString algo1 = cl.getValue ("algo1", "ak5pf"); - TString algo2 = cl.getValue ("algo2", "ak5pf"); + TString samplePU = cl.getValue ("samplePU", "QCDHLT/QCD_Pt-15to3000_TuneCUETP8M1_Flat_13TeV_pythia8/crab_QCDHLTJEC/161129_150822/0000/JRA_1.root"); + TString sampleNoPU = cl.getValue ("sampleNoPU", "QCDHLT_NoPU/QCD_Pt-15to3000_TuneCUETP8M1_Flat_13TeV_pythia8/crab_QCDHLTJECNoPU/161129_041315/0000/JRA_1.root"); + TString basepath = cl.getValue ("basepath", "/afs/cern.ch/user/f/fengwang/eos/cms/store/user/fengwang/"); + TString algo1 = cl.getValue ("algo1", "ak4pfHLT"); + TString algo2 = cl.getValue ("algo2", "ak4pfHLT"); + TString order1 = cl.getValue ("order1", "0"); + TString order2 = cl.getValue ("order2", "0"); bool iftest = cl.getValue ("iftest", false); int maxEvts = cl.getValue ("maxEvts", 40000); bool ApplyJEC = cl.getValue ("ApplyJEC", false); - string JECpar = cl.getValue ("JECpar", "parameters_ak5pf.txt"); + string JECpar = cl.getValue ("JECpar", "parameters_ak4pfHLT.txt"); bool runDep = cl.getValue ("runDep", true); TString outputPath = cl.getValue ("outputPath", "./"); TString treeName = cl.getValue ("treeName", "t"); int npvRhoNpuBinWidth = cl.getValue ("npvRhoNpuBinWidth", 5); int NBinsNpvRhoNpu = cl.getValue ("NBinsNpvRhoNpu", 6); vector vptBins = cl.getVector ("vptBins", "14:::18:::20:::24:::28:::30"); - bool reduceHistograms = cl.getValue ("reduceHistograms", true); + bool reduceHistograms = cl.getValue ("reduceHistograms", false); bool verbose = cl.getValue ("verbose", false); if (!cl.check()) return 0; @@ -1111,7 +1115,7 @@ int main(int argc,char**argv) mej->OpenInputFiles(basepath+samplePU,basepath+sampleNoPU); mej->GetNtuples(treeName); mej->MakeMatchedEventsMaps(treeName); - mej->OpenOutputFile(outputPath); + mej->OpenOutputFile(outputPath,order1,order2); if (ApplyJEC) { cout << "jet_synchtest_x::Setting the JEC parameter file to " << JECpar << " ... "; mej->SetJEC(JECpar); diff --git a/JetAnalyzers/test/Scripts/L1Hadd.sh b/JetAnalyzers/test/Scripts/L1Hadd.sh new file mode 100755 index 00000000..03ffbc95 --- /dev/null +++ b/JetAnalyzers/test/Scripts/L1Hadd.sh @@ -0,0 +1,59 @@ +#!/bin/bash +export SCRAM_ARCH=slc6_amd64_gcc491 +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +eval $(scramv1 runtime -sh) +cd JetMETAnalysis/JetAnalyzers/test/ + +inpath="/store/group/phys_jetmet/fengwang/HLTBX25JECL1/" +outpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/test/" + +num=$1 +outfile="L1Prefile_" +list="list_" + +if [ $num -eq 1 ]; then + outfile=$outfile"ak4caloHLT_" + list=$list"ak4caloHLT.txt" +elif [ $num -eq 2 ]; then + outfile=$outfile"ak4pfHLT_" + list=$list"ak4pfHLT.txt" +elif [ $num -eq 3 ]; then + outfile=$outfile"ak8caloHLT_" + list=$list"ak8caloHLT.txt" +else + outfile=$outfile"ak8pfHLT_" + list=$list"ak8pfHLT.txt" +fi + +num1=0 +num2=1 + +while read file +do + label=`printf $num1` + label2=`printf $num2` + + if [ $num1 -eq 0 ]; then + infile=$inpath$file + echo $infile + printf "Copy file from eos to local directory ..." + cmsStage $infile $outpath + mv $outpath$file $outpath$outfile$label2".root" + else + infile1=$outpath$outfile$label".root" + infile2=$inpath$file + echo $infile1 + echo $infile2 + printf "Copy file from eos to local directory ..." + cmsStage $infile2 $outpath + printf "Hadd source files ..." + hadd $outpath$outfile$label2".root" $outpath$outfile$label".root" $outpath$file + printf "Hadd finish!!!" + rm $outpath$outfile$label".root" + rm $outpath$file + fi + + (( num1 += 1 )) + (( num2 += 1 )) + +done < $list diff --git a/JetAnalyzers/test/Scripts/L1batch.sh b/JetAnalyzers/test/Scripts/L1batch.sh new file mode 100755 index 00000000..ac80b29f --- /dev/null +++ b/JetAnalyzers/test/Scripts/L1batch.sh @@ -0,0 +1,60 @@ +#!/bin/bash +export SCRAM_ARCH=slc6_amd64_gcc491 +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +eval $(scramv1 runtime -sh) +cd JetMETAnalysis/JetAnalyzers/test/ + +confpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/config/" +inpath="/store/user/fengwang/QCDHLT" +midpath="/tmp/fengwang" +outpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" + +num=$1 +filelist="list$num.txt" + +string="JRA_L1_" +string2="jra_L1_" +string3="jra_L1-MergeEta_" +string4="jra_L1-MergePt_" + +confile="jra_dr_finebinning.config" +confile2="jra_QCDflat_MergeEta.config" +confile3="jra_Eta_finebinning.config" + +iter=$(($num * 1000)) + +while read file +do + echo $file + label=`printf $iter` + outfile="$string$label.root" + outfile2="$string2$label.root" + outfile3="$string3$label.root" + outfile4="$string4$label.root" + + printf "Copy file from eos to tmp..." + cmsStage $inpath/$file $midpath/ + + jet_apply_jec_x -input $midpath/$file -output $midpath/$outfile -era EcalMultifitHCALMethod3 -levels 1 -jecpath ./JECTag_EcalMultifit_HCALMethod3/ -algs ak4pfHLT ak4caloHLT ak8pfHLT ak8caloHLT + + jet_response_analyzer_x $confpath/$confile -input $midpath/$outfile -output $midpath/$outfile2 -nbinsabsrsp 0 -nbinsetarsp 0 -nbinsphirsp 0 -algs ak4pfHLTl1 ak4caloHLTl1 ak8pfHLTl1 ak8caloHLTl1 + + jet_response_analyzer_x $confpath/$confile2 -input $midpath/$outfile -output $midpath/$outfile3 -nbinsabsrsp 0 -nbinsetarsp 0 -nbinsphirsp 0 -algs ak4pfHLTl1 ak4caloHLTl1 ak8pfHLTl1 ak8caloHLTl1 + + jet_response_analyzer_x $confpath/$confile3 -input $midpath/$outfile -output $midpath/$outfile4 -nbinsabsrsp 0 -nbinsetarsp 0 -nbinsphirsp 0 -algs ak4pfHLTl1 ak4caloHLTl1 ak8pfHLTl1 ak8caloHLTl1 + + printf "Copy file from tmp back to eos..." + cmsStage $midpath/$outfile $outpath/ + cmsStage $midpath/$outfile2 $outpath/ + cmsStage $midpath/$outfile3 $outpath/ + cmsStage $midpath/$outfile4 $outpath/ + + rm -rf $midpath/$file + rm -rf $midpath/$outfile + rm -rf $midpath/$outfile2 + rm -rf $midpath/$outfile3 + rm -rf $midpath/$outfile4 + + (( iter += 1 )) + +done < $filelist diff --git a/JetAnalyzers/test/Scripts/L2batch.sh b/JetAnalyzers/test/Scripts/L2batch.sh new file mode 100755 index 00000000..3f0cca03 --- /dev/null +++ b/JetAnalyzers/test/Scripts/L2batch.sh @@ -0,0 +1,37 @@ +#!/bin/bash +export SCRAM_ARCH=slc6_amd64_gcc491 +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +eval $(scramv1 runtime -sh) +cd JetMETAnalysis/JetAnalyzers/test/ + +inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" +midpath="/tmp/fengwang" +outpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" + +num=$1 +filelist="list$num.txt" + +string="JRA_L1L2_" + +iter=$(($num * 1000)) + +while read file +do + echo $file + label=`printf $iter` + outfile="$string$label.root" + + printf "Copy file from eos to tmp..." + cmsStage $inpath/$file $midpath/ + + jet_apply_jec_x -input $midpath/$file -output $midpath/$outfile -era EcalMultifitHCALMethod3 -levels 2 -jecpath ./JECTag_EcalMultifit_HCALMethod3/ -algs ak4pfHLTl1 ak4caloHLTl1 ak8pfHLTl1 ak8caloHLTl1 + + printf "Copy file from tmp back to eos..." + cmsStage $midpath/$outfile $outpath/ + + rm -rf $midpath/$file + rm -rf $midpath/$outfile + + (( iter += 1 )) + +done < $filelist diff --git a/JetAnalyzers/test/Scripts/L3batch.sh b/JetAnalyzers/test/Scripts/L3batch.sh new file mode 100755 index 00000000..8f1b966b --- /dev/null +++ b/JetAnalyzers/test/Scripts/L3batch.sh @@ -0,0 +1,60 @@ +#!/bin/bash +export SCRAM_ARCH=slc6_amd64_gcc491 +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +eval $(scramv1 runtime -sh) +cd JetMETAnalysis/JetAnalyzers/test/ + +confpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/config" +inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" +midpath="/tmp/fengwang" +outpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" + +num=$1 +filelist="list$num.txt" + +string="JRA_L1L2L3_" +string1="jra_L1L2L3_" +string2="jra_L1L2L3-MergeEta_" +string3="jra_L1L2L3-MergePt_" + +confile1="jra_dr_finebinning.config" +confile2="jra_QCDflat_MergeEta.config" +confile3="jra_Eta_finebinning.config" + +iter=$(($num * 1000)) + +while read file +do + echo $file + label=`printf $iter` + outfile="$string$label.root" + outfile1="$string1$label.root" + outfile2="$string2$label.root" + outfile3="$string3$label.root" + + printf "Copy file from eos to tmp..." + cmsStage $inpath/$file $midpath/ + + jet_apply_jec_x -input $midpath/$file -output $midpath/$outfile -era EcalMultifitHCALMethod3 -levels 3 -jecpath ./JECTag_EcalMultifit_HCALMethod3/ -algs ak4pfHLTl1l2 ak4caloHLTl1l2 ak8pfHLTl1l2 ak8caloHLTl1l2 + + jet_response_analyzer_x $confpath/$confile1 -input $midpath/$outfile -output $midpath/$outfile1 -nbinsabsrsp 0 -nbinsetarsp 0 -nbinsphirsp 0 -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 ak8pfHLTl1l2l3 ak8caloHLTl1l2l3 + + jet_response_analyzer_x $confpath/$confile2 -input $midpath/$outfile -output $midpath/$outfile2 -nbinsabsrsp 0 -nbinsetarsp 0 -nbinsphirsp 0 -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 ak8pfHLTl1l2l3 ak8caloHLTl1l2l3 + + jet_response_analyzer_x $confpath/$confile3 -input $midpath/$outfile -output $midpath/$outfile3 -nbinsabsrsp 0 -nbinsetarsp 0 -nbinsphirsp 0 -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 ak8pfHLTl1l2l3 ak8caloHLTl1l2l3 + + printf "Copy file from tmp back to eos..." + cmsStage $midpath/$outfile $outpath/ + cmsStage $midpath/$outfile1 $outpath/ + cmsStage $midpath/$outfile2 $outpath/ + cmsStage $midpath/$outfile3 $outpath/ + + rm -rf $midpath/$file + rm -rf $midpath/$outfile + rm -rf $midpath/$outfile1 + rm -rf $midpath/$outfile2 + rm -rf $midpath/$outfile3 + + (( iter += 1 )) + +done < $filelist diff --git a/JetAnalyzers/test/Scripts/MergeEta.sh b/JetAnalyzers/test/Scripts/MergeEta.sh new file mode 100644 index 00000000..87890400 --- /dev/null +++ b/JetAnalyzers/test/Scripts/MergeEta.sh @@ -0,0 +1,3 @@ +jet_response_fitter_x -input ./HLTBX25JEC/jra_L1L2L3_MergeEta.root -output ./HLTBX25JEC/jra_L1L2L3_MergeEta_f.root + +jet_response_and_resolution_x -input ./HLTBX25JEC/jra_L1L2L3_MergeEta_f.root -output ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergeEta_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 ak8pfHLTl1l2l3 ak8caloHLTl1l2l3 diff --git a/JetAnalyzers/test/Scripts/MergePt.sh b/JetAnalyzers/test/Scripts/MergePt.sh new file mode 100644 index 00000000..c721cc0e --- /dev/null +++ b/JetAnalyzers/test/Scripts/MergePt.sh @@ -0,0 +1,3 @@ +jet_response_fitter_x -input ./HLTBX25JEC/jra_L1L2L3_MergePt.root -output ./HLTBX25JEC/jra_L1L2L3_MergePt_f.root + +jet_response_and_resolution_x -input ./HLTBX25JEC/jra_L1L2L3_MergePt_f.root -output ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 ak8pfHLTl1l2l3 ak8caloHLTl1l2l3 diff --git a/JetAnalyzers/test/Scripts/MultiGraph.sh b/JetAnalyzers/test/Scripts/MultiGraph.sh new file mode 100644 index 00000000..5a30fce9 --- /dev/null +++ b/JetAnalyzers/test/Scripts/MultiGraph.sh @@ -0,0 +1,29 @@ +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelResVsJetEta:RefPt@10 -xmin -5 -xmax 5 -ymin 0.2 -ymax 0.8 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelResVsJetEta:RefPt@30 -xmin -5 -xmax 5 -ymin 0 -ymax 0.4 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelResVsJetEta:RefPt@50 -xmin -5 -xmax 5 -ymin 0 -ymax 0.4 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergeEta_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelResVsRefPt:JetEta@0.0 -xmin 10 -xmax 1000 -ymin 0 -ymax 0.6 -logx true + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergeEta_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelResVsRefPt:JetEta@1.3 -xmin 10 -xmax 500 -ymin 0 -ymax 0.6 -logx true + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergeEta_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelResVsRefPt:JetEta@3.0 -xmin 10 -xmax 300 -ymin 0 -ymax 0.6 -logx true + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsTrueNPU:RefPt@10 -xmin 0 -xmax 70 -ymin 0.95 -ymax 1.25 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsTrueNPU:RefPt@30 -xmin 0 -xmax 70 -ymin 0.95 -ymax 1.25 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsTrueNPU:RefPt@50 -xmin 0 -xmax 70 -ymin 0.95 -ymax 1.25 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsJetEta:RefPt@10 -xmin -5 -xmax 5 -ymin 0.95 -ymax 1.25 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsJetEta:RefPt@30 -xmin -5 -xmax 5 -ymin 0.95 -ymax 1.15 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsJetEta:RefPt@50 -xmin -5 -xmax 5 -ymin 0.95 -ymax 1.05 + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergeEta_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsRefPt:JetEta@0.0 -xmin 10 -xmax 1000 -ymin 0.95 -ymax 1.2 -logx true + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergeEta_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsRefPt:JetEta@1.3 -xmin 10 -xmax 500 -ymin 0.95 -ymax 1.2 -logx true + +jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergeEta_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelRspVsRefPt:JetEta@3.0 -xmin 10 -xmax 300 -ymin 0.95 -ymax 1.2 -logx true diff --git a/JetAnalyzers/test/Scripts/PreL1batch.sh b/JetAnalyzers/test/Scripts/PreL1batch.sh new file mode 100755 index 00000000..ea1ebe56 --- /dev/null +++ b/JetAnalyzers/test/Scripts/PreL1batch.sh @@ -0,0 +1,63 @@ +#!/bin/bash +export SCRAM_ARCH=slc6_amd64_gcc491 +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +eval $(scramv1 runtime -sh) +cd JetMETAnalysis/JetAnalyzers/test/ + +inpath="/store/user/fengwang/QCDHLT/" +inpath2="/store/user/fengwang/QCDHLT_NoPU/" +midpath="/tmp/fengwang/" +outpath="/store/group/phys_jetmet/fengwang/HLTBX25JECL1/" + +num=$1 +label=`printf $num` +prefix="JRA_" +string="PU_" +num2=1 + +outstring1="output_ak4caloHLT_" +outstring2="output_ak4pfHLT_" +outstring3="output_ak8caloHLT_" +outstring4="output_ak8pfHLT_" + +while read file +do + infile="$prefix$label.root" + midfile="$prefix$string$label.root" + + echo $infile + echo $midfile + echo $file + printf "Copy file from eos to tmp..." + cmsStage $inpath$infile $midpath + mv $midpath$infile $midpath$midfile + cmsStage $inpath2$file $midpath + + label2=`printf $num2` + + jet_synchtest_x -basepath $midpath -samplePU $midfile -sampleNoPU $file -algo1 ak4caloHLT -algo2 ak4caloHLT -order1 $label -order2 $label2 + jet_synchtest_x -basepath $midpath -samplePU $midfile -sampleNoPU $file -algo1 ak4pfHLT -algo2 ak4pfHLT -order1 $label -order2 $label2 + jet_synchtest_x -basepath $midpath -samplePU $midfile -sampleNoPU $file -algo1 ak8caloHLT -algo2 ak8caloHLT -order1 $label -order2 $label2 + jet_synchtest_x -basepath $midpath -samplePU $midfile -sampleNoPU $file -algo1 ak8pfHLT -algo2 ak8pfHLT -order1 $label -order2 $label2 + + outfile1=$outstring1$label"_"$label2".root" + outfile2=$outstring2$label"_"$label2".root" + outfile3=$outstring3$label"_"$label2".root" + outfile4=$outstring4$label"_"$label2".root" + + printf "Copy file from tmp back to eos..." + cmsStage ./$outfile1 $outpath/ + cmsStage ./$outfile2 $outpath/ + cmsStage ./$outfile3 $outpath/ + cmsStage ./$outfile4 $outpath/ + + rm -rf $midpath/$midfile + rm -rf $midpath/$file + rm -rf ./$outfile1 + rm -rf ./$outfile2 + rm -rf ./$outfile3 + rm -rf ./$outfile4 + + (( num2 += 1 )) + +done < list.txt diff --git a/JetAnalyzers/test/Scripts/PrejraHadd.sh b/JetAnalyzers/test/Scripts/PrejraHadd.sh new file mode 100755 index 00000000..1d872f61 --- /dev/null +++ b/JetAnalyzers/test/Scripts/PrejraHadd.sh @@ -0,0 +1,57 @@ +#!/bin/bash +export SCRAM_ARCH=slc6_amd64_gcc491 +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +eval $(scramv1 runtime -sh) +cd JetMETAnalysis/JetAnalyzers/test/ + +inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC/" +outpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/test/" + +num=$1 +outfile="jraPrefile_L1_" +list="list_" + +if [ $num -eq 1 ]; then + outfile=$outfile"fineBinning_" + list=$list"fineBinning.txt" +elif [ $num -eq 2 ]; then + outfile=$outfile"MergeEta_" + list=$list"MergeEta.txt" +else + outfile=$outfile"MergePt_" + list=$list"MergePt.txt" +fi + + +num1=0 +num2=1 + +while read file +do + label=`printf $num1` + label2=`printf $num2` + + if [ $num1 -eq 0 ]; then + infile=$inpath$file + echo $infile + printf "Copy file from eos to local directory ..." + cmsStage $infile $outpath + mv $outpath$file $outpath$outfile$label2".root" + else + infile1=$outpath$outfile$label".root" + infile2=$inpath$file + echo $infile1 + echo $infile2 + printf "Copy file from eos to local directory ..." + cmsStage $infile2 $outpath + printf "Hadd source files ..." + hadd $outpath$outfile$label2".root" $outpath$outfile$label".root" $outpath$file + printf "Hadd finish!!!" + rm $outpath$outfile$label".root" + rm $outpath$file + fi + + (( num1 += 1 )) + (( num2 += 1 )) + +done < $list diff --git a/JetAnalyzers/test/Scripts/deterjec.sh b/JetAnalyzers/test/Scripts/deterjec.sh new file mode 100644 index 00000000..6a27c22d --- /dev/null +++ b/JetAnalyzers/test/Scripts/deterjec.sh @@ -0,0 +1,17 @@ +jet_response_fitter_x -input ./HLTBX25JEC/jra_L1.root -output ./HLTBX25JEC/jra_L1_f.root + +jet_l3_correction_x -input ./HLTBX25JEC/jra_L1_f.root -era EcalMultifitHCALMethod3 -algs ak4pfHLTl1 ak4caloHLTl1 ak8pfHLTl1 ak8caloHLTl1 -output ./HLTBX25JEC/l3.root + +jet_l2_correction_x -input ./HLTBX25JEC/jra_L1_f.root -l3input ./HLTBX25JEC/l3.root -output ./HLTBX25JEC/l2.root -era EcalMultifitHCALMethod3 -algs ak4pfHLTl1 ak4caloHLTl1 ak8pfHLTl1 ak8caloHLTl1 + +rm EcalMultifitHCALMethod3_L3Absolute_AK4PFHLTl1.txt +rm EcalMultifitHCALMethod3_L3Absolute_AK4CaloHLTl1.txt +rm EcalMultifitHCALMethod3_L3Absolute_AK8PFHLTl1.txt +rm EcalMultifitHCALMethod3_L3Absolute_AK8CaloHLTl1.txt + +mv EcalMultifitHCALMethod3_L2Relative_AK4PFHLTl1.txt JECTag_EcalMultifit_HCALMethod3/ +mv EcalMultifitHCALMethod3_L2Relative_AK4CaloHLTl1.txt JECTag_EcalMultifit_HCALMethod3/ +mv EcalMultifitHCALMethod3_L2Relative_AK8PFHLTl1.txt JECTag_EcalMultifit_HCALMethod3/ +mv EcalMultifitHCALMethod3_L2Relative_AK8CaloHLTl1.txt JECTag_EcalMultifit_HCALMethod3/ + +rm -rf L3*.png diff --git a/JetAnalyzers/test/Scripts/jraHadd.sh b/JetAnalyzers/test/Scripts/jraHadd.sh new file mode 100755 index 00000000..e61dad59 --- /dev/null +++ b/JetAnalyzers/test/Scripts/jraHadd.sh @@ -0,0 +1,57 @@ +#!/bin/bash +export SCRAM_ARCH=slc6_amd64_gcc491 +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +eval $(scramv1 runtime -sh) +cd JetMETAnalysis/JetAnalyzers/test/ + +inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC/" +outpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/test/" + +num=$1 +outfile="jraPrefile_L1L2L3_" +list="list_" + +if [ $num -eq 1 ]; then + outfile=$outfile"fineBinning_" + list=$list"fineBinning.txt" +elif [ $num -eq 2 ]; then + outfile=$outfile"MergeEta_" + list=$list"MergeEta.txt" +else + outfile=$outfile"MergePt_" + list=$list"MergePt.txt" +fi + + +num1=0 +num2=1 + +while read file +do + label=`printf $num1` + label2=`printf $num2` + + if [ $num1 -eq 0 ]; then + infile=$inpath$file + echo $infile + printf "Copy file from eos to local directory ..." + cmsStage $infile $outpath + mv $outpath$file $outpath$outfile$label2".root" + else + infile1=$outpath$outfile$label".root" + infile2=$inpath$file + echo $infile1 + echo $infile2 + printf "Copy file from eos to local directory ..." + cmsStage $infile2 $outpath + printf "Hadd source files ..." + hadd $outpath$outfile$label2".root" $outpath$outfile$label".root" $outpath$file + printf "Hadd finish!!!" + rm $outpath$outfile$label".root" + rm $outpath$file + fi + + (( num1 += 1 )) + (( num2 += 1 )) + +done < $list diff --git a/JetAnalyzers/test/Scripts/jrabatch.sh b/JetAnalyzers/test/Scripts/jrabatch.sh new file mode 100755 index 00000000..cff78a7f --- /dev/null +++ b/JetAnalyzers/test/Scripts/jrabatch.sh @@ -0,0 +1,40 @@ +#!/bin/bash +export SCRAM_ARCH=slc6_amd64_gcc491 +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +eval $(scramv1 runtime -sh) +cd JetMETAnalysis/JetAnalyzers/test/ + +confpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/config" +inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" +midpath="/tmp/fengwang" +outpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" + +num=$1 +filelist="list$num.txt" + +string="jra_L1L2L3_" + +confile="jra_dr_finebinning.config" + +iter=$(($num * 1000)) + +while read file +do + echo $file + label=`printf $iter` + outfile="$string$label.root" + + printf "Copy file from eos to tmp..." + cmsStage $inpath/$file $midpath/ + + jet_response_analyzer_x $confpath/$confile -input $midpath/$file -output $midpath/$outfile -nbinsabsrsp 0 -nbinsetarsp 0 -nbinsphirsp 0 -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 ak8pfHLTl1l2l3 ak8caloHLTl1l2l3 + + printf "Copy file from tmp back to eos..." + cmsStage $midpath/$outfile $outpath/ + + rm -rf $midpath/$file + rm -rf $midpath/$outfile + + (( iter += 1 )) + +done < $filelist diff --git a/JetAnalyzers/test/Scripts/prolist.sh b/JetAnalyzers/test/Scripts/prolist.sh new file mode 100644 index 00000000..ec6a2e5d --- /dev/null +++ b/JetAnalyzers/test/Scripts/prolist.sh @@ -0,0 +1,61 @@ +#!/bin/bash +source /afs/cern.ch/project/eos/installation/cms/etc/setup.sh + +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JECL1/output_ak4caloHLT*.root > list_ak4caloHLT.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JECL1/output_ak4pfHLT*.root > list_ak4pfHLT.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JECL1/output_ak8caloHLT*.root > list_ak8caloHLT.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JECL1/output_ak8pfHLT*.root > list_ak8pfHLT.txt + + +#eos ls /store/user/fengwang/QCDHLT/JRA_1*.root > list1.txt +#eos ls /store/user/fengwang/QCDHLT/JRA_2*.root > list2.txt +#eos ls /store/user/fengwang/QCDHLT/JRA_3*.root > list3.txt +#eos ls /store/user/fengwang/QCDHLT/JRA_4*.root > list4.txt +#eos ls /store/user/fengwang/QCDHLT/JRA_5*.root > list5.txt +#eos ls /store/user/fengwang/QCDHLT/JRA_6*.root > list6.txt +#eos ls /store/user/fengwang/QCDHLT/JRA_7*.root > list7.txt +#eos ls /store/user/fengwang/QCDHLT/JRA_8*.root > list8.txt +#eos ls /store/user/fengwang/QCDHLT/JRA_9*.root > list9.txt + + +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1_*.root > list_fineBinning.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1-MergeEta_*.root > list_MergeEta.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1-MergePt_*.root > list_MergePt.txt + + +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_1*.root > list1.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_2*.root > list2.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_3*.root > list3.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_4*.root > list4.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_5*.root > list5.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_6*.root > list6.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_7*.root > list7.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_8*.root > list8.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_9*.root > list9.txt + + +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_1*.root > list1.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_2*.root > list2.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_3*.root > list3.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_4*.root > list4.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_5*.root > list5.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_6*.root > list6.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_7*.root > list7.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_8*.root > list8.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_9*.root > list9.txt + + +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_1*.root > list1.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_2*.root > list2.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_3*.root > list3.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_4*.root > list4.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_5*.root > list5.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_6*.root > list6.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_7*.root > list7.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_8*.root > list8.txt +#eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_9*.root > list9.txt + + +eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1L2L3_*.root > list_fineBinning.txt +eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1L2L3-MergeEta_*.root > list_MergeEta.txt +eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1L2L3-MergePt_*.root > list_MergePt.txt diff --git a/JetAnalyzers/test/crab.py b/JetAnalyzers/test/crab.py new file mode 100644 index 00000000..1dccbd2f --- /dev/null +++ b/JetAnalyzers/test/crab.py @@ -0,0 +1,16 @@ +from CRABClient.UserUtilities import config, getUsernameFromSiteDB + +config = config() +config.General.requestName = 'QCDHLTJEC' +config.General.transferOutputs = True +config.General.transferLogs = False +config.JobType.pluginName = 'Analysis' +config.JobType.psetName = 'run_JRA_hlt_cfg.py' +config.JobType.maxJobRuntimeMin = 2800 +config.Data.inputDataset = '/QCD_Pt-15to3000_TuneCUETP8M1_Flat_13TeV_pythia8/fengwang-Fall16HLTJEC_80X_FlatPU0to70HcalNZSRAW_v1-afe01c608037eee01c6ee6bf3906eb29/USER' +config.Data.inputDBS = 'phys03' +config.Data.splitting = 'FileBased' +config.Data.unitsPerJob = 6 +config.Data.outLFNDirBase = '/store/user/fengwang/QCDHLT/' +config.Data.publication = False +config.Site.storageSite = 'T2_CH_CERN' diff --git a/JetAnalyzers/test/runJRAtauNtupleProd_cfg.py b/JetAnalyzers/test/runJRAtauNtupleProd_cfg.py deleted file mode 100644 index 85cdab5f..00000000 --- a/JetAnalyzers/test/runJRAtauNtupleProd_cfg.py +++ /dev/null @@ -1,89 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -#! -#! JET & REFERENCE KINEMATIC CUTS -#! -import JetMETAnalysis.JetAnalyzers.Defaults_cff as Defaults - -Defaults.JetPtEta = cms.PSet( - etaMin = cms.double(-2.5), - etaMax = cms.double(+2.5), - ptMin = cms.double(15.0) -) -Defaults.RefPtEta = cms.PSet( - etaMin = cms.double(-2.5), - etaMax = cms.double(+2.5), - ptMin = cms.double(15.0) -) -Defaults.JetResponseParameters.doComposition = True -Defaults.JetResponseParameters.deltaRMax = cms.double(0.5) - -#! -#! PROCESS -#! -process = cms.Process("JRAtau") - - -#! -#! CONDITIONS (DELIVERING JEC BY DEFAULT!) -#! -process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.GlobalTag.globaltag = "PHYS14_25_V2::All" - - -#! -#! INPUT -#! -tauFiles = cms.untracked.vstring( - 'file:TTbarH_HToTauTau_M-125_13TeV_AODSIM.root' -) - -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(100)) -process.source = cms.Source("PoolSource", fileNames = tauFiles ) - - -#! -#! SERVICES -#! -process.load('FWCore.MessageLogger.MessageLogger_cfi') -process.MessageLogger.cerr.FwkReport.reportEvery = 1000 -process.load('CommonTools.UtilAlgos.TFileService_cfi') -process.TFileService.fileName=cms.string('ntupleJRAtau_Ztautau.root') - - -#! -#! CHOOSE ALGORITHMS -#! -from JetMETAnalysis.JetAnalyzers.addAlgorithm import addAlgorithm - -algorithms = [] -algorithms.append('ak5tauHPSlooseCombDBcorrAll') -algorithms.append('ak5tauHPSlooseCombDBcorrOneProng0Pi0') -algorithms.append('ak5tauHPSlooseCombDBcorrOneProng1Pi0') -algorithms.append('ak5tauHPSlooseCombDBcorrOneProng2Pi0') -algorithms.append('ak5tauHPSlooseCombDBcorrThreeProng0Pi0') -algorithms.append('ak5tauHPSmediumCombDBcorrAll') -algorithms.append('ak5tauHPSmediumCombDBcorrOneProng0Pi0') -algorithms.append('ak5tauHPSmediumCombDBcorrOneProng1Pi0') -algorithms.append('ak5tauHPSmediumCombDBcorrOneProng2Pi0') -algorithms.append('ak5tauHPSmediumCombDBcorrThreeProng0Pi0') -algorithms.append('ak5tauHPStightCombDBcorrAll') -algorithms.append('ak5tauHPStightCombDBcorrOneProng0Pi0') -algorithms.append('ak5tauHPStightCombDBcorrOneProng1Pi0') -algorithms.append('ak5tauHPStightCombDBcorrOneProng2Pi0') -algorithms.append('ak5tauHPStightCombDBcorrThreeProng0Pi0') - - -# set to False to use jets/taus from the input file (NOT RECOMMENDED) -doJetReco = True - -for algorithm in algorithms: - addAlgorithm(process, algorithm, Defaults, doJetReco, False) - - -#! -#! THAT'S ALL! CAN YOU BELIEVE IT? :-D -#! - -processDumpFile = open('runJRAtauNtupleProd.dump' , 'w') -print >> processDumpFile, process.dumpPython() diff --git a/JetAnalyzers/test/runJRAtauWorkflow.py b/JetAnalyzers/test/runJRAtauWorkflow.py deleted file mode 100755 index 9f688cb8..00000000 --- a/JetAnalyzers/test/runJRAtauWorkflow.py +++ /dev/null @@ -1,526 +0,0 @@ -#!/usr/bin/env python - -#from TauAnalysis.TauIdEfficiency.tools.buildConfigFilesTauIdEffAnalysis import buildConfigFile_hadd - -import os -import re - -version = 'v1_2enRecoveryCBa' -era = 'TauJec11V1' - -#inputFilePath = '/data2/veelken/CMSSW_4_2_x/JRAtauNtuples/Ztautau/v1_2enRecovery/' \ -# + 'user/v/veelken/CMSSW_4_2_x/JRAtauNtuples/Ztautau/v1_2enRecovery' -inputFilePath = '/hdfs/cms/store/user/calpas/DYJetsToLL_M-50_13TeV-madgraph-pythia8/DYJetsToLL_M-50_13TeV-madgraph-pythia8_TransferFunc_v1/a683f4f5fc0a3cbafdd5a17e17e4babe/' - -#outputFilePath = '/data1/veelken/tmp/JRAtau/%s' % version -outputFilePath = '/home/calpas/TransferFunction/CMSSW_7_2_5/src/JetMETAnalysis/JetAnalyzers/test/JRAtau/%s' % version - -samplesToAnalyze = [ - 'Ztautau' -] - -algorithms = [ - 'ak5tauHPSlooseCombDBcorrAll', - 'ak5tauHPSlooseCombDBcorrOneProng0Pi0', - 'ak5tauHPSlooseCombDBcorrOneProng1Pi0', - 'ak5tauHPSlooseCombDBcorrOneProng2Pi0', - 'ak5tauHPSlooseCombDBcorrThreeProng0Pi0', - 'ak5tauHPSmediumCombDBcorrAll', - 'ak5tauHPSmediumCombDBcorrOneProng0Pi0', - 'ak5tauHPSmediumCombDBcorrOneProng1Pi0', - 'ak5tauHPSmediumCombDBcorrOneProng2Pi0', - 'ak5tauHPSmediumCombDBcorrThreeProng0Pi0', - 'ak5tauHPStightCombDBcorrAll', - 'ak5tauHPStightCombDBcorrOneProng0Pi0', - 'ak5tauHPStightCombDBcorrOneProng1Pi0', - 'ak5tauHPStightCombDBcorrOneProng2Pi0', - 'ak5tauHPStightCombDBcorrThreeProng0Pi0', -] - -execDir = "%s/bin/%s/" % (os.environ['CMSSW_BASE'], os.environ['SCRAM_ARCH']) - -executable_jrAnalyzer = execDir + 'jet_response_analyzer_x' -executable_fitResponse = execDir + 'jet_response_fitter_x' -executable_fitResolution = execDir + 'jet_response_and_resolution_x' -executable_fitL3param = execDir + 'jet_l3_correction_x' -executable_fitL2param = execDir + 'jet_l2_correction_x' -executable_applyL2L3param = execDir + 'jet_apply_jec_x' -executable_showGraphs = execDir + 'jet_inspect_graphs_x' -executable_showHistos = execDir + 'jet_inspect_histos_x' -executable_showProfiles = execDir + 'jet_inspect_profiles_x' -executable_hadd = 'hadd -f' -executable_shell = '/bin/csh' -executable_python = 'python' - -# define function used for fitting tau-jet response: -# 0 = Gaussian -# 1 = Crystall-Ball function -fitOption = 1 - -jecTextFilePath = os.getcwd() - -if not os.path.exists(outputFilePath): - os.mkdir(outputFilePath) - -outputFilePath_plots = os.path.join(outputFilePath, "plots") -if not os.path.exists(outputFilePath_plots): - os.mkdir(outputFilePath_plots) - -#-------------------------------------------------------------------------------- -# -# build shell script for running 'hadd' in order to "harvest" histograms -# produced by FWLiteZllRecoilCorrectionAnalyzer macro -# -fileNames_hadd = {} - -ntupleFileNames = os.listdir(inputFilePath) -#print(ntupleFileNames) - -ntupleFile_regex = r"ntupleJRAtau_(?P\w*)_(?P\d*)_(?P\d*)_(?P[a-zA-Z0-9]*).root" -ntupleFile_matcher = re.compile(ntupleFile_regex) - -#################### -def buildConfigFile_hadd(haddCommand, shellFileName_full, inputFileNames, outputFileName_full): - - """Build shell script to run 'hadd' command in order to add all histograms - in files specified by inputFileNames argument and write the sum to file outputFileName""" - - shellFile = open(shellFileName_full, "w") - shellFile.write("#!/bin/csh -f\n") - shellFile.write("\n") - # CV: delete output file in case it exists - shellFile.write("rm -f %s\n" % outputFileName_full) - shellFile.write("\n") - haddCommandLine = "%s %s" % (haddCommand, outputFileName_full) - for inputFileName in inputFileNames: - haddCommandLine += " %s" % inputFileName - shellFile.write("%s\n" % haddCommandLine) - shellFile.close() - - logFileName_full = shellFileName_full.replace('.csh', '.log') - - retVal = {} - retVal['shellFileName'] = shellFileName_full - retVal['outputFileName'] = outputFileName_full - retVal['logFileName'] = logFileName_full - - return retVal -#################### - - -for sampleToAnalyze in samplesToAnalyze: - haddInputFileNames = [] - for ntupleFileName in ntupleFileNames: - if ntupleFile_matcher.match(ntupleFileName) and \ - ntupleFile_matcher.match(ntupleFileName).group('sample') == sampleToAnalyze: - haddInputFileNames.append(os.path.join(inputFilePath, ntupleFileName)) - - print "sample = %s: found %i input files." % (sampleToAnalyze, len(haddInputFileNames)) - - haddShellFileName = os.path.join(outputFilePath, 'harvestJRAtauNtuples_%s.csh' % sampleToAnalyze) - haddOutputFileName = os.path.join(inputFilePath, 'ntupleJRAtau_%s_all.root' % sampleToAnalyze) - - retVal_hadd = \ - buildConfigFile_hadd(executable_hadd, haddShellFileName, haddInputFileNames, haddOutputFileName) - - fileNames_hadd[sampleToAnalyze] = {} - fileNames_hadd[sampleToAnalyze]['shellFileName'] = haddShellFileName - fileNames_hadd[sampleToAnalyze]['inputFileNames'] = haddInputFileNames - fileNames_hadd[sampleToAnalyze]['outputFileName'] = haddOutputFileName - fileNames_hadd[sampleToAnalyze]['logFileName'] = retVal_hadd['logFileName'] -#-------------------------------------------------------------------------------- - -def make_MakeFile_vstring(list_of_strings): - retVal = "" - for i, string_i in enumerate(list_of_strings): - if i > 0: - retVal += " " - retVal += string_i - return retVal - -#-------------------------------------------------------------------------------- -# -# initialize command-line parameters for analyzing "plain" ROOT Ntuples for uncalibrated tau-jets -# and filling tau-jet response and resolution histograms -# -fileNames_and_options_jrAnalyzer = {} - -ptBinning = [ - 20., 22.5, 25., 27.5, 30., 35., 40., 45., 50., 60., 80., 120., 200. -] - -etaBinning = [ - -2.5, -2.3, -2.1, -1.9, -1.7, -1.5, -1.3, -1.1, -0.9, -0.7, -0.5, -0.3, -0.1, - +0.1, +0.3, +0.5, +0.7, +0.9, +1.1, +1.3, +1.5, +1.7, +1.9, +2.1, +2.3, +2.5 -] - -def make_MakeFile_vdouble(list_of_doubles): - retVal = "" - for i, double_i in enumerate(list_of_doubles): - if i > 0: - retVal += " " - retVal += "%2.1f" % double_i - return retVal - -def make_jrAnalyzer_config(configFileName): - configFile = open(configFileName, "w") - configFile.write("drmax = 0.3\n") - configFile.write("etabarrelmin = -1.3\n") - configFile.write("etabarrelmax = 1.3\n") - configFile.write("binspt = %s\n" % make_MakeFile_vdouble(ptBinning)) - configFile.write("binseta = %s\n" % make_MakeFile_vdouble(etaBinning)) - configFile.close() - -for sampleToAnalyze in samplesToAnalyze: - fileNames_and_options_jrAnalyzer[sampleToAnalyze] = {} - fileNames_and_options_jrAnalyzer[sampleToAnalyze]['inputFileNames'] = \ - [ fileNames_hadd[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_jrAnalyzer[sampleToAnalyze]['outputFileName'] = \ - os.path.join(outputFilePath, "histogramsJRAtau_%s.root" % sampleToAnalyze) - fileNames_and_options_jrAnalyzer[sampleToAnalyze]['configFileName'] = \ - os.path.join(outputFilePath, "jet_response_analyzer_%s.cfg" % sampleToAnalyze) - make_jrAnalyzer_config(fileNames_and_options_jrAnalyzer[sampleToAnalyze]['configFileName']) - fileNames_and_options_jrAnalyzer[sampleToAnalyze]['logFileName'] = \ - os.path.join(outputFilePath, "jet_response_analyzer_%s.log" % sampleToAnalyze) - fileNames_and_options_jrAnalyzer[sampleToAnalyze]['commandLine'] = \ - '%s -input %s -output %s -algs %s' % \ - (fileNames_and_options_jrAnalyzer[sampleToAnalyze]['configFileName'], - make_MakeFile_vstring(fileNames_and_options_jrAnalyzer[sampleToAnalyze]['inputFileNames']), - fileNames_and_options_jrAnalyzer[sampleToAnalyze]['outputFileName'], - "".join([ "%s:0.3 " % algorithm for algorithm in algorithms ])) -#-------------------------------------------------------------------------------- - -#-------------------------------------------------------------------------------- -# -# initialize command-line parameters for fitting jet response for uncalibrated tau-jets -# -fileNames_and_options_fitResponse_uncalibrated = {} - -for sampleToAnalyze in samplesToAnalyze: - fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze] = {} - fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['inputFileNames'] = \ - [ fileNames_and_options_jrAnalyzer[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['outputFileName'] = \ - os.path.join(outputFilePath, "responseJRAtau_%s.root" % sampleToAnalyze) - fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['logFileName'] = \ - os.path.join(outputFilePath, "jet_response_fitter_%s.log" % sampleToAnalyze) - fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['commandLine'] = \ - '-input %s -output %s -algs %s -fittype %i' % \ - (make_MakeFile_vstring(fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['inputFileNames']), - fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['outputFileName'], - make_MakeFile_vstring(algorithms), - fitOption) -#-------------------------------------------------------------------------------- - -#-------------------------------------------------------------------------------- -# -# initialize command-line parameters for determining L2 and L3 correction parameters -# -fileNames_and_options_fitL3param = {} -fileNames_and_options_fitL2param = {} - -for sampleToAnalyze in samplesToAnalyze: - fileNames_and_options_fitL3param[sampleToAnalyze] = {} - fileNames_and_options_fitL3param[sampleToAnalyze]['inputFileNames'] = \ - [ fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_fitL3param[sampleToAnalyze]['outputFileName'] = \ - os.path.join(outputFilePath, "fitL3param_%s.root" % sampleToAnalyze) - fileNames_and_options_fitL3param[sampleToAnalyze]['logFileName'] = \ - os.path.join(outputFilePath, "fitL3param_%s.log" % sampleToAnalyze) - fileNames_and_options_fitL3param[sampleToAnalyze]['commandLine'] = \ - '-input %s -output %s -era %s -algs %s -formats png -batch true' % \ - (make_MakeFile_vstring(fileNames_and_options_fitL3param[sampleToAnalyze]['inputFileNames']), - fileNames_and_options_fitL3param[sampleToAnalyze]['outputFileName'], - era, - make_MakeFile_vstring(algorithms)) - - fileNames_and_options_fitL2param[sampleToAnalyze] = {} - fileNames_and_options_fitL2param[sampleToAnalyze]['inputFileNames'] = \ - [ fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['outputFileName'], - fileNames_and_options_fitL3param[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_fitL2param[sampleToAnalyze]['outputFileName'] = \ - os.path.join(outputFilePath, "fitL2param_%s.root" % sampleToAnalyze) - fileNames_and_options_fitL2param[sampleToAnalyze]['logFileName'] = \ - os.path.join(outputFilePath, "fitL2param_%s.log" % sampleToAnalyze) - fileNames_and_options_fitL2param[sampleToAnalyze]['commandLine'] = \ - '-input %s -l3input %s -output %s -era %s -algs %s -formats png -batch true' % \ - (fileNames_and_options_fitResponse_uncalibrated[sampleToAnalyze]['outputFileName'], - fileNames_and_options_fitL3param[sampleToAnalyze]['outputFileName'], - fileNames_and_options_fitL2param[sampleToAnalyze]['outputFileName'], - era, - make_MakeFile_vstring(algorithms)) -#-------------------------------------------------------------------------------- - -#-------------------------------------------------------------------------------- -# -# initialize command-line parameters for applying L2/L3 correction parameters -# and producing new "plain" ROOT Ntuples for calibrated tau-jets -# -fileNames_and_options_applyL2L3param = {} - -for sampleToAnalyze in samplesToAnalyze: - fileNames_and_options_applyL2L3param[sampleToAnalyze] = {} - fileNames_and_options_applyL2L3param[sampleToAnalyze]['inputFileNames'] = \ - [ fileNames_and_options_jrAnalyzer[sampleToAnalyze]['outputFileName'], - fileNames_and_options_fitL3param[sampleToAnalyze]['outputFileName'], - fileNames_and_options_fitL2param[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_applyL2L3param[sampleToAnalyze]['outputFileName'] = \ - os.path.join(outputFilePath, "applyL2L3param_%s.root" % sampleToAnalyze) - fileNames_and_options_applyL2L3param[sampleToAnalyze]['logFileName'] = \ - os.path.join(outputFilePath, "applyL2L3param_%s.log" % sampleToAnalyze) - fileNames_and_options_applyL2L3param[sampleToAnalyze]['commandLine'] = \ - '-input %s -output %s -era %s -algs %s -jecpath %s -levels 2 3' % \ - (fileNames_hadd[sampleToAnalyze]['outputFileName'], - fileNames_and_options_applyL2L3param[sampleToAnalyze]['outputFileName'], - era, - make_MakeFile_vstring(algorithms), - jecTextFilePath) -#-------------------------------------------------------------------------------- - -#-------------------------------------------------------------------------------- -# -# initialize command-line parameters for analyzing "plain" ROOT Ntuples for calibrated tau-jets -# and filling tau-jet response and resolution histograms -# -fileNames_and_options_jrAnalyzer_calibrated = {} - -for sampleToAnalyze in samplesToAnalyze: - fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze] = {} - fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['inputFileNames'] = \ - [ fileNames_and_options_applyL2L3param[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['outputFileName'] = \ - os.path.join(outputFilePath, "histogramsJRAtau_%s_calibrated.root" % sampleToAnalyze) - fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['configFileName'] = \ - os.path.join(outputFilePath, "jet_response_analyzer_%s_calibrated.cfg" % sampleToAnalyze) - make_jrAnalyzer_config(fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['configFileName']) - fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['logFileName'] = \ - os.path.join(outputFilePath, "jet_response_analyzer_%s_calibrated.log" % sampleToAnalyze) - fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['commandLine'] = \ - '%s -input %s -output %s -algs %s' % \ - (fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['configFileName'], - make_MakeFile_vstring(fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['inputFileNames']), - fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['outputFileName'], - make_MakeFile_vstring([ "".join([ algorithm, suffix]) for algorithm in algorithms for suffix in [ "", "l2l3"] ])) -#-------------------------------------------------------------------------------- - -#-------------------------------------------------------------------------------- -# -# initialize command-line parameters for fitting jet response and resolution -# for calibrated as well as uncalibrated tau-jets -# -fileNames_and_options_fitResponse_calibrated = {} - -fileNames_and_options_fitResolution = {} - -for sampleToAnalyze in samplesToAnalyze: - fileNames_and_options_fitResponse_calibrated[sampleToAnalyze] = {} - fileNames_and_options_fitResponse_calibrated[sampleToAnalyze]['inputFileNames'] = \ - [ fileNames_and_options_jrAnalyzer_calibrated[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_fitResponse_calibrated[sampleToAnalyze]['outputFileName'] = \ - os.path.join(outputFilePath, "responseJRAtau_%s_calibrated.root" % sampleToAnalyze) - fileNames_and_options_fitResponse_calibrated[sampleToAnalyze]['logFileName'] = \ - os.path.join(outputFilePath, "jet_response_fitter_%s_calibrated.log" % sampleToAnalyze) - fileNames_and_options_fitResponse_calibrated[sampleToAnalyze]['commandLine'] = \ - '-input %s -output %s -algs %s -fittype %i' % \ - (make_MakeFile_vstring(fileNames_and_options_fitResponse_calibrated[sampleToAnalyze]['inputFileNames']), - fileNames_and_options_fitResponse_calibrated[sampleToAnalyze]['outputFileName'], - make_MakeFile_vstring([ "".join([ algorithm, suffix]) for algorithm in algorithms for suffix in [ "", "l2l3"] ]), - fitOption) - - fileNames_and_options_fitResolution[sampleToAnalyze] = {} - fileNames_and_options_fitResolution[sampleToAnalyze]['inputFileNames'] = \ - [ fileNames_and_options_fitResponse_calibrated[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_fitResolution[sampleToAnalyze]['outputFileName'] = \ - os.path.join(outputFilePath, "resolutionJRAtau_%s.root" % sampleToAnalyze) - fileNames_and_options_fitResolution[sampleToAnalyze]['logFileName'] = \ - os.path.join(outputFilePath, "jet_resolution_fitter_%s.log" % sampleToAnalyze) - fileNames_and_options_fitResolution[sampleToAnalyze]['commandLine'] = \ - '-input %s -output %s -algs %s -dorelrsp true -doetarsp true -docbfits true' % \ - (make_MakeFile_vstring(fileNames_and_options_fitResolution[sampleToAnalyze]['inputFileNames']), - fileNames_and_options_fitResolution[sampleToAnalyze]['outputFileName'], - make_MakeFile_vstring([ "".join([ algorithm, suffix]) for algorithm in algorithms for suffix in [ "", "l2l3"] ])) -#-------------------------------------------------------------------------------- - -#-------------------------------------------------------------------------------- -# -# initialize command-line parameters for making jet response plots for calibrated tau-jets -# plus resolution plots for calibrated compared to uncalibrated tau-jets -# -fileNames_and_options_showHistos = {} -fileNames_and_options_showGraphs = {} - -for sampleToAnalyze in samplesToAnalyze: - - fileNames_and_options_showHistos[sampleToAnalyze] = {} - fileNames_and_options_showGraphs[sampleToAnalyze] = {} - - for algorithm in algorithms: - - outputFilePath_plots_algorithm = os.path.join(outputFilePath_plots, algorithm) - if not os.path.exists(outputFilePath_plots_algorithm): - os.mkdir(outputFilePath_plots_algorithm) - - fileNames_and_options_showHistos[sampleToAnalyze][algorithm] = {} - for refVariable in [ "RefPt", "JetEta" ]: - fileNames_and_options_showHistos[sampleToAnalyze][algorithm][refVariable] = {} - fileNames_and_options_showHistos[sampleToAnalyze][algorithm][refVariable]['inputFileNames'] = \ - [ fileNames_and_options_fitResponse_calibrated[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_showHistos[sampleToAnalyze][algorithm][refVariable]['outputFileName'] = \ - "make_jet_inspect_histos_target_%s_%s_%s_calibrated" % (sampleToAnalyze, algorithm, refVariable) - fileNames_and_options_showHistos[sampleToAnalyze][algorithm][refVariable]['logFileName'] = \ - os.path.join(outputFilePath, "jet_inspect_histos_%s_%s_%s_calibrated.log" % (sampleToAnalyze, algorithm, refVariable)) - fileNames_and_options_showHistos[sampleToAnalyze][algorithm][refVariable]['commandLine'] = \ - '-inputs %s -algs %s -variables RelRsp:%s %s -formats png -batch true -opath %s' % \ - (make_MakeFile_vstring(fileNames_and_options_showHistos[sampleToAnalyze][algorithm][refVariable]['inputFileNames']), - make_MakeFile_vstring([ "".join([ algorithm, suffix]) for suffix in [ "", "l2l3"] ]), - refVariable, - "-norm true -npercanvas 1", - outputFilePath_plots_algorithm) - - fileNames_and_options_showGraphs[sampleToAnalyze][algorithm] = {} - for refVariable in [ "RefPt", "JetEta" ]: - fileNames_and_options_showGraphs[sampleToAnalyze][algorithm][refVariable] = {} - fileNames_and_options_showGraphs[sampleToAnalyze][algorithm][refVariable]['inputFileNames'] = \ - [ fileNames_and_options_fitResolution[sampleToAnalyze]['outputFileName'] ] - fileNames_and_options_showGraphs[sampleToAnalyze][algorithm][refVariable]['outputFileName'] = \ - "make_jet_inspect_graphs_%s_%s_%s_target" % (sampleToAnalyze, algorithm, refVariable) - fileNames_and_options_showGraphs[sampleToAnalyze][algorithm][refVariable]['logFileName'] = \ - os.path.join(outputFilePath, "jet_inspect_graphs_%s_%s_%s.log" % (sampleToAnalyze, algorithm, refVariable)) - fileNames_and_options_showGraphs[sampleToAnalyze][algorithm][refVariable]['commandLine'] = \ - '-inputs %s -algs %s -variables RelRspVs%s %s -formats png -batch true -opath %s' % \ - (make_MakeFile_vstring(fileNames_and_options_showGraphs[sampleToAnalyze][algorithm][refVariable]['inputFileNames']), - make_MakeFile_vstring([ "".join([ algorithm, suffix]) for suffix in [ "", "l2l3"] ]), - refVariable, - "-ymin 0.5 -ymax 1.5 -legx 0.20 -legy 0.35 -legw 0.60", - outputFilePath_plots_algorithm) -#-------------------------------------------------------------------------------- - -# done building config files and initializing command-line parameters, now build Makefile... -makeFileName = "Makefile_runJRAtauworkflow_%s" % version -makeFile = open(makeFileName, "w") -makeFile.write("\n") -outputFileNames_runJRAtauworkflow = [] -for sampleName in samplesToAnalyze: - outputFileNames_runJRAtauworkflow.extend([ - fileNames_and_options_jrAnalyzer[sampleName]['outputFileName'], - fileNames_and_options_fitResponse_uncalibrated[sampleName]['outputFileName'], - fileNames_and_options_fitL3param[sampleName]['outputFileName'], - fileNames_and_options_fitL2param[sampleName]['outputFileName'], - fileNames_and_options_applyL2L3param[sampleName]['outputFileName'], - fileNames_and_options_jrAnalyzer_calibrated[sampleName]['outputFileName'], - fileNames_and_options_fitResponse_calibrated[sampleName]['outputFileName'], - fileNames_and_options_fitResolution[sampleName]['outputFileName'] - ]) - for algorithm in algorithms: - for refVariable in [ "RefPt", "JetEta" ]: - outputFileNames_runJRAtauworkflow.extend([ - fileNames_and_options_showHistos[sampleName][algorithm][refVariable]['outputFileName'], - fileNames_and_options_showGraphs[sampleName][algorithm][refVariable]['outputFileName'] - ]) -makeFile.write("all: %s\n" % make_MakeFile_vstring(outputFileNames_runJRAtauworkflow)) -makeFile.write("\techo 'Finished running JRAtau Workflow.'\n") -makeFile.write("\n") -for sampleName in samplesToAnalyze: - if len(fileNames_hadd[sampleName]['inputFileNames']) > 0: - makeFile.write("%s: %s\n" % - (fileNames_hadd[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_hadd[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_shell, - fileNames_hadd[sampleName]['shellFileName'], - fileNames_hadd[sampleName]['logFileName'])) -makeFile.write("\n") -for sampleName in samplesToAnalyze: - makeFile.write("%s: %s\n" % - (fileNames_and_options_jrAnalyzer[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_jrAnalyzer[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_jrAnalyzer, - fileNames_and_options_jrAnalyzer[sampleName]['commandLine'], - fileNames_and_options_jrAnalyzer[sampleName]['logFileName'])) -makeFile.write("\n") -for sampleName in samplesToAnalyze: - makeFile.write("%s: %s\n" % - (fileNames_and_options_fitResponse_uncalibrated[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_fitResponse_uncalibrated[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_fitResponse, - fileNames_and_options_fitResponse_uncalibrated[sampleName]['commandLine'], - fileNames_and_options_fitResponse_uncalibrated[sampleName]['logFileName'])) -makeFile.write("\n") -for sampleName in samplesToAnalyze: - makeFile.write("%s: %s\n" % - (fileNames_and_options_fitL3param[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_fitL3param[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_fitL3param, - fileNames_and_options_fitL3param[sampleName]['commandLine'], - fileNames_and_options_fitL3param[sampleName]['logFileName'])) - makeFile.write("%s: %s\n" % - (fileNames_and_options_fitL2param[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_fitL2param[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_fitL2param, - fileNames_and_options_fitL2param[sampleName]['commandLine'], - fileNames_and_options_fitL2param[sampleName]['logFileName'])) -makeFile.write("\n") -for sampleName in samplesToAnalyze: - makeFile.write("%s: %s\n" % - (fileNames_and_options_applyL2L3param[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_applyL2L3param[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_applyL2L3param, - fileNames_and_options_applyL2L3param[sampleName]['commandLine'], - fileNames_and_options_applyL2L3param[sampleName]['logFileName'])) -makeFile.write("\n") -for sampleName in samplesToAnalyze: - makeFile.write("%s: %s\n" % - (fileNames_and_options_jrAnalyzer_calibrated[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_jrAnalyzer_calibrated[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_jrAnalyzer, - fileNames_and_options_jrAnalyzer_calibrated[sampleName]['commandLine'], - fileNames_and_options_jrAnalyzer_calibrated[sampleName]['logFileName'])) -makeFile.write("\n") -for sampleName in samplesToAnalyze: - makeFile.write("%s: %s\n" % - (fileNames_and_options_fitResponse_calibrated[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_fitResponse_calibrated[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_fitResponse, - fileNames_and_options_fitResponse_calibrated[sampleName]['commandLine'], - fileNames_and_options_fitResponse_calibrated[sampleName]['logFileName'])) - makeFile.write("%s: %s\n" % - (fileNames_and_options_fitResolution[sampleName]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_fitResolution[sampleName]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_fitResolution, - fileNames_and_options_fitResolution[sampleName]['commandLine'], - fileNames_and_options_fitResolution[sampleName]['logFileName'])) -makeFile.write("\n") -for sampleName in samplesToAnalyze: - for algorithm in algorithms: - for refVariable in [ "RefPt", "JetEta" ]: - makeFile.write("%s: %s\n" % - (fileNames_and_options_showHistos[sampleName][algorithm][refVariable]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_showHistos[sampleName][algorithm][refVariable]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_showHistos, - fileNames_and_options_showHistos[sampleName][algorithm][refVariable]['commandLine'], - fileNames_and_options_showHistos[sampleName][algorithm][refVariable]['logFileName'])) - makeFile.write("%s: %s\n" % - (fileNames_and_options_showGraphs[sampleName][algorithm][refVariable]['outputFileName'], - make_MakeFile_vstring(fileNames_and_options_showGraphs[sampleName][algorithm][refVariable]['inputFileNames']))) - makeFile.write("\t%s %s &> %s\n" % - (executable_showGraphs, - fileNames_and_options_showGraphs[sampleName][algorithm][refVariable]['commandLine'], - fileNames_and_options_showGraphs[sampleName][algorithm][refVariable]['logFileName'])) -makeFile.write("\n") -makeFile.write(".PHONY: clean\n") -makeFile.write("clean:\n") -makeFile.write("\trm -f %s\n" % make_MakeFile_vstring(outputFileNames_runJRAtauworkflow)) -makeFile.write("\techo 'Finished deleting old files.'\n") -makeFile.write("\n") -makeFile.close() - -print("Finished building Makefile. Now execute 'make -j 8 -f %s'." % makeFileName) diff --git a/JetAnalyzers/test/run_JRA_cfg.py b/JetAnalyzers/test/run_JRA_cfg.py index 905b1496..158a3e2a 100644 --- a/JetAnalyzers/test/run_JRA_cfg.py +++ b/JetAnalyzers/test/run_JRA_cfg.py @@ -54,7 +54,7 @@ if conditionsSource == "DB": conditionsConnect = cms.string("frontier://FrontierPrep/CMS_COND_PHYSICSTOOLS") elif conditionsSource == "SQLite": - conditionsConnect = cms.string('sqlite_file:'+era+'.db') + conditionsConnect = cms.string('sqlite_file:'+era+'.db') from CondCore.DBCommon.CondDBSetup_cfi import * process.jec = cms.ESSource("PoolDBESSource",CondDBSetup, diff --git a/JetAnalyzers/test/run_JRA_hlt_cfg.py b/JetAnalyzers/test/run_JRA_hlt_cfg.py index 6239a25e..e393f24e 100644 --- a/JetAnalyzers/test/run_JRA_hlt_cfg.py +++ b/JetAnalyzers/test/run_JRA_hlt_cfg.py @@ -94,7 +94,8 @@ RefreshEachRun = cms.untracked.bool(False), RefreshOpenIOVs = cms.untracked.bool(False), connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'), - globaltag = cms.string('80X_mcRun2_asymptotic_ForTSGStudies_v0'), + globaltag = cms.string('80X_mcRun2_asymptotic_ForTSGStudies_fromRunIIFall15DR76_v0'), + #globaltag = cms.string('80X_mcRun2_asymptotic_ForTSGStudies_v0'), pfnPrefix = cms.untracked.string('frontier://FrontierProd/'), snapshotTime = cms.string('9999-12-31 23:59:59.000'), toGet = cms.VPSet() @@ -116,7 +117,8 @@ ################### # Upgrade with PU # ################### - '/store/group/phys_jetmet/kirschen/HLTJEC2016/QCD/QCD_Pt-15to3000_TuneCUETP8M1_Flat_13TeV_pythia8/crab_JECFall15_PUFlat0to50_withPFCalib_QCD/160222_213430/0000/outputA_5.root' + #'/store/group/phys_jetmet/fengwang/JECFall16HLT/QCD_Pt-15to3000_TuneCUETP8M1_Flat_13TeV_pythia8/Fall16HLTJEC_80X_FlatPU0to70HcalNZSRAW_v1/161128_155705/0001/outputA_1101.root', + '/store/group/phys_jetmet/fengwang/JECFall16HLT/QCD_Pt-15to3000_TuneCUETP8M1_Flat_13TeV_pythia8/Fall16HLTJEC_80X_NoPUHcalNZSRAW_v1/161128_155846/0000/outputA_11.root', ###################### # Upgrade without PU # ###################### @@ -124,9 +126,9 @@ ########################### # RelVal CMSSW_7_4_0_pre9 # ########################### -# '/store/relval/CMSSW_7_4_0_pre9/RelValQCD_FlatPt_15_3000_13/GEN-SIM-DIGI-RECO/MCRUN2_74_V7_FastSim-v1/00000/EEC9F0EF-10D4-E411-A6E7-0025905A48D0.root' +# '/store/relval/CMSSW_7_4_0_pre9/RelValQCD_FlatPt_15_3000_13/GEN-SIM-DIGI-RECO/MCRUN2_74_V7_FastSim-v1/00000/EEC9F0EF-10D4-E411-A6E7-0025905A48D0.root' ) -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(100)) +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1000)) process.source = cms.Source("PoolSource", fileNames = qcdFiles ) @@ -144,7 +146,7 @@ #! NEEDED FOR PFCHS (last two lines needed for 44X and up) #! #process.load('CommonTools.ParticleFlow.pfNoPileUp_cff') -#process.pfPileUp.PFCandidates = 'particleFlow' +#process.pfPileUp.PFCandidates = 'particleFlow' #process.pfNoPileUp.bottomCollection = 'particleFlow' process.load('CommonTools.ParticleFlow.pfNoPileUpJME_cff') process.pfPileUp.checkClosestZVertex = False diff --git a/JetAnalyzers/test/sanity/CaloCorFactor.cc b/JetAnalyzers/test/sanity/CaloCorFactor.cc index 15139ec2..d7ef1c8b 100644 --- a/JetAnalyzers/test/sanity/CaloCorFactor.cc +++ b/JetAnalyzers/test/sanity/CaloCorFactor.cc @@ -13,10 +13,10 @@ void Corrfunction(){ double pthigh = 0; vector para; - //ifstream input("EcalMultifitHCALMethod3_L2Relative_AK4CaloHLTl1.txt"); - ifstream input("EcalMultifitHCALMethod3_L2Relative_AK8CaloHLTl1.txt"); - //ofstream output("CaloFactor_AK4.txt",ios::out); - ofstream output("CaloFactor_AK8.txt",ios::out); + ifstream input("EcalMultifitHCALMethod3_L2Relative_AK4CaloHLTl1.txt"); + //ifstream input("EcalMultifitHCALMethod3_L2Relative_AK8CaloHLTl1.txt"); + ofstream output("CaloFactor_AK4.txt",ios::out); + //ofstream output("CaloFactor_AK8.txt",ios::out); TF1* fun = new TF1("fun","[0]+([1]/((log10(x)^[2])+[3]))", 0, 3500); // ===================== validate PF Jet correction factor ======================= diff --git a/JetAnalyzers/test/sanity/PFCorFactor.cc b/JetAnalyzers/test/sanity/PFCorFactor.cc index 89fb7b11..a2f12305 100644 --- a/JetAnalyzers/test/sanity/PFCorFactor.cc +++ b/JetAnalyzers/test/sanity/PFCorFactor.cc @@ -13,10 +13,10 @@ void Corrfunction(){ double pthigh = 0; vector para; - //ifstream input("EcalMultifitHCALMethod3_L2Relative_AK4PFHLTl1.txt"); - ifstream input("EcalMultifitHCALMethod3_L2Relative_AK8PFHLTl1.txt"); - //ofstream output("PFFactor_AK4.txt",ios::out); - ofstream output("PFFactor_AK8.txt",ios::out); + ifstream input("EcalMultifitHCALMethod3_L2Relative_AK4PFHLTl1.txt"); + //ifstream input("EcalMultifitHCALMethod3_L2Relative_AK8PFHLTl1.txt"); + ofstream output("PFFactor_AK4.txt",ios::out); + //ofstream output("PFFactor_AK8.txt",ios::out); TF1* fun = new TF1("fun","((x>=[6])*(([0]+([1]/((log10(x)^2)+[2])))+([3]*exp(-([4]*((log10(x)-[5])*(log10(x)-[5])))))))+((x<[6])*[7])", 0, 3500); diff --git a/JetUtilities/bin/jet_inspect_graphs_x.cc b/JetUtilities/bin/jet_inspect_graphs_x.cc index f2ef1ea7..1c01ed3e 100644 --- a/JetUtilities/bin/jet_inspect_graphs_x.cc +++ b/JetUtilities/bin/jet_inspect_graphs_x.cc @@ -437,9 +437,9 @@ int main(int argc,char** argv) leg->SetBorderSize(0); if (drawlegend) leg->Draw(); - TLatex *beautify1 = new TLatex(0.25,0.86,"2015, 13TeV"); - TLatex *beautify2 = new TLatex(0.25,0.81,"CMS"); - TLatex *beautify3 = new TLatex(0.25,0.76,"Simulation"); + TLatex *beautify1 = new TLatex(0.75,0.94,"2017 (13TeV)"); + TLatex *beautify2 = new TLatex(0.25,0.86,"CMS"); + TLatex *beautify3 = new TLatex(0.25,0.81,"Simulation"); beautify1->SetNDC(); beautify2->SetNDC(); @@ -951,9 +951,9 @@ void draw_range(const string& range, const int residual) TLatex tex; tex.SetNDC(true); tex.SetTextAlign(13); - tex.SetTextSize(0.055); + tex.SetTextSize(0.04); tex.SetTextFont(42); - if (residual<0) tex.DrawLatex(0.18,0.98,range.c_str()); + if (residual<0) tex.DrawLatex(0.58,0.75,range.c_str()); else tex.DrawLatex(0.15,0.96,range.c_str()); } @@ -963,10 +963,10 @@ string get_range(const ObjectLoader& gl, const vector& indices, bool addFixedVars, string refpt) { - string varnameEta = "#eta"; - for (unsigned int i=0;i=0) varnameEta="|#eta|"; - + string varnameEta = "#eta^{jet}"; +/* for (unsigned int i=0;i=0) varnameEta="|#eta^{jet}|"; +*/ string varnameY = "y"; for (unsigned int i=0;i=0) varnameY="|y|"; @@ -984,7 +984,7 @@ string get_range(const ObjectLoader& gl, double varmax = gl.maximum(i,indices[i]); bool threshold(false); - if (varname=="RefPt") { varname = refpt.empty() ? "p_{T}^{REF}" : refpt.c_str(); + if (varname=="RefPt") { varname = refpt.empty() ? "p_{T}^{gen-jet}" : refpt.c_str(); unit = " GeV"; } if (varname=="JetPt") { varname = "p_{T}"; unit = " GeV"; } if (varname=="JetEta") { varname = varnameEta; unit = ""; } @@ -1019,7 +1019,7 @@ string get_legend_label_from_alg(const string& alg) else return alg; string reco[10] = { "gen", "caloHLT", "pfchsHLT", "pfHLTNoPU", "pfHLT", "calo", "pfchs", "pf", "trk", "jpt" }; - string RECO[10] = { "(Gen)","(CaloHLT)","(PFlowNPHLT)","(PFlowHLTNoPU)","(PFlowHLT)","(Calo)","(PFlowNP)","(PFlow)", "(Tracks)", "(JPT)" }; + string RECO[10] = { "(Gen)","(Calo HLT)","(PFlowNPHLT)","(PFlowHLTNoPU)","(Particle Flow HLT)","(Calo)","(PFlowNP)","(PFlow)", "(Tracks)", "(JPT)" }; size_t pos=string::npos; int ireco=-1; while (pos==string::npos&&ireco<8) { pos = tmp.find(reco[++ireco]); } @@ -1135,12 +1135,12 @@ void set_axis_titles(TH1* h,const string& quantity,float ymin,float ymax, if (ytitle.empty()) { string ystr=quantity.substr(0,pos); if (ystr=="Rsp"||ystr=="RelRsp"||ystr=="AbsRsp") { - ytitle=refpt.empty() ? "p_{T} / p_{T}^{REF}" : ("p_{T} / "+refpt).c_str(); + ytitle=refpt.empty() ? "p_{T}^{jet} / p_{T}^{gen-jet}" : ("p_{T} / "+refpt).c_str(); ymax = (ymax<0.0) ? 1.2 : ymax; h->SetMaximum(ymax); } else if (ystr=="Res"||ystr=="RelRes"||ystr=="AbsRes") { - ytitle= refpt.empty() ? "#sigma(p_{T}/p_{T}^{REF}) / " : + ytitle= refpt.empty() ? "#sigma(p_{T}^{jet}) / " : ("#sigma(p_{T}/"+refpt+") / ").c_str(); if (ymax>0.0) h->SetMaximum(ymax); } @@ -1170,9 +1170,9 @@ void set_axis_titles(TH1* h,const string& quantity,float ymin,float ymax, if (xtitle.empty()) { string xstr=quantity.substr(pos+2); - if (xstr=="RefPt") xtitle=refpt.empty() ? "p_{T}^{REF} [GeV]" : (refpt+" [GeV]").c_str(); + if (xstr=="RefPt") xtitle=refpt.empty() ? "p_{T}^{gen-jet} [GeV]" : (refpt+" [GeV]").c_str(); if (xstr=="JetPt") xtitle="p_{T} [GeV]"; - if (xstr=="JetEta") xtitle="#eta"; + if (xstr=="JetEta") xtitle="#eta^{jet}"; if (xstr=="JetPhi") xtitle="#varphi"; if (xstr=="JetY") xtitle="y"; if (xstr=="PtRel") xtitle="p_{T}^{rel} [GeV]"; diff --git a/JetUtilities/src/JRAEvent.cc b/JetUtilities/src/JRAEvent.cc index 550399b7..37963aa1 100644 --- a/JetUtilities/src/JRAEvent.cc +++ b/JetUtilities/src/JRAEvent.cc @@ -68,9 +68,10 @@ void JRAEvent::MakeTree(TTree* tree) fChain->Branch("ntrks_highpt", "vector", &ntrks_highpt); fChain->Branch("rhos", "vector", &rhos); fChain->Branch("rho", &rho, "rho/F"); - if(!flags.test(0) || (flags.test(0) && flags.test(1))) { - fChain->Branch("rho_hlt", &rho_hlt, "rho_hlt/F"); - } + fChain->Branch("rho_hlt", &rho_hlt, "rho_hlt/F"); + //if(!flags.test(0) || (flags.test(0) && flags.test(1))) { + // fChain->Branch("rho_hlt", &rho_hlt, "rho_hlt/F"); + //} fChain->Branch("pthat", &pthat, "pthat/F"); fChain->Branch("beta", &beta, "beta/F"); fChain->Branch("betaStar", &betaStar, "betaStar/F"); @@ -169,9 +170,10 @@ void JRAEvent::Init(TTree *tree) fChain->SetBranchAddress("ntrks_highpt", &ntrks_highpt, &b_ntrks_highpt); fChain->SetBranchAddress("rhos", &rhos, &b_rhos); fChain->SetBranchAddress("rho", &rho, &b_rho); - if(!flags.test(0) || (flags.test(0) && flags.test(1))) { - fChain->SetBranchAddress("rho_hlt", &rho_hlt, &b_rho_hlt); - } + fChain->SetBranchAddress("rho_hlt", &rho_hlt, &b_rho_hlt); + //if(!flags.test(0) || (flags.test(0) && flags.test(1))) { + // fChain->SetBranchAddress("rho_hlt", &rho_hlt, &b_rho_hlt); + //} fChain->SetBranchAddress("pthat", &pthat, &b_pthat); fChain->SetBranchAddress("beta", &beta, &b_beta); fChain->SetBranchAddress("betaStar", &betaStar, &b_betaStar); From 76628af5438c171dc61fc033bc47c239c220a4aa Mon Sep 17 00:00:00 2001 From: Fengwangdong Date: Sat, 21 Jan 2017 04:53:57 +0100 Subject: [PATCH 3/4] update gitignore list --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index a7685b9f..f915d996 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ *_cc.d *_cc.so *.pcm +*.root +*.pdf +*.png __init__.py # git will not consider these directories: From 41eb45e79107e399cf493afbec7396451ad1e9e8 Mon Sep 17 00:00:00 2001 From: Fengwangdong Date: Sat, 21 Jan 2017 16:31:09 +0100 Subject: [PATCH 4/4] update captions for the commands --- JetAnalyzers/test/Scripts/L1Hadd.sh | 4 +++- JetAnalyzers/test/Scripts/L1batch.sh | 5 ++++- JetAnalyzers/test/Scripts/L2batch.sh | 4 +++- JetAnalyzers/test/Scripts/L3batch.sh | 4 +++- JetAnalyzers/test/Scripts/MergeEta.sh | 5 +++++ JetAnalyzers/test/Scripts/MergePt.sh | 5 +++++ JetAnalyzers/test/Scripts/MultiGraph.sh | 4 ++++ JetAnalyzers/test/Scripts/PreL1batch.sh | 7 ++++++- JetAnalyzers/test/Scripts/PrejraHadd.sh | 4 +++- JetAnalyzers/test/Scripts/deterjec.sh | 8 ++++++++ JetAnalyzers/test/Scripts/jraHadd.sh | 4 +++- JetAnalyzers/test/Scripts/jrabatch.sh | 4 +++- JetAnalyzers/test/Scripts/prolist.sh | 16 ++++++++++------ 13 files changed, 60 insertions(+), 14 deletions(-) diff --git a/JetAnalyzers/test/Scripts/L1Hadd.sh b/JetAnalyzers/test/Scripts/L1Hadd.sh index 03ffbc95..01f52545 100755 --- a/JetAnalyzers/test/Scripts/L1Hadd.sh +++ b/JetAnalyzers/test/Scripts/L1Hadd.sh @@ -1,11 +1,13 @@ #!/bin/bash export SCRAM_ARCH=slc6_amd64_gcc491 -cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ # modify this to your own directory! eval $(scramv1 runtime -sh) cd JetMETAnalysis/JetAnalyzers/test/ +# -------------- please change these paths to your own ones ------------- inpath="/store/group/phys_jetmet/fengwang/HLTBX25JECL1/" outpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/test/" +# ----------------------------------------------------------------------- num=$1 outfile="L1Prefile_" diff --git a/JetAnalyzers/test/Scripts/L1batch.sh b/JetAnalyzers/test/Scripts/L1batch.sh index ac80b29f..b13e4555 100755 --- a/JetAnalyzers/test/Scripts/L1batch.sh +++ b/JetAnalyzers/test/Scripts/L1batch.sh @@ -1,13 +1,16 @@ #!/bin/bash +#set up the environment export SCRAM_ARCH=slc6_amd64_gcc491 -cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ # modify this to your own path! eval $(scramv1 runtime -sh) cd JetMETAnalysis/JetAnalyzers/test/ +#----------------Please modify these file paths to your own directories! --------------------- confpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/config/" inpath="/store/user/fengwang/QCDHLT" midpath="/tmp/fengwang" outpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" +#--------------------------------------------------------------------------------------------- num=$1 filelist="list$num.txt" diff --git a/JetAnalyzers/test/Scripts/L2batch.sh b/JetAnalyzers/test/Scripts/L2batch.sh index 3f0cca03..08d39d1e 100755 --- a/JetAnalyzers/test/Scripts/L2batch.sh +++ b/JetAnalyzers/test/Scripts/L2batch.sh @@ -1,12 +1,14 @@ #!/bin/bash export SCRAM_ARCH=slc6_amd64_gcc491 -cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ #modify this to your directory! eval $(scramv1 runtime -sh) cd JetMETAnalysis/JetAnalyzers/test/ +#----------------Please modify these file paths to your own directories! --------------------- inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" midpath="/tmp/fengwang" outpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" +#---------------------------------------------------------------------------------------- num=$1 filelist="list$num.txt" diff --git a/JetAnalyzers/test/Scripts/L3batch.sh b/JetAnalyzers/test/Scripts/L3batch.sh index 8f1b966b..ca60a105 100755 --- a/JetAnalyzers/test/Scripts/L3batch.sh +++ b/JetAnalyzers/test/Scripts/L3batch.sh @@ -1,13 +1,15 @@ #!/bin/bash export SCRAM_ARCH=slc6_amd64_gcc491 -cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ #change this to your directory! eval $(scramv1 runtime -sh) cd JetMETAnalysis/JetAnalyzers/test/ +#----------------Please modify these file paths to your own directories! --------------------- confpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/config" inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" midpath="/tmp/fengwang" outpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" +#--------------------------------------------------------------------------------------------- num=$1 filelist="list$num.txt" diff --git a/JetAnalyzers/test/Scripts/MergeEta.sh b/JetAnalyzers/test/Scripts/MergeEta.sh index 87890400..60c8ecde 100644 --- a/JetAnalyzers/test/Scripts/MergeEta.sh +++ b/JetAnalyzers/test/Scripts/MergeEta.sh @@ -1,3 +1,8 @@ +#!/bin/bash +#------------- Fit all the response profiles with Gaussian function ------------------------ jet_response_fitter_x -input ./HLTBX25JEC/jra_L1L2L3_MergeEta.root -output ./HLTBX25JEC/jra_L1L2L3_MergeEta_f.root +#------------- Extract the jet response and resolution versus gen-jet pt in different jet eta regions ------ jet_response_and_resolution_x -input ./HLTBX25JEC/jra_L1L2L3_MergeEta_f.root -output ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergeEta_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 ak8pfHLTl1l2l3 ak8caloHLTl1l2l3 + +# Note: You need to change the path after -input and -output in the command according to your path! diff --git a/JetAnalyzers/test/Scripts/MergePt.sh b/JetAnalyzers/test/Scripts/MergePt.sh index c721cc0e..d627589a 100644 --- a/JetAnalyzers/test/Scripts/MergePt.sh +++ b/JetAnalyzers/test/Scripts/MergePt.sh @@ -1,3 +1,8 @@ +#!/bin/bash +#------------- Fit all the response profiles with Gaussian function ------------------------ jet_response_fitter_x -input ./HLTBX25JEC/jra_L1L2L3_MergePt.root -output ./HLTBX25JEC/jra_L1L2L3_MergePt_f.root +#------------- Extract the jet response and resolution versus jet eta in different gen-jet pt regions ------ jet_response_and_resolution_x -input ./HLTBX25JEC/jra_L1L2L3_MergePt_f.root -output ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 ak8pfHLTl1l2l3 ak8caloHLTl1l2l3 + +# Note: You need to change the path after -input and -output in the command according to your path! diff --git a/JetAnalyzers/test/Scripts/MultiGraph.sh b/JetAnalyzers/test/Scripts/MultiGraph.sh index 5a30fce9..b7f5e0d5 100644 --- a/JetAnalyzers/test/Scripts/MultiGraph.sh +++ b/JetAnalyzers/test/Scripts/MultiGraph.sh @@ -1,3 +1,7 @@ +#!/bin/bash +#--------------- draw the closure plots and resolution calibration --------------- +# Note: You need to change the path after -inputs in the command according to your path! + jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelResVsJetEta:RefPt@10 -xmin -5 -xmax 5 -ymin 0.2 -ymax 0.8 jet_inspect_graphs_x -inputs ./HLTBX25JEC/EcalMultifitHCALMethod3_jra_L1L2L3_MergePt_g.root -algs ak4pfHLTl1l2l3 ak4caloHLTl1l2l3 -variables RelResVsJetEta:RefPt@30 -xmin -5 -xmax 5 -ymin 0 -ymax 0.4 diff --git a/JetAnalyzers/test/Scripts/PreL1batch.sh b/JetAnalyzers/test/Scripts/PreL1batch.sh index ea1ebe56..f3a9bf27 100755 --- a/JetAnalyzers/test/Scripts/PreL1batch.sh +++ b/JetAnalyzers/test/Scripts/PreL1batch.sh @@ -1,13 +1,16 @@ #!/bin/bash +#set up environment and enter the workspace export SCRAM_ARCH=slc6_amd64_gcc491 -cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ #modify this to your own directory! eval $(scramv1 runtime -sh) cd JetMETAnalysis/JetAnalyzers/test/ +#----- Please modify these to your own paths --------------- inpath="/store/user/fengwang/QCDHLT/" inpath2="/store/user/fengwang/QCDHLT_NoPU/" midpath="/tmp/fengwang/" outpath="/store/group/phys_jetmet/fengwang/HLTBX25JECL1/" +#----------------------------------------------------------- num=$1 label=`printf $num` @@ -20,6 +23,7 @@ outstring2="output_ak4pfHLT_" outstring3="output_ak8caloHLT_" outstring4="output_ak8pfHLT_" +# Start loop on each input file while read file do infile="$prefix$label.root" @@ -35,6 +39,7 @@ do label2=`printf $num2` + # Manufacture the histograms for the subsequent parametrization jet_synchtest_x -basepath $midpath -samplePU $midfile -sampleNoPU $file -algo1 ak4caloHLT -algo2 ak4caloHLT -order1 $label -order2 $label2 jet_synchtest_x -basepath $midpath -samplePU $midfile -sampleNoPU $file -algo1 ak4pfHLT -algo2 ak4pfHLT -order1 $label -order2 $label2 jet_synchtest_x -basepath $midpath -samplePU $midfile -sampleNoPU $file -algo1 ak8caloHLT -algo2 ak8caloHLT -order1 $label -order2 $label2 diff --git a/JetAnalyzers/test/Scripts/PrejraHadd.sh b/JetAnalyzers/test/Scripts/PrejraHadd.sh index 1d872f61..5695d6b9 100755 --- a/JetAnalyzers/test/Scripts/PrejraHadd.sh +++ b/JetAnalyzers/test/Scripts/PrejraHadd.sh @@ -1,11 +1,13 @@ #!/bin/bash export SCRAM_ARCH=slc6_amd64_gcc491 -cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ # change this to your directory ! eval $(scramv1 runtime -sh) cd JetMETAnalysis/JetAnalyzers/test/ +#----------------Please modify these file paths to your own directories! --------------------- inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC/" outpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/test/" +#--------------------------------------------------------------------------------------------- num=$1 outfile="jraPrefile_L1_" diff --git a/JetAnalyzers/test/Scripts/deterjec.sh b/JetAnalyzers/test/Scripts/deterjec.sh index 6a27c22d..3d201514 100644 --- a/JetAnalyzers/test/Scripts/deterjec.sh +++ b/JetAnalyzers/test/Scripts/deterjec.sh @@ -1,17 +1,25 @@ +#!/bin/bash +#------- fit the pre-response profile ----- jet_response_fitter_x -input ./HLTBX25JEC/jra_L1.root -output ./HLTBX25JEC/jra_L1_f.root +#------- derive the L3 correction (will be merged by next step with L2 correction) ------ jet_l3_correction_x -input ./HLTBX25JEC/jra_L1_f.root -era EcalMultifitHCALMethod3 -algs ak4pfHLTl1 ak4caloHLTl1 ak8pfHLTl1 ak8caloHLTl1 -output ./HLTBX25JEC/l3.root +#------- derive the L2 correction merged with L3 correction ------------- jet_l2_correction_x -input ./HLTBX25JEC/jra_L1_f.root -l3input ./HLTBX25JEC/l3.root -output ./HLTBX25JEC/l2.root -era EcalMultifitHCALMethod3 -algs ak4pfHLTl1 ak4caloHLTl1 ak8pfHLTl1 ak8caloHLTl1 +#------ delete the redundant L3 correction files --------- rm EcalMultifitHCALMethod3_L3Absolute_AK4PFHLTl1.txt rm EcalMultifitHCALMethod3_L3Absolute_AK4CaloHLTl1.txt rm EcalMultifitHCALMethod3_L3Absolute_AK8PFHLTl1.txt rm EcalMultifitHCALMethod3_L3Absolute_AK8CaloHLTl1.txt +#------ change the name of L2 correction (merged with L3) files and put them together with the L1 correction files mv EcalMultifitHCALMethod3_L2Relative_AK4PFHLTl1.txt JECTag_EcalMultifit_HCALMethod3/ mv EcalMultifitHCALMethod3_L2Relative_AK4CaloHLTl1.txt JECTag_EcalMultifit_HCALMethod3/ mv EcalMultifitHCALMethod3_L2Relative_AK8PFHLTl1.txt JECTag_EcalMultifit_HCALMethod3/ mv EcalMultifitHCALMethod3_L2Relative_AK8CaloHLTl1.txt JECTag_EcalMultifit_HCALMethod3/ rm -rf L3*.png + +# Note: You need to change the path after -input and -output in the command according to your path! diff --git a/JetAnalyzers/test/Scripts/jraHadd.sh b/JetAnalyzers/test/Scripts/jraHadd.sh index e61dad59..46cd4c84 100755 --- a/JetAnalyzers/test/Scripts/jraHadd.sh +++ b/JetAnalyzers/test/Scripts/jraHadd.sh @@ -1,11 +1,13 @@ #!/bin/bash export SCRAM_ARCH=slc6_amd64_gcc491 -cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ # change it to your directory! eval $(scramv1 runtime -sh) cd JetMETAnalysis/JetAnalyzers/test/ +#----------------Please modify these file paths to your own directories! --------------------- inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC/" outpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/test/" +#--------------------------------------------------------------------------------------------- num=$1 outfile="jraPrefile_L1L2L3_" diff --git a/JetAnalyzers/test/Scripts/jrabatch.sh b/JetAnalyzers/test/Scripts/jrabatch.sh index cff78a7f..7cc9a3c6 100755 --- a/JetAnalyzers/test/Scripts/jrabatch.sh +++ b/JetAnalyzers/test/Scripts/jrabatch.sh @@ -1,13 +1,15 @@ #!/bin/bash export SCRAM_ARCH=slc6_amd64_gcc491 -cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ +cd /afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/ #modify this to your directory! eval $(scramv1 runtime -sh) cd JetMETAnalysis/JetAnalyzers/test/ +#----------------Please modify these file paths to your own directories! --------------------- confpath="/afs/cern.ch/work/f/fengwang/OnlineJEC/CMSSW_8_0_0/src/JetMETAnalysis/JetAnalyzers/config" inpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" midpath="/tmp/fengwang" outpath="/store/group/phys_jetmet/fengwang/HLTBX25JEC" +#---------------------------------------------------------------------------------------------- num=$1 filelist="list$num.txt" diff --git a/JetAnalyzers/test/Scripts/prolist.sh b/JetAnalyzers/test/Scripts/prolist.sh index ec6a2e5d..3264a532 100644 --- a/JetAnalyzers/test/Scripts/prolist.sh +++ b/JetAnalyzers/test/Scripts/prolist.sh @@ -1,12 +1,16 @@ #!/bin/bash source /afs/cern.ch/project/eos/installation/cms/etc/setup.sh +#----------- For PreL1batch.sh ------------------------- +#eos ls store/user/fengwang/QCDHLT_NoPU/*.root > list.txt + +#----------- For L1Hadd.sh ------------------------- #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JECL1/output_ak4caloHLT*.root > list_ak4caloHLT.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JECL1/output_ak4pfHLT*.root > list_ak4pfHLT.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JECL1/output_ak8caloHLT*.root > list_ak8caloHLT.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JECL1/output_ak8pfHLT*.root > list_ak8pfHLT.txt - +#-------------- For L1batch.sh --------------------------- #eos ls /store/user/fengwang/QCDHLT/JRA_1*.root > list1.txt #eos ls /store/user/fengwang/QCDHLT/JRA_2*.root > list2.txt #eos ls /store/user/fengwang/QCDHLT/JRA_3*.root > list3.txt @@ -17,12 +21,12 @@ source /afs/cern.ch/project/eos/installation/cms/etc/setup.sh #eos ls /store/user/fengwang/QCDHLT/JRA_8*.root > list8.txt #eos ls /store/user/fengwang/QCDHLT/JRA_9*.root > list9.txt - +#-------------- For PrejraHadd.sh ------------------------- #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1_*.root > list_fineBinning.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1-MergeEta_*.root > list_MergeEta.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1-MergePt_*.root > list_MergePt.txt - +#-------------- For L2batch.sh ---------------------------- #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_1*.root > list1.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_2*.root > list2.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_3*.root > list3.txt @@ -33,7 +37,7 @@ source /afs/cern.ch/project/eos/installation/cms/etc/setup.sh #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_8*.root > list8.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1_9*.root > list9.txt - +#------------- For L3batch.sh ----------------------------- #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_1*.root > list1.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_2*.root > list2.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_3*.root > list3.txt @@ -44,7 +48,7 @@ source /afs/cern.ch/project/eos/installation/cms/etc/setup.sh #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_8*.root > list8.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2_9*.root > list9.txt - +#------------- For jrabatch.sh ----------------------------- #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_1*.root > list1.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_2*.root > list2.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_3*.root > list3.txt @@ -55,7 +59,7 @@ source /afs/cern.ch/project/eos/installation/cms/etc/setup.sh #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_8*.root > list8.txt #eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/JRA_L1L2L3_9*.root > list9.txt - +#------------- For jraHadd.sh ------------------------------- eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1L2L3_*.root > list_fineBinning.txt eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1L2L3-MergeEta_*.root > list_MergeEta.txt eos ls /store/group/phys_jetmet/fengwang/HLTBX25JEC/jra_L1L2L3-MergePt_*.root > list_MergePt.txt