diff --git a/include/AnalysisCMS.h b/include/AnalysisCMS.h index 703628dd..bda8f66c 100644 --- a/include/AnalysisCMS.h +++ b/include/AnalysisCMS.h @@ -173,6 +173,8 @@ class AnalysisCMS : public AnalysisBase void GetScaleAndResolution(); + TRandom3* _rand; + TRandom3* _rand2; // Data members //---------------------------------------------------------------------------- @@ -191,7 +193,11 @@ class AnalysisCMS : public AnalysisBase std::vector _bjet30csvv2m_phi; std::vector _bjet30csvv2m_pt; - + // to testing for the fakes + //std::vector _lep1GenDeltaR; + //std::vector _lep2GenDeltaR; + //std::vector _testMotherID; + TH1F* _shapemlb; bool _saveminitree; @@ -215,7 +221,7 @@ class AnalysisCMS : public AnalysisBase bool _applytopptreweighting; bool _applytriggeremulation; - TRandom3* _rand; + TString _analysis; TString _dataperiod; @@ -429,6 +435,8 @@ class AnalysisCMS : public AnalysisBase float _ZZpt; float _ZZmass; + + float _MR; float _R2; float _Rpt; diff --git a/include/AnalysisStop.h b/include/AnalysisStop.h index 02682083..ffec5c50 100644 --- a/include/AnalysisStop.h +++ b/include/AnalysisStop.h @@ -118,10 +118,11 @@ class AnalysisStop : public AnalysisCMS TH1D* h_dphil1MET [nchannel][ncut][njetbin+1]; TH1D* h_dphil2MET [nchannel][ncut][njetbin+1]; TH1D* h_METphi [nchannel][ncut][njetbin+1]; + TH1D* h_m2L [nchannel][ncut][njetbin+1]; TH1D* h_Jet1Pt [nchannel][ncut][njetbin+1]; TH1D* h_Jet2Pt [nchannel][ncut][njetbin+1]; TH1D* h_JetPt [nchannel][ncut][njetbin+1]; - + int _SaveHistograms, _DoTheoreticalVariations; float _metmeff, _MT2ll, _MT2llgen, _MT2llfake; diff --git a/include/Constants.h b/include/Constants.h index 5afb52f9..bf6734eb 100644 --- a/include/Constants.h +++ b/include/Constants.h @@ -141,6 +141,7 @@ const Color_t color_Fakes = kGray+1; const Color_t color_Data = kBlack; const Color_t color_WZTo3LNu = kOrange-2; const Color_t color_VZ = kOrange+3; +//const Color_t color_ZZ = kOrange+6; const Color_t color_TTTo2L2Nu = kYellow; const Color_t color_ST = kYellow+3; const Color_t color_WW = kAzure-9; diff --git a/make b/make index 208cbafd..9c1de5a7 100755 --- a/make +++ b/make @@ -1,2 +1,2 @@ -`root-config --cxx --cflags` -o runAnalysis runAnalysis.C src/AnalysisCMS.C src/AnalysisBase.C `root-config --glibs` +#`root-config --cxx --cflags` -o runAnalysis runAnalysis.C src/AnalysisCMS.C src/AnalysisBase.C `root-config --glibs` `root-config --cxx --cflags` -o runAnalysisMiniTrees runAnalysisMiniTrees.C src/AnalysisCMS.C src/AnalysisBase.C `root-config --glibs` diff --git a/paths.txt b/paths.txt new file mode 100644 index 00000000..c9ca3662 --- /dev/null +++ b/paths.txt @@ -0,0 +1,8 @@ +# Path to Minitrees - Latest changes on 25 October 2017 - Valid for the freezing 22 November 2017 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/ + +# Path to rootfiles - Latest changes on 20 November 2017 - Valid for the freezing 22 November 2017 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles + +# Path to minitrees - Latest changes on 7 Febrary 2018 - Valid for the END. +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/nominalF/Stop diff --git a/samples/80x/stopSel/lxplus/MCtriggers_minitrees.txt b/samples/80x/stopSel/lxplus/MCtriggers_minitrees.txt new file mode 100644 index 00000000..95b1a0c7 --- /dev/null +++ b/samples/80x/stopSel/lxplus/MCtriggers_minitrees.txt @@ -0,0 +1,81 @@ +# MCTrigger_Minitrees +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/01_Data.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/02_WZTo3LNu.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/05_ST.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/06_WW.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/09_TTW.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/10_TTZ.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/11_HWW.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/13_VVV.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50-LO-ext1__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50-LO-ext1__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50-LO-ext1__part2.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50-LO-ext1__part3.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50-LO-ext1__part4.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50-LO-ext1__part5.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50-LO-ext1__part6.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50-LO-ext1__part7.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-10to50-LO.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-5to50_HT-70to100.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-5to50_HT-100to200.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-5to50_HT-200to400.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-5to50_HT-400to600.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-5to50_HT-600toInf.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-70to100__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-70to100__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-100to200_ext1__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-100to200_ext1__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-200to400_ext1__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-200to400_ext1__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-400to600.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-600to800__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-600to800__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-600to800__part2.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-800to1200.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-1200to2500.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/DYJetsToLL_M-50_HT-2500toInf.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part10.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part11.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part12.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part13.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part14.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part15.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part16.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part17.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part18.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part2.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part3.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part4.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part5.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part6.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part7.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part8.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TTTo2L2Nu__part9.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/ZZTo2L2Nu__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/ZZTo2L2Nu__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/ZZTo2L2Q__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/ZZTo2L2Q__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/ZZTo2L2Q__part2.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/ggZZTo2e2nu.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/ggZZTo2mu2nu.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/WZTo2L2Q__part0.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/WZTo2L2Q__part1.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/WZTo2L2Q__part2.root 1 +/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/WZTo2L2Q__part3.root 1 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/T2bW.root 1 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/T2tt_mStop-150to250.root 1 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/T2tt_mStop-250to350.root 1 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/T2tt_mStop-350to400.root 1 350 175 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/T2tt_mStop-350to400.root 1 350 263 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/T2tt_mStop-350to400.root 1 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/T2tt_mStop-400to1200.root 1 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TChiSlep.root 1 200 1 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TChiSlep.root 1 500 200 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TChiSlep.root 1 800 400 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TChiSlepExt.root 1 +#/eos/user/b/bchazinq/MCtrigger_minitrees/Stop/TChiWW.root 1 + + + diff --git a/samples/80x/stopSel/lxplus/My_nominal_minitrees.txt b/samples/80x/stopSel/lxplus/My_nominal_minitrees.txt new file mode 100644 index 00000000..e7688120 --- /dev/null +++ b/samples/80x/stopSel/lxplus/My_nominal_minitrees.txt @@ -0,0 +1,78 @@ +# Nominal_MinitreesVersion_26Oct2017 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/01_Data.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/02_WZTo3LNu.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/05_ST.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/06_WW.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/09_TTW.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/10_TTZ.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/11_HWW.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/13_VVV.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part2.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part3.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part4.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part5.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part6.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part7.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-10to50-LO.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-5to50_HT-70to100.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-5to50_HT-100to200.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-5to50_HT-200to400.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-5to50_HT-400to600.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-5to50_HT-600toInf.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-70to100__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-70to100__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-100to200_ext1__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-100to200_ext1__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-200to400_ext1__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-200to400_ext1__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-400to600.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-600to800__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-600to800__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-600to800__part2.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-800to1200.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-1200to2500.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/DYJetsToLL_M-50_HT-2500toInf.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part10.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part11.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part12.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part13.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part14.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part15.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part16.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part17.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part18.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part2.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part3.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part4.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part5.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part6.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part7.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part8.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TTTo2L2Nu__part9.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/ZZTo2L2Nu__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/ZZTo2L2Nu__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/ZZTo2L2Q__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/ZZTo2L2Q__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/ZZTo2L2Q__part2.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/ggZZTo2e2nu.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/ggZZTo2mu2nu.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/WZTo2L2Q__part0.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/WZTo2L2Q__part1.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/WZTo2L2Q__part2.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/WZTo2L2Q__part3.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/T2bW.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/T2tt_mStop-150to250.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/T2tt_mStop-250to350.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/T2tt_mStop-350to400.root 1 350 175 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/T2tt_mStop-350to400.root 1 350 263 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/T2tt_mStop-350to400.root 1 +/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/T2tt_mStop-400to1200.root 1 +#/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TChiSlep.root 1 200 1 +#/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TChiSlep.root 1 500 200 +#/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TChiSlep.root 1 800 400 +#/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TChiSlepExt.root 1 +#/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/minitrees/nominal/Stop/TChiWW.root 1 diff --git a/samples/80x/stopSel/lxplus/multilepton_minitrees.txt b/samples/80x/stopSel/lxplus/multilepton_minitrees.txt new file mode 100644 index 00000000..aa758711 --- /dev/null +++ b/samples/80x/stopSel/lxplus/multilepton_minitrees.txt @@ -0,0 +1,41 @@ +#3TightL_MinitreeVersion_26Oct2017 +#To use the mimic WZtoWW in shape validation plot -> run over this samples but using "WZtoWWveto" instead of "nominal" 12Febrery2018 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/01_Data.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/02_WZTo3LNu.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/04_TTTo2L2Nu.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/05_ST.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/06_WW.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/07_ZJets.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/07_ZJetsHT.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/09_TTW.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/10_TTZ.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/11_HWW.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/13_VVV.root 0 +##/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/15_VZ.root 0 +#This samples correspond to the ZZ -> 2l samples in the analysis (signal regions) +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Nu__part0.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Nu__part1.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part0.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part1.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part2.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2nu.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2mu2nu.root 0 +#This samples correspond to the ZZ -> 4l samples in the analysis (control regions) +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo4L__part0.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo4L__part1.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2mu.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2tau.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2mu2tau.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4e.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4mu.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4tau.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggHToZZTo4L.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/qqHToZZTo4L.root 0 +#other +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZTo2L2Q__part0.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZTo2L2Q__part1.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZTo2L2Q__part2.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZTo2L2Q__part3.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WWW.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WWZ.root 0 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZZ.root 0 diff --git a/samples/80x/stopSel/lxplus/nominal_minitrees.txt b/samples/80x/stopSel/lxplus/nominal_minitrees.txt new file mode 100644 index 00000000..ce56490d --- /dev/null +++ b/samples/80x/stopSel/lxplus/nominal_minitrees.txt @@ -0,0 +1,81 @@ +# Nominal_MinitreesVersion_26Oct2017 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/01_Data.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/02_WZTo3LNu.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/05_ST.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/06_WW.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/09_TTW.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/10_TTZ.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/11_HWW.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/13_VVV.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part2.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part3.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part4.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part5.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part6.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50-LO-ext1__part7.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-10to50-LO.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-5to50_HT-70to100.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-5to50_HT-100to200.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-5to50_HT-200to400.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-5to50_HT-400to600.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-5to50_HT-600toInf.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-70to100__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-70to100__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-100to200_ext1__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-100to200_ext1__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-200to400_ext1__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-200to400_ext1__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-400to600.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-600to800__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-600to800__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-600to800__part2.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-800to1200.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-1200to2500.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/DYJetsToLL_M-50_HT-2500toInf.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part10.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part11.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part12.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part13.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part14.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part15.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part16.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part17.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part18.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part2.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part3.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part4.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part5.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part6.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part7.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part8.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TTTo2L2Nu__part9.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/ZZTo2L2Nu__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/ZZTo2L2Nu__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/ZZTo2L2Q__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/ZZTo2L2Q__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/ZZTo2L2Q__part2.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/ggZZTo2e2nu.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/ggZZTo2mu2nu.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/WZTo2L2Q__part0.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/WZTo2L2Q__part1.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/WZTo2L2Q__part2.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/WZTo2L2Q__part3.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/T2bW.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/T2tt_mStop-150to250.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/T2tt_mStop-250to350.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/T2tt_mStop-350to400.root 1 350 175 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/T2tt_mStop-350to400.root 1 350 263 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/T2tt_mStop-350to400.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/T2tt_mStop-400to1200.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TChiSlep.root 1 200 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TChiSlep.root 1 500 200 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TChiSlep.root 1 800 400 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TChiSlepExt.root 1 +/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/TChiWW.root 1 + + + diff --git a/samples/80x/stopSel/lxplus/samples_chargino__Ghent_Summer16.txt b/samples/80x/stopSel/lxplus/samples_chargino__Ghent_Summer16.txt new file mode 100644 index 00000000..ecf6a3e2 --- /dev/null +++ b/samples/80x/stopSel/lxplus/samples_chargino__Ghent_Summer16.txt @@ -0,0 +1,3 @@ +/eos/cms/store/caf/user/scodella/BTV/Feb2017_Summer16_stop_ghent_others_isr/MCl2stop__SFWeights__hadd/latino_TChiSlep.root +/eos/cms/store/caf/user/scodella/BTV/Feb2017_Summer16_stop_ghent_others_isr/MCl2stop__SFWeights__hadd/latino_TChiSlepExt.root +/eos/cms/store/caf/user/scodella/BTV/Feb2017_Summer16_stop_ghent_others_isr/MCl2stop__SFWeights__hadd/latino_TChiWW.root diff --git a/samples/80x/stopSel/lxplus/samples_others_Ghent_Summer16.txt b/samples/80x/stopSel/lxplus/samples_others_Ghent_Summer16.txt index 5c8ab8a1..732be610 100644 --- a/samples/80x/stopSel/lxplus/samples_others_Ghent_Summer16.txt +++ b/samples/80x/stopSel/lxplus/samples_others_Ghent_Summer16.txt @@ -69,3 +69,14 @@ root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summ root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_others/MCl2stop__SFWeights__hadd/latino_Zg__part0.root root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_others/MCl2stop__SFWeights__hadd/latino_Zg__part1.root root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_others/MCl2stop__SFWeights__hadd/latino_ggZH_HToWW_M125.root +#extra ZZ samples +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggHToZZTo4L.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggZZTo2e2mu.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggZZTo2e2tau.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggZZTo2e2nu.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggZZTo2mu2nu.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggZZTo2mu2tau.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggZZTo4e.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggZZTo4mu.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_ggZZTo4tau.root +/eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ZZ/MCl2stop__SFWeights__hadd/latino_qqHToZZTo4L.root diff --git a/samples_minitrees.txt b/samples_minitrees.txt new file mode 100644 index 00000000..7e5bb779 --- /dev/null +++ b/samples_minitrees.txt @@ -0,0 +1,7 @@ +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZTo2L2Q__part0.root +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZTo2L2Q__part1.root +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZTo2L2Q__part2.root +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZTo2L2Q__part3.root +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WWW.root +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WWZ.root +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/WZZ.root diff --git a/src/AnalysisCMS.C b/src/AnalysisCMS.C old mode 100644 new mode 100755 index 155b2940..f2b0a24d --- a/src/AnalysisCMS.C +++ b/src/AnalysisCMS.C @@ -11,11 +11,12 @@ //------------------------------------------------------------------------------ AnalysisCMS::AnalysisCMS(TTree* tree, TString systematic) : AnalysisBase(tree) { - if (_verbosity > 0) printf(" <<< Entering [AnalysisCMS::AnalysisCMS]\n"); _verbosity = 0; // Set it to 1 for debugging + if (_verbosity > 0) printf(" <<< Entering [AnalysisCMS::AnalysisCMS]\n"); _ismc = true; + _rand = new TRandom3(0); _saveminitree = false; _eventdump = false; _applytopptreweighting = false; @@ -36,7 +37,7 @@ AnalysisCMS::AnalysisCMS(TTree* tree, TString systematic) : AnalysisBase(tree) _systematic_toppt = (systematic.Contains("Toppt")) ? true : false; _systematic = systematic; - + _minitreepath = ""; } @@ -107,7 +108,6 @@ bool AnalysisCMS::PassTrigger() else return true; } - } @@ -686,6 +686,7 @@ void AnalysisCMS::ApplyWeights() if (_systematic_fastsim_do) sf_fastsim = sf_fastsim_do; if (_systematic_fastsim_do) sf_fastsim = sf_fastsim_do; + //_event_weight *= (sf_btag * sf_trigger * sf_idiso * sf_reco * sf_fastsim); _event_weight *= (sf_btag * sf_trigger * sf_idiso * sf_reco * sf_fastsim); if (_verbosity > 0) @@ -2180,6 +2181,10 @@ void AnalysisCMS::OpenMinitree() minitree->Branch("Mdr", &_Mdr, "Mdr/F"); minitree->Branch("DeltaPhiRll", &_DeltaPhiRll, "DeltaPhiRll/F"); + // to test + //minitree->Branch("lep1GenDeltaR", "std::vector", &_lep1GenDeltaR); + //minitree->Branch("lep2GenDeltaR", "std::vector", &_lep2GenDeltaR); + //minitree->Branch("testMotherID", "std::vector", &_testMotherID); // Only available in MC if (std_vector_LHE_weight) minitree->Branch("LHEweight", &std_vector_LHE_weight); @@ -2816,6 +2821,10 @@ void AnalysisCMS::GetStopVar() } } + // Matching gen and reco leptons from W + // -------------------------------------- + // fakes estimate + for (int ml = 0; ml<2; ml++) { double MinimumDeltaR = 1.; @@ -2824,11 +2833,11 @@ void AnalysisCMS::GetStopVar() if (std_vector_leptonGen_pt->at(lp) < 0) continue; - int Wid = 2*ml - 1; // -1 for ml==0 (W-), +1 for ml==1 (W+) + int Wid = 2*ml - 1; // Stablish the sign of W => -1 for ml==0 (W-), +1 for ml==1 (W+) - if (Wid*std_vector_leptonGen_pid->at(lp) > 0) continue; + if (Wid*std_vector_leptonGen_pid->at(lp) > 0) continue; // avoid lepton mismatching W+ & e-mu- or W- & e+mu+ - if (fabs(std_vector_leptonGen_MotherPID->at(lp)) != 24) continue; + if (fabs(std_vector_leptonGen_MotherPID->at(lp)) != 24) continue; float LeptonMass = (fabs(std_vector_leptonGen_pid->at(lp)) == 13) ? MUON_MASS : ELECTRON_MASS; @@ -2840,16 +2849,18 @@ void AnalysisCMS::GetStopVar() LeptonMass); double DeltaRGenLepLep1 = (Lepton1.v).DeltaR(ChargedLepton); - + + // Get the MinimumDeltaR of the two W's, i.e., get the best matching of the two possible W's (+-) + if (DeltaRGenLepLep1at(Lepton1.index)*Wid<0) _lep1isfake *= -1; + if (std_vector_lepton_ch->at(Lepton1.index)*Wid<0) _lep1isfake *= -1; //_lep1fake < 0 there is a charge mismatching. It counts as fake lepton - if (MinimumDeltaR < 0.04 && lepIndex[ml] < 0) lepIndex[ml] = lp; + if (MinimumDeltaR < 0.04 && lepIndex[ml] < 0) lepIndex[ml] = lp; // different use } double DeltaRGenLepLep2 = (Lepton2.v).DeltaR(ChargedLepton); @@ -2860,7 +2871,7 @@ void AnalysisCMS::GetStopVar() _lep2isfake = MinimumDeltaR; - if (std_vector_lepton_ch->at(Lepton2.index)*Wid < 0) _lep2isfake *= -1; + if (std_vector_lepton_ch->at(Lepton2.index)*Wid < 0) _lep2isfake *= -1; //_lep1fake < 0 there is a charge mismatching. It counts as fake lepton if (MinimumDeltaR<0.04 && lepIndex[ml]<0) lepIndex[ml] = lp; @@ -3395,6 +3406,10 @@ void AnalysisCMS::GetScaleAndResolution() //------------------------------------------------------------------------------ int AnalysisCMS::GetMotherPID(int index) { + // _lep1GenDeltaR.clear(); + // _lep2GenDeltaR.clear(); + // _testMotherID.clear(); + int motherPID = -9999; //if (!_ismc || index > 1) return motherPID; @@ -3403,11 +3418,13 @@ int AnalysisCMS::GetMotherPID(int index) //TLorentzVector lepton_tlorentz = (index == 0) ? Lepton1.v : Lepton2.v; TLorentzVector lepton_tlorentz = AnalysisLeptons[index].v; + // Loop over GEN leptons //---------------------------------------------------------------------------- float deltaRMin = 0.3; for (UInt_t j=0; jsize(); j++) { + if (std_vector_leptonGen_pt->at(j) < 0) continue; @@ -3697,4 +3714,3 @@ float AnalysisCMS::kfactor_qqZZ_qcd_Pt(float GENpTZZ, int finalState) else return k; // if something goes wrong return inclusive k-factor } - diff --git a/src/AnalysisStop.C b/src/AnalysisStop.C index b16f5ee2..4a61b43e 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -7,7 +7,8 @@ // AnalysisStop //------------------------------------------------------------------------------ AnalysisStop::AnalysisStop(TTree* tree, TString systematic) : AnalysisCMS(tree, systematic) -{ +{ + _applyDYcorrections = systematic.Contains("DYcorr") ? true : false; systematic.ReplaceAll("DYcorr", ""); _applytopptreweighting = systematic.Contains("NoTopPt") ? false : true; @@ -31,7 +32,9 @@ AnalysisStop::AnalysisStop(TTree* tree, TString systematic) : AnalysisCMS(tree, AnalysisStop::AnalysisStop(TFile* MiniTreeFile, TString systematic, int SaveHistograms) { _applyDYcorrections = systematic.Contains("DYcorr") ? true : false; - _applytopptreweighting = true; + _applytopptreweighting = systematic.Contains("NoTopPt") ? false : true; + systematic.ReplaceAll("NoTopPt", ""); + //_applytopptreweighting = true; systematic.ReplaceAll("DYcorr", ""); SetSaveMinitree(false); GetMiniTree(MiniTreeFile, systematic); @@ -124,11 +127,11 @@ void AnalysisStop::Loop(TString analysis, TString filename, float luminosity, fl BTagSF_UpFSb = new BTagSFUtil("mujets", "DeepCSV", "Medium", +11, FastSimDataset); BTagSF_DoFSb = new BTagSFUtil("mujets", "DeepCSV", "Medium", -11, FastSimDataset);*/ - // Stop trigger efficiencies - TFile TriggerEfficiencyFile("/afs/cern.ch/work/s/scodella/Stop/CodeDevelopment/CMSSW_8_0_26_patch1/src/AnalysisCMS/stop/trigger/CopyOfFrameWork/output_stop_pt.root"); - TrgEff_ee = (TEfficiency *) TriggerEfficiencyFile.Get("DATAdenominatoree2D_clone"); - TrgEff_mm = (TEfficiency *) TriggerEfficiencyFile.Get("DATAdenominatormm2D_clone"); - TrgEff_em = (TEfficiency *) TriggerEfficiencyFile.Get("DATAdenominatorem2D_clone"); + // Stop trigger efficiencies using othogonal method + //TFile TriggerEfficiencyFile("/afs/cern.ch/work/s/scodella/Stop/CodeDevelopment/CMSSW_8_0_26_patch1/src/AnalysisCMS/stop/trigger/CopyOfFrameWork/output_stop_pt.root"); + //TrgEff_ee = (TEfficiency *) TriggerEfficiencyFile.Get("DATAdenominatoree2D_clone"); + //TrgEff_mm = (TEfficiency *) TriggerEfficiencyFile.Get("DATAdenominatormm2D_clone"); + //TrgEff_em = (TEfficiency *) TriggerEfficiencyFile.Get("DATAdenominatorem2D_clone"); // Loop over events //---------------------------------------------------------------------------- @@ -267,12 +270,14 @@ void AnalysisStop::Loop(TString analysis, TString filename, float luminosity, fl if (_systematic.Contains("SS") && Lepton1.flavour * Lepton2.flavour < 0) continue; if (_systematic.Contains("SSp") && (Lepton1.flavour <0 || Lepton2.flavour < 0)) continue; if (_systematic.Contains("SSm") && (Lepton1.flavour >0 || Lepton2.flavour > 0)) continue; - + if (_ismc) CorrectEventWeight(); float LeadingLeptonPtCut = (_systematic.Contains("multilepton")) ? 20. : 25.; + //********** Lepton pt selection ******************* if (Lepton1.v.Pt() < LeadingLeptonPtCut) continue; if (Lepton2.v.Pt() < 20.) continue; + //************************************************** _nelectron = 0; @@ -541,7 +546,13 @@ void AnalysisStop::Loop(TString analysis, TString filename, float luminosity, fl // Fill histograms // ----------------------------------------------------------------------------- - + /* //********** Lepton pt selection ********************************************* + if (_channel == 3 && (_lep1pt<23 || _lep2pt<12)) continue; + if (_channel == 4 && (_lep1pt<17 || _lep2pt<8)) continue; + if (_channel == 5 && abs(_lep1id==13) && (_lep1pt<23 || _lep2pt<12)) continue; + if (_channel == 5 && abs(_lep1id==11) && (_lep1pt<23 || _lep2pt<8)) continue; + //**************************************************************************** + */ // Basics Stop //------------------------------------------------------------------------- FillLevelHistograms(Stop_00_Has2Leptons, !_isminitree && _m2l>20. && pass && pass_blind && pass_masspoint); @@ -586,6 +597,9 @@ void AnalysisStop::Loop(TString analysis, TString filename, float luminosity, fl bool Zpeak = pass && _channel!=em && fabs(_m2l - Z_MASS)<15. ; if (_systematic.Contains("Zpeak") && !Zpeak) continue; + //*** WZtoWWVeto Zpeak *** + //FillLevelHistograms(Stop_05_Zpeak, Zpeak && pass_blind && pass_masspoint); // 2 OS Leptons, mll > 20, Z peak + //************************************ /*if (MET.Et()>140. && _njet==0 && dphill>3.2-0.32) { cout << "SSSLLL " << _nLeptonsMatched << " M2l " << _m2l << " dphill " << 180./3.14159*dphill << " dphilmet " << 180./3.14159*_dphiminlmet << " dphillmet " << 180./3.14159*_dphillmet << " mt2 " << _MT2ll << endl; cout << " event = " << run << " " << event << " " << ZDecayType << " " << _htgen << endl; @@ -666,7 +680,7 @@ void AnalysisStop::Loop(TString analysis, TString filename, float luminosity, fl if (_leadingPtCSVv2M >= 20.) { FillLevelHistograms(Stop_02_VR1_Tag, pass && (MET.Et()>=100. && MET.Et()<140.) && pass_blind && pass_masspoint); - if (_leadingPtCSVv2T >= 30. && njet>1) + //if (_leadingPtCSVv2T >= 30. && njet>1) FillLevelHistograms(Stop_02_VR1_Tag2Jet, pass && (MET.Et()>=100. && MET.Et()<140.) && pass_masspoint); FillLevelHistograms(Stop_02_SR1_Tag, pass && (MET.Et()>=140. && MET.Et()<200.) && pass_blind && pass_masspoint); FillLevelHistograms(Stop_02_SR2_Tag, pass && (MET.Et()>=200. && MET.Et()<300.) && pass_blind && pass_masspoint); @@ -755,13 +769,14 @@ void AnalysisStop::BookAnalysisHistograms() TString suffix = "_" + schannel[i]; - if (_SaveHistograms==0) DefineHistograms(i, j, k, suffix); + if (_SaveHistograms==0) DefineHistograms(i, j, k, suffix); h_MT2ll [i][j][k] = new TH1F("h_MT2ll" + suffix, "", 7, 0, 140); h_MT2llgen [i][j][k] = new TH1F("h_MT2llgen" + suffix, "", 7, 0, 140); h_MT2llisr [i][j][k] = new TH1F("h_MT2llisr" + suffix, "", 7, 0, 140); h_MT2llisrgen [i][j][k] = new TH1F("h_MT2llisrgen" + suffix, "", 7, 0, 140); + if (_SaveHistograms>=2 && _systematic=="nominal") { h_MT2ll_nvtxup [i][j][k] = new TH1F("h_MT2ll_nvtxup" + suffix, "", 7, 0, 140); @@ -811,6 +826,7 @@ void AnalysisStop::BookAnalysisHistograms() h_dphil1MET [i][j][k] = new TH1D("h_dphil1MET" + suffix, "", 100, 0, 3.2); h_dphil2MET [i][j][k] = new TH1D("h_dphil2MET" + suffix, "", 100, 0, 3.2); h_METphi [i][j][k] = new TH1D("h_METphi" + suffix, "", 200, -3.2, 3.2); + h_m2L [i][j][k] = new TH1D("h_m2L" + suffix, "", 180, 0, 180); if (_systematic.Contains("DYcorrections")) { h_dphiLLbin1 [i][j][k] = new TH1D("h_dphiLLbin1" + suffix, "", 80, 0, 3.14159); @@ -839,7 +855,7 @@ void AnalysisStop::BookAnalysisHistograms() h_Jet1Pt [i][j][k] = new TH1D("h_Jet1Pt" + suffix, "", 2000, 0, 2000); h_Jet2Pt [i][j][k] = new TH1D("h_Jet2Pt" + suffix, "", 2000, 0, 2000); h_JetPt [i][j][k] = new TH1D("h_JetPt" + suffix, "", 2000, 0, 2000); - h_mt2LL [i][j][k] = new TH1F("h_mt2LL" + suffix, "", 2000, 0, 2000); + //h_mt2LL [i][j][k] = new TH1F("h_mt2LL" + suffix, "", 2000, 0, 2000); h_MT2ll_MET [i][j][k] = new TH2F("h_MT2ll_MET" + suffix, "", 80, 0, 800, 7, 0, 140); @@ -1039,7 +1055,12 @@ void AnalysisStop::BookTheoreticalVariationsHistograms() void AnalysisStop::GetAnalysisVariables() { - if (_isminitree) { + if (_isminitree) { + + // Weight + if (_systematic.Contains("JES") || _systematic.Contains("MET")) + if (!_applytopptreweighting && _filename.Contains("TTTo2L2Nu")) + _event_weight = _event_weight_Toppt; // Met MET.SetPtEtaPhiM(metPfType1, 0.0, metPfType1Phi, 0.0); @@ -1164,6 +1185,8 @@ void AnalysisStop::FillAnalysisHistograms(int ichannel, int icut, int ijet) { + + //_event_weight = _event_weight/effTrigW; if (ichannel != ll) FillAnalysisHistograms(ll, icut, ijet); if ((_SaveHistograms>=2 || _systematic!="nominal") && ijetFill(dphilmet1, _event_weight); h_dphil2MET [ichannel][icut][ijet]->Fill(dphilmet2, _event_weight); h_METphi [ichannel][icut][ijet]->Fill(MET.Phi(), _event_weight); + h_m2L [ichannel][icut][ijet]->Fill(_m2l, _event_weight); if (_systematic.Contains("DYcorrections")) { float pi = acos(-1.); @@ -1256,10 +1280,11 @@ void AnalysisStop::FillAnalysisHistograms(int ichannel, if (_systematic.Contains("Zpeak")) return; if (_nLeptonsMatched==2) { - h_MT2ll_truth [ichannel][icut][ijet]->Fill(_MT2ll, _event_weight); + + h_MT2ll_truth [ichannel][icut][ijet]->Fill(_MT2ll, _event_weight); h_MET_truth [ichannel][icut][ijet]->Fill(MET.Et(), _event_weight); } else { - h_MT2ll_fake [ichannel][icut][ijet]->Fill(_MT2ll, _event_weight); + h_MT2ll_fake [ichannel][icut][ijet]->Fill(_MT2ll, _event_weight); h_MET_fake [ichannel][icut][ijet]->Fill(MET.Et(), _event_weight); } @@ -1268,7 +1293,7 @@ void AnalysisStop::FillAnalysisHistograms(int ichannel, h_Jet1Pt [ichannel][icut][ijet]->Fill(jetpt1, _event_weight); h_Jet2Pt [ichannel][icut][ijet]->Fill(jetpt2, _event_weight); for (int ij = 0; ij<_jet_pt.size(); ij++) h_JetPt[ichannel][icut][ijet]->Fill(_jet_pt.at(ij), _event_weight); - h_mt2LL [ichannel][icut][ijet]->Fill(_mt2ll, _event_weight); + //h_mt2LL [ichannel][icut][ijet]->Fill(_mt2ll, _event_weight); h_MT2ll_MET [ichannel][icut][ijet]->Fill(MET.Et(), _MT2ll, _event_weight); @@ -25730,6 +25755,8 @@ bool AnalysisStop::ShapeWZtoWW() if (_systematic.Contains("veto") && _nlepton>3) return false; + //float DMZCut = 999.;//Roberto's checking cut + //float DMZCut = 10.;//nominal cut float DMZCut = (_systematic.Contains("noZcut")) ? 999. : 10.; if (_systematic.Contains("DM15")) DMZCut = 15.; @@ -25774,11 +25801,13 @@ bool AnalysisStop::ShapeWZtoWW() if (DMZ>=DMZCut || Wlep1<0 || Wlep2<0 || Lostlep<0) { return false; } else { - - if (AnalysisLeptons[Wlep1].v.Pt()<25. || AnalysisLeptons[Wlep2].v.Pt()<20.) return false; + + // Selection of the WW leptons Pt + if (AnalysisLeptons[Wlep1].v.Pt() <25 || AnalysisLeptons[Wlep2].v.Pt() <20) return false; //if (AnalysisLeptons[Wlep1].v.Pt()<25. && AnalysisLeptons[Wlep2].v.Pt()<25.) return false; //if (AnalysisLeptons[Wlep1].v.Pt()<20. || AnalysisLeptons[Wlep2].v.Pt()<20.) return false; + // Variables re-computation TVector3 NewMET; NewMET.SetXYZ(MET.Px() + AnalysisLeptons[Lostlep].v.Px(), MET.Py() + AnalysisLeptons[Lostlep].v.Py(), MET.Pz()); @@ -25798,7 +25827,8 @@ bool AnalysisStop::ShapeWZtoWW() if (abs(Lepton1.flavour)!=abs(Lepton2.flavour)) _channel = em; else if (abs(Lepton1.flavour)==11) _channel = ee; else if (abs(Lepton1.flavour)==13) _channel = mm; - + + _mt2ll = ComputeMT2(Lepton1.v, Lepton2.v, MET); _MT2ll = (_mt2ll<140.) ? _mt2ll : 139.; @@ -25812,10 +25842,11 @@ bool AnalysisStop::ShapeWZtoWW() dphilmet1 = fabs((Lepton1.v).DeltaPhi(MET)); // this recompute the latino variable used in AnalysisCMS.C dphilmet2 = fabs((Lepton2.v).DeltaPhi(MET)); // this recompute the latino variable used in AnalysisCMS.C _dphillmet = fabs((Lepton1.v + Lepton2.v).DeltaPhi(MET)); - } - + + + // if (fabs(_m2l - Z_MASS) < 15. && _channel != em) return false; return true; } diff --git a/stop/CheckShapes.C b/stop/CheckShapes.C index 7f12b1a1..1148404e 100644 --- a/stop/CheckShapes.C +++ b/stop/CheckShapes.C @@ -1,16 +1,75 @@ +#include"TString.h" +#include"TH1F.h" +#include"TFile.h" +#include +#include +#include "TCanvas.h" +#include "TLegend.h" +#include "TSystem.h" +#include "TStyle.h" +#include "TPad.h" + bool verbose = true; +bool info = true; -void CheckShapes(TString ProcessName, TString UncertaintyName, TString ShapeName, TString HistoDirectory = "../minitrees/rootfiles2R/") { - +void CheckShapes(TString ProcessName, TString UncertaintyName, TString ShapeName, TString channel, TString HistoDirectory = "../minitrees/rootfiles2R/", bool sameFlavour = false) { + + + if (info){ + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "ProcessName " << ProcessName << std::endl; + std::cout << "UncertaintyName " << UncertaintyName << std::endl; + std::cout << "ShapeName + channel " << ShapeName+"_"+channel << std::endl; + std::cout << "HistoDirectory " << HistoDirectory << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << HistoDirectory + UncertaintyName + "up/Stop/" + ProcessName + ".root" << std::endl; + std::cout << HistoDirectory + "nominal/Stop/" + ProcessName + ".root" << std::endl; + std::cout << HistoDirectory + UncertaintyName + "do/Stop/" + ProcessName + ".root" << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + } //TString HistoDirectory = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/"; + TH1F *HUP; TH1F *HCN; TH1F *HDO; + TFile *_fileu = TFile::Open(HistoDirectory + UncertaintyName + "up/Stop/" + ProcessName + ".root"); TFile *_filec = TFile::Open(HistoDirectory + "nominal/Stop/" + ProcessName + ".root"); TFile *_filed = TFile::Open(HistoDirectory + UncertaintyName + "do/Stop/" + ProcessName + ".root"); - TH1F *HUP = (TH1F*) _fileu->Get(ShapeName); - TH1F *HCN = (TH1F*) _filec->Get(ShapeName); - TH1F *HDO = (TH1F*) _filed->Get(ShapeName); + if (sameFlavour){ + + std::cout << "sameFlavour" << std::endl; + + HUP = (TH1F*) _fileu->Get(ShapeName+"_ee"); TH1F *HUP_mm = (TH1F*) _fileu->Get(ShapeName+"_mm"); + HCN = (TH1F*) _filec->Get(ShapeName+"_ee"); TH1F *HCN_mm = (TH1F*) _filec->Get(ShapeName+"_mm"); + HDO = (TH1F*) _filed->Get(ShapeName+"_ee"); TH1F *HDO_mm = (TH1F*) _filed->Get(ShapeName+"_mm"); + + HUP -> Add(HUP_mm); + HCN -> Add(HCN_mm); + HDO -> Add(HDO_mm); + + channel = "_sameFlavour"; + } + else{ + + std::cout << "sameFlavour = false" << std::endl; + + HUP = (TH1F*) _fileu->Get(ShapeName+"_"+channel); + HCN = (TH1F*) _filec->Get(ShapeName+"_"+channel); + HDO = (TH1F*) _filed->Get(ShapeName+"_"+channel); + } + + gSystem->mkdir("Pileup_Uncert/", kTRUE); + TCanvas* c = new TCanvas ( "PU_uncertainty", "", 1200,1000); + //TPad *pad1 = new TPad("pad1", "pad1", 0, 0, 1, 1); + //pad1->cd(); + //ad1->SetLogy(1); + + //TPad *pad1 = new TPad(); + //pad1->cd(); + //pad1->SetLogy(); + + gStyle->SetOptStat(""); + TString title = ProcessName.ReplaceAll(".root", ""); HUP->SetLineColor(2); HDO->SetLineColor(4); @@ -18,15 +77,35 @@ void CheckShapes(TString ProcessName, TString UncertaintyName, TString ShapeName float min = HDO->GetMinimum(); HCN->SetMinimum(0.9*min); float max = HCN->GetMaximum(); - HCN->SetMaximum(1.2*max); + HCN->SetMaximum(2*max); + //HCN->SetMaximum(1.2*max); + + HCN -> SetTitle(title + "_" + channel); + HCN -> SetXTitle ("MT2ll (GeV)"); + TLegend* leg; + //leg = new TLegend(0.1,0.7,0.3,0.9); + leg = new TLegend(0.75, 0.9, 0.9, 0.7); + leg -> AddEntry(HCN, "nominal" , "lp"); + leg -> AddEntry(HUP, "Pileup Up" , "lp"); + leg -> AddEntry(HDO, "Pileup Down" , "lp"); + + gPad->SetLogy(); + HCN->Draw(); HUP->Draw("same"); HDO->Draw("same"); + leg -> Draw(); if (verbose) { - for (int ibin = 1; ibin<=HCN->GetNbinsX(); ibin++) - cout << ibin << " " << HUP->GetBinContent(ibin)/HCN->GetBinContent(ibin) << " " << HDO->GetBinContent(ibin)/HCN->GetBinContent(ibin) << endl; - cout << "Total " << HUP->Integral()/HCN->Integral() << " " << HDO->Integral()/HCN->Integral() << endl; + cout << "bin HUP/HCN % HDO/HCN %" <GetNbinsX(); ibin++) + { + cout << ibin << " " << HUP->GetBinContent(ibin)/HCN->GetBinContent(ibin) << " " << 100*(HCN->GetBinContent(ibin)-HUP->GetBinContent(ibin))/HUP->GetBinContent(ibin) << " "<< HDO->GetBinContent(ibin)/HCN->GetBinContent(ibin) << " " << 100*(HCN->GetBinContent(ibin)-HDO->GetBinContent(ibin))/HDO->GetBinContent(ibin)<< endl; + } + cout << "Total " << HUP->Integral()/HCN->Integral() << " " << 100*(HCN->Integral()-HUP->Integral())/HCN->Integral() << " " << HDO->Integral()/HCN->Integral() << " " << 100*(HCN->Integral()-HDO->Integral())/HCN->Integral()<< endl; } + c -> Print("Pileup_Uncert/PU_uncertainty"+ title + "_" + channel +".png"); } + + diff --git a/stop/Compare_twoHistos.C b/stop/Compare_twoHistos.C new file mode 100644 index 00000000..c05f8acd --- /dev/null +++ b/stop/Compare_twoHistos.C @@ -0,0 +1,305 @@ +#include "TString.h" +#include "TH1F.h" +#include "TFile.h" +#include +#include +#include "TCanvas.h" +#include "TLegend.h" +#include "TSystem.h" +#include "TStyle.h" +#include "TPad.h" +#include "TMath.h" +#include "TFrame.h" +#include "TAttMarker.h" +#include "TLine.h" + +bool verbose = false; +bool info = true; + + +void Shapes_Builder( TString channel, + TString ProcessName1, + TString ProcessName2, + //TString ProcessName = "TTTo2L2Nu__part0", + TString cut = "Stop/02_SRs/", + TString cutName = "BaseSelection", + //TString cut = "Stop/02_SRs_NoTag/", + //TString cutName = "BaseSelection_NoTag", + //TString HistoDirectoryi1 = "../MCtrigger_rootfiles/nominal/Stop/", + //TString HistoDirectoryi1 = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfilesTrgEmu/nominal/Stop/", + //TString HistoDirectoryi2 = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfilesTrg/nominal/Stop/", + + TString HistoDirectoryi1 = "../freezing_rootfiles/nominal/Stop/", //3rd Lepton veto + //TString HistoDirectoryi2 = "../freezing_rootfiles/nominal/Stop/", //3rd Lepton veto + + //TString HistoDirectoryi1 = "../rootfiles_No3LepVeto_Use/nominal/Stop/", //3rd Lepton no veto + TString HistoDirectoryi2 = "../rootfiles_No3LepVeto_Use/nominal/Stop/", //3rd Lepton no veto + + //TString HistoDirectoryi3 = "../minitrees/rootfiles/nominal/Stop/", + bool sameFlavour = false) + +{ + if (info){ + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "ProcessName1 " << ProcessName1 << std::endl; + std::cout << "ProcessName2 " << ProcessName2 << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "HistoDirectoryi1 " << HistoDirectoryi1 << std::endl; + std::cout << "HistoDirectoryi2 " << HistoDirectoryi2 << std::endl; +// std::cout << "HistoDirectoryi3 " << HistoDirectoryi3 << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "channel "<< channel << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + } + + + //======================================================== + // User Configuartion + //======================================================== + + //Output folder + //---------------------------------------------- + TString outputFolder = "3rdVeto_NoVeto/"; + TString outputSuffix; + + //Output suffix + //---------------------------------------------- + if (ProcessName2 == "") outputSuffix=""; + else outputSuffix= "Yes3rdLepVeto"; + + //Ratio axis limits + //---------------------------------------------- + float r_ymin =0.7, r_ymax =1.3; + //float ymin =0.0, ymax =0.1; + + //Set normalized distributions + //---------------------------------------------- + bool normalized = false; + + //Legend and ratio y axis title + //---------------------------------------------- + // For ProcessName1 & ProcessName2 + // TString ratio_Ytitle = " T2tt / ttbar"; + // TString h1_legendEntry = "T2tt"; + // TString h2_legendEntry = "ttbar"; + TString legHeader = "3rd lepton No Veto"; + //---------------------------------------------- + // For ProcessName1 Only + TString ratio_Ytitle = " veto / No veto"; + TString h1_legendEntry = "3rd lepton veto"; + TString h2_legendEntry = "No 3rd lepton veto"; + + //======================================================== + //======================================================== + + TH1F *h_1; TH1F *h_2; TH1F *h_3; + + TFile *_file1 = TFile::Open(HistoDirectoryi1 + ProcessName1 + ".root"); // MC trigger selection + TFile *_file2; + if (ProcessName2 == "") _file2 = TFile::Open(HistoDirectoryi2 + ProcessName1 + ".root"); // Efficiency from Data + else _file2 = TFile::Open(HistoDirectoryi2 + ProcessName2 + ".root"); +// TFile *_file3 = TFile::Open(HistoDirectoryi3 + ProcessName + ".root"); // No trigger weight + + if (sameFlavour){ + + std::cout << "sameFlavour" << std::endl; + + h_1 = (TH1F*) _file1->Get(cut+"h_MT2ll_ee"); TH1F *h_1_mm = (TH1F*) _file1->Get(cut+"h_MT2ll_mm"); + h_2 = (TH1F*) _file2->Get(cut+"h_MT2ll_ee"); TH1F *h_2_mm = (TH1F*) _file2->Get(cut+"h_MT2ll_mm"); +// h_3 = (TH1F*) _file3->Get(cut+"h_MT2ll_ee"); TH1F *h_3_mm = (TH1F*) _file3->Get(cut+"h_MT2ll_mm"); + + h_1 -> Add(h_1_mm); + h_2 -> Add(h_2_mm); +// h_3 -> Add(h_3_mm); + + channel = "_sameFlavour"; + } + else{ + + std::cout << "sameFlavour = false" << std::endl; + + h_1 = (TH1F*) _file1->Get(cut+"h_MT2ll_"+channel); + h_2 = (TH1F*) _file2->Get(cut+"h_MT2ll_"+channel); +// h_3 = (TH1F*) _file3->Get(cut+"h_MT2ll_"+channel); + } + + // Normalization to unity + //-------------------------------------------------- + if (normalized) + { + h_1->Scale(1/h_1->Integral()); + h_2->Scale(1/h_2->Integral()); + } + //-------------------------------------------------- + + gSystem->cd("/afs/cern.ch/user/b/bchazinq/www/STOP/"); + gSystem->mkdir(outputFolder, kTRUE); + //gSystem->CopyFile("index.php", "MCTrigger_Eff/.", kTRUE); + gSystem->cd("-"); + + + TCanvas* canvas = NULL; + TPad* pad1 = NULL; + TPad* pad2 = NULL; + + //TCanvas* c = new TCanvas ( "MCtrigger_"+ ProcessName, "", 1200,1000); + TCanvas* c = new TCanvas ( cutName + ProcessName1+ "_"+ ProcessName2, "", 550, 600); + + pad1 = new TPad(); + pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.02); + pad1->Draw(); + + pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); + pad2->SetTopMargin (0.08); + pad2->SetBottomMargin(0.35); + pad2->Draw(); + + TString title; + if (ProcessName2 == "") {title = ProcessName1.ReplaceAll(".root", "");} + else { title = ProcessName1.ReplaceAll(".root", "") + "Vs" + ProcessName2.ReplaceAll(".root", "");} + + pad1->cd(); + gStyle->SetOptStat(""); + pad1->SetLogy(); + //gPad->SetLogy(); + + + float min = h_1->GetMinimum(); + h_1->SetMinimum(0.9*min); + float max = h_2->GetMaximum(); + h_1->SetMaximum(2*max); + //HCN->SetMaximum(1.2*max); + + //axis title + //----------- + TAxis* xaxis = (TAxis*)h_1->GetXaxis(); + TAxis* yaxis = (TAxis*)h_1->GetYaxis(); + xaxis->SetTitleSize(.10); + xaxis->SetTitle("MT2ll (GeV)"); + xaxis->SetLabelSize(.08); + yaxis->SetTitle("events/20 GeV"); + yaxis->SetTitleSize(.05); + yaxis->SetTitleOffset(1); + yaxis->CenterTitle(); + + // Legend + //---------------------------------------------------------------------------- + TLegend* leg; + //leg = new TLegend(0.1,0.7,0.3,0.9); + leg = new TLegend(0.65, 0.9, 0.9, 0.7); + leg -> AddEntry(h_1, h1_legendEntry, "lp"); + leg -> AddEntry(h_2, h2_legendEntry, "lp"); + //leg -> AddEntry(h_3, "No trigger weight" , "lp"); + leg -> SetTextSize (0.03); + TString processIN[] = {"02_WZTo3LNu","03_ZZ","04_TTTo2L2Nu","05_ST","06_WW","07_ZJetsHT","07_ZJetsHT_DYcorr","09_TTW","10_TTZ","11_HWW","13_VVV","14_ZZTo4l","15_VZ", "15_VZ3V","T2tt_mStop-350to400_Sm350_Xm225", "T2tt_mStop-350to400_Sm350_Xm263", "T2tt_mStop-350to400_Sm350_Xm175", "TChiSlep_Xm500_Xm200"}; + TString processOUT[] = {"WZTo3LNu", "ZZ", "ttbar", "tW", "WW", "ZJets", "ZJetsHT_DYcorr","ttbarW","ttbarZ", "HWW", "VVV", "ZZTo4l", "VZ", "VVV+VZ", "T2tt(350,225)", "T2tt(350,263)", "T2tt(350,175)", "TChiSlep(500,200)"}; + + if (ProcessName2 == "") + { + for (int i=0; i<18;i++) + { + if (ProcessName1 == processIN[i]) {leg -> SetHeader(processOUT[i] + " channel " + channel); break;} + if (i==17 && ProcessName1 != processIN[i]){std::cout<<"WARNING this sample: "<< ProcessName1 << "is not in the rootfile"< SetHeader( legHeader + " channel " + channel); + } + + h_1->SetMarkerStyle(kPlus); + h_2->SetMarkerStyle(kPlus); + h_1->SetMarkerSize(4); + h_2->SetMarkerSize(4); + h_1->SetMarkerColor(2); + h_2->SetMarkerColor(4); + + // Draw + //----------------------------------------------------------------------------- + h_1->Draw("hist p0"); + h_2->Draw("hist p0, same"); + //h_3->Draw("same"); + leg -> Draw(); + + //------------------------------------------------------------------------------- + // Ratio + //------------------------------------------------------------------------------- + pad2->cd(); + TH1F* ratio = (TH1F*)h_1->Clone("ratio"); + float ymin = r_ymin, ymax = r_ymax; + for (Int_t ibin=1; ibin<=ratio->GetNbinsX(); ibin++) { + float ratioVal = -999; //float ratioErr = 999; + ratioVal = h_1->GetBinContent(ibin)/h_2->GetBinContent(ibin); + //ratioErr = (ratioVal * ratioVal)*( TMath::Power(h_1->GetBinError(ibin)/ h_1->GetBinContent(ibin),2) + TMath::Power(h_2->GetBinError(ibin)/ h_2->GetBinContent(ibin),2)); + ratio -> SetBinContent(ibin, ratioVal); + //ratio->SetBinError (ibin, ratioErr); + //if (ratioVal+ratioErr>ymax) ymax = (ratioVal+ratioErr) + (ratioVal+ratioErr)*0.01; + //if (ratioVal>0. && ratioVal-ratioErrGetBinContent(ibin)); if (abs(min) < abs(ymin)) ymin=min; + //float max = ratioVal + 0.02*(h_2->GetBinContent(ibin)); if (abs(max) > abs(ymax)) ymin=max; + } + ratio->SetMarkerColor(1); + ratio->SetMarkerSize(1); + ratio->SetMarkerStyle(kFullCircle); + ratio->GetYaxis()->SetRangeUser(ymin, ymax); + + //axix title + //------------------------------------------------------------------------------ + + TAxis* yaxis2 = (TAxis*)ratio->GetYaxis(); + yaxis2->SetLabelSize(.08); + yaxis2->SetTitle(ratio_Ytitle); + yaxis2->SetTitleSize(.055); + yaxis2->SetTitleOffset(1); + yaxis->CenterTitle(); + //draw + //----------------------------------------------------------------------------- + ratio->Draw("hist p0"); + + c->Update(); + pad2->Update(); + TLine *line=new TLine(0,1.0,140,1.); + line->SetLineColor(1); + line->SetLineWidth(2); + line->SetLineStyle(kDotted); + line->Draw("same"); + c->Modified(); + c->Update(); + + if (verbose) { + cout << "bin h1 / h2 % " <GetNbinsX(); ibin++) + { + cout << ibin << " " << h_1->GetBinContent(ibin)/h_2->GetBinContent(ibin) <<" " << Form("%.2f", (h_1->GetBinContent(ibin)/h_2->GetBinContent(ibin))*100) <GetBinContent(ibin) << " freezing_rootfiles " << h_2->GetBinContent(ibin) <Integral()<< endl; + cout << "Total trigger eff from Data" << h_2->Integral()<< endl; + cout << " "<< endl; + cout << "Total_MC_trigger_select./Total_trigger_eff_from_Data %"<< endl; + cout << h_1->Integral()/h_2->Integral() << " " << Form("%.2f", (h_1->Integral()/h_2->Integral())*100) << endl; +// cout << "Total No trigger weight" << h_3->Integral()<< endl; + } + //c ->SaveAs("/afs/cern.ch/user/b/bchazinq/www/MCTrigger_Eff/MCTrigger_"+ title + "_" + channel +".png"); + c ->Print("/afs/cern.ch/user/b/bchazinq/www/STOP/" + outputFolder+ "comparation_"+ title + "_" + channel + "_" +cutName + "_" +outputSuffix + ".png"); + gSystem->cd("/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/stop/"); + //std::cout<< gSystem->pwd() < Draw( b_name[lep1pt ] + " >> " + h_name[lep1pt ] + "( 3000, 0 , 3000 )", thecut ); +/* mytree -> Draw( b_name[lep1pt ] + " >> " + h_name[lep1pt ] + "( 3000, 0 , 3000 )", thecut ); mytree -> Draw( b_name[lep1eta ] + " >> " + h_name[lep1eta ] + "( 60, -3 , 3 )", thecut ); mytree -> Draw( b_name[lep1phi ] + " >> " + h_name[lep1phi ] + "( 200, -3.2, 3.2 )", thecut ); mytree -> Draw( b_name[lep1mass ] + " >> " + h_name[lep1mass ] + "( 100, 0 , 100 )", thecut ); @@ -141,19 +141,21 @@ void CreateHistograms2( int process ){ mytree -> Draw( b_name[metPfType1Phi] + " >> " + h_name[metPfType1Phi] + "( 100, 0, 3.2 )", thecut ); mytree -> Draw( b_name[m2l ] + " >> " + h_name[m2l ] + "( 3000, 0, 3000 )", thecut ); - mytree -> Draw( b_name[mt2ll ] + " >> " + h_name[mt2ll ] + "( 3000, 0, 3000 )", thecut ); mytree -> Draw( b_name[mt2lblb ] + " >> " + h_name[mt2lblb ] + "( 3000, 0, 3000 )", thecut ); -/* mytree -> Draw( b_name[mtw1 ] + " >> " + h_name[mtw1 ] + "( 3000, 0, 3000 )", thecut ); + mytree -> Draw( b_name[mtw1 ] + " >> " + h_name[mtw1 ] + "( 3000, 0, 3000 )", thecut ); mytree -> Draw( b_name[mtw2 ] + " >> " + h_name[mtw2 ] + "( 3000, 0, 3000 )", thecut ); mytree -> Draw( b_name[ht ] + " >> " + h_name[ht ] + "( 3000, 0, 3000 )", thecut ); mytree -> Draw( b_name[htjets ] + " >> " + h_name[htjets ] + "( 3000, 0, 3000 )", thecut ); mytree -> Draw( b_name[htnojets ] + " >> " + h_name[htnojets ] + "( 3000, 0, 3000 )", thecut ); -*/ mytree -> Draw( b_name[njet ] + " >> " + h_name[njet ] + "( 10, 0, 10 )", thecut ); - mytree -> Draw( b_name[nbjet30csvv2m] + " >> " + h_name[nbjet30csvv2m] + "( 10, 0, 10 )", thecut ); -/* mytree -> Draw( b_name[nbjet30csvv2l] + " >> " + h_name[nbjet30csvv2l] + "( 10, 0, 10 )", thecut ); +*/ mytree -> Draw( b_name[njet ] + " >> " + h_name[njet ] + "( 10, 0, 10 )", thecut ); + mytree -> Draw( b_name[nbjet30csvv2m] + " >> " + h_name[nbjet30csvv2m] + "( 10, 0, 10 )", thecut ); + mytree -> Draw( b_name[nbjet30csvv2l] + " >> " + h_name[nbjet30csvv2l] + "( 10, 0, 10 )", thecut ); mytree -> Draw( b_name[nbjet30csvv2t] + " >> " + h_name[nbjet30csvv2t] + "( 10, 0, 10 )", thecut ); + mytree -> Draw( b_name[mt2ll ] + " >> " + h_name[mt2ll ] + "( 3000, 0, 3000 )", thecut ); +/* mytree -> Draw( b_name[leadingPtCSVv2M] + " >> " + h_name[leadingPtCSVv2M] + "( 3000, 0, 3000 )", thecut ); + mytree -> Draw( b_name[leadingPtCSVv2T] + " >> " + h_name[leadingPtCSVv2T] + "( 3000, 0, 3000 )", thecut ); mytree -> Draw( b_name[dphijet1met ] + " >> " + h_name[dphijet1met ] + "( 100, 0, 3.2 )", thecut ); mytree -> Draw( b_name[dphijet2met ] + " >> " + h_name[dphijet2met ] + "( 100, 0, 3.2 )", thecut ); diff --git a/stop/FakeStudies.C b/stop/FakeStudies.C index 910da066..70a108d5 100644 --- a/stop/FakeStudies.C +++ b/stop/FakeStudies.C @@ -10,24 +10,38 @@ #include "TStyle.h" #include "TSystem.h" #include "TTree.h" +#include "TFile.h" +#include "TPad.h" +#include "TCanvas.h" +#include "TH1F.h" +#include "TDirectory.h" #include #include -void FakeStudies(TString Selection) { - const int nChannels = 4, nVariables = 2, nMetCuts = 5, nBtagCuts = 2; +void FakeStudies(TString Selection, TString channel) { + + const int nChannels = 4, nVariables = 1, nMetCuts = 1, nBtagCuts = 1; TString Channel[nChannels] = {"_ee", "_mm", "_em", "_ll"}; - TString Variable[nVariables] = {"MT2ll", "MET"}; - TString MetCut[nMetCuts] = {"01", "02_VR1", "02_SR1", "02_SR2", "02_SR3"}; - TString BtagCut[nBtagCuts] = {"_NoTag", "_Tag"}; - + TString Variable[nVariables] = {"MT2ll"}; + //TString MetCut[nMetCuts] = {"02_VR1", "02_SR1", "02_SR2", "02_SR3"}; + TString MetCut[nMetCuts] = {"02_SR1_Tag"}; + TString BtagCut[nBtagCuts] = {"_Veto"}; + + gSystem->mkdir("FakesPlots", kTRUE); + // gSystem->Exec("cp ./index.php ./FakesPlots/; done"); +// gSystem->Exec("for dir in $(find ./FakesPlots/ -type d); do cp -n ./index.php $dir/; done"); + TString RootFileName = ""; - if (Selection=="ttbar") RootFileName = "../rootfiles/nominal/Stop/04_TTTo2L2Nu.root"; - if (Selection=="WW") RootFileName = "../rootfiles/nominal/Stop/06_WW.root"; + if (Selection=="ttbar") RootFileName = "../minitrees/rootfiles/nominal/Stop/04_TTTo2L2Nu.root"; + if (Selection=="WW") RootFileName = "../minitrees/rootfiles/nominal/Stop/06_WW.root"; + if (Selection=="ST") RootFileName = "../minitrees/rootfiles/nominal/Stop/05_ST.root"; + if (Selection=="ZJets") RootFileName = "../minitrees/rootfiles/nominal/Stop/07_ZJetsHT.root"; if (RootFileName=="") return; TFile *RootFile = TFile::Open(RootFileName); + //TFile *RootFile = TFile::Open(RootFileName); TCanvas *CC = new TCanvas("CC", "", 900, 600); CC->Divide(2, 2); @@ -36,9 +50,9 @@ void FakeStudies(TString Selection) { CL->Divide(1, 2); TPad *PadC1 = (TPad*)CC->GetPad(1); - TPad *PadC2 = (TPad*)CC->GetPad(2); - TPad *PadC4 = (TPad*)CC->GetPad(3); - TPad *PadC3 = (TPad*)CC->GetPad(4); + //TPad *PadC2 = (TPad*)CC->GetPad(2); + //TPad *PadC4 = (TPad*)CC->GetPad(3); + //TPad *PadC3 = (TPad*)CC->GetPad(4); //TPad *PadL1 = (TPad*)CL->GetPad(1); TPad *PadL1 = new TPad("PadL1", "", 0.02, 0.27, 0.98, 0.98, 21); @@ -131,20 +145,63 @@ void FakeStudies(TString Selection) { leg->SetTextFont(62); leg->SetHeader("t#bar{t} dilepton events"); if (Selection=="WW") leg->SetHeader("WW dilepton events"); - - for (int c = 3; cGet("Stop/" + MetCut[m] + BtagCut[b] + "/h_" + Variable[v] + "_fake" + Channel[c]); - TH1F* Truth = (TH1F*) RootFile->Get("Stop/" + MetCut[m] + BtagCut[b] + "/h_" + Variable[v] + "_truth" + Channel[c]); - - Fake->Scale(lumi); + if (Selection=="ST") leg->SetHeader("tW dilepton events"); + if (Selection=="ZJets") leg->SetHeader("ZJets dilepton events"); + + //for (int c = 3; cGet("Stop/" + MetCut[m] + "_NoTag/h_" + Variable[v] + "_fake" + channel); + // Fake1->SetDirectory(0); + Fake1 = (TH1F*) RootFile->Get("Stop/" + MetCut[m] + "_NoJet/h_" + Variable[v] + "_fake" + channel); + Fake0 -> Add (Fake1); + Fake = (TH1F*) Fake0 ->Clone(); + //Fake->SetDirectory(0); + + Truth0 = (TH1F*) RootFile->Get("Stop/" + MetCut[m] + "_NoTag/h_" + Variable[v] + "_truth" + channel); + //Truth1->SetDirectory(0); + Truth1 = (TH1F*) RootFile->Get("Stop/" + MetCut[m] + "_NoJet/h_" + Variable[v] + "_truth" + channel); + Truth0 -> Add (Truth1); + //Truth->SetDirectory(0); + Truth = (TH1F*) Truth0 ->Clone(); + std::cout << "done Veto" <Reset(); Fake1 ->Reset(); Truth0 ->Reset(); Truth1 ->Reset(); + } + else + { + Fake = (TH1F*) RootFile->Get("Stop/" + MetCut[m] + BtagCut[b] + "/h_" + Variable[v] + "_fake" + channel); + Truth = (TH1F*) RootFile->Get("Stop/" + MetCut[m] + BtagCut[b] + "/h_" + Variable[v] + "_truth" + channel); + } + + Fake->Scale(lumi); Truth->Scale(lumi); - - float fmin = Fake->GetMinimum(); - if (fmin>0.) - Truth->SetMinimum(fmin*0.9); - else Truth->SetMinimum(0.1); - + + //if (!BtagCut[b].Contains("Veto")) + // { + // Fake->Scale(lumi); + // Truth->Scale(lumi); + // } + + std::cout << "Fake ->GetMinimum() " << Fake->GetMinimum() <GetMinimum() " << Truth->GetMinimum() <GetMinimum(); + float truthmin = Truth->GetMinimum(); + if (fakemin < truthmin) { Truth->SetMinimum(fakemin + 0.0001);} + //float fmin = Fake->GetMinimum(); + // if (fmin>0.) + // Truth->SetMinimum(fmin*0.9); + // else Truth->SetMinimum(0.1); + + + // Truth->SetMinimum(0.1); //Truth->SetXTitle("M_{T2}(ll) [GeV]"); Truth->SetYTitle("Events / 20 GeV"); @@ -165,15 +222,18 @@ void FakeStudies(TString Selection) { Fake->SetLineColor(2); - if (c==0) PadC1->cd(); - if (c==1) PadC2->cd(); - if (c==2) PadC3->cd(); - if (c==3) PadC4->cd(); + PadC1->cd(); + //if (c==0) PadC1->cd(); + //if (c==1) PadC2->cd(); + //if (c==2) PadC3->cd(); + //if (c==3) PadC4->cd(); Truth->DrawCopy(); Fake->DrawCopy("same"); - if (c==3) PadL1->cd(); + std::cout << "2" <cd(); + //if (c==3) PadL1->cd(); //if (c==1) PadL2->cd(); //if (c==2) PadL3->cd(); //if (c==3) PadL4->cd(); @@ -181,7 +241,7 @@ void FakeStudies(TString Selection) { Truth->DrawCopy(); Fake->DrawCopy("same"); - leg->AddEntry(Truth, "Two leptons matched to W leptons", "l"); + leg->AddEntry(Truth, "Two leptons matched", "l"); leg->AddEntry(Fake, "At least one no matched lepton", "l"); leg->Draw(); @@ -206,14 +266,18 @@ void FakeStudies(TString Selection) { Fake->GetYaxis()->SetTitleOffset(0.44); Fake->DrawCopy("p"); + std::cout << "3" <Print("../Plots/FakeStudies/" + PlotName + ".png"); - CL->Print("../Plots/FakeStudies/" + PlotName + "_log.png"); + CL->Print("FakesPlots/" + PlotName + "_log.png"); + Truth->Reset(); + Fake ->Reset(); } + std::cout << "end " << MetCut[m] << std::endl; } diff --git a/stop/MCtrigger_Shapes.C b/stop/MCtrigger_Shapes.C new file mode 100644 index 00000000..90b91eb7 --- /dev/null +++ b/stop/MCtrigger_Shapes.C @@ -0,0 +1,233 @@ +#include "TString.h" +#include "TH1F.h" +#include "TFile.h" +#include +#include +#include "TCanvas.h" +#include "TLegend.h" +#include "TSystem.h" +#include "TStyle.h" +#include "TPad.h" +#include "TMath.h" +#include "TFrame.h" +#include "TAttMarker.h" +#include "TLine.h" + +bool verbose = true; +bool info = true; + + +void MCtrigger_Shapes_Builder( TString channel, + TString ProcessName, + //TString ProcessName = "TTTo2L2Nu__part0", + TString cut = "Stop/02_SRs/", + //TString HistoDirectoryi1 = "../MCtrigger_rootfiles/nominal/Stop/", + TString HistoDirectoryi1 = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfilesTrgEmu/nominal/Stop/", + //TString HistoDirectoryi2 = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfilesTrg/nominal/Stop/", + TString HistoDirectoryi2 = "../freezing_rootfiles/nominal/Stop/", + //TString HistoDirectoryi3 = "../minitrees/rootfiles/nominal/Stop/", + bool sameFlavour = false) + +{ + if (info){ + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "HistoDirectoryi1 " << HistoDirectoryi1 << std::endl; + std::cout << "HistoDirectoryi2 " << HistoDirectoryi2 << std::endl; +// std::cout << "HistoDirectoryi3 " << HistoDirectoryi3 << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + std::cout << "channel "<< channel << std::endl; + std::cout << "---------------------------------------------------------------------" << std::endl; + } + + TH1F *h_1; TH1F *h_2; TH1F *h_3; + + TFile *_file1 = TFile::Open(HistoDirectoryi1 + ProcessName + ".root"); // MC trigger selection + TFile *_file2 = TFile::Open(HistoDirectoryi2 + ProcessName + ".root"); // Efficiency from Data +// TFile *_file3 = TFile::Open(HistoDirectoryi3 + ProcessName + ".root"); // No trigger weight + + if (sameFlavour){ + + std::cout << "sameFlavour" << std::endl; + + h_1 = (TH1F*) _file1->Get(cut+"h_MT2ll_ee"); TH1F *h_1_mm = (TH1F*) _file1->Get(cut+"h_MT2ll_mm"); + h_2 = (TH1F*) _file2->Get(cut+"h_MT2ll_ee"); TH1F *h_2_mm = (TH1F*) _file2->Get(cut+"h_MT2ll_mm"); +// h_3 = (TH1F*) _file3->Get(cut+"h_MT2ll_ee"); TH1F *h_3_mm = (TH1F*) _file3->Get(cut+"h_MT2ll_mm"); + + h_1 -> Add(h_1_mm); + h_2 -> Add(h_2_mm); +// h_3 -> Add(h_3_mm); + + channel = "_sameFlavour"; + } + else{ + + std::cout << "sameFlavour = false" << std::endl; + + h_1 = (TH1F*) _file1->Get(cut+"h_MT2ll_"+channel); + h_2 = (TH1F*) _file2->Get(cut+"h_MT2ll_"+channel); +// h_3 = (TH1F*) _file3->Get(cut+"h_MT2ll_"+channel); + } + + // Normalization to unity + h_1->Scale(1/h_1->Integral()); + h_2->Scale(1/h_2->Integral()); + + gSystem->cd("/afs/cern.ch/user/b/bchazinq/www/public/"); + gSystem->mkdir("MCTrigger_Eff_Shape/", kTRUE); + //gSystem->CopyFile("index.php", "MCTrigger_Eff/.", kTRUE); + gSystem->cd("-"); + + + TCanvas* canvas = NULL; + TPad* pad1 = NULL; + TPad* pad2 = NULL; + + //TCanvas* c = new TCanvas ( "MCtrigger_"+ ProcessName, "", 1200,1000); + TCanvas* c = new TCanvas ( "MCtrigger_"+ ProcessName, "", 550, 600); + + pad1 = new TPad(); + pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.02); + pad1->Draw(); + + pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); + pad2->SetTopMargin (0.08); + pad2->SetBottomMargin(0.35); + pad2->Draw(); + + + TString title = ProcessName.ReplaceAll(".root", ""); + + + pad1->cd(); + gStyle->SetOptStat(""); + pad1->SetLogy(); + //gPad->SetLogy(); + + + float min = h_1->GetMinimum(); + h_1->SetMinimum(0.9*min); + float max = h_2->GetMaximum(); + h_1->SetMaximum(2*max); + //HCN->SetMaximum(1.2*max); + + //axis title + //----------- + TAxis* xaxis = (TAxis*)h_1->GetXaxis(); + TAxis* yaxis = (TAxis*)h_1->GetYaxis(); + xaxis->SetTitleSize(.10); + xaxis->SetTitle("MT2ll (GeV)"); + xaxis->SetLabelSize(.08); + yaxis->SetTitle("events/20 GeV"); + yaxis->SetTitleSize(.05); + yaxis->SetTitleOffset(1); + yaxis->CenterTitle(); + + // Legend + //---------------------------------------------------------------------------- + TLegend* leg; + //leg = new TLegend(0.1,0.7,0.3,0.9); + leg = new TLegend(0.65, 0.9, 0.9, 0.7); + leg -> AddEntry(h_1, "MC trigger emulation" , "lp"); + leg -> AddEntry(h_2, "trigger eff from Data" , "lp"); + //leg -> AddEntry(h_3, "No trigger weight" , "lp"); + leg -> SetTextSize (0.03); + TString processIN[] = {"02_WZTo3LNu","03_ZZ","04_TTTo2L2Nu","05_ST","06_WW","07_ZJetsHT","07_ZJetsHT_DYcorr","09_TTW","10_TTZ","11_HWW","13_VVV","14_ZZTo4l","15_VZ", "15_VZ3V"}; + TString processOUT[] = {"WZTo3LNu", "ZZ", "ttbar", "tW", "WW", "ZJets", "ZJetsHT_DYcorr","ttbarW","ttbarZ", "HWW", "VVV", "ZZTo4l", "VZ", "VVV+VZ"}; + for (int i=0; i<14;i++) + { + if (ProcessName == processIN[i]) {leg -> SetHeader(processOUT[i] + " channel " + channel); break;} + if (i==13 && ProcessName != processIN[i]){std::cout<<"WARNING this sample: "<< ProcessName << "is not in the rootfile"<SetMarkerStyle(kPlus); + h_2->SetMarkerStyle(kPlus); + h_1->SetMarkerSize(4); + h_2->SetMarkerSize(4); + h_1->SetMarkerColor(2); + h_2->SetMarkerColor(4); + + // Draw + //----------------------------------------------------------------------------- + h_1->Draw("hist p0"); + h_2->Draw("hist p0, same"); + //h_3->Draw("same"); + leg -> Draw(); + + //------------------------------------------------------------------------------- + // Ratio + //------------------------------------------------------------------------------- + pad2->cd(); + TH1F* ratio = (TH1F*)h_1->Clone("ratio"); + float ymin =0.95, ymax =1.05; + for (Int_t ibin=1; ibin<=ratio->GetNbinsX(); ibin++) { + float ratioVal = -999; //float ratioErr = 999; + ratioVal = h_1->GetBinContent(ibin)/h_2->GetBinContent(ibin); + //ratioErr = (ratioVal * ratioVal)*( TMath::Power(h_1->GetBinError(ibin)/ h_1->GetBinContent(ibin),2) + TMath::Power(h_2->GetBinError(ibin)/ h_2->GetBinContent(ibin),2)); + ratio -> SetBinContent(ibin, ratioVal); + //ratio->SetBinError (ibin, ratioErr); + //if (ratioVal+ratioErr>ymax) ymax = (ratioVal+ratioErr) + (ratioVal+ratioErr)*0.01; + //if (ratioVal>0. && ratioVal-ratioErrGetBinContent(ibin)); if (abs(min) < abs(ymin)) ymin=min; + //float max = ratioVal + 0.02*(h_2->GetBinContent(ibin)); if (abs(max) > abs(ymax)) ymin=max; + } + ratio->SetMarkerColor(1); + ratio->SetMarkerSize(1); + ratio->SetMarkerStyle(kFullCircle); + ratio->GetYaxis()->SetRangeUser(ymin, ymax); + + //axix title + //------------------------------------------------------------------------------ + TAxis* yaxis2 = (TAxis*)ratio->GetYaxis(); + yaxis2->SetLabelSize(.08); + yaxis2->SetTitle("McTrigg / EffData"); + yaxis2->SetTitleSize(.055); + yaxis2->SetTitleOffset(1); + yaxis->CenterTitle(); + //draw + //----------------------------------------------------------------------------- + ratio->Draw("hist p0"); + + c->Update(); + pad2->Update(); + TLine *line=new TLine(0,1.0,140,1.); + line->SetLineColor(1); + line->SetLineWidth(2); + line->SetLineStyle(kDotted); + line->Draw("same"); + c->Modified(); + c->Update(); + + if (verbose) { + cout << "bin MC trigger select/trigger eff from Data % " <GetNbinsX(); ibin++) + { + cout << ibin << " " << h_1->GetBinContent(ibin)/h_2->GetBinContent(ibin) <<" " << Form("%.2f", (h_1->GetBinContent(ibin)/h_2->GetBinContent(ibin))*100) <GetBinContent(ibin) << " freezing_rootfiles " << h_2->GetBinContent(ibin) <Integral()<< endl; + cout << "Total trigger eff from Data" << h_2->Integral()<< endl; + cout << " "<< endl; + cout << "Total_MC_trigger_select./Total_trigger_eff_from_Data %"<< endl; + cout << h_1->Integral()/h_2->Integral() << " " << Form("%.2f", (h_1->Integral()/h_2->Integral())*100) << endl; +// cout << "Total No trigger weight" << h_3->Integral()<< endl; + } + //c ->SaveAs("/afs/cern.ch/user/b/bchazinq/www/MCTrigger_Eff/MCTrigger_"+ title + "_" + channel +".png"); + c ->Print("/afs/cern.ch/user/b/bchazinq/www/public/MCTrigger_Eff_Shape/MCTrigger_"+ title + "_" + channel +".png"); + gSystem->cd("/afs/cern.ch/user/b/bchazinq/work/CMSSW_8_0_5/src/AnalysisCMS/stop/"); + //std::cout<< gSystem->pwd() < all distributions normalized to the luminosity +// option = "nostack,hist" --> signal and top distributions normalized to one +// +// Draw(TString hname, Name of the histogram. +// TString xtitle = "", Title of the x-axis. +// Int_t ngroup = -1, Number of bins to be merged into one bin. +// Int_t precision = 0, Number of decimal digits. +// TString units = "NULL", Units of the histogram. +// Bool_t setlogy = false, Set it to true (false) for logarithmic (linear) scale. +// Bool_t moveoverflow = true, Set it to true to plot the events out of range. +// Float_t xmin = -999, +// Float_t xmax = -999, +// Float_t ymin = -999, +// Float_t ymax = -999); +// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +void Plotter(TString option = "hist"){ + + gInterpreter->ExecuteMacro("../test/PaperStyle.C"); + + float lumi = 35.867;//lumi_fb_2016; + //float lumi = 9.983;//lumi_fb_2016; + + Bool_t scale = linY; + + HistogramReader plotter(inputdir, outputdir); + + plotter.SetStackOption(option); + plotter.SetPublicStyle(false); + plotter.SetSavePdf (true); + + if (option.Contains("nostack")) + { + plotter.SetDrawRatio(false); + } + else + { + plotter.SetLuminosity(lumi); + plotter.SetDrawRatio (true); + } + + + // Get the data + //---------------------------------------------------------------------------- + //plotter.AddData("01_Data", "data", color_Data); + + + // Add processes + //---------------------------------------------------------------------------- + //plotter.AddProcess("14_HZ", "HZ", color_HZ); + /* plotter.AddProcess("11_HWW", "HWW", color_HWW); + plotter.AddProcess("06_WW", "WW", color_WW); + plotter.AddProcess("02_WZTo3LNu", "WZ", color_WZTo3LNu); + plotter.AddProcess("15_VZ", "VZ", color_VZ); + plotter.AddProcess("13_VVV", "VVV", color_VVV); + //plotter.AddProcess("11_Wg", "W#gamma", color_Wg); + //plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); + plotter.AddProcess("09_TTW", "ttw", color_TTV); + plotter.AddProcess("10_TTZ", "ttz", color_TTV +1); + plotter.AddProcess("05_ST", "tW", color_ST); + *///plotter.AddProcess("00_Fakes", "non-prompt", color_Fakes, roc_background, -999); // -999 is needed to not scale by luminosity + //plotter.AddProcess("04_TTTo2L2Nu", "tt", color_TTTo2L2Nu); + plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets); + + // Add signals + //---------------------------------------------------------------------------- + //plotter.AddSignal("ttDM0001scalar00010", "m_{#chi}1 m_{S}10 x10", color_Signal, roc_signal, 10); + //plotter.AddSignal("ttDM0001scalar00020", "m_{#chi}1 m_{S}20", color_Signal+2, roc_signal); + //plotter.AddSignal("ttDM0001scalar00050", "m_{#chi}1 m_{S}50", color_Signal+4, roc_signal); + //plotter.AddSignal("ttDM0001scalar00100", "m_{#chi}1 m_{S}100", color_Signal+2, roc_signal); + //plotter.AddSignal("ttDM0001scalar00200", "m_{#chi}1 m_{S}200", color_Signal, roc_signal); + //plotter.AddSignal("ttDM0001scalar00300", "m_{#chi}1 m_{S}300", color_Signal, roc_signal); + + + // Add systematics + //---------------------------------------------------------------------------- + //plotter.AddSystematic("Btagup"); + + + // Draw distributions + //---------------------------------------------------------------------------- + if (!option.Contains("nostack")) plotter.SetDrawYield(true); + + gSystem->mkdir(outputdir, kTRUE); + + TString title = "cms"; + + plotter.SetTitle(title); + + + // hname xtitle ngroup precision units setlogy moveoverflow xmin xmax ymin ymax + // ------------------------------------------------------------------------------------------------------------------------- + //plotter.Draw( "newdarkpt" , "(reconstructed) mediator p_{T}", 5, 0, "GeV", scale, false, -100, 800 ); + //plotter.Draw( "dphijet1met" , "#Delta#phi(jet1,E_{T}^{miss})", 5, 2, "rad", scale, false); + //plotter.Draw( "dphijet2met" , "#Delta#phi(jet2,E_{T}^{miss})", 5, 2, "rad", scale, false); + //plotter.Draw( "dphijj" , "#Delta#phi(jet1,jet2)", 5, 2, "rad", scale, false); + //plotter.Draw( "dphijjmet" , "#Delta#phi(jj,E_{T}^{miss})", 5, 2, "rad", scale, false); + //plotter.Draw( "dphilep1jet1" , "#Delta#phi(lep1,jet1)", 5, 2, "rad", scale, false); + //plotter.Draw( "dphilep1jet2" , "#Delta#phi(lep1,jet2)", 5, 2, "rad", scale, false); + //plotter.Draw( "dphilep2jet1" , "#Delta#phi(lep2,jet1)", 5, 2, "rad", scale, false); + //plotter.Draw( "dphilep2jet2" , "#Delta#phi(lep2,jet2)", 5, 2, "rad", scale, false); + //plotter.Draw( "dphill" , "#Delta#phi(lep1,lep2)", 5, 2, "rad", scale, false); + //plotter.Draw( "dphillmet" , "#Delta#phi(" +sll + "," + sm + ")", 5, 2, "rad", scale); + //plotter.Draw( "dphilmet1" , "#Delta#phi(lep1,E_{T}^{miss})", 5, 2, "rad", scale, false); + //plotter.Draw( "dphilmet2" , "#Delta#phi(lep2,E_{T}^{miss})", 5, 2, "rad", scale, false); + //plotter.Draw( "ht" , "H_{T}", 20, 0, "GeV", scale, true, 0, 1500); + //plotter.Draw( "htjets" , "#sum_{jet} p_{T}", 20, 0, "GeV", scale, true, 0, 1500); + //plotter.Draw( "htnojets" , "p_{T}^{lep1} + p_{T}^{lep2} + MET", 20, 0, "GeV", scale, true, 0, 1500); + // plotter.Draw( "jet1eta" , "leading jet #eta", -1, 1, "NULL", scale, false); + // plotter.Draw( "jet1mass" , "leading jet mass", -1, 0, "GeV", scale, true, 0, 50); + // plotter.Draw( "jet1phi" , "leading jet #phi", 5, 2, "rad", scale, false); + // plotter.Draw( "jet1pt" , "leading jet p_{T}", 5, 0, "GeV", scale, true, 0, 400); + // plotter.Draw( "jet2eta" , "trailing jet #eta", -1, 1, "NULL", scale, false); + // plotter.Draw( "jet2mass" , "trailing jet mass", -1, 0, "GeV", scale, true, 0, 50); + // plotter.Draw( "jet2phi" , "trailing jet #phi", 5, 2, "rad", scale, false); + // plotter.Draw( "jet2pt" , "trailing jet p_{T}", 5, 0, "GeV", scale, true, 0, 400); + // plotter.Draw( "lep1eta" , "leading lepton #eta", -1, 1, "NULL", scale); + // plotter.Draw( "lep1phi" , "leading lepton #phi", 5, 2, "rad", scale); + // plotter.Draw( "lep1pt" , "leading lepton p_{T}", 5, 0, "GeV", scale, true, 0, 150); + // plotter.Draw( "lep2eta" , "trailing lepton #eta", -1, 1, "NULL", scale); + // plotter.Draw( "lep2phi" , "trailing lepton #phi", 5, 2, "rad", scale); + // plotter.Draw( "lep2pt" , "trailing lepton p_{T}", 5, 0, "GeV", scale, true, 0, 150); + // plotter.Draw( "m2l" , "m_{" + sll + "}", 10, 0, "GeV", scale, true, 0, 300); + // plotter.Draw( "metPfType1" , sm, 10, 0, "GeV", scale, true, 0, 200); + // plotter.Draw( "mt2lblb" , "M_{T2}(" + sl + "b" + sl + "b)", 10, 0, "GeV", scale, false, 0, 600); + //plotter.Draw( "mt2ll" , "M_{T2}(" + sll + ")", 10, 0, "GeV", scale, false, 0, 200); + //plotter.Draw( "mtw1" , "m_{T}^{W,1}", 10, 0, "GeV", scale, true, 0, 400); + //plotter.Draw( "mtw2" , "m_{T}^{W,2}", 10, 0, "GeV", scale, true, 0, 400); + plotter.Draw( "nbjet30csvv2l" , "number of 20 GeV csvv2l b-jets", -1, 0, "NULL", scale, true, 0, 6); + plotter.Draw( "nbjet30csvv2m" , "number of 20 GeV csvv2m b-jets", -1, 0, "NULL", scale, true, 0, 6); + plotter.Draw( "nbjet30csvv2t" , "number of 20 GeV csvv2t b-jets", -1, 0, "NULL", scale, true, 0, 6); + plotter.Draw( "njet" , "number of 20 GeV jets", -1, 0, "NULL", scale, true, 0, 10); + //plotter.Draw( "nvtx" , "number of vertices", -1, 0, "NULL", linY, true, 0, 30); + //plotter.Draw( "topRecoW" , "top reco weight", -1, 4, "NULL", scale, true, 0, 0.01); + //plotter.Draw( "ANN_170222_mt2ll80_ttDM0001scalar00100", "ANN output", 10, 2, "NULL", scale, true, -0.1, 1.1); + //plotter.Draw( "ANN_170222_mt2ll90_ttDM0001scalar00100", "ANN output", 10, 2, "NULL", scale, true, -0.1, 1.0); + //plotter.Draw( "ANN_170222_mt2ll100_ttDM0001scalar00100", "ANN output", 10, 2, "NULL", scale, true, -0.1, 1.0); + //plotter.Draw( "ANN_alpha005_mt2ll80_ttDM0001scalar00500", "ANN output", 10, 2, "NULL", scale, true, 0, 1.0); + //plotter.Draw( "ANN_alpha01_mt2ll80_ttDM0001scalar00500", "ANN output", 10, 2, "NULL", scale, true, 0, 1.0); + //plotter.Draw( "ANN_alpha05_mt2ll80_ttDM0001scalar00500", "ANN output", 10, 2, "NULL", scale, true, 0, 1.0); + + // hname xtitle npoints units xmin xmax + // --------------------------------------------------------------------------- + //plotter.Roc( "darkpt" , "(reconstructed) mediator p_{T}" , 80, "GeV",0, 800); + //plotter.Roc( "metPfType1", sm , 100, "GeV", 0, 200); + //plotter.Roc( "mt2ll" , "M_{T2}(" + sll + ")", 50, "GeV", 0, 150); + //plotter.Roc( "topRecoW" , "top reco weight" , 100, "GeV", 0, .01); + //plotter.Roc( "ANN_170222_mt2ll80_ttDM0001scalar00100", "ANN output" , 60, "GeV", -0.1, 1.1); + //plotter.Roc( "ANN_alpha005_mt2ll80_ttDM0001scalar00500", "ANN output" , 60, "GeV", -0.1, 1.1); + //plotter.Roc( "ANN_alpha01_mt2ll80_ttDM0001scalar00500", "ANN output" , 60, "GeV", -0.1, 1.1); + //plotter.Roc( "ANN_alpha05_mt2ll80_ttDM0001scalar00500", "ANN output" , 60, "GeV", -0.1, 1.1); + + // Copy index.php in every directory + //---------------------------------------------------------------------------- + gSystem->Exec("for dir in $(find ./ -type d); do cp -n ../index.php $dir/; done"); + gSystem->Exec("rm -f index.php"); + +} + diff --git a/stop/SystematicTables.C b/stop/SystematicTables.C new file mode 100644 index 00000000..9009c978 --- /dev/null +++ b/stop/SystematicTables.C @@ -0,0 +1,235 @@ +#include "TCanvas.h" +#include "TFile.h" +#include "TFrame.h" +#include "TH1.h" +#include "THStack.h" +#include "TInterpreter.h" +#include "TLatex.h" +#include "TLegend.h" +#include "TLine.h" +#include "TGraphAsymmErrors.h" +#include "TMath.h" +#include "TPaletteAxis.h" +#include "TROOT.h" +#include "TString.h" +#include "TStyle.h" +#include "TSystem.h" +#include "TTree.h" + +#include +#include + +#include "../include/CutsStop.h" + +int const nSRs = 12; +bool UseSR[nSRs]; + +void SetUseSR(TString Analysis) { + + if (Analysis=="_Stop") { + UseSR[0] = 0; UseSR[1] = 0; UseSR [2] = 1; UseSR [3] = 1; + UseSR[4] = 0; UseSR[5] = 0; UseSR [6] = 1; UseSR [7] = 1; + UseSR[8] = 0; UseSR[9] = 0; UseSR[10] = 1; UseSR[11] = 1; + } else if (Analysis=="_Chargino") { + UseSR[0] = 1; UseSR[1] = 1; UseSR [2] = 0; UseSR [3] = 0; + UseSR[4] = 1; UseSR[5] = 1; UseSR [6] = 0; UseSR [7] = 0; + UseSR[8] = 1; UseSR[9] = 0; UseSR[10] = 0; UseSR[11] = 0; + } + +} + +TString ReadSystematic(TString SystName, TString SRname, TString Channel, TString Type, TString Aname) { + + TString isrstring = SRname.Contains("_isr") ? "isr" : ""; + SRname.ReplaceAll("_isr", ""); + + TString TableName; + if (Aname=="_Chargino" && Type!="_Background") TableName = "./Tables/Syst_02_" + SRname + "_MT2ll" + isrstring + Channel + "_TChiSlep_Xm500_Xm200"; + else if (Aname=="_Stop" && Type!="_Background") { TableName = "./Tables/Syst_02_" + SRname + "_MT2ll" + isrstring + Channel + "_T2tt_mStop-350to400_Sm350_Xm225";} + else TableName = "./TablesSystPaper/Syst_02_" + SRname + "_MT2ll" + isrstring + Channel + Type; + //TString TableName = "./TablesSystPaper/Syst_02_" + SRname + "_MT2ll" + isrstring + Channel + Type; + /*if (SRname.Contains("Tag") || (SRname.Contains("Veto") && (isrstring!="" || !SRname.Contains("SR3")))) + TableName.ReplaceAll("Syst/", "T2ttNoTopPt/"); + else + TableName.ReplaceAll("Syst/", "TChiNoTopPt/");*/ + std::ifstream outFile(TableName + ".txt",std::ios::out); + + float maxsyst = -1., minsyst = 999.; + float imaxsyst = -1., iminsyst = 999.; + + float bin[7], ibin[7]; + + int firstbin = 4;//(Type.Contains("TChi")) ? 4 : 0; + + while (outFile) { + + TString systname; + outFile >> systname >> bin[0] >> bin[1] >> bin[2] >> bin[3] >> bin[4] >> bin[5] >> bin[6]; + + if (systname!=SystName) continue; + + for (int ib = firstbin; ib<7; ib++) + if (bin[ib]>=1.0) ibin[ib] = ceil(bin[ib]-0.5); + else ibin[ib] = 0; + + for (int ib = firstbin; ib<7; ib++) { + if (ibin[ib]>imaxsyst) + imaxsyst = ibin[ib]; + if (ibin[ib]maxsyst) + maxsyst = bin[ib]; + if (bin[ib]=1. && iminsyst<1.) || (iminsyst>0. && fabs(imaxsyst-iminsyst)/iminsyst>=0.125)) { + thissyst += int(iminsyst); thissyst += "$-$"; thissyst += int(imaxsyst); thissyst += "\\%$"; + } /*else if (iminsyst<1. && imaxsyst<1.) { + int x1 = ceil(10.*minsyst); + int x2 = ceil(10.*maxsyst); + if (x2-x1>=2) { + thissyst += "0."; thissyst += x1; thissyst += "$-$"; + if (x2<10) { thissyst += "0."; thissyst += x2; } + else thissyst += "1"; + thissyst += "\\%$"; + } else { + thissyst += "0."; thissyst += x2; thissyst += "\\%$"; + } + } else { + if (maxsyst<1.) { + thissyst += thissyst += "0."; thissyst += int(10.*maxsyst); thissyst += "\\%$"; + } else if (maxsyst<10.) { + thissyst += maxsyst; thissyst.Remove(4); thissyst += "\\%$"; + } else { + thissyst += int(maxsyst); thissyst += "\\%$"; + } + }*/ + else if (imaxsyst<1.) { + thissyst += "<1\\%$"; + } else { + thissyst += maxsyst; thissyst.Remove(4); thissyst += "\\%$"; + } + + return thissyst; + +} + +void SystematicTables(TString Type, TString Analysis, TString Channel) { + + TString SRname[nSRs] = {"SR1_NoJet", "SR1_NoTag", "SR1_Veto", "SR1_Tag", + "SR2_NoJet", "SR2_NoTag", "SR2_Veto", "SR2_Tag", + "SR3_Veto", "SR3_Tag", "SR3_Veto_isr", "SR3_Tag_isr"}; + TString SRtitle[nSRs] = {"SR1^{\\text{0Jet}}_{\\text{0Tag}}", "SR1^{\\text{Jets}}_{\\text{0Tag}}", "SR1_{\\text{0Tag}}", "SR1_{\\text{Tags}}", + "SR2^{\\text{0Jet}}_{\\text{0Tag}}", "SR2^{\\text{Jets}}_{\\text{0Tag}}", "SR2_{\\text{0Tag}}", "SR2_{\\text{Tags}}", + "SR3_{\\text{0Tag}}", "SR3_{\\text{Tags}}", "SR3^{\\text{ISR}}_{\\text{0Tag}}", "SR3^{\\text{ISR}}_{\\text{Tags}}"}; + + int const nSyst = 26; + TString SystName[nSyst] = {"Statistics", "Luminosity", "Trigger", "MT2llTop", "MT2llWW", + "Fake", "Idiso", "JES", "MET", "PDF", "Q2", "Reco", "Toppt", + "Isrnjet", "Metfastsim", "Pileup", "Fastsim", "BtagFS", + "Btag", "Btaglight", "ttZSF", "WZSF", "ZZSF", "ZZshape", + "DYshape", "normDY"}; + int IsSignal[nSyst] = {1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0}; +// int IsSignal[nSyst] = {0, 1, 1, 0, 0, +// 0, 1, 1, 1, 0, 1, 1, 0, +// 1, 1, 1, 1, 1, +// 1, 1, 0, 0, 0, 0, +// 0, 0}; + int IsBackground[nSyst] = {1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0}; +// int IsBackground[nSyst] = {0, 1, 1, 1, 1, +// 1, 1, 1, 1, 1, 1, 1, 1, +// 0, 0, 0, 0, 0, +// 1, 1, 1, 1, 1, 1, +// 1, 1}; + TString SystDescr[nSyst] = {"MC statistics", "Luminosity", "Trigger", "\\mtll shape (Top)", "\\mtll shape (WW)", + "Nonprompt leptons", "Lepton ID and isolation", "JES", "Unclustered energy", "PDFs", "QCD scale", "Track reconsruction", "\\ttbar \\pt reweighting", + "ISR reweighting", "\\ptmiss FastSim", "Pileup", "Leptons Fastsim", "b-tagging FastSim", + "b-tagging", "b-tagging (light jets)", "ttZ normalization", "WZ normalization", "ZZ normalization", "ZZ k-factors", + "\\mtll shape (Drell-Yan)", "Drell-Yan normalization"}; + + TString AnalysisName[2] = {"_Stop", "_Chargino"}; + + + TString TableName = "./TablesSyst/Systematic" + Type + Analysis + Channel; + std::ofstream inFile(TableName + ".tex",std::ios::out); + + //inFile << "\\begin{table}[htb]" << endl; + //inFile << "\\tiny" << endl; + inFile << "\\begin{center}" << endl; + if (Analysis=="_Stop") + inFile << "\\begin{tabular}{|l|cccccc|}" << endl; + else if (Analysis=="_Chargino") + inFile << "\\begin{tabular}{|l|ccccc|}" << endl; + else if (Analysis=="_All") + inFile << "\\begin{tabular}{|l|cccccc|ccccc|}" << endl; + inFile << "\\hline\\hline" << endl; + inFile << " Systematic "; + for (int na = 0; na<2; na++) { + if (Analysis=="_All" || Analysis==AnalysisName[na]) { + SetUseSR(AnalysisName[na]); + for (int sr = 0; sr +#include + + +void VetoMaker(TString RootFileName = "../minitrees/rootfiles/nominal/Stop/04_TTTo2L2Nu_Test.root", + TString metCut = "02_VR1", + TString Variable = "MT2ll", + TString channel = "_ll", + TString kind = "_fake") +{ + TFile* RootFile = new TFile(RootFileName, "update"); + + TH1F* histo = (TH1F*)RootFile->Get("Stop/" + metCut + "_NoTag/h_" + Variable + kind + channel); + TH1F* histo1 = (TH1F*)RootFile->Get("Stop/" + metCut + "_NoJet/h_" + Variable + kind + channel); + + RootFile->cd(); + + gDirectory->mkdir("Stop/"+ metCut + "_" + "Veto/"); + + RootFile->cd("Stop/"+ metCut + "_" + "Veto/"); + + TH1F* newHisto = (TH1F*)histo->Clone("newHisto"); + + newHisto->Add(histo1); + + newHisto->Write("newHisto", TObject::kOverwrite); + + RootFile->Close(); +} diff --git a/stop/ZZShapes.C b/stop/ZZShapes.C new file mode 100644 index 00000000..a5eda9c4 --- /dev/null +++ b/stop/ZZShapes.C @@ -0,0 +1,568 @@ +#include "../include/CutsStop.h" + +#include "TCanvas.h" +#include "TLegend.h" +#include "TFile.h" +#include "TH1.h" +#include "TH2.h" +#include "TGraph.h" +#include "TLatex.h" +#include "TLegend.h" +#include "TLine.h" +#include "TGraphAsymmErrors.h" +#include "TMath.h" +#include "TPaletteAxis.h" +#include "TROOT.h" +#include "TString.h" +#include "TStyle.h" +#include "TSystem.h" +#include "TTree.h" +#include "TLorentzVector.h" +#include "TAxis.h" +#include +#include + + +bool verbose = true; + +float BB[4] = {1.27037, 1.26317, 1.6111, 1.11252}; + +TH1D *GetHisto(TFile *filein, TString hname) { + + TH1D *H0 = new TH1D("H0", "", 7, 0., 140.); + + TH1D *H1 = (TH1D*)filein->Get("Stop/02_SR1_Tag/h_MT2ll_ll"); + TH1D *H2 = (TH1D*)filein->Get("Stop/02_SR2_Tag/h_MT2ll_ll"); + TH1D *H3 = (TH1D*)filein->Get("Stop/02_SR3_Tag/h_MT2ll_ll"); + TH1D *H4 = (TH1D*)filein->Get("Stop/02_SR1_NoTag/h_MT2ll_ll"); + TH1D *H5 = (TH1D*)filein->Get("Stop/02_SR2_NoTag/h_MT2ll_ll"); + TH1D *H6 = (TH1D*)filein->Get("Stop/02_SR3_NoTag/h_MT2ll_ll"); + TH1D *H7 = (TH1D*)filein->Get("Stop/02_SR1_NoJet/h_MT2ll_ll"); + TH1D *H8 = (TH1D*)filein->Get("Stop/02_SR2_NoJet/h_MT2ll_ll"); + TH1D *H9 = (TH1D*)filein->Get("Stop/02_SR3_NoJet/h_MT2ll_ll"); + + if (hname.Contains("Tag") || hname.Contains("All")) { + if (hname.Contains("SR1") || hname.Contains("SRs")) H0->Add(H1); + if (hname.Contains("SR2") || hname.Contains("SRs")) H0->Add(H2); + if (hname.Contains("SR3") || hname.Contains("SRs")) H0->Add(H3); + } + if (hname.Contains("NoTag") || hname.Contains("All") || hname.Contains("Veto")) { + if (hname.Contains("SR1") || hname.Contains("SRs")) H0->Add(H4); + if (hname.Contains("SR2") || hname.Contains("SRs")) H0->Add(H5); + if (hname.Contains("SR3") || hname.Contains("SRs")) H0->Add(H6); + } + if (hname.Contains("NoJet") || hname.Contains("All") || hname.Contains("Veto")) { + if (hname.Contains("SR1") || hname.Contains("SRs")) H0->Add(H7); + if (hname.Contains("SR2") || hname.Contains("SRs")) H0->Add(H8); + if (hname.Contains("SR3") || hname.Contains("SRs")) H0->Add(H9); + } + //cout << H0->Integral() << endl; + return H0; + +} + +//TString HistoDirectory = "../minitrees/rootfiles/"; +TString HistoDirectory = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/"; + +void PlotZZShapes(TString ShapeName) { + + TH1::SetDefaultSumw2(); + + TFile *_fileM = TFile::Open(HistoDirectory + "nominal/Stop/03_ZZ.root"); +// TFile *_fileD = TFile::Open(HistoDirectory + "kfdPhi/Stop/03_ZZ.root"); +// TFile *_fileP = TFile::Open(HistoDirectory + "kfPt/Stop/03_ZZ.root"); +// TFile *_fileN = TFile::Open(HistoDirectory + "kfNo/Stop/03_ZZ.root"); + + TH1D *HM = GetHisto(_fileM, ShapeName); +// TH1D *HD = GetHisto(_fileD, ShapeName); +// TH1D *HP = GetHisto(_fileP, ShapeName); +// TH1D *HN = GetHisto(_fileN, ShapeName); + +// HM->SetMarkerStyle(20); +// HD->SetLineColor(2); +// HP->SetLineColor(3); +// HN->SetLineColor(4); + + TCanvas *CC = new TCanvas("CC", "", 600, 600); + +/* TPad *pad1 = new TPad("pad1", "pad1", 0, 0.33, 1, 1.00); + TPad *pad2 = new TPad("pad2", "pad2", 0, 0.00, 1, 0.33); + + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.02); + pad1->Draw(); + + pad2->SetTopMargin (0.08); + pad2->SetBottomMargin(0.35); + pad2->Draw(); + + CC->SetFillColor(10); + CC->SetBorderMode(0); + CC->SetBorderSize(2); + pad1->SetFillColor(10); + pad1->SetBorderMode(0); + pad1->SetBorderSize(2); + pad2->SetFillColor(10); + pad2->SetBorderMode(0); + pad2->SetBorderSize(2); + gStyle->SetOptStat(0); + + pad1->cd(); + +// float Integ = HM->Integral(); HM->Scale(1./Integ); +// Integ = HD->Integral(); HD->Scale(1./Integ); +// Integ = HP->Integral(); HP->Scale(1./Integ); +// Integ = HN->Integral(); HN->Scale(1./Integ); + //HM->Scale(BB[0]/BB[0]); + //HD->Scale(BB[0]/BB[1]); + //HP->Scale(BB[0]/BB[2]); + //HN->Scale(BB[0]/BB[3]); + + TLegend *leg = new TLegend(0.2, 0.5, 0.5, 0.8); + leg->SetFillColor(kWhite); leg->SetBorderSize(0.); + leg->SetTextColor(1); leg->SetTextSize(0.035); + leg->SetTextFont(62); + + leg->AddEntry(HM, "no k-factors", "f"); +// leg->AddEntry(HN, "ZZ-mass", "lpe"); +// leg->AddEntry(HP, "ZZ-p_{T}", "f"); +// leg->AddEntry(HD, "ZZ-#Delta#phi", "f"); + + HM->SetXTitle("M_{T2}^{ll} [GeV]"); + HM->SetYTitle("Fraction of events / 20 GeV"); + + HM->GetXaxis()->SetLabelOffset(999.); + HM->GetXaxis()->SetTitleOffset(999.); + HM->GetXaxis()->SetLabelSize(0.07); + HM->GetXaxis()->SetTitleSize(0.07); + HM->GetYaxis()->SetLabelSize(0.045); + HM->GetYaxis()->SetTitleSize(0.05); + HM->SetLineColor(1); +*/ + HM->Draw(); +// HM->DrawCopy("p"); +// HD->DrawCopy("samehisto"); +// HP->DrawCopy("samehisto"); +// HN->DrawCopy("samehisto"); + +// leg->Draw(); + +/* pad2->cd(); + + HD->Divide(HM); + HP->Divide(HM); + HN->Divide(HM); + + HD->SetXTitle("M_{T2}^{ll} [GeV]"); + HD->SetYTitle("ZZ-x/ZZ-mass"); + + HD->GetXaxis()->SetLabelSize(0.09); + HD->GetXaxis()->SetTitleSize(0.1); + HD->GetYaxis()->SetLabelSize(0.09); + HD->GetYaxis()->SetTitleSize(0.1); + + HD->SetMinimum(0.7); + HD->SetMaximum(1.3); + + HD->DrawCopy("histoe"); + HP->DrawCopy("samehistoe"); + HN->DrawCopy("samehistoe"); +*/ +} + +void ZZShapes() { + + int const nObservables = 4; + TString ObservableName[nObservables] = {"MT2ll", "MT2llgen", "MT2llisr", "MT2llisrgen"}; + + int const nChannels = 4; + TString ChannelName[nChannels] = {"_ee", "_em", "_mm", "_ll"}; + + gSystem->mkdir(HistoDirectory + "ZZshapeup/Stop/", kTRUE); + gSystem->mkdir(HistoDirectory + "ZZshapedo/Stop/", kTRUE); + + TFile *_fileM = TFile::Open(HistoDirectory + "nominal/Stop/03_ZZ.root"); + TFile *_fileD = TFile::Open(HistoDirectory + "kfdPhi/Stop/03_ZZ.root"); + TFile *_fileP = TFile::Open(HistoDirectory + "kfPt/Stop/03_ZZ.root"); + TFile *_fileN = TFile::Open(HistoDirectory + "kfNo/Stop/03_ZZ.root"); + + for (int vr = 0; vr<2; vr++) { + + TString Variation = (vr==0) ? "up" : "do"; + + TFile *OutputFile = new TFile(HistoDirectory + "ZZshape" + Variation + "/Stop/03_ZZ.root", "recreate"); + + for (int sr = 0; srcd(); + + gDirectory->mkdir(scut[sr]); + + for (int ob = 0; obcd(scut[sr]); + + TString HistoName = "h_" + ObservableName[ob] + ChannelName[ch]; + TH1F *OutputHisto; + if (vr==0) { + OutputHisto = (TH1F*) _fileP->Get(scut[sr] + "/" + HistoName); + OutputHisto->Scale(BB[0]/BB[2]); + } else { + OutputHisto = (TH1F*) _fileN->Get(scut[sr] + "/" + HistoName); + OutputHisto->Scale(BB[0]/BB[3]); + } + + OutputHisto->Write(); + + } + + } + + OutputFile->Close(); + + } + +} + + +//------------------------------------------------------------------------------ +// kfactor_qqZZ_qcd_dPhi(float GENdPhiZZ, int finalState) +//------------------------------------------------------------------------------ +float kfactor_qqZZ_qcd_dPhi(float GENdPhiZZ, int finalState) +{ + + // finalState=1 : 4e/4mu/4tau + // finalState=2 : 2e2mu/2mutau/2e2tau + + float k=0.0; + + if (finalState==1) { + k+=1.515838921760*(abs(GENdPhiZZ)>0.0&&abs(GENdPhiZZ)<=0.1); + k+=1.496256665410*(abs(GENdPhiZZ)>0.1&&abs(GENdPhiZZ)<=0.2); + k+=1.495522061910*(abs(GENdPhiZZ)>0.2&&abs(GENdPhiZZ)<=0.3); + k+=1.483273154250*(abs(GENdPhiZZ)>0.3&&abs(GENdPhiZZ)<=0.4); + k+=1.465589701130*(abs(GENdPhiZZ)>0.4&&abs(GENdPhiZZ)<=0.5); + k+=1.491500887510*(abs(GENdPhiZZ)>0.5&&abs(GENdPhiZZ)<=0.6); + k+=1.441183580450*(abs(GENdPhiZZ)>0.6&&abs(GENdPhiZZ)<=0.7); + k+=1.440830603990*(abs(GENdPhiZZ)>0.7&&abs(GENdPhiZZ)<=0.8); + k+=1.414339019120*(abs(GENdPhiZZ)>0.8&&abs(GENdPhiZZ)<=0.9); + k+=1.422534218560*(abs(GENdPhiZZ)>0.9&&abs(GENdPhiZZ)<=1.0); + k+=1.401037066000*(abs(GENdPhiZZ)>1.0&&abs(GENdPhiZZ)<=1.1); + k+=1.408539428810*(abs(GENdPhiZZ)>1.1&&abs(GENdPhiZZ)<=1.2); + k+=1.381247744080*(abs(GENdPhiZZ)>1.2&&abs(GENdPhiZZ)<=1.3); + k+=1.370553357430*(abs(GENdPhiZZ)>1.3&&abs(GENdPhiZZ)<=1.4); + k+=1.347323316000*(abs(GENdPhiZZ)>1.4&&abs(GENdPhiZZ)<=1.5); + k+=1.340113437450*(abs(GENdPhiZZ)>1.5&&abs(GENdPhiZZ)<=1.6); + k+=1.312661036510*(abs(GENdPhiZZ)>1.6&&abs(GENdPhiZZ)<=1.7); + k+=1.290055062010*(abs(GENdPhiZZ)>1.7&&abs(GENdPhiZZ)<=1.8); + k+=1.255322614790*(abs(GENdPhiZZ)>1.8&&abs(GENdPhiZZ)<=1.9); + k+=1.254455642450*(abs(GENdPhiZZ)>1.9&&abs(GENdPhiZZ)<=2.0); + k+=1.224047664420*(abs(GENdPhiZZ)>2.0&&abs(GENdPhiZZ)<=2.1); + k+=1.178816782670*(abs(GENdPhiZZ)>2.1&&abs(GENdPhiZZ)<=2.2); + k+=1.162624827140*(abs(GENdPhiZZ)>2.2&&abs(GENdPhiZZ)<=2.3); + k+=1.105401140940*(abs(GENdPhiZZ)>2.3&&abs(GENdPhiZZ)<=2.4); + k+=1.074749265690*(abs(GENdPhiZZ)>2.4&&abs(GENdPhiZZ)<=2.5); + k+=1.021864599380*(abs(GENdPhiZZ)>2.5&&abs(GENdPhiZZ)<=2.6); + k+=0.946334793286*(abs(GENdPhiZZ)>2.6&&abs(GENdPhiZZ)<=2.7); + k+=0.857458082628*(abs(GENdPhiZZ)>2.7&&abs(GENdPhiZZ)<=2.8); + k+=0.716607670482*(abs(GENdPhiZZ)>2.8&&abs(GENdPhiZZ)<=2.9); + k+=1.132841784840*(abs(GENdPhiZZ)>2.9&&abs(GENdPhiZZ)<=3.1416); + } + + if (finalState==2) { + k+=1.513834489150*(abs(GENdPhiZZ)>0.0&&abs(GENdPhiZZ)<=0.1); + k+=1.541738780180*(abs(GENdPhiZZ)>0.1&&abs(GENdPhiZZ)<=0.2); + k+=1.497829632510*(abs(GENdPhiZZ)>0.2&&abs(GENdPhiZZ)<=0.3); + k+=1.534956782920*(abs(GENdPhiZZ)>0.3&&abs(GENdPhiZZ)<=0.4); + k+=1.478217033060*(abs(GENdPhiZZ)>0.4&&abs(GENdPhiZZ)<=0.5); + k+=1.504330859290*(abs(GENdPhiZZ)>0.5&&abs(GENdPhiZZ)<=0.6); + k+=1.520626246850*(abs(GENdPhiZZ)>0.6&&abs(GENdPhiZZ)<=0.7); + k+=1.507013090030*(abs(GENdPhiZZ)>0.7&&abs(GENdPhiZZ)<=0.8); + k+=1.494243156250*(abs(GENdPhiZZ)>0.8&&abs(GENdPhiZZ)<=0.9); + k+=1.450536096150*(abs(GENdPhiZZ)>0.9&&abs(GENdPhiZZ)<=1.0); + k+=1.460812521660*(abs(GENdPhiZZ)>1.0&&abs(GENdPhiZZ)<=1.1); + k+=1.471603622200*(abs(GENdPhiZZ)>1.1&&abs(GENdPhiZZ)<=1.2); + k+=1.467700038200*(abs(GENdPhiZZ)>1.2&&abs(GENdPhiZZ)<=1.3); + k+=1.422408690640*(abs(GENdPhiZZ)>1.3&&abs(GENdPhiZZ)<=1.4); + k+=1.397184022730*(abs(GENdPhiZZ)>1.4&&abs(GENdPhiZZ)<=1.5); + k+=1.375593447520*(abs(GENdPhiZZ)>1.5&&abs(GENdPhiZZ)<=1.6); + k+=1.391901318370*(abs(GENdPhiZZ)>1.6&&abs(GENdPhiZZ)<=1.7); + k+=1.368564350560*(abs(GENdPhiZZ)>1.7&&abs(GENdPhiZZ)<=1.8); + k+=1.317884804290*(abs(GENdPhiZZ)>1.8&&abs(GENdPhiZZ)<=1.9); + k+=1.314019950800*(abs(GENdPhiZZ)>1.9&&abs(GENdPhiZZ)<=2.0); + k+=1.274641749910*(abs(GENdPhiZZ)>2.0&&abs(GENdPhiZZ)<=2.1); + k+=1.242346606820*(abs(GENdPhiZZ)>2.1&&abs(GENdPhiZZ)<=2.2); + k+=1.244727403840*(abs(GENdPhiZZ)>2.2&&abs(GENdPhiZZ)<=2.3); + k+=1.146259351670*(abs(GENdPhiZZ)>2.3&&abs(GENdPhiZZ)<=2.4); + k+=1.107804993520*(abs(GENdPhiZZ)>2.4&&abs(GENdPhiZZ)<=2.5); + k+=1.042053646740*(abs(GENdPhiZZ)>2.5&&abs(GENdPhiZZ)<=2.6); + k+=0.973608545141*(abs(GENdPhiZZ)>2.6&&abs(GENdPhiZZ)<=2.7); + k+=0.872169942668*(abs(GENdPhiZZ)>2.7&&abs(GENdPhiZZ)<=2.8); + k+=0.734505279177*(abs(GENdPhiZZ)>2.8&&abs(GENdPhiZZ)<=2.9); + k+=1.163152837230*(abs(GENdPhiZZ)>2.9&&abs(GENdPhiZZ)<=3.1416); + } + if (k==0.0) return 1.1; // if something goes wrong return inclusive k-factor + else return k; + +} + +//------------------------------------------------------------------------------ +// kfactor_qqZZ_qcd_M (float GENmassZZ, int finalState); +//------------------------------------------------------------------------------ +float kfactor_qqZZ_qcd_M(float GENmassZZ, int finalState) +{ + + // finalState=1 : 4e/4mu/4tau + // finalState=2 : 2e2mu/2mutau/2e2tau + + float k=0.0; + + if (finalState==1) { + k+=1.23613311013*(abs(GENmassZZ)>0.0&&abs(GENmassZZ)<=25.0); + k+=1.17550314639*(abs(GENmassZZ)>25.0&&abs(GENmassZZ)<=50.0); + k+=1.17044565911*(abs(GENmassZZ)>50.0&&abs(GENmassZZ)<=75.0); + k+=1.03141209689*(abs(GENmassZZ)>75.0&&abs(GENmassZZ)<=100.0); + k+=1.05285574912*(abs(GENmassZZ)>100.0&&abs(GENmassZZ)<=125.0); + k+=1.11287217794*(abs(GENmassZZ)>125.0&&abs(GENmassZZ)<=150.0); + k+=1.13361441158*(abs(GENmassZZ)>150.0&&abs(GENmassZZ)<=175.0); + k+=1.10355603327*(abs(GENmassZZ)>175.0&&abs(GENmassZZ)<=200.0); + k+=1.10053981637*(abs(GENmassZZ)>200.0&&abs(GENmassZZ)<=225.0); + k+=1.10972676811*(abs(GENmassZZ)>225.0&&abs(GENmassZZ)<=250.0); + k+=1.12069120525*(abs(GENmassZZ)>250.0&&abs(GENmassZZ)<=275.0); + k+=1.11589101635*(abs(GENmassZZ)>275.0&&abs(GENmassZZ)<=300.0); + k+=1.13906170314*(abs(GENmassZZ)>300.0&&abs(GENmassZZ)<=325.0); + k+=1.14854594271*(abs(GENmassZZ)>325.0&&abs(GENmassZZ)<=350.0); + k+=1.14616229031*(abs(GENmassZZ)>350.0&&abs(GENmassZZ)<=375.0); + k+=1.14573157789*(abs(GENmassZZ)>375.0&&abs(GENmassZZ)<=400.0); + k+=1.13829430515*(abs(GENmassZZ)>400.0&&abs(GENmassZZ)<=425.0); + k+=1.15521193686*(abs(GENmassZZ)>425.0&&abs(GENmassZZ)<=450.0); + k+=1.13679822698*(abs(GENmassZZ)>450.0&&abs(GENmassZZ)<=475.0); + k+=1.13223956942*(abs(GENmassZZ)>475.0); + } + + if (finalState==2) { + k+=1.25094466582*(abs(GENmassZZ)>0.0&&abs(GENmassZZ)<=25.0); + k+=1.22459455362*(abs(GENmassZZ)>25.0&&abs(GENmassZZ)<=50.0); + k+=1.19287368979*(abs(GENmassZZ)>50.0&&abs(GENmassZZ)<=75.0); + k+=1.04597506451*(abs(GENmassZZ)>75.0&&abs(GENmassZZ)<=100.0); + k+=1.08323413771*(abs(GENmassZZ)>100.0&&abs(GENmassZZ)<=125.0); + k+=1.09994968030*(abs(GENmassZZ)>125.0&&abs(GENmassZZ)<=150.0); + k+=1.16698455800*(abs(GENmassZZ)>150.0&&abs(GENmassZZ)<=175.0); + k+=1.10399053155*(abs(GENmassZZ)>175.0&&abs(GENmassZZ)<=200.0); + k+=1.10592664340*(abs(GENmassZZ)>200.0&&abs(GENmassZZ)<=225.0); + k+=1.10690381480*(abs(GENmassZZ)>225.0&&abs(GENmassZZ)<=250.0); + k+=1.11194928918*(abs(GENmassZZ)>250.0&&abs(GENmassZZ)<=275.0); + k+=1.13522586553*(abs(GENmassZZ)>275.0&&abs(GENmassZZ)<=300.0); + k+=1.11895090244*(abs(GENmassZZ)>300.0&&abs(GENmassZZ)<=325.0); + k+=1.13898508615*(abs(GENmassZZ)>325.0&&abs(GENmassZZ)<=350.0); + k+=1.15463977506*(abs(GENmassZZ)>350.0&&abs(GENmassZZ)<=375.0); + k+=1.17341664594*(abs(GENmassZZ)>375.0&&abs(GENmassZZ)<=400.0); + k+=1.20093349763*(abs(GENmassZZ)>400.0&&abs(GENmassZZ)<=425.0); + k+=1.18915554919*(abs(GENmassZZ)>425.0&&abs(GENmassZZ)<=450.0); + k+=1.18546007375*(abs(GENmassZZ)>450.0&&abs(GENmassZZ)<=475.0); + k+=1.12864505708*(abs(GENmassZZ)>475.0); + } + + if (k==0.0) return 1.1; + else return k; // if something goes wrong return inclusive k-factor + +} + + +//------------------------------------------------------------------------------ +// kfactor_qqZZ_qcd_Pt (float GENpTZZ, int finalState); +//------------------------------------------------------------------------------ +float kfactor_qqZZ_qcd_Pt(float GENpTZZ, int finalState) +{ + + // finalState=1 : 4e/4mu/4tau + // finalState=2 : 2e2mu/2mutau/2e2tau + + float k=0.0; + + if (finalState==1) { + k+=0.64155491983*(abs(GENpTZZ)>0.0&&abs(GENpTZZ)<=5.0); + k+=1.09985240531*(abs(GENpTZZ)>5.0&&abs(GENpTZZ)<=10.0); + k+=1.29390628654*(abs(GENpTZZ)>10.0&&abs(GENpTZZ)<=15.0); + k+=1.37859998571*(abs(GENpTZZ)>15.0&&abs(GENpTZZ)<=20.0); + k+=1.42430263312*(abs(GENpTZZ)>20.0&&abs(GENpTZZ)<=25.0); + k+=1.45038493266*(abs(GENpTZZ)>25.0&&abs(GENpTZZ)<=30.0); + k+=1.47015377651*(abs(GENpTZZ)>30.0&&abs(GENpTZZ)<=35.0); + k+=1.48828685748*(abs(GENpTZZ)>35.0&&abs(GENpTZZ)<=40.0); + k+=1.50573440448*(abs(GENpTZZ)>40.0&&abs(GENpTZZ)<=45.0); + k+=1.50211655928*(abs(GENpTZZ)>45.0&&abs(GENpTZZ)<=50.0); + k+=1.50918720827*(abs(GENpTZZ)>50.0&&abs(GENpTZZ)<=55.0); + k+=1.52463089491*(abs(GENpTZZ)>55.0&&abs(GENpTZZ)<=60.0); + k+=1.52400838378*(abs(GENpTZZ)>60.0&&abs(GENpTZZ)<=65.0); + k+=1.52418067701*(abs(GENpTZZ)>65.0&&abs(GENpTZZ)<=70.0); + k+=1.55424382578*(abs(GENpTZZ)>70.0&&abs(GENpTZZ)<=75.0); + k+=1.52544284222*(abs(GENpTZZ)>75.0&&abs(GENpTZZ)<=80.0); + k+=1.57896384602*(abs(GENpTZZ)>80.0&&abs(GENpTZZ)<=85.0); + k+=1.53034682567*(abs(GENpTZZ)>85.0&&abs(GENpTZZ)<=90.0); + k+=1.56147329708*(abs(GENpTZZ)>90.0&&abs(GENpTZZ)<=95.0); + k+=1.54468169268*(abs(GENpTZZ)>95.0&&abs(GENpTZZ)<=100.0); + k+=1.57222952415*(abs(GENpTZZ)>100.0); + } + + if (finalState==2) { + k+=0.743602533303*(abs(GENpTZZ)>0.0&&abs(GENpTZZ)<=5.0); + k+=1.14789453219*(abs(GENpTZZ)>5.0&&abs(GENpTZZ)<=10.0); + k+=1.33815867892*(abs(GENpTZZ)>10.0&&abs(GENpTZZ)<=15.0); + k+=1.41420044104*(abs(GENpTZZ)>15.0&&abs(GENpTZZ)<=20.0); + k+=1.45511318916*(abs(GENpTZZ)>20.0&&abs(GENpTZZ)<=25.0); + k+=1.47569225244*(abs(GENpTZZ)>25.0&&abs(GENpTZZ)<=30.0); + k+=1.49053003693*(abs(GENpTZZ)>30.0&&abs(GENpTZZ)<=35.0); + k+=1.50622827695*(abs(GENpTZZ)>35.0&&abs(GENpTZZ)<=40.0); + k+=1.50328889799*(abs(GENpTZZ)>40.0&&abs(GENpTZZ)<=45.0); + k+=1.52186945281*(abs(GENpTZZ)>45.0&&abs(GENpTZZ)<=50.0); + k+=1.52043468754*(abs(GENpTZZ)>50.0&&abs(GENpTZZ)<=55.0); + k+=1.53977869986*(abs(GENpTZZ)>55.0&&abs(GENpTZZ)<=60.0); + k+=1.53491994434*(abs(GENpTZZ)>60.0&&abs(GENpTZZ)<=65.0); + k+=1.51772882172*(abs(GENpTZZ)>65.0&&abs(GENpTZZ)<=70.0); + k+=1.54494489131*(abs(GENpTZZ)>70.0&&abs(GENpTZZ)<=75.0); + k+=1.57762411697*(abs(GENpTZZ)>75.0&&abs(GENpTZZ)<=80.0); + k+=1.55078339014*(abs(GENpTZZ)>80.0&&abs(GENpTZZ)<=85.0); + k+=1.57078191891*(abs(GENpTZZ)>85.0&&abs(GENpTZZ)<=90.0); + k+=1.56162666568*(abs(GENpTZZ)>90.0&&abs(GENpTZZ)<=95.0); + k+=1.54183774627*(abs(GENpTZZ)>95.0&&abs(GENpTZZ)<=100.0); + k+=1.58485762205*(abs(GENpTZZ)>100.0); + } + + if (k==0.0) return 1.1; + else return k; // if something goes wrong return inclusive k-factor + +} + + + +TH1F *ApplyKFactor(TH1F *INHISTO, int Type, int State) { + + int nBins = INHISTO->GetNbinsX(); + float minX = INHISTO->GetBinLowEdge(1); + float maxX = INHISTO->GetBinLowEdge(nBins+1); + TH1F *OUTHISTO = new TH1F("out", "", nBins, minX, maxX); + + for (int ib = 1; ib<=nBins; ib++) { + + float xx = OUTHISTO->GetBinCenter(ib); + float yy = INHISTO->GetBinContent(ib); + + if (Type==0) yy *= kfactor_qqZZ_qcd_dPhi(xx, State); + if (Type==1) yy *= kfactor_qqZZ_qcd_M (xx, State); + if (Type==2) yy *= kfactor_qqZZ_qcd_Pt (xx, State); + + OUTHISTO->SetBinContent(ib, yy); + + } + + return OUTHISTO; + +} + +void TestKFactors() { + + TFile *_file0 = TFile::Open("../minitrees/multilepton/Stop/ZZTo4L__part0.root"); + //TFile *_file0 = TFile::Open("../minitrees/nominalTrg/Stop/ZZTo4L__part0.root"); + TTree *latino = (TTree*)_file0->Get("latino"); + + TH1F *M = new TH1F("M", "", 40, 0., 1000.); + latino->Project("M", "ZZmass", "nlepton>=4 && ntightlepton>=3 && lep1pt>20. && lep2pt>20. && lep3pt>20. && lep4pt>20. && (fabs(lep1id)!=fabs(lep2id) || fabs(lep1id)!=fabs(lep3id) || fabs(lep1id)!=fabs(lep4id))"); + //latino->Project("M", "ZZmass"); + TH1F *M2 = ApplyKFactor(M, 1, 2); + cout << M2->Integral()/M->Integral() << endl; + TString M2Legend = "ZZ-mass"; + M2->SetXTitle("M(ZZ) [GeV]"); + M->SetYTitle("Arbitrary units / 25 GeV"); + /* + TH1F *M = new TH1F("M", "", 80, 0., 400.); + latino->Project("M", "ZZpt", "nlepton>=4 && ntightlepton>=3 && lep1pt>20. && lep2pt>20. && lep3pt>20. && lep4pt>20. && (fabs(lep1id)!=fabs(lep2id) || fabs(lep1id)!=fabs(lep3id) || fabs(lep1id)!=fabs(lep4id))"); + //latino->Project("M", "ZZpt"); + TH1F *M2 = ApplyKFactor(M, 2, 2); + cout << M2->Integral()/M->Integral() << endl; + TString M2Legend = "ZZ-p_{T}"; + M2->SetXTitle("p_{T}(ZZ) [GeV]"); + M->SetYTitle("Arbitrary units / 5 GeV"); + + TH1F *M = new TH1F("M", "", 32, 0., 3.2); + latino->Project("M", "fabs(ZZdphi)", "nlepton>=4 && ntightlepton>=3 && lep1pt>20. && lep2pt>20. && lep3pt>20. && lep4pt>20. && (fabs(lep1id)!=fabs(lep2id) || fabs(lep1id)!=fabs(lep3id) || fabs(lep1id)!=fabs(lep4id))"); + //latino->Project("M", "ZZdphi"); + TH1F *M2 = ApplyKFactor(M, 0, 2); + cout << M2->Integral()/M->Integral() << endl; + TString M2Legend = "ZZ-#Delta#phi"; + M2->SetXTitle("#Delta#phi(ZZ) [GeV]"); + M->SetYTitle("Arbitrary units / 0.1"); + */ + TCanvas *CC = new TCanvas("CC", "", 600, 600); + + TPad *pad1 = new TPad("pad1", "pad1", 0, 0.33, 1, 1.00); + TPad *pad2 = new TPad("pad2", "pad2", 0, 0.00, 1, 0.33); + + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.02); + pad1->Draw(); + + pad2->SetTopMargin (0.08); + pad2->SetBottomMargin(0.35); + pad2->Draw(); + + CC->SetFillColor(10); + CC->SetBorderMode(0); + CC->SetBorderSize(2); + pad1->SetFillColor(10); + pad1->SetBorderMode(0); + pad1->SetBorderSize(2); + pad2->SetFillColor(10); + pad2->SetBorderMode(0); + pad2->SetBorderSize(2); + gStyle->SetOptStat(0); + + pad1->cd(); + + M->GetXaxis()->SetLabelOffset(999.); + M->GetXaxis()->SetTitleOffset(999.); + M->GetXaxis()->SetTitleSize(0.07); + M->GetYaxis()->SetLabelSize(0.045); + M->GetYaxis()->SetTitleSize(0.05); + M2->SetLineColor(2); + + float maxY = M2->GetMaximum(); + M->SetMaximum(maxY*1.1); + M->DrawCopy("histo"); + M2->DrawCopy("histosame"); + + TLegend *leg = new TLegend(0.5, 0.5, 0.8, 0.8); + leg->SetFillColor(kWhite); leg->SetBorderSize(0.); + leg->SetTextColor(1); leg->SetTextSize(0.035); + leg->SetTextFont(62); + + leg->AddEntry(M, "no k-factors", "f"); + leg->AddEntry(M2, M2Legend, "f"); + + leg->Draw(); + + pad2->cd(); + + M2->Divide(M); + M2->SetYTitle("k-factors"); + + //M2->GetXaxis()->SetLabelOffset(0.9); + //M2->GetXaxis()->SetTitleOffset(0.9); + M2->GetXaxis()->SetLabelSize(0.09); + M2->GetXaxis()->SetTitleSize(0.1); + M2->GetYaxis()->SetLabelSize(0.09); + M2->GetYaxis()->SetTitleSize(0.1); + M2->GetYaxis()->SetTitleOffset(0.5); + + M2->SetMinimum(0.6); + M2->SetMaximum(1.6); + + M2->DrawCopy("histo"); + +} diff --git a/stop/merge.sh b/stop/merge.sh index d014442e..ec83fcfd 100755 --- a/stop/merge.sh +++ b/stop/merge.sh @@ -12,36 +12,33 @@ FOLDER="$1" pushd $FOLDER -##hadd -f -k 00_Fakes.root fakeW*.root +# Data hadd -f -k 01_Data.root *03Feb2017* ##hadd -f -k 01_DataBlind.root *Run2016B-03Feb2017* *Run2016C-03Feb2017* *Run2016D-03Feb2017* -hadd -f -k 02_WZTo3LNu.root WZTo3LNu.root -##hadd -f -k 03_VZ.root ZZTo2L2Q__part*.root ZZTo2L2Nu__part*.root WZTo2L2Q__part*.root -hadd -f -k 03_ZZ.root ZZTo2L2Nu__part*.root ggZZTo2e2nu.root ggZZTo2mu2nu.root -##hadd -f -k 03a_ZZ.root ZZTo2L2Nu__part*.root -##hadd -f -k 03b_ZZ.root ggZZTo2e2nu.root ggZZTo2mu2nu.root -hadd -f -k 04_TTTo2L2Nu.root TTTo2L2Nu__part*.root -hadd -f -k 05_ST.root ST_tW_antitop.root ST_tW_top.root -hadd -f -k 06_WW.root WWTo2L2Nu.root GluGluWWTo2L2Nu_MCFM.root -#hadd -f -k 07_ZJets.root DYJetsToLL_M-10to50.root DYJetsToLL_M-50__part*.root -hadd -f -k 07_ZJetsHT_DYcorr.root DYJetsToLL_M-10to50-LO_DYcorr.root DYJetsToLL_M-5to50_HT-*_DYcorr.root DYJetsToLL_M-50-LO-ext1__part*_DYcorr.root DYJetsToLL_M-50_HT-70to100__part*_DYcorr.root DYJetsToLL_M-50_HT-100to200_ext1__part*_DYcorr.root DYJetsToLL_M-50_HT-200to400_ext1__part*_DYcorr.root DYJetsToLL_M-50_HT-400to600_DYcorr.root DYJetsToLL_M-50_HT-600to800__part*_DYcorr.root DYJetsToLL_M-50_HT-800to1200_DYcorr.root DYJetsToLL_M-50_HT-1200to2500_DYcorr.root DYJetsToLL_M-50_HT-2500toInf_DYcorr.root -##rm DY*_DYcorr.root -#hadd -f -k 07_ZJetsHT.root DYJetsToLL_M-10to50-LO.root DYJetsToLL_M-5to50_HT-*root DYJetsToLL_M-50-LO-ext1__part*.root -DYJetsToLL_M-50_HT-70to100__part* DYJetsToLL_M-50_HT-100to200_ext1__part* DYJetsToLL_M-50_HT-200to400_ext1__part* DYJetsToLL_M-50_HT-400to600.root DYJetsToLL_M-50_HT-600to800__part* DYJetsToLL_M-50_HT-800to1200.root DYJetsToLL_M-50_HT-1200to2500.root DYJetsToLL_M-50_HT-2500toInf.root -##hadd -f -k 08_WJets.root WJetsToLNu.root -hadd -f -k 09_TTW.root TTWJetsToLNu.root TTWJetsToQQ.root -hadd -f -k 10_TTZ.root TTZToQQ.root TTZToLLNuNu_M-10.root -hadd -f -k 11_HWW.root GluGluHToWWTo2L2NuAMCNLO_M125.root VBFHToWWTo2L2Nu_M125.root GluGluHToTauTau_M125.root VBFHToTauTau_M125.root HWminusJ_HToWW_M125.root HWplusJ_HToWW_M125.root -##hadd -f -k 11_Wg.root Wg_MADGRAPHMLM.root -##hadd -f -k 12_Zg.root Zg.root -hadd -f -k 13_VVV.root WWW.root WWZ.root WZZ.root #ZZZ.root -##hadd -f -k 14_HZ.root HZJ_HToWWTo2L2Nu_M125_noHLT.root GluGluZH_HToWWTo2L2Nu_M125_noHLT.root -##hadd -f -k 15_WgStar.root WgStarLNuEE.root WgStarLNuMuMu.root -#hadd -f -k 14_ZZTo4L.root ZZTo4L__part*.root ggZZTo4mu.root ggZZTo4e.root ggZZTo4tau.root ggZZTo2e2mu.root ggZZTo2mu2tau.root ggZZTo2e2tau.root qqHToZZTo4L.root ggHToZZTo4L.root -#hadd -f -k 14a_ZZTo4L.root ZZTo4L__part*.root -#hadd -f -k 14b_ZZTo4L.root ggZZTo4mu.root ggZZTo4e.root ggZZTo4tau.root ggZZTo2e2mu.root ggZZTo2mu2tau.root ggZZTo2e2tau.root -#hadd -f -k 14c_ZZTo4L.root qqHToZZTo4L.root ggHToZZTo4L.root -hadd -f -k 15_VZ.root WZTo2L2Q__part*.root ZZTo2L2Q__part*.root -hadd -f -k 15_VZ3V.root 15_VZ.root 13_VVV.root +# Top +hadd -f -k 04_TTTo2L2Nu.root TTTo2L2Nu__part*.root +hadd -f -k 05_ST.root ST_tW_antitop.root ST_tW_top.root + +# ZJets + +#hadd -f -k 07_ZJets.root DYJetsToLL_M-10to50.root DYJetsToLL_M-50__part*.root # NLO +hadd -f -k 07_ZJetsHT.root DYJetsToLL_M-10to50-LO.root DYJetsToLL_M-5to50_HT-*root DYJetsToLL_M-50-LO-ext1__part*.root DYJetsToLL_M-50_HT-70to100__part*.root DYJetsToLL_M-50_HT-100to200_ext1__part*.root DYJetsToLL_M-50_HT-200to400_ext1__part*.root DYJetsToLL_M-50_HT-400to600.root DYJetsToLL_M-50_HT-600to800__part*.root DYJetsToLL_M-50_HT-800to1200.root DYJetsToLL_M-50_HT-1200to2500.root DYJetsToLL_M-50_HT-2500toInf.root + +hadd -f -k 07_ZJetsHT_DYcorr.root DYJetsToLL_M-10to50-LO_DYcorr.root DYJetsToLL_M-5to50_HT-*_DYcorr.root DYJetsToLL_M-50-LO-ext1__part*_DYcorr.root DYJetsToLL_M-50_HT-70to100__part*_DYcorr.root DYJetsToLL_M-50_HT-100to200_ext1__part*_DYcorr.root DYJetsToLL_M-50_HT-200to400_ext1__part*_DYcorr.root DYJetsToLL_M-50_HT-400to600_DYcorr.root DYJetsToLL_M-50_HT-600to800__part*_DYcorr.root DYJetsToLL_M-50_HT-800to1200_DYcorr.root DYJetsToLL_M-50_HT-1200to2500_DYcorr.root DYJetsToLL_M-50_HT-2500toInf_DYcorr.root + +# Dibosons + +hadd -f -k 02_WZTo3LNu.root WZTo3LNu.root +hadd -f -k 03_ZZ.root ZZTo2L2Nu__part* ggZZTo2e2nu.root ggZZTo2mu2nu.root +hadd -f -k 06_WW.root WWTo2L2Nu.root GluGluWWTo2L2Nu_MCFM.root +hadd -f -k 14_ZZTo4L.root ZZTo4L__part* ggHToZZTo4L.root ggZZTo2e2mu.root ggZZTo2e2nu.root ggZZTo2e2tau.root ggZZTo2mu2nu.root ggZZTo2mu2tau.root ggZZTo4e.root ggZZTo4mu.root ggZZTo4tau.root qqHToZZTo4L.root +hadd -f -k 15_VZ.root ZZTo2L2Q__part*.root WZTo2L2Q__part*.root + +# Tribosons +hadd -f -k 09_TTW.root TTWJetsToLNu.root TTWJetsToQQ.root +hadd -f -k 10_TTZ.root TTZToQQ.root TTZToLLNuNu_M-10.root +hadd -f -k 11_HWW.root GluGluHToWWTo2L2NuAMCNLO_M125.root VBFHToWWTo2L2Nu_M125.root GluGluHToTauTau_M125.root VBFHToTauTau_M125.root HWminusJ_HToWW_M125.root HWplusJ_HToWW_M125.root +hadd -f -k 13_VVV.root WWW.root WWZ.root WZZ.root #ZZZ.root +hadd -f -k 15_VZ3V.root 15_VZ.root 13_VVV.root popd diff --git a/stop/runPlotter.C b/stop/runPlotter.C index f6f5100c..82567e04 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -5,48 +5,44 @@ const Bool_t datadriven = false; const Bool_t allplots = false; const Bool_t dosystematics = true; -const Bool_t postfitplots = true; -const Bool_t paperstyle = true; +const Bool_t postfitplots = false; +const Bool_t paperstyle = false; const Bool_t regionlegend = true; const Bool_t relativeratio = true; -//const TString inputdir = "../rootfiles/nominalFullStatus/"; -//const TString inputdir = "../minitrees/rootfiles/Zpeak_kinematic/"; -//const TString inputdir = "../minitrees/rootfilesOct17/nominal/"; -//const TString inputdir = "../minitrees/rootfilesFakePM/nominal/"; +//const TString inputdir = "../minitrees/rootfiles/WZtoWW/"; +//const TString inputdir = "../minitrees/rootfiles/WZtoWWveto/"; +//const TString inputdir = "../minitrees/rootfiles/nominal/"; +//const TString inputdir = "../freezing_rootfiles/nominal/"; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; -//const TString inputdir = "../minitrees/rootfiles/WZtoWWptcut20_veto/"; -//const TString inputdir = "../minitrees/rootfiles/WZtoWWvetoMetCorr2/"; -//const TString inputdir = "../rootfiles/fake/"; -//const TString inputdir = "../rootfiles/SS/"; -//const TString inputdir = "../rootfiles/SSp/"; -//const TString inputdir = "../rootfiles/SSm/"; -//const TString inputdir = "../minitrees/rootfiles/ttZalexis/"; -//const TString inputdir = "../minitrees/rootfiles/WZ3L/"; -//const TString inputdir = "../minitrees/rootfiles/ttZWZ3LNoMetCut/"; -//const TString inputdir = "../minitrees/rootfiles/ZZ/"; -//const TString inputdir = "../minitrees/rootfiles3R/ZpeakkfM/"; -//const TString inputdir = "../minitrees/rootfiles3R/ZZkfM/"; -//const TString inputdir = "../minitrees/rootfiles3R/ZZkfPt/"; -//const TString inputdir = "../minitrees/rootfiles3R/ZZkfdPhi/"; -//const TString inputdir = "../minitrees/rootfilesOct17/Zpeak_ptll/"; -//const TString inputdir = "../minitrees/rootfilesOct17/ZpeakMetCorr/"; -//const TString inputdir = "../minitrees/rootfiles/ZpeakDYcorrections/"; -////const TString inputdir = "../minitrees/rootfilesOct17/WZtoWWveto/"; -//const TString inputdir = "../minitrees/rootfilesFakePM/nominal/"; -//const TString inputdir = "../minitrees/rootfilesNoTopPt/nominal/"; -//const TString inputdir = "../minitrees/rootfilesFakePM/kinematiclowMet/"; -//const TString inputdir = "../minitrees/rootfiles/kinematic/"; -//const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsPostfitV4/MassPointChiWW_Xm100_Xm1/Postfit/"; -//const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsPostfitV4/MassPointChiWW_Xm125_Xm1/Postfit/"; -//const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsPostfitV4/MassPointChiWW_Xm150_Xm1/Postfit/"; -//const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsPostfitV4/MassPointChiWW_Xm175_Xm1/Postfit/"; -const TString inputdir = "/eos/cms/store/user/scodella/Stop/rootfiles/PostfitPaperV2/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfit/"; const TString signal = "T2tt"; +//const TString inputdir = "../minitrees/rootfiles/nominal/"; +//const TString inputdir = "../minitrees/rootfiles3R/nominal/"; +//const TString inputdir = "../rootfiles/PostfitPaperV2/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfit/"; const TString signal = ""; +//const TString inputdir = "../rootfiles/PostfitPaperV2/MassPointChiSlep_Xm500_Xm200/Postfit/"; const TString signal = ""; +//const TString inputdir = "/eos/cms/store/user/scodella/Stop/rootfiles/PostfitPaperV2/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfit/"; const TString signal = "T2tt"; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/rootfiles/PostfitPaperV2/MassPointChiSlep_Xm500_Xm200/Postfit/"; const TString signal = "TChi"; -const TString outputdir = "figures/"; +const TString inputdir = "../minitrees/rootfiles/nominal/"; +//const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; +const TString outputdir = "sysTables/"; + +//const TString outputdir = "ForPaperv2Tables_2March18/"; +//const TString outputdir = "Paperfigures_7Dec17/"; +//const TString outputdir = "DYcorr_ZZcorr_MT2ll/"; +//const TString outputdir = "DYcorr_MT2ll/"; +//const TString outputdir = "ST_s_t_channels/"; +//const TString outputdir = "PreapprovalTalk_Check_DYcorr/"; +//const TString outputdir = "PreapprovalTalk_Yieldls/"; +//const TString outputdir = "TBTHanns_ValidatSyst_YSF_22Nov17/"; +//const TString outputdir = "Paperfigures_22Nov17_DrawSign/"; +//const TString outputdir = "Zpeak_WZtoWWmimc_Roberto/"; +//const TString outputdir = "LeptonPt_selection/"; //const TString signal = ""; +//const TString signal = "mix"; +const TString signal = "T2tt"; +//const TString signal = "TChi"; + const TString sl = "#font[12]{l}"; const TString sll = "#font[12]{ll}"; @@ -116,10 +112,10 @@ void runPlotter(TString level, else { plotter.SetLuminosity(lumi, postfitplots); - plotter.SetDrawRatio (true); + plotter.SetDrawRatio (false); + plotter.SetDrawSignificance(false); plotter.SetDrawRatioRel (relativeratio); } - float SF_ttZ = 1., SF_ZMet = 1., SF_DY = 1., SF_WZ = 1.; if (!postfitplots && !inputdir.Contains("fake") && !inputdir.Contains("SS") && !inputdir.Contains("ttZ") && !inputdir.Contains("WZ3L")) { if (level.Contains("_SR") || level.Contains("_VRggg")) {// && inputdir.Contains("DYcorr"))) { @@ -136,6 +132,11 @@ void runPlotter(TString level, } } + +/* plotter.AddProcess("ST_s-channel", "ST_s-channel", color_VZ); + plotter.AddProcess("ST_t-channel_top", "ST_t-channel_top", color_Wg); + plotter.AddProcess("ST_t-channel_antitop", "ST_t-channel_antitop", color_VVV); +*/ // Get the data //---------------------------------------------------------------------------- plotter.AddData("01_Data", "Data", color_Data); @@ -155,6 +156,7 @@ void runPlotter(TString level, level.ReplaceAll("_DYcorrVR1norm", ""); } + // Add processes //---------------------------------------------------------------------------- if (paperstyle) { @@ -214,19 +216,23 @@ void runPlotter(TString level, plotter.AddPostfitSM("99_TotalBackground", "Post-fit", kRed+4); } + if (signal=="T2tt") { - + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,225)",kViolet); if (postfitplots) { plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", STP+" "+STP+", "+STP+"#rightarrow t"+LSP+", (m_{"+STP+"} = 350 GeV, m_{"+LSP+"} = 225 GeV)",kViolet); - } else { - plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,225)",kViolet); - plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm175", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,175)",kRed); + } //else { + //if (inputdir.Contains("Sm350_Xm225")) + //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,225)",kViolet); + /* plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm175", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,175)",kRed); plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm263", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,263)",kOrange); plotter.AddSignal("T2tt_mStop-150to250_Sm250_Xm125", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (250,125)",kBlue); plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (450,325)",kCyan); - } - + */ + // } + } else if (signal=="TChi") { + plotter.AddSignal("TChiSlep_Xm500_Xm200", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (500,200)", kViolet); if (postfitplots) { if (inputdir.Contains("Xm500_Xm200")) @@ -239,27 +245,34 @@ void runPlotter(TString level, plotter.AddSignal("TChiWW_Xm150_Xm1", CHR+CHR+", "+CHR+"#rightarrow W"+LSP+", (m_{"+CHR+"} = 150 GeV, m_{"+LSP+"} = 1 GeV)", kViolet); else if (inputdir.Contains("Xm175_Xm1")) plotter.AddSignal("TChiWW_Xm175_Xm1", CHR+CHR+", "+CHR+"#rightarrow W"+LSP+", (m_{"+CHR+"} = 175 GeV, m_{"+LSP+"} = 1 GeV)", kViolet); - } else { - plotter.AddSignal("TChiSlep_Xm200_Xm1", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (200, 1)", kRed); - plotter.AddSignal("TChiSlep_Xm500_Xm200", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (500,200)", kViolet); + } //else { + //if (inputdir.Contains("Xm500_Xm200")) + /*plotter.AddSignal("TChiSlep_Xm200_Xm1", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (200, 1)", kRed); plotter.AddSignal("TChiSlep_Xm800_Xm400", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (800,400)", kOrange); plotter.AddSignal("TChiWW_Xm200_Xm25", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow#tilde{#chi}^{0}_{1}W (200, 25)", kBlue); plotter.AddSignal("TChiWW_Xm300_Xm100", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow#tilde{#chi}^{0}_{1}W (300,100)", kCyan); - } + */ + // } } else if (signal=="Mix") { - plotter.AddSignal("T2bW_Sm250_Xm1", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (250,1)",kRed); - plotter.AddSignal("T2bW_Sm250_Xm50", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (250,50)",kRed); - plotter.AddSignal("T2bW_Sm200_Xm25", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (200,25)",kRed); + if (inputdir.Contains("Xm500_Xm200")) + plotter.AddSignal("TChiSlep_Xm500_Xm200", CHR+CHR+", "+CHR+"#rightarrow l#nu"+LSP+", (m_{"+CHR+"} = 500 GeV, m_{"+LSP+"} = 200 GeV)", kViolet); + if (inputdir.Contains("Sm350_Xm225")) + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", STP+" "+STP+", "+STP+"#rightarrow t"+LSP+", (m_{"+STP+"} = 350 GeV, m_{"+LSP+"} = 225 GeV)",kViolet+3); + + //plotter.AddSignal("T2bW_Sm250_Xm1", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (250,1)",kRed); + //plotter.AddSignal("T2bW_Sm250_Xm50", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (250,50)",kRed); + //plotter.AddSignal("T2bW_Sm200_Xm25", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (200,25)",kRed); //plotter.AddSignal("T2tt_mStop-150to250_Sm250_Xm125", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (250,125)",kRed); //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,225)",kRed); //plotter.AddSignal("T2tt_mStop-250to350_Sm300_Xm125", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (300,125)",kRed); //plotter.AddSignal("TChiSlep_Xm200_Xm1", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (200,1)", kBlue); //plotter.AddSignal("TChiSlep_Xm500_Xm200", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (500,200)", kCyan); - + } else if (signal==""){ + printf ("No signal"); } - + if (inputdir.Contains("rootfiles/nominalX")) { // Draw events by cut @@ -283,7 +296,7 @@ void runPlotter(TString level, // Draw events by channel //---------------------------------------------------------------------------- - plotter.SetDrawYield(false); + plotter.SetDrawYield(true); for (int j=0; j<=njetbin; j++) { @@ -305,21 +318,21 @@ void runPlotter(TString level, plotter.AddSystematic("Stop", "Postfit"); } else { plotter.AddSystematic("Stop", "Statistics"); - plotter.AddSystematic("Stop", "Luminosity"); - plotter.AddSystematic("Stop", "Trigger"); - plotter.AddSystematic("Stop", "MT2llTop"); - plotter.AddSystematic("Stop", "MT2llWW"); - plotter.AddSystematic("Stop", "Fake"); - plotter.AddSystematic("Stop", "Idiso"); - plotter.AddSystematic("Stop", "JES"); - plotter.AddSystematic("Stop", "MET"); + plotter.AddSystematic("Stop", "Metfastsim"); + //plotter.AddSystematic("Stop", "JES"); + // plotter.AddSystematic("Stop", "Reco"); + // plotter.AddSystematic("Stop", "Luminosity"); + // plotter.AddSystematic("Stop", "Trigger"); + // plotter.AddSystematic("Stop", "MT2llTop"); + // plotter.AddSystematic("Stop", "MT2llWW"); + // plotter.AddSystematic("Stop", "Fake"); + // plotter.AddSystematic("Stop", "Idiso"); + // plotter.AddSystematic("Stop", "Pileup"); + /* plotter.AddSystematic("Stop", "MET"); plotter.AddSystematic("Stop", "PDF"); plotter.AddSystematic("Stop", "Q2"); - plotter.AddSystematic("Stop", "Reco"); plotter.AddSystematic("Stop", "Toppt"); plotter.AddSystematic("Stop", "Isrnjet"); - plotter.AddSystematic("Stop", "Metfastsim"); - plotter.AddSystematic("Stop", "Pileup"); plotter.AddSystematic("Stop", "Fastsim"); plotter.AddSystematic("Stop", "BtagFS"); plotter.AddSystematic("Stop", "Btag"); @@ -339,7 +352,7 @@ void runPlotter(TString level, ///plotter.AddSystematic("Stop", "normTTW"); ///plotter.AddSystematic("Stop", "normHWW"); ///plotter.AddSystematic("Stop", "normVVV"); - } + */ } } // Draw distributions @@ -364,6 +377,7 @@ void runPlotter(TString level, for (int i=firstchannel; i<=lastchannel+1; i++) { + // if (i != lastchannel) continue; TString suffix = (i <= lastchannel) ? "_" + schannel[i] : "_sf"; TString title = (i < lastchannel) ? lchannel[i] : "inclusive"; @@ -402,9 +416,11 @@ void runPlotter(TString level, plotter.Draw(prefix + "dphiLLbin5" + suffix, "#Delta#phi(lep1,lep2)", 10, 0, "NULL", scale); continue; } - + std::cout << " before plotter" << std::endl; // Common histograms //-------------------------------------------------------------------- + std::cout << "pass the plotter" << std::endl; + if (inputdir.Contains("/ttZ/")) { plotter.Draw(prefix + "Counter" + suffix, "m_{ll} (" + sll + ")", 1, 0, "GeV", linY, false, 80, 100); continue; @@ -414,15 +430,39 @@ void runPlotter(TString level, plotter.Draw(prefix + "M2ll" + suffix, "m_{ll}", 4, 0, "GeV", linY, false, 0, 180); continue; } - /*plotter.Draw(prefix + "m2l" + suffix, "m_{" + sll + "}", m2l_ngroup, 0, "GeV", linY, true, m2l_xmin, m2l_xmax); + plotter.Draw(prefix + "MT2ll" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); + //plotter.Draw(prefix + "MT2ll" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", linY, false, 0, 140); + //plotter.Draw(prefix + "m2L" + suffix, "m_{" + sll + "}", -1, 0, "GeV", linY); + //plotter.Draw(prefix + "m2L" + suffix, "m_{" + sll + "}", -1, 0, "GeV", scale); + //plotter.Draw(prefix + "MET" + suffix, sm, 1, 0, "GeV", scale, true, 0, 400); + //plotter.Draw(prefix + "MET" + suffix, sm, 1, 0, "GeV", linY, true, 0, 400); + //plotter.Draw(prefix + "Lep1Pt" + suffix, "leading lepton p_{T}", 5, 0, "GeV", scale, true, 0, 250); + //plotter.Draw(prefix + "Lep2Pt" + suffix, "trailing lepton p_{T}", 5, 0, "GeV", scale, true, 0, 150); + /* plotter.Draw(prefix + "m2L" + suffix, "m_{" + sll + "}", -1, 0, "GeV", linY); plotter.Draw(prefix + "lep1pt" + suffix, "leading lepton p_{T}", 10, 0, "GeV", scale, true, 0, 250); plotter.Draw(prefix + "lep2pt" + suffix, "trailing lepton p_{T}", 5, 0, "GeV", scale, true, 0, 150); plotter.Draw(prefix + "lep1eta" + suffix, "leading lepton #eta", -1, 1, "NULL", scale); plotter.Draw(prefix + "lep2eta" + suffix, "trailing lepton #eta", -1, 1, "NULL", scale); - plotter.Draw(prefix + "lep1phi" + suffix, "leading lepton #phi", 5, 2, "rad", scale); - plotter.Draw(prefix + "lep2phi" + suffix, "trailing lepton #phi", 5, 2, "rad", scale); - plotter.Draw(prefix + "nvtx" + suffix, "number of vertices", -1, 0, "NULL", scale, true, 0, 30);*/ + plotter.Draw(prefix + "nvtx" + suffix, "number of vertices", -1, 0, "NULL", scale, true, 0, 30); + plotter.Draw(prefix + "njet20" + suffix, "number of jets", -1, 0, "NULL", linY, true, 0, 10); plotter.Draw(prefix + "MT2ll" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); + plotter.Draw(prefix + "MT2ll_fake" + suffix, "M_{T2}(" + sll + "_fake)", 1, 0, "GeV", scale, false, 0, 140); + plotter.Draw(prefix + "dphillMET" + suffix, "#Delta#phi(" +sll + "," + sm + ")", 10, 0, "NULL", scale); + plotter.Draw(prefix + "dphillMET" + suffix, "#Delta#phi(" +sll + "," + sm + ")", 10, 0, "NULL", linY); + plotter.Draw(prefix + "dphil1MET" + suffix, "#Delta#phi(l1," + sm + ")", 10, 0, "NULL", linY); + plotter.Draw(prefix + "dphil2MET" + suffix, "#Delta#phi(l2," + sm + ")", 10, 0, "NULL", linY); + plotter.Draw(prefix + "dphiLL" + suffix, "#Delta#phi(lep1,lep2)", 10, 0, "NULL", scale); + plotter.Draw(prefix + "dphiLL" + suffix, "#Delta#phi(lep1,lep2)", 10, 0, "NULL", linY); + plotter.Draw(prefix + "MET" + suffix, sm, 1, 0, "GeV", scale, false, 50, 200); + plotter.Draw(prefix + "MET" + suffix, sm, 1, 0, "GeV", linY, false, 140, 400); + plotter.Draw(prefix + "metPfType1" + suffix, sm, 100, 0, "GeV", scale, true, 0, 400); + plotter.Draw(prefix + "metPfType1" + suffix, sm, 100, 0, "GeV", linY, true, 0, 400); + plotter.Draw(prefix + "Lep1Phi" + suffix, "leading lepton #phi", 5, 2, "rad", scale); + plotter.Draw(prefix + "lep2phi" + suffix, "trailing lepton #phi", 5, 2, "rad", scale); + plotter.Draw(prefix + "lep1phi" + suffix, "leading lepton #phi", 5, 2, "rad", linY); + plotter.Draw(prefix + "Lep2Phi" + suffix, "trailing lepton #phi", 5, 2, "rad", scale); + plotter.Draw(prefix + "METphi" + suffix, "sm #phi", 5, 2, "rad", scale); + */ //plotter.Draw(prefix + "MT2ll" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", linY, false, 0, 140); if (level.Contains("_SR3") && signal=="T2tt") plotter.Draw(prefix + "MT2llisr" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); if (inputdir.Contains("Oct17/nominal/")) continue; @@ -463,6 +503,8 @@ void runPlotter(TString level, //continue; //plotter.Draw(prefix + "Counter" + suffix, "m_{ll} (" + sll + ")", 1, 0, "GeV", linY, false, 80, 100); //plotter.Draw(prefix + "MT2_Met" + suffix, "M_{T2}-Met", 1, 0, "GeV", scale, false); + //plotter.Draw(prefix + "MET" + suffix, sm, 1, 0, "GeV", scale, true, 0, 400); + //plotter.Draw(prefix + "mt2ll" + suffix, "M_{T2}(" + sll + ")", 10, 0, "GeV", scale, true, 0, 400); //continue; if (inputdir.Contains("../rootfiles/nominal")) { @@ -489,7 +531,8 @@ void runPlotter(TString level, plotter.Draw(prefix + "dphiLL" + suffix, "#Delta#phi(lep1,lep2)", 10, 0, "NULL", linY); continue; } - //plotter.Draw(prefix + "lep1pt" + suffix, "lep1pt", 1, 0, "GeV", scale, true, 0, 200); + + //plotter.Draw(prefix + "lep1pt" + suffix, "lep1pt", 1, 0, "GeV", scale, true, 0, 200); //plotter.Draw(prefix + "maxjetpt" + suffix, "leading jet pt", 2, 0, "GeV", scale, false, 0, 600); //plotter.Draw(prefix + "dphiminlepmet" + suffix, "#Delta#phi(lep,E_{T}^{miss})", 10, 2, "rad", linY, false); //plotter.Draw(prefix + "dphillMET" + suffix, "#Delta#phi(ll,E_{T}^{miss})", 10, 2, "rad", linY, false); @@ -509,7 +552,6 @@ void runPlotter(TString level, //plotter.Draw(prefix + "htvisible" + suffix, "#sum_{jet,lepton} p_{T}", 20, 0, "GeV", scale, true, 0, 1500); //plotter.Draw(prefix + "htjets" + suffix, "#sum_{jet} p_{T}", 20, 0, "GeV", scale, true, 0, 1500); //plotter.Draw(prefix + "htnojets" + suffix, "p_{T}^{lep1} + p_{T}^{lep2} + MET", 20, 0, "GeV", scale, true, 0, 1500); - //plotter.Draw(prefix + "metPfType1" + suffix, sm, 10, 0, "GeV", scale, true, 0, 400); //plotter.Draw(prefix + "Counter" + suffix, "m_{ll} (" + sll + ")", 1, 0, "GeV", scale, false, 80, 100); //plotter.Draw(prefix + "mt2ll" + suffix, "M_{T2}(" + sll + ")", 10, 0, "GeV", scale, false, 0, 400); //plotter.Draw(prefix + "dphilmet1" + suffix, "#Delta#phi(lep1,E_{T}^{miss})", 10, 2, "rad", scale, false); diff --git a/stop/stop.h b/stop/stop.h index a530084a..19642591 100644 --- a/stop/stop.h +++ b/stop/stop.h @@ -2,7 +2,8 @@ //const TString inputdir = "/gpfs/csic_projects/tier3data/LatinosSkims/RunII/2016/Stop/minitrees/nominal/Stop/"; // where the minitrees are stored //const TString inputdir = "../minitrees/nominal/Stop/"; // where the minitrees are stored -const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/nominal/Stop/"; // where the minitrees are stored. 29Sept2017 +//const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/nominal/Stop/"; // where the minitrees are stored. 29Sept2017 +const TString inputdir = "/eos/cms/store/caf/user/scodella/BTV/MiniTrees/minitrees_36fb/nominal/Stop/"; // where the minitrees are stored. 17Oct2017 (added in a new variable the lepton efficiencies of trigger from orthogonal method) const float thelumi = 35.867; const float ttSF = 1.; const float ettSF = 0.0; @@ -13,7 +14,7 @@ const bool doshape = false; const bool onlyShape = false; - const TCut selection= "leadingPtCSVv2M < 20 && metPfType1 >= 140"; + const TCut selection= "metPfType1 >= 100 && metPfType1 < 140 && njet > 1 && leadingPtCSVv2T >30"; //const TCut selection= "1>0"; //const TCut selection= " run < 276502 && channel == 5 && leadingPtCSVv2M > 20."; //const TCut selection= "channel == 5 && njet < 1"; @@ -22,7 +23,7 @@ const bool onlyShape = false; /*const TCut hard_cut = soft_cut&&"mt2ll>100.&&darkpt>0."; */ -enum{ /* data, +enum{ data, //TT: TT0, TT1, @@ -83,7 +84,7 @@ enum{ /* data, VZ, VVV, HWW, - */ + WW, WZ, nprocess @@ -132,8 +133,8 @@ enum{ nominal, DDfakes, nsystematic }; -enum{ dphilmet1, dphilmet2, dphillmet, mt2ll, njet, - /*lep1pt, lep1eta, lep1phi, lep1mass, +enum{ njet, nbjet30csvv2l, nbjet30csvv2m, nbjet30csvv2t, mt2ll, metPfType1, leadingPtCSVv2T, /* dphilmet1, dphilmet2, dphillmet, mt2ll, njet, + lep1pt, lep1eta, lep1phi, lep1mass, lep2pt, lep2eta, lep2phi, lep2mass, jet1pt, jet1eta, jet1phi, jet1mass, jet2pt, jet2eta, jet2phi, jet2mass, @@ -169,7 +170,7 @@ void Assign(){ //---------- -/* processID[data ] = "01_Data" ; + processID[data ] = "01_Data" ; //processID[TT ] = "04_TTTo2L2Nu" ; processID[TT0 ] = "TTTo2L2Nu__part0"; processID[TT1 ] = "TTTo2L2Nu__part1"; @@ -227,11 +228,11 @@ void Assign(){ processID[TTW ] = "09_TTW" ; processID[WW ] = "06_WW" ; processID[WZ ] = "02_WZTo3LNu" ; - processID[VZ ] = "03_VZ" ; + processID[VZ ] = "15_VZ" ; processID[VVV ] = "13_VVV" ; processID[TTZ ] = "10_TTZ" ; processID[HWW ] = "11_HWW" ; -*/ + processID[WW ] = "06_WW" ; processID[WZ ] = "02_WZTo3LNu" ; @@ -343,15 +344,16 @@ void Assign(){ b_name[htnojets] = "htnojets"; b_name[nbjet30csvv2m] = "nbjet30csvv2m"; -*/ b_name[dphilmet1 ] = "dphilmet1" ; + b_name[dphilmet1 ] = "dphilmet1" ; b_name[dphilmet2 ] = "dphilmet2" ; b_name[dphillmet ] = "dphillmet" ; - b_name[mt2ll ] = "mt2ll" ; +*/ b_name[mt2ll ] = "mt2ll" ; b_name[njet ] = "njet" ; -/* b_name[nbjet30csvv2l] = "nbjet30csvv2l"; + b_name[nbjet30csvv2l] = "nbjet30csvv2l"; b_name[nbjet30csvv2t] = "nbjet30csvv2t"; + b_name[nbjet30csvv2m] = "nbjet30csvv2m"; - b_name[dphijet1met ] = "dphijet1met" ; +/* b_name[dphijet1met ] = "dphijet1met" ; b_name[dphijet2met ] = "dphijet2met" ; b_name[dphijj ] = "dphijj" ; b_name[dphijjmet ] = "dphijjmet" ; diff --git a/test/HistogramReader.C b/test/HistogramReader.C index 53a6dced..07b6401a 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -229,7 +229,7 @@ void HistogramReader::AddSignal(const TString& filename, //------------------------------------------------------------------------------ void HistogramReader::AddSystematic(TString analysis, TString systematic) { - //_mycut = mycut; + // _mycut = mycut; _analysis = analysis; _systematics.push_back(systematic); } @@ -293,9 +293,11 @@ void HistogramReader::Draw(TString hname, else { canvas = new TCanvas(cname, cname, 550, 600); - pad1 = new TPad("pad1", "pad1", 0, 0, 1, 1); - + //canvas = new TCanvas(cname, cname, 550, 720); + //pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + //pad1->SetTopMargin (0.08); + //pad1->SetBottomMargin(0.02); pad1->Draw(); } @@ -600,7 +602,9 @@ void HistogramReader::Draw(TString hname, if (ymin != -999) hfirst->SetMinimum(ymin); if (ymax != -999) hfirst->SetMaximum(ymax); + + //hfirst ->SetMaximum(0.1); // Legend //---------------------------------------------------------------------------- @@ -654,6 +658,9 @@ void HistogramReader::Draw(TString hname, // Standard Model processes legend //---------------------------------------------------------------------------- + + //Int_t nrow = (!_datahist=NULL && _mchist.size() >= 11) ? 5 : 4; + //Int_t nrow = (_mchist.size() > 11) ? 5 : 4; int addRow = 0; if (_prefithist) addRow++; if (_postfithist) addRow++; @@ -687,6 +694,8 @@ void HistogramReader::Draw(TString hname, ny = nrow; nx++; } + //DrawLegend(x0 + nx*(xdelta*1.6), y0 - ny*ydelta, _signalhist[i], _signallabel[i].Data(), "l"); + //DrawLegend(x0 + nx*(xdelta*1.6), y0 - ny*ydelta, _signalhist[i], _signallabel[i].Data(), "l"); DrawLegend(x0 + nx*(xdelta*xScale), y0 - ny*ydelta, _signalhist[i], _signallabel[i].Data(), "l"); ny++; } @@ -834,6 +843,7 @@ void HistogramReader::Draw(TString hname, uncertainty->SetBinContent(ibin, 1.); uncertainty->SetBinError (ibin, uncertaintyError); + if (ratioVal+ratioErr>ymax) ymax = ratioVal+ratioErr; if (ratioVal>0. && ratioVal-ratioErrymax) ymax = 1.+uncertaintyError; @@ -865,8 +875,14 @@ void HistogramReader::Draw(TString hname, } } - ratio->SetTitle("");/* - if (hname.Contains("MET") && hname.Contains("01")) { + ratio->SetTitle(""); + //Apply a simple fit everywhere + //------ + //ratio -> Fit("pol0"); + //ratio->Fit("pol0", "", "", 0., 120.); + //------- + //Apply a simple fit and more +/* if (hname.Contains("MET") && hname.Contains("01")) { float minedge = 0.; if (_inputdir.Contains("Zpeak")) { minedge = 100.; @@ -889,6 +905,7 @@ void HistogramReader::Draw(TString hname, _allmchist->SetName("MC"); _allmchist->Write(); }*/ + //------ ratio->Draw("ep"); //if (hname.Contains("MT2ll_ll") && hname.Contains("SR")) //ratio->Fit("pol0", "", "", 0., 120.); @@ -916,7 +933,92 @@ void HistogramReader::Draw(TString hname, else if (_drawsignificance) { // Barbara's stuff + pad2->cd(); + // Just for three first signal points you use in addSignal function + TH1D* signf0 = (TH1D*)_signalhist[0] ->Clone("S0_sqrt(B)"); + TH1D* signf1 = (TH1D*)_signalhist[1] ->Clone("S1_sqrt(B)"); + TH1D* signf2 = (TH1D*)_signalhist[2] ->Clone("S2_sqrt(B)"); + + for (Int_t ibin=1; ibin<=signf0->GetNbinsX(); ibin++) { + //signals + Float_t SignalValue0 = _signalhist[0]->GetBinContent(ibin); + Float_t SignalError0 = _signalhist[0]->GetBinError (ibin); + + Float_t SignalValue1 = _signalhist[1]->GetBinContent(ibin); + Float_t SignalError1 = _signalhist[1]->GetBinError (ibin); + + Float_t SignalValue2 = _signalhist[2]->GetBinContent(ibin); + Float_t SignalError2 = _signalhist[2]->GetBinError (ibin); + + //all mc + Float_t mcValue = _allmchist->GetBinContent(ibin); + Float_t mcError = _allmchist->GetBinError (ibin); + + //significance S/sqrt(B) + Float_t signfVal0 = 999; + Float_t signfErr0 = 999; + + Float_t signfVal1 = 999; + Float_t signfErr1 = 999; + + Float_t signfVal2 = 999; + Float_t signfErr2 = 999; + + if (mcValue > 0) + { + //double a = 1 + SignalValue0/mcValue; + //signfVal0 = sqrt(2*(SignalValue0 + mcValue)*TMath::Log(a) - 2*SignalValue0); + signfVal0 = SignalValue0 / mcValue; + signfErr0 = signfVal0 * sqrt( (SignalError0*SignalError0)/(SignalValue0*SignalValue0) + (mcError*mcError)/(mcValue*mcValue)); + + //double b = 1 + SignalValue1/mcValue; + //signfVal1 = sqrt(2*(SignalValue1 + mcValue)*TMath::Log(b) - 2*SignalValue1); + signfVal1 = SignalValue1 / mcValue; + signfErr1 = signfVal1 * sqrt( (SignalError1*SignalError1)/(SignalValue1*SignalValue1) + (mcError*mcError)/(mcValue*mcValue)); + + //double c = 1 + SignalValue2/mcValue; + //signfVal2 = sqrt(2*(SignalValue2 + mcValue)*TMath::Log(c) - 2*SignalValue2); + signfVal2 = SignalValue2 / mcValue; + signfErr2 = signfVal2 * sqrt( (SignalError2*SignalError2)/(SignalValue2*SignalValue2) + (mcError*mcError)/(mcValue*mcValue)); + } + + /* std::cout << "bin number : " << ibin << " " << "S/B = " << signfVal0 << " " << "error = " << signfErr0 << std::endl; + std::cout << "bin number : " << ibin << " " << "S/B = " << signfVal1 << " " << "error = " << signfErr1 << std::endl; + std::cout << "bin number : " << ibin << " " << "S/B = " << signfVal2 << " " << "error = " << signfErr2 << std::endl; + */ + signf0 -> SetBinContent(ibin, signfVal0); + if (!signfVal0 == 0) signf0 -> SetBinError (ibin, signfErr0); + + signf1 -> SetBinContent(ibin, signfVal1); + if (!signfVal1 == 0) signf1 -> SetBinError (ibin, signfErr1); + + signf2 -> SetBinContent(ibin, signfVal2); + if (!signfVal2 == 0) signf2 -> SetBinError (ibin, signfErr2); } + //draw significance + signf0->SetTitle(""); + + //draw the bin label + if (hname.Contains("SR_MT2Met")) + { int ibin1 = 0; + for (int i = 0; i<3;i++) + { for (int j =0; j<7; j++) + { int ivalue = 20*(j+1); ibin1 = ibin1+1; TString iValue; iValue += ivalue; signf0 -> GetXaxis()->SetBinLabel(ibin1, " " + iValue); + } + } + } + + signf0->Draw("ep"); + + signf0->GetXaxis()->SetRangeUser(xmin, xmax); + signf0->GetYaxis()->SetRangeUser(0.0, 1.2); +// signf0->GetYaxis()->SetRangeUser(-0.001, 0.055); + + signf1->Draw("ep,same"); + signf2->Draw("ep,same"); + + SetAxis(signf0, xtitle, "S / B", 1.4, 0.75); + } //---------------------------------------------------------------------------- @@ -2084,9 +2186,10 @@ void FormatTableYields(float *YY, float *EY) { } + void HistogramReader::IncludeSystematics(TString hname) { - bool _verbose = false, _dotable = true, _dotablebkg = false, _dotablesyst = true; + bool _verbose = false, _dotable = true, _dotablebkg = false, _dotablesyst = true, _mergeNbins = false, _doPaperTable = false; float StatZero = 1.84102; @@ -2100,10 +2203,12 @@ void HistogramReader::IncludeSystematics(TString hname) float errBackTab_do [nprocess][nbins+1]; float errBackTab_up [nprocess][nbins+1]; float errBackSystTab_do [nprocess][nsystematics][nbins+1]; - float errBackSystTab_up [nprocess][nsystematics][nbins+1]; + float errBackSystTab_up [nprocess][nsystematics][nbins+1]; + float _err2StatMerged[nprocess]; //merging the statistical error of n MT2ll bins bool FirstSystematic[nprocess]; bool _isPostfit = false; for (int k=0; k GetBinContent(ibin+1)>0.005)) ApplyZeroStat = true; } if (ApplyZeroStat && dummy0->GetEntries()>0.) - StatUncert2 = TMath::Power(StatZero*dummy0->Integral()/dummy0->GetEntries(), 2); + StatUncert2 = TMath::Power(StatZero*dummy0->Integral()/dummy0->GetEntries(), 2); } - errBackTab_up[kproce][ibin] += StatUncert2; - errBackTab_do[kproce][ibin] += StatUncert2; - errBackSystTab_up[kproce][isyst][ibin] = sqrt(StatUncert2); - errBackSystTab_do[kproce][isyst][ibin] = sqrt(StatUncert2); - errSystUp [isyst][ibin] += StatUncert2; - errSystDo [isyst][ibin] += StatUncert2; + if (_mergeNbins && ibin<=4) + {//merging the statistical error of 4 MT2ll first bins + _err2StatMerged[kproce]+= StatUncert2; + //................................................... + }else { + errBackTab_up[kproce][ibin] += StatUncert2; + errBackTab_do[kproce][ibin] += StatUncert2; + errBackSystTab_up[kproce][isyst][ibin] = sqrt(StatUncert2); + errBackSystTab_do[kproce][isyst][ibin] = sqrt(StatUncert2); + errSystUp [isyst][ibin] += StatUncert2; + errSystDo [isyst][ibin] += StatUncert2; + } } + if (_systematics.at(isyst)=="Postfit") _isPostfit = true; myfile0->Close(); continue; @@ -2507,7 +2622,7 @@ void HistogramReader::IncludeSystematics(TString hname) } else { for (int ibin = 1; ibin<=nbins; ibin++) { float StatUncert2 = TMath::Power((dummy0->GetBinError(ibin)+dummy3->GetBinError(ibin))/2., 2); - if (StatUncert2<0.0001 && dummy0->GetEntries()>0.) StatUncert2 = TMath::Power(StatZero*(dummy0->Integral()+dummy3->Integral())/(dummy0->GetEntries()+dummy3->GetEntries()), 2); + if (StatUncert2<0.0001 && dummy0->GetEntries()>0) StatUncert2 = TMath::Power(StatZero*(dummy0->Integral()+dummy3->Integral())/(dummy0->GetEntries()+dummy3->GetEntries()), 2); errSignUp [kproce][ibin] += StatUncert2; errSignDo [kproce][ibin] += StatUncert2; tabSignUp [kproce][isyst][ibin] += sqrt(StatUncert2); @@ -2649,7 +2764,7 @@ void HistogramReader::IncludeSystematics(TString hname) exl [ibin] = (_allmchist -> GetXaxis() -> GetBinWidth(ibin))/2; exh [ibin] = exl[ibin]; - if (_verbose) { + if (_verbose) { //Print Stat and flat errors per bin printf( "bin number = %i\n", ibin ); printf( " \n"); @@ -2666,6 +2781,9 @@ void HistogramReader::IncludeSystematics(TString hname) printf( "--------------------------------------------------------\n" ); } + printf( "Percentage errStat = %f\n", (errStat [ibin]/y[ibin])*100); + printf( "errStat = %f\n", errStat [ibin] ); + float systUp2 = 0; float systDo2 = 0; float systSym2 = 0; @@ -2820,14 +2938,14 @@ void HistogramReader::IncludeSystematics(TString hname) //float norDY = (intData - (intSM - intDY))/intDY; TString TableFlag = hname; TableFlag.ReplaceAll("Stop/", "_"); TableFlag.ReplaceAll("/h", ""); - std::ofstream inFile("./Tables/Yields" + TableFlag + ".tex",std::ios::out); + std::ofstream inFile("Tables/Yields" + TableFlag + ".tex",std::ios::out); // Process | nbins = 7; //inFile << "\\begin{table}[htb]" << endl; inFile << "\\tiny" << endl; inFile << "\\begin{center}" << endl; - inFile << "\\begin{tabular}{|l|ccccccc|}" << endl; + inFile << "\\begin{tabular}{l|ccccccc}" << endl; inFile << "\\hline" << endl; //Yield & stat_error & systematic_error & total_error" << endl; inFile << "\\hline" << endl; @@ -2838,8 +2956,9 @@ void HistogramReader::IncludeSystematics(TString hname) inFile << "$\\ge$ " << (nbins-1)*20 << "~\\GeV \\\\" << endl; inFile << "\\hline" << endl; - for (int kproce=0; kproce=0; kproce--) { + + //for (int kproce=0; kproce=0; kproce--) { TString ThisLabel = _mclabel[kproce].Data(); ThisLabel.ReplaceAll("#", "\\"); if (ThisLabel=="ZZ (#rightarrow 2l2#nu)") ThisLabel = "ZZ ($\\rightarrow 2\\ell 2\\nu$)"; @@ -2847,18 +2966,20 @@ void HistogramReader::IncludeSystematics(TString hname) if (ThisLabel=="WZ (#rightarrow 3l)") ThisLabel = "WZ ($\\rightarrow 3\\ell$)"; if (ThisLabel=="t#bar{t}") ThisLabel = "\\ttbar"; inFile << "$" << ThisLabel << "$"; - //inFile << " & " << ThisLabel; - //inFile << _mclabel[kproce].Data(); + ////inFile << " & " << ThisLabel; + ////inFile << _mclabel[kproce].Data(); for (int ibin=1; ibin<=nbins; ibin++) { float ThisYield = yieldTab[kproce][ibin]; float ThisError = (sqrt(errBackTab_up[kproce][ibin])+sqrt(errBackTab_do[kproce][ibin]))/2.; FormatTableYields(&ThisYield, &ThisError); - inFile << " & $" << ThisYield << " \\pm " << ThisError << "$"; + if (ThisYield == 0 && ThisError <= 0.01) { inFile << " & $ \\leq 0.01 $";} + else if (ThisYield - ThisError <= 0) {inFile << " & $" << ThisYield << " ^{+ " << ThisError << "}_{-" << ThisYield << "}$";} + else {inFile << " & $" << ThisYield << " \\pm " << ThisError << "$";} } inFile << " \\\\" << endl; } inFile << "\\hline" << endl; - inFile << "SM Processes "; + inFile << "SM Processes "; for (int ibin=1; ibin<=nbins; ibin++) { float ThisYield = y[ibin]; float ThisError = _ErrorGr->GetErrorY(ibin); @@ -2869,6 +2990,7 @@ void HistogramReader::IncludeSystematics(TString hname) if (_postfitSMhist) { TString addLeg = (hname.Contains("fit_s_")) ? " (only-b) " : "(Fit b+s) "; + inFile << "\\hline" << endl; inFile << "SM Processes " << addLeg; for (int ibin=1; ibin<=nbins; ibin++) { float ThisYield = _postfitSMhist->GetBinContent(ibin); @@ -2878,7 +3000,7 @@ void HistogramReader::IncludeSystematics(TString hname) } inFile << " \\\\" << endl; } - inFile << " \\hline" << endl; + //inFile << " \\hline" << endl; if (_datahist) { inFile << " Data "; @@ -2911,6 +3033,76 @@ void HistogramReader::IncludeSystematics(TString hname) inFile << "\\end{center}" << endl; //inFile << "\\end{table}" << endl; + //Write table after merging the 4 first bins + //............................................... + if (_mergeNbins) + { + std::ofstream inFile("Tables/Yields" + TableFlag + "_Merged.tex",std::ios::out); + // Per process + for (int kproce=nprocess-1; kproce>=0; kproce--) { + + TString ThisLabel = _mclabel[kproce].Data(); + if (ThisLabel=="ZZ (#rightarrow 2l2#nu)") ThisLabel = "ZZ ($\\rightarrow 2\\ell 2\\nu$)"; + if (ThisLabel=="t#bar{t}Z") ThisLabel = "\\ttZ"; + if (ThisLabel=="WZ (#rightarrow 3l)") ThisLabel = "WZ ($\\rightarrow 3\\ell$)"; + if (ThisLabel=="t#bar{t}") ThisLabel = "\\ttbar"; + inFile << " & " << ThisLabel; + float thisMergedYield = 0; + float thisMergedError = 0, thisMergedError_up = _err2StatMerged[kproce], thisMergedError_do = _err2StatMerged[kproce]; + for (int ibin=1; ibin<=4; ibin++) + { + thisMergedYield += yieldTab[kproce][ibin]; + thisMergedError_up += errBackTab_up[kproce][ibin]; + thisMergedError_do += errBackTab_do[kproce][ibin]; + } + thisMergedError = (sqrt(thisMergedError_up) + sqrt(thisMergedError_do))/2.; + FormatTableYields(&thisMergedYield, &thisMergedError); + inFile << " & $" << thisMergedYield << " \\pm " << thisMergedError << "$"; + for (int ibin=5; ibin<=nbins; ibin++) + { + float ThisYield = yieldTab[kproce][ibin]; + float ThisError = (sqrt(errBackTab_up[kproce][ibin])+sqrt(errBackTab_do[kproce][ibin]))/2.; + FormatTableYields(&ThisYield, &ThisError); + inFile << " & $" << ThisYield << " \\pm " << ThisError << "$"; + } + inFile << " \\\\" << endl; + } + // Per total SM + inFile << " & SM Processes "; + float mergedSM = 0 ; float errMergedSM =0; + for (int ibin=1; ibin<=4; ibin++) + { + mergedSM += y[ibin]; + errMergedSM += _ErrorGr->GetErrorY(ibin); // This error does not take a account the correlation of the bin uncertainties + } + FormatTableYields(&mergedSM, &errMergedSM); + inFile << " & $" << mergedSM << " \\pm " << errMergedSM << "$"; + for (int ibin=5; ibin<=nbins; ibin++) + { + float thisSMyield = y[ibin]; float thisSMerr = _ErrorGr->GetErrorY(ibin); + FormatTableYields(&thisSMyield, &thisSMerr); + inFile << " & $" << thisSMyield << " \\pm " << thisSMerr << "$"; + } + inFile << " \\\\" << endl; + // For Data + if (_datahist) { + inFile << " & Data "; + float thisMergedData = 0; + for (int ibin=1; ibin<=4; ibin++) + { + thisMergedData += _datahist->GetBinContent(ibin); + } + + inFile << " & $" << thisMergedData << "$"; + for (int ibin=5; ibin<=nbins; ibin++) + { + inFile << " & $" << _datahist->GetBinContent(ibin) << "$"; + } + } + inFile << " \\\\" << endl; + inFile << " \\hline" << endl; + } + //................................................. inFile.close(); } @@ -2944,7 +3136,7 @@ void HistogramReader::IncludeSystematics(TString hname) if (_analysis == "Stop" && _systematics.at(isyst) == "PDF" && _mcfilename.at(kproce)=="05_ST") continue; if (_analysis == "Stop" && _systematics.at(isyst) == "Q2" && _mcfilename.at(kproce)=="05_ST") continue; if (_analysis == "Stop" && (_systematics.at(isyst)=="BtagFS" || _systematics.at(isyst)=="Fastsim" || - _systematics.at(isyst)=="Pileup" || _systematics.at(isyst)=="Metfastsim" || + _systematics.at(isyst)=="Pileup_signal" || _systematics.at(isyst)=="Metfastsim" || _systematics.at(isyst)=="Isrnjet")) continue; if (_systematics.at(isyst).Contains("MT2ll") && !hname.Contains("h_MT2ll")) continue; if (_systematics.at(isyst)=="MT2llTop" && _mcfilename.at(kproce)!="04_TTTo2L2Nu" && _mcfilename.at(kproce)!="05_ST") continue; @@ -2996,4 +3188,138 @@ void HistogramReader::IncludeSystematics(TString hname) } + // ------------------------------- + // Do reduced tables for the Paper + // ------------------------------- + // This table is filled with the integrated yield and its uncertainty for bins + // from 0 to 80 GeV of MT2ll in the Low MT2 region (lowYield) and for bins from + // 80 to >120 GeV of MT2ll in the High MT2ll region. It is done for each process. + // ------------------------------ + if ( _doPaperTable && hname.Contains("h_MT2ll")) { + gSystem->mkdir("Tables/", kTRUE); + TString TableFlag = hname; TableFlag.ReplaceAll("Stop/", "_"); TableFlag.ReplaceAll("/h", ""); + std::ofstream inFile("Tables/Yields_Paper_" + TableFlag + ".tex",std::ios::out); + //first try of getting the region flag + Ssiz_t from = 0; + TString region = TableFlag.ReplaceAll("_02_",""); + TString tok; + TString region2 = region.Tokenize(tok, from, "_MT2ll") ? tok : "NONE"; + region.ReplaceAll(region2, ""); // region flag should be modified to make it work in the latex table. + // Create the table + inFile << "\\begin{center}" << endl; + inFile << "\\begin{tabular}{|l|l|l|}" << endl; + inFile << "\\hline" << endl; + inFile << "& \\multicolumn{2}{c|}{ $" << region << "$} \\\\" << endl; + inFile << "\\cline{2-3}"; + inFile << "& Low mt2ll & High mt2ll \\\\" << endl; + //inFile << "& Low \mt2ll & High \mt2ll \\" << endl; + inFile << "\\hline \\hline" << endl; + + + // ~~~~~~~~~~~~ + // Fill the data + // ~~~~~~~~~~~~ + inFile << " Data "; + // if (_datahist) + //inFile << " & $" << _datahist->GetBinContent(ibin) << "$"; + // else + // write in the table + inFile << " & blind & blind \\\\"<< endl;; + inFile << " \\hline\\hline" << endl; + + //inFile << "\\end{table}" << endl; + // + + // ~~~~~~~~~~~~ + // Fill the background + // ~~~~~~~~~~~~ + for (int kproce=0; kproceGetErrorY(ibin), 2); + } + lowMC_Uncert = sqrt(lowMC_Uncert2); + FormatTableYields(&lowMC, &lowMC_Uncert); + for (int ibin=5; ibin<=7; ibin++) { + highMC += y[ibin]; + highMC_Uncert2 += TMath::Power(_ErrorGr->GetErrorY(ibin),2); + } + highMC_Uncert = sqrt(highMC_Uncert2); + FormatTableYields(&highMC, &highMC_Uncert); + // write in the table + inFile << "SM Processes"; + inFile << " & " << lowMC << "$\\pm$" << lowMC_Uncert << " & "<< highMC << "$\\pm$" << highMC_Uncert << "\\\\"<< endl; + inFile << "\\hline \\hline " <GetBinContent(ibin) << "$"; + else + inFile << " & $" << "blind" << "$"; + inFile << " \\\\" << endl; + inFile << " \\hline" << endl; + */ + //inFile << "\\end{table}" << endl; + + } }