From cd4ee819cd47f313d2be9a521e63f8dc5640c19d Mon Sep 17 00:00:00 2001 From: Barbara Date: Mon, 2 Oct 2017 16:39:15 +0200 Subject: [PATCH 01/28] forzed commit --- include/AnalysisBase.h | 6 +-- include/AnalysisCMS.h | 7 ++++ make | 2 +- .../lxplus/samples_ttbar_Ghent_Summer16.txt | 36 ++++++++--------- src/AnalysisCMS.C | 40 ++++++++++++++----- 5 files changed, 60 insertions(+), 31 deletions(-) diff --git a/include/AnalysisBase.h b/include/AnalysisBase.h index 1c863415..6ab80d67 100644 --- a/include/AnalysisBase.h +++ b/include/AnalysisBase.h @@ -739,7 +739,7 @@ public : TBranch *b_std_vector_leptonGen_phi; //! TBranch *b_std_vector_leptonGen_pid; //! TBranch *b_std_vector_leptonGen_pt; //! - // TBranch *b_std_vector_leptonGen_status; //! + TBranch *b_std_vector_leptonGen_status; //! TBranch *b_std_vector_leptonGen_MotherPID; //! TBranch *b_std_vector_DarkMatterGen_pt; //! TBranch *b_std_vector_neutrinoGen_eta; //! @@ -1120,7 +1120,7 @@ void AnalysisBase::Init(TTree *tree) std_vector_leptonGen_phi = 0; std_vector_leptonGen_pid = 0; std_vector_leptonGen_pt = 0; - // std_vector_leptonGen_status = 0; + std_vector_leptonGen_status = 0; std_vector_leptonGen_MotherPID = 0; std_vector_DarkMatterGen_pt = 0; std_vector_neutrinoGen_eta = 0; @@ -1480,7 +1480,7 @@ void AnalysisBase::Init(TTree *tree) fChain->SetBranchAddress("std_vector_leptonGen_phi", &std_vector_leptonGen_phi, &b_std_vector_leptonGen_phi); fChain->SetBranchAddress("std_vector_leptonGen_pid", &std_vector_leptonGen_pid, &b_std_vector_leptonGen_pid); fChain->SetBranchAddress("std_vector_leptonGen_pt", &std_vector_leptonGen_pt, &b_std_vector_leptonGen_pt); - // fChain->SetBranchAddress("std_vector_leptonGen_status", &std_vector_leptonGen_status, &b_std_vector_leptonGen_status); + fChain->SetBranchAddress("std_vector_leptonGen_status", &std_vector_leptonGen_status, &b_std_vector_leptonGen_status); fChain->SetBranchAddress("std_vector_leptonGen_MotherPID", &std_vector_leptonGen_MotherPID, &b_std_vector_leptonGen_MotherPID); fChain->SetBranchAddress("std_vector_DarkMatterGen_pt", &std_vector_DarkMatterGen_pt, &b_std_vector_DarkMatterGen_pt); fChain->SetBranchAddress("std_vector_neutrinoGen_eta", &std_vector_neutrinoGen_eta, &b_std_vector_neutrinoGen_eta); diff --git a/include/AnalysisCMS.h b/include/AnalysisCMS.h index f10ebbbc..9b39aa1d 100644 --- a/include/AnalysisCMS.h +++ b/include/AnalysisCMS.h @@ -185,6 +185,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; @@ -409,6 +414,8 @@ class AnalysisCMS : public AnalysisBase float _tjet2csvv2ivf; float _tjet2assignment; + + float _MR; float _R2; float _Rpt; diff --git a/make b/make index 208cbafd..95bd8f0e 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 runAnalysisMiniTrees runAnalysisMiniTrees.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/samples/80x/stopSel/lxplus/samples_ttbar_Ghent_Summer16.txt b/samples/80x/stopSel/lxplus/samples_ttbar_Ghent_Summer16.txt index 58de3f48..791f35dc 100644 --- a/samples/80x/stopSel/lxplus/samples_ttbar_Ghent_Summer16.txt +++ b/samples/80x/stopSel/lxplus/samples_ttbar_Ghent_Summer16.txt @@ -1,19 +1,19 @@ root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part0.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part1.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part10.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part11.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part12.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part13.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part14.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part15.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part16.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part17.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part18.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part2.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part3.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part4.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part5.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part6.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part7.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part8.root -root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part9.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part1.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part10.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part11.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part12.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part13.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part14.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part15.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part16.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part17.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part18.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part2.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part3.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part4.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part5.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part6.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part7.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part8.root +#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part9.root diff --git a/src/AnalysisCMS.C b/src/AnalysisCMS.C index 0a2eaa46..e8d5bce5 100644 --- a/src/AnalysisCMS.C +++ b/src/AnalysisCMS.C @@ -1836,6 +1836,8 @@ void AnalysisCMS::OpenMinitree() //---------------------------------------------------------------------------- minitree = new TTree("latino", "minitree"); + + // B minitree->Branch("bjet1csvv2ivf", &_bjet1csvv2ivf, "bjet1csvv2ivf/F"); minitree->Branch("bjet1eta", &_bjet1eta, "bjet1eta/F"); @@ -2054,6 +2056,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); @@ -2494,6 +2500,10 @@ void AnalysisCMS::GetStopVar() } } + // Matching gen and reco leptons from W + // -------------------------------------- + // fakes estimate + for (int ml = 0; ml<2; ml++) { double MinimumDeltaR = 1.; @@ -2502,11 +2512,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; @@ -2518,27 +2528,28 @@ void AnalysisCMS::GetStopVar() LeptonMass); double DeltaRGenLepLep1 = (Lepton1.v).DeltaR(ChargedLepton); - - 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); - if (DeltaRGenLepLep2at(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; @@ -3075,17 +3086,23 @@ void AnalysisCMS::GetScaleAndResolution() int AnalysisCMS::GetMotherPID(int index) { + // _lep1GenDeltaR.clear(); + // _lep2GenDeltaR.clear(); + // _testMotherID.clear(); + int motherPID = -9999; if (!_ismc || index > 1) return motherPID; TLorentzVector lepton_tlorentz = (index == 0) ? Lepton1.v : Lepton2.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; @@ -3104,6 +3121,11 @@ int AnalysisCMS::GetMotherPID(int index) std_vector_leptonGen_phi->at(j), std_vector_leptonGen_mass); + //if (index == 0) _lep1GenDeltaR.push_back(lepton_tlorentz.DeltaR(leptonGen_tlorentz)); + //if (index == 1) _lep2GenDeltaR.push_back(lepton_tlorentz.DeltaR(leptonGen_tlorentz)); + //_testMotherID.push_back(std_vector_leptonGen_MotherPID->at(j)); + + // Get the GEN lepton index //-------------------------------------------------------------------------- if (lepton_tlorentz.DeltaR(leptonGen_tlorentz) < deltaRMin) { From 91be777705591bac5b6386cf8883da32002f8c32 Mon Sep 17 00:00:00 2001 From: Barbara Date: Fri, 20 Oct 2017 15:01:00 +0200 Subject: [PATCH 02/28] update 20 Octubre 17 --- include/Constants.h | 1 + make | 4 +- src/AnalysisStop.C | 27 +++++-- stop/CreateHistogramsStop.C | 16 +++-- stop/FakeStudies.C | 130 ++++++++++++++++++++++++--------- stop/runPlotter.C | 140 ++++++++++++++++++++---------------- stop/stop.h | 28 ++++---- test/HistogramReader.C | 10 +-- 8 files changed, 230 insertions(+), 126 deletions(-) diff --git a/include/Constants.h b/include/Constants.h index c2e997a0..e4facbce 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 95bd8f0e..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 runAnalysisMiniTrees runAnalysisMiniTrees.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/src/AnalysisStop.C b/src/AnalysisStop.C index 65e56590..180cfead 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -460,7 +460,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 >= 20. && _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); @@ -829,8 +829,9 @@ void AnalysisStop::GetAnalysisVariables() // Fake _nLeptonsMatched = 0; - if (fabs(lep1mid)==24 || fabs(lep1mid)==23 || fabs(lep1mid)==15) _nLeptonsMatched++; - if (fabs(lep2mid)==24 || fabs(lep2mid)==23 || fabs(lep2mid)==15) _nLeptonsMatched++; + if (fabs(_lep1mid)==24 || fabs(_lep1mid)==23 || fabs(_lep1mid)==15) _nLeptonsMatched++; + if (fabs(_lep2mid)==24 || fabs(_lep2mid)==23 || fabs(_lep2mid)==15) _nLeptonsMatched++; + if (fabs(_lep1mid)== fabs(_lep2mid) && (fabs(_lep1mid)==21 || fabs(_lep1mid)<= 6)) _nLeptonsMatched = 2; //if (fabs(_lep1isfake)<0.1) _nLeptonsMatched++; //if (fabs(_lep2isfake)<0.1) _nLeptonsMatched++; @@ -931,10 +932,10 @@ void AnalysisStop::FillAnalysisHistograms(int ichannel, if (_systematic.Contains("Zpeak")) return; if (_nLeptonsMatched==2) { - h_MT2ll_truth [ichannel][icut][ijet]->Fill(_MT2llfake, _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(_MT2llfake, _event_weight); + h_MT2ll_fake [ichannel][icut][ijet]->Fill(_MT2ll, _event_weight); h_MET_fake [ichannel][icut][ijet]->Fill(MET.Et(), _event_weight); } @@ -25266,6 +25267,7 @@ bool AnalysisStop::ShapeWZtoWW() return false; } else { + // Variables re-computation TVector3 NewMET; NewMET.SetXYZ(MET.Px() + AnalysisLeptons[Lostlep].v.Px(), MET.Py() + AnalysisLeptons[Lostlep].v.Py(), MET.Pz()); @@ -25290,7 +25292,20 @@ bool AnalysisStop::ShapeWZtoWW() _mt2ll = ComputeMT2(Lepton1.v, Lepton2.v, MET); _MT2ll = (_mt2ll<140.) ? _mt2ll : 139.; - + + _lep1pt = Lepton1.v.Pt(); + _lep2pt = Lepton2.v.Pt(); + + _lep1phi = Lepton1.v.Phi(); + _lep2phi = Lepton2.v.Phi(); + + _metPfType1Phi = MET.Phi(); + + _dphill = fabs(Lepton1.DeltaPhi(Lepton2)); + 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)); + } return true; diff --git a/stop/CreateHistogramsStop.C b/stop/CreateHistogramsStop.C index 21e9d3d9..91a2531e 100644 --- a/stop/CreateHistogramsStop.C +++ b/stop/CreateHistogramsStop.C @@ -9,7 +9,7 @@ #include "stop.h" -const TString outputdir = "histo_Minitree_JetCheck"; +const TString outputdir = "histo_Minitree_TheCut"; void CreateHistograms2( int process ); @@ -117,7 +117,7 @@ void CreateHistograms2( int process ){ } - mytree -> 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..71601331 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_VR1"}; + 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/runPlotter.C b/stop/runPlotter.C index ea0426b6..3b539f7e 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -4,16 +4,19 @@ //------------------------------------------------------------------------------ const Bool_t datadriven = false; const Bool_t allplots = false; -const Bool_t dosystematics = true; +const Bool_t dosystematics = false; const Bool_t postfitplots = false; -const TString inputdir = "../minitrees/rootfiles3R/nominal/"; +const TString inputdir = "WZtoWW_WW/"; +//const TString inputdir = "../minitrees/rootfiles/nominal/"; +//const TString inputdir = "../minitrees/rootfiles3R/nominal/"; //const TString inputdir = "../minitrees/rootfiles/ZpeakDYcorrections/"; //const TString inputdir = "../minitrees/rootfiles/WZtoWWveto/"; //const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsTestAddBkg/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfitasimov/"; -const TString outputdir = "figures/"; +const TString outputdir = "figures_WZtoWW/"; -const TString signal = "TChi"; +const TString signal = ""; +//const TString signal = "TChi"; const TString sl = "#font[12]{l}"; const TString sll = "#font[12]{ll}"; @@ -43,7 +46,7 @@ enum {linY, logY}; // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void runPlotter(TString level, - TString option = "hist") + TString option = "nostack") { gInterpreter->ExecuteMacro("../test/PaperStyle.C"); @@ -104,21 +107,27 @@ void runPlotter(TString level, // Add processes //---------------------------------------------------------------------------- //plotter.AddProcess("14_HZ", "HZ", color_HZ); - plotter.AddProcess("13_VVV", "VVV", color_VVV); - if (inputdir.Contains("/ZZ") || inputdir.Contains("/WZ")) + /* if (inputdir.Contains("/ZZ") || inputdir.Contains("/WZ")) plotter.AddProcess("14_ZZTo4L", "ZZ (#rightarrow 4l)", 49, roc_background, 1.256/1.212); - plotter.AddProcess("03_VZ", "VZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); + //plotter.AddProcess("03_VZ", "VZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); + plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_ZZ, roc_background); + //plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_ZZ, roc_background, SF_ZMet); //plotter.AddProcess("11_Wg", "W#gamma", color_Wg); //plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); - plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); - plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); - plotter.AddProcess("11_HWW", "HWW", color_HWW); - plotter.AddProcess("02_WZTo3LNu", "WZ (#rightarrow 3l)", color_WZTo3LNu, roc_background); - plotter.AddProcess("06_WW", "WW", color_WW); - plotter.AddProcess("05_ST", "tW", color_ST); - plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background, SF_DY); + //plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background, SF_DY); + plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets, roc_background); + plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); + plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_ZZ, roc_background, SF_ZMet); + plotter.AddProcess("05_ST", "tW", color_ST); + plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); + plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); + plotter.AddProcess("11_HWW", "HWW", color_HWW); + plotter.AddProcess("13_VVV", "VVV", color_VVV); + */plotter.AddProcess("02_WZTo3LNu", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); + plotter.AddProcess("06_WW", "WW", color_WW); + if (inputdir.Contains("SS")) plotter.AddProcess("TTToSemiLepton", "t#bar{t} Semilep.", 41); - plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); +// plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); //else plotter.AddProcess("TTJets", "#bar{t}t", color_TTTo2L2Nu); //if (inputdir.Contains("SS")) plotter.AddProcess("WJetsToLNu", "WJets", color_WJets); @@ -193,36 +202,36 @@ 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", "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"); - plotter.AddSystematic("Stop", "ttZSF"); - plotter.AddSystematic("Stop", "ZZSF"); - //plotter.AddSystematic("Stop", "DYSF"); - plotter.AddSystematic("Stop", "DYshape"); - plotter.AddSystematic("Stop", "DYnojet"); - plotter.AddSystematic("Stop", "normWZ"); - ////plotter.AddSystematic("Stop", "normWW"); - //plotter.AddSystematic("Stop", "normTtbar"); - //plotter.AddSystematic("Stop", "normTW"); - //plotter.AddSystematic("Stop", "normTTW"); - //plotter.AddSystematic("Stop", "normHWW"); - //plotter.AddSystematic("Stop", "normVVV"); + //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", "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"); + //plotter.AddSystematic("Stop", "ttZSF"); + //plotter.AddSystematic("Stop", "ZZSF"); + ////plotter.AddSystematic("Stop", "DYSF"); + //plotter.AddSystematic("Stop", "DYshape"); + //plotter.AddSystematic("Stop", "DYnojet"); + //plotter.AddSystematic("Stop", "normWZ"); + //////plotter.AddSystematic("Stop", "normWW"); + ////plotter.AddSystematic("Stop", "normTtbar"); + ////plotter.AddSystematic("Stop", "normTW"); + ////plotter.AddSystematic("Stop", "normTTW"); + ////plotter.AddSystematic("Stop", "normHWW"); + ////plotter.AddSystematic("Stop", "normVVV"); } } @@ -287,17 +296,32 @@ void runPlotter(TString level, 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 + "MT2ll" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); - if (level.Contains("_SR3") && signal=="T2tt") plotter.Draw(prefix + "MT2llisr" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); + //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" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", linY, 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 + "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 + "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 + "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 + "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", linY); + + if (level.Contains("_SR3") && signal=="T2tt") plotter.Draw(prefix + "MT2llisr" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); if (dosystematics) continue; - //plotter.Draw(prefix + "Counter" + suffix, "m_{ll} (" + sll + ")", 1, 0, "GeV", linY, false, 80, 100); + + //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, 2, 0, "GeV", scale, false, 0, 400); //continue; - if (inputdir.Contains("ZZ")) { + + if (inputdir.Contains("ZZ")) { plotter.Draw(prefix + "M1ll" + suffix, "m_{ll}", 1, 0, "GeV", linY, false, 60, 120); plotter.Draw(prefix + "M2ll" + suffix, "m_{ll}", 1, 0, "GeV", linY, false, 60, 120); } else if (inputdir.Contains("Zpeak")) { @@ -310,17 +334,14 @@ void runPlotter(TString level, plotter.Draw(prefix + "njet20dphilmet" + suffix, "number of 20 GeV jets", -1, 0, "NULL", scale); plotter.Draw(prefix + "njet20dphilmet" + suffix, "number of 20 GeV jets", -1, 0, "NULL", linY); } - 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 + "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 + "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); - plotter.Draw(prefix + "njet20" + suffix, "number of jets", -1, 0, "NULL", scale, true, 0, 10); + //plotter.Draw(prefix + "njet20" + suffix, "number of jets", -1, 0, "NULL", scale, true, 0, 10); //plotter.Draw(prefix + "njet30" + suffix, "number of 30 GeV jets", -1, 0, "NULL", scale); - plotter.Draw(prefix + "njet20" + suffix, "number of jets", -1, 0, "NULL", linY, true, 0, 10); +// plotter.Draw(prefix + "njet20" + suffix, "number of jets", -1, 0, "NULL", linY, true, 0, 10); //plotter.Draw(prefix + "njet30" + suffix, "number of 30 GeV jets", -1, 0, "NULL", linY); if (inputdir.Contains("../rootfiles/nominal")) { //plotter.Draw(prefix + "jet1pt" + suffix, "jep1pt", 10, 0, "GeV", scale, true, 0, 200); @@ -336,7 +357,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 dad157e2..23ea5cb1 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -1888,7 +1888,7 @@ void HistogramReader::IncludeSystematics(TString hname) if (fabs(dummy0->GetBinContent(ibin+1)>0.005)) ApplyZeroStat = true; } if (ApplyZeroStat) - StatUncert2 = TMath::Power(StatZero*dummy0->Integral()/dummy0->GetEntries(), 2); + if (dummy0->GetEntries()>0)StatUncert2 = TMath::Power(StatZero*dummy0->Integral()/dummy0->GetEntries(), 2); } errBackTab_up[kproce][ibin] += StatUncert2; errBackTab_do[kproce][ibin] += StatUncert2; @@ -2133,14 +2133,14 @@ void HistogramReader::IncludeSystematics(TString hname) if (!_doMetFastSim) { for (int ibin = 1; ibin<=nbins; ibin++) { float StatUncert2 = dummy0->GetSumw2()->At(ibin); - if (StatUncert2<0.0001) StatUncert2 = TMath::Power(StatZero*dummy0->Integral()/dummy0->GetEntries(), 2); + if (StatUncert2<0.0001 && dummy0->GetEntries()>0) StatUncert2 = TMath::Power(StatZero*dummy0->Integral()/dummy0->GetEntries(), 2); errSignUp [kproce][ibin] += StatUncert2; errSignDo [kproce][ibin] += StatUncert2; } } else { for (int ibin = 1; ibin<=nbins; ibin++) { float StatUncert2 = TMath::Power((dummy0->GetBinError(ibin)+dummy3->GetBinError(ibin))/2., 2); - if (StatUncert2<0.0001) 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; } @@ -2389,9 +2389,9 @@ void HistogramReader::IncludeSystematics(TString hname) } if (_dotable && hname.Contains("h_MT2ll")) { - + gSystem->mkdir("Tables/", kTRUE); 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; From 1c463a4dce29a7b25989fc1a9304476f72ec8c13 Mon Sep 17 00:00:00 2001 From: Barbara Date: Fri, 20 Oct 2017 19:37:54 +0200 Subject: [PATCH 03/28] 20 Oct 17 v2 --- include/AnalysisStop.h | 7 +++++++ src/AnalysisStop.C | 23 +++++++++++++++++++---- stop/runPlotter.C | 21 ++++++++++++--------- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/include/AnalysisStop.h b/include/AnalysisStop.h index 653fe8ff..d28160ab 100644 --- a/include/AnalysisStop.h +++ b/include/AnalysisStop.h @@ -100,6 +100,13 @@ class AnalysisStop : public AnalysisCMS TH1D* h_dphiLLbin5 [nchannel][ncut][njetbin+1]; TH1D* h_M1ll [nchannel][ncut][njetbin+1]; TH1D* h_M2ll [nchannel][ncut][njetbin+1]; + TH1D* h_Lep1Pt [nchannel][ncut][njetbin+1]; + TH1D* h_Lep2Pt [nchannel][ncut][njetbin+1]; + TH1D* h_Lep1Phi [nchannel][ncut][njetbin+1]; + TH1D* h_Lep2Phi [nchannel][ncut][njetbin+1]; + TH1D* h_dphil1MET [nchannel][ncut][njetbin+1]; + TH1D* h_dphil2MET [nchannel][ncut][njetbin+1]; + TH1D* h_METphi [nchannel][ncut][njetbin+1]; int _SaveHistograms, _DoTheoreticalVariations; diff --git a/src/AnalysisStop.C b/src/AnalysisStop.C index 180cfead..4dfed165 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -542,13 +542,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); @@ -582,6 +583,13 @@ void AnalysisStop::BookAnalysisHistograms() h_Counter [i][j][k] = new TH1D("h_Counter" + suffix, "", 1, 80, 100); h_njet20 [i][j][k] = new TH1D("h_njet20" + suffix, "", 10, 0, 10); h_njet30 [i][j][k] = new TH1D("h_njet30" + suffix, "", 10, 0, 10); + h_Lep1Pt [i][j][k] = new TH1D("h_Lep1Pt" + suffix, "", 2000, 0, 2000); + h_Lep2Pt [i][j][k] = new TH1D("h_Lep2Pt" + suffix, "", 2000, 0, 2000); + h_Lep1Phi [i][j][k] = new TH1D("h_Lep2Phi" + suffix, "", 200, -3.2, 3.2); + h_Lep2Phi [i][j][k] = new TH1D("h_Lep1Phi" + suffix, "", 200, -3.2, 3.2); + 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); if (_systematic.Contains("DYcorrections")) { h_dphiLLbin1 [i][j][k] = new TH1D("h_dphiLLbin1" + suffix, "", 80, 0, 3.14159); @@ -912,6 +920,13 @@ void AnalysisStop::FillAnalysisHistograms(int ichannel, h_Counter [ichannel][icut][ijet]->Fill(90., _event_weight); h_njet20 [ichannel][icut][ijet]->Fill(_njet, _event_weight); h_njet30 [ichannel][icut][ijet]->Fill(_njet30, _event_weight); + h_Lep1Pt [ichannel][icut][ijet]->Fill(_lep1pt, _event_weight); + h_Lep2Pt [ichannel][icut][ijet]->Fill(_lep2pt, _event_weight); + h_Lep1Phi [ichannel][icut][ijet]->Fill(_lep1phi, _event_weight); + h_Lep2Phi [ichannel][icut][ijet]->Fill(_lep2phi, _event_weight); + h_dphil1MET [ichannel][icut][ijet]->Fill(dphilmet1, _event_weight); + h_dphil2MET [ichannel][icut][ijet]->Fill(dphilmet2, _event_weight); + h_METphi [ichannel][icut][ijet]->Fill(MET.Phi(), _event_weight); if (_systematic.Contains("DYcorrections")) { float pi = acos(-1.); @@ -1098,7 +1113,7 @@ void AnalysisStop::FillLevelHistograms(int icut, if (!pass) return; if (_SaveHistograms==0) { - + printf("fill"); FillHistograms(_channel, icut, _jetbin); FillHistograms(_channel, icut, njetbin); } @@ -25299,9 +25314,9 @@ bool AnalysisStop::ShapeWZtoWW() _lep1phi = Lepton1.v.Phi(); _lep2phi = Lepton2.v.Phi(); - _metPfType1Phi = MET.Phi(); + metPfType1Phi = MET.Phi(); - _dphill = fabs(Lepton1.DeltaPhi(Lepton2)); + dphill = fabs((Lepton1.v).DeltaPhi(Lepton2.v)); 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)); diff --git a/stop/runPlotter.C b/stop/runPlotter.C index 3b539f7e..76de911a 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -7,13 +7,13 @@ const Bool_t allplots = false; const Bool_t dosystematics = false; const Bool_t postfitplots = false; -const TString inputdir = "WZtoWW_WW/"; +const TString inputdir = "WZtoWW_Exp/"; //const TString inputdir = "../minitrees/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; //const TString inputdir = "../minitrees/rootfiles/ZpeakDYcorrections/"; //const TString inputdir = "../minitrees/rootfiles/WZtoWWveto/"; //const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsTestAddBkg/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfitasimov/"; -const TString outputdir = "figures_WZtoWW/"; +const TString outputdir = "figures_WZtoWW_Exp/"; const TString signal = ""; //const TString signal = "TChi"; @@ -123,7 +123,7 @@ void runPlotter(TString level, plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); plotter.AddProcess("11_HWW", "HWW", color_HWW); plotter.AddProcess("13_VVV", "VVV", color_VVV); - */plotter.AddProcess("02_WZTo3LNu", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); + */plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); plotter.AddProcess("06_WW", "WW", color_WW); if (inputdir.Contains("SS")) plotter.AddProcess("TTToSemiLepton", "t#bar{t} Semilep.", 41); @@ -292,8 +292,6 @@ void runPlotter(TString level, // Common histograms //-------------------------------------------------------------------- /*plotter.Draw(prefix + "m2l" + suffix, "m_{" + sll + "}", m2l_ngroup, 0, "GeV", linY, true, m2l_xmin, m2l_xmax); - 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 + "nvtx" + suffix, "number of vertices", -1, 0, "NULL", scale, true, 0, 30);*/ @@ -302,17 +300,22 @@ void runPlotter(TString level, plotter.Draw(prefix + "MT2ll" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", linY, 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 + "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 + "dphiLL" + suffix, "#Delta#phi(lep1,lep2)", 10, 0, "NULL", linY); //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 + "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 + "lep1phi" + suffix, "leading lepton #phi", 5, 2, "rad", 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 + "lep1phi" + suffix, "leading lepton #phi", 5, 2, "rad", linY); - //plotter.Draw(prefix + "lep2phi" + suffix, "trailing lepton #phi", 5, 2, "rad", linY); + plotter.Draw(prefix + "Lep2Phi" + suffix, "trailing lepton #phi", 5, 2, "rad", linY); + plotter.Draw(prefix + "METphi" + suffix, "sm #phi", 5, 2, "rad", 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); if (level.Contains("_SR3") && signal=="T2tt") plotter.Draw(prefix + "MT2llisr" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); if (dosystematics) continue; From f629d3af55095decad4c33a585f2da12ff9b20d9 Mon Sep 17 00:00:00 2001 From: Barbara Date: Mon, 23 Oct 2017 19:02:16 +0200 Subject: [PATCH 04/28] 23 Oct 2017 --- .../lxplus/samples_ttbar_Ghent_Summer16.txt | 36 +++++++++---------- src/AnalysisStop.C | 9 +++-- stop/runPlotter.C | 18 +++++----- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/samples/80x/stopSel/lxplus/samples_ttbar_Ghent_Summer16.txt b/samples/80x/stopSel/lxplus/samples_ttbar_Ghent_Summer16.txt index 791f35dc..58de3f48 100644 --- a/samples/80x/stopSel/lxplus/samples_ttbar_Ghent_Summer16.txt +++ b/samples/80x/stopSel/lxplus/samples_ttbar_Ghent_Summer16.txt @@ -1,19 +1,19 @@ root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part0.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part1.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part10.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part11.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part12.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part13.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part14.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part15.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part16.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part17.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part18.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part2.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part3.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part4.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part5.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part6.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part7.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part8.root -#root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part9.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part1.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part10.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part11.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part12.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part13.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part14.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part15.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part16.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part17.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part18.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part2.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part3.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part4.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part5.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part6.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part7.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part8.root +root://eoscms.cern.ch//eos/cms/store/user/scodella/Stop/LatinoSkims/Feb2017_Summer16_stop_ghent_ttbar/MCl2stop__SFWeights__hadd/latino_TTTo2L2Nu__part9.root diff --git a/src/AnalysisStop.C b/src/AnalysisStop.C index 4dfed165..5077c444 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -25281,7 +25281,10 @@ bool AnalysisStop::ShapeWZtoWW() if (DMZ>=DMZCut || Wlep1<0 || Wlep2<0 || Lostlep<0) { return false; } else { - + + // Selection of the WW leptons + if (AnalysisLeptons[Wlep1].v.Pt() <25 || 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(), @@ -25295,8 +25298,8 @@ bool AnalysisStop::ShapeWZtoWW() Lepton1 = AnalysisLeptons[0]; Lepton2 = AnalysisLeptons[1]; - - if (Lepton1.v.Pt()<25. && Lepton2.v.Pt()<25.) return false; + + //if (Lepton1.v.Pt()<25. && Lepton2.v.Pt()<25.) return false; mll = (Lepton1.v+Lepton2.v).M(); _m2l = mll; diff --git a/stop/runPlotter.C b/stop/runPlotter.C index 76de911a..157b1351 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -101,7 +101,7 @@ void runPlotter(TString level, // Get the data //---------------------------------------------------------------------------- - //plotter.AddData("01_Data", "data", color_Data); + plotter.AddData("01_Data", "data", color_Data); // Add processes @@ -115,15 +115,17 @@ void runPlotter(TString level, //plotter.AddProcess("11_Wg", "W#gamma", color_Wg); //plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); //plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background, SF_DY); - plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets, roc_background); - plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); + *///plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); + //plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_ZZ, roc_background, SF_ZMet); - plotter.AddProcess("05_ST", "tW", color_ST); - plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); - plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); - plotter.AddProcess("11_HWW", "HWW", color_HWW); plotter.AddProcess("13_VVV", "VVV", color_VVV); - */plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); + plotter.AddProcess("11_HWW", "HWW", color_HWW); + plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); + plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); + plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets, roc_background); + plotter.AddProcess("05_ST", "tW", color_ST); + plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); + plotter.AddProcess("02_WZTo3LNu", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); plotter.AddProcess("06_WW", "WW", color_WW); if (inputdir.Contains("SS")) plotter.AddProcess("TTToSemiLepton", "t#bar{t} Semilep.", 41); From 2eb63f7ee5046668254d8b88f38af30e7f883422 Mon Sep 17 00:00:00 2001 From: Barbara Date: Mon, 23 Oct 2017 19:54:55 +0200 Subject: [PATCH 05/28] UpUpdate 23Oct17 --- include/Constants.h | 2 +- src/AnalysisStop.C | 4 ++-- stop/runPlotter.C | 2 +- test/HistogramReader.C | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/Constants.h b/include/Constants.h index 916a76b2..bf6734eb 100644 --- a/include/Constants.h +++ b/include/Constants.h @@ -141,7 +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_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/src/AnalysisStop.C b/src/AnalysisStop.C index 07494698..dfb64cdf 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -518,7 +518,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 >= 20. && _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); @@ -1208,7 +1208,7 @@ void AnalysisStop::FillLevelHistograms(int icut, if (!pass) return; if (_SaveHistograms==0) { - printf("fill"); + FillHistograms(_channel, icut, _jetbin); FillHistograms(_channel, icut, njetbin); } diff --git a/stop/runPlotter.C b/stop/runPlotter.C index 157b1351..7753f4a6 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -117,7 +117,7 @@ void runPlotter(TString level, //plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background, SF_DY); *///plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); //plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); - plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_ZZ, roc_background, SF_ZMet); + plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); plotter.AddProcess("13_VVV", "VVV", color_VVV); plotter.AddProcess("11_HWW", "HWW", color_HWW); plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); diff --git a/test/HistogramReader.C b/test/HistogramReader.C index 294d4338..12d2330c 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -1888,8 +1888,8 @@ void HistogramReader::IncludeSystematics(TString hname) if (ibinGetBinContent(ibin+1)>0.005)) ApplyZeroStat = true; } - if (ApplyZeroStat) - if (dummy0->GetEntries()>0)StatUncert2 = TMath::Power(StatZero*dummy0->Integral()/dummy0->GetEntries(), 2); + if (ApplyZeroStat && dummy0->GetEntries()>0.) + StatUncert2 = TMath::Power(StatZero*dummy0->Integral()/dummy0->GetEntries(), 2); } errBackTab_up[kproce][ibin] += StatUncert2; errBackTab_do[kproce][ibin] += StatUncert2; From 5f89db4ef5b23b11ec9fabe29186196b7a63fae3 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 26 Oct 2017 15:22:52 +0200 Subject: [PATCH 06/28] 26 Oct 2017 --- include/AnalysisStop.h | 4 +-- src/AnalysisStop.C | 9 +++-- stop/merge.sh | 16 +++------ stop/runPlotter.C | 78 ++++++++++++++++++++++++++---------------- test/HistogramReader.C | 3 +- 5 files changed, 64 insertions(+), 46 deletions(-) diff --git a/include/AnalysisStop.h b/include/AnalysisStop.h index 10a10e4b..a36f3b16 100644 --- a/include/AnalysisStop.h +++ b/include/AnalysisStop.h @@ -114,7 +114,7 @@ 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]; int _SaveHistograms, _DoTheoreticalVariations; float _metmeff, _MT2ll, _MT2llgen, _MT2llfake; @@ -135,7 +135,7 @@ class AnalysisStop : public AnalysisCMS TH1F* h_MT2ll_truth [nchannel][ncut][njetbin+1]; TH1F* h_MET_fake [nchannel][ncut][njetbin+1]; TH1F* h_MET_truth [nchannel][ncut][njetbin+1]; - + bool _hasisrjet; float _dphiminlmet, _m2lZ2; diff --git a/src/AnalysisStop.C b/src/AnalysisStop.C index dfb64cdf..3275f678 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -655,6 +655,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); @@ -1021,6 +1022,7 @@ void AnalysisStop::FillAnalysisHistograms(int ichannel, h_dphil1MET [ichannel][icut][ijet]->Fill(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.); @@ -25452,7 +25454,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.; @@ -25468,7 +25471,9 @@ bool AnalysisStop::ShapeWZtoWW() _dphillmet = fabs((Lepton1.v + Lepton2.v).DeltaPhi(MET)); } - + + + if (fabs(_m2l - Z_MASS) < 15. && _channel != em) return false; return true; } diff --git a/stop/merge.sh b/stop/merge.sh index 39fb0f49..b328b46d 100755 --- a/stop/merge.sh +++ b/stop/merge.sh @@ -16,24 +16,16 @@ pushd $FOLDER 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_ZZTo2l.root ZZTo2L2Nu__part* ZZTo2L2Q__part* ggZZTo2e2nu.root ggZZTo2mu2nu.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 03_VZ.root ZZTo2L2Q__part*.root ZZTo2L2Nu__part*.root WZTo2L2Q__part*.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_ZJets.root DYJetsToLL_M-10to50.root DYJetsToLL_M-50__part*.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 - popd diff --git a/stop/runPlotter.C b/stop/runPlotter.C index 7753f4a6..fd75db54 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -4,16 +4,21 @@ //------------------------------------------------------------------------------ const Bool_t datadriven = false; const Bool_t allplots = false; -const Bool_t dosystematics = false; +const Bool_t dosystematics = true; const Bool_t postfitplots = false; -const TString inputdir = "WZtoWW_Exp/"; +const TString inputdir = ""; +//const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; +//const TString inputdir = "../minitrees/rootfiles/WZtoWW_veto/"; //const TString inputdir = "../minitrees/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; //const TString inputdir = "../minitrees/rootfiles/ZpeakDYcorrections/"; -//const TString inputdir = "../minitrees/rootfiles/WZtoWWveto/"; //const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsTestAddBkg/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfitasimov/"; -const TString outputdir = "figures_WZtoWW_Exp/"; + +const TString outputdir = "figures_Fakes/"; +//const TString outputdir = "figures_WZtoWW_vetoNewCut2_CheckVeto2_Mt2ll/"; +//const TString outputdir = "figures_WZtoWW_vetoNewCut2_ZVeto/"; +//const TString outputdir = "figures_WW_Mimic/"; const TString signal = ""; //const TString signal = "TChi"; @@ -46,7 +51,7 @@ enum {linY, logY}; // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void runPlotter(TString level, - TString option = "nostack") + TString option = "hist") { gInterpreter->ExecuteMacro("../test/PaperStyle.C"); @@ -87,13 +92,13 @@ void runPlotter(TString level, SF_ttZ = 1.44; if (!postfitplots && !inputdir.Contains("Zpeakz") && !inputdir.Contains("ZZ")) { if (level.Contains("NoJet")) { - SF_ZMet = 1.08; // +/- 0.14 + SF_ZMet = 0.74; // +/- 0.14 SF_DY = 1.;//4.06; // 2.39 } else if (level.Contains("Tag")) { - SF_ZMet = 1.52;// +/- 0.20 + SF_ZMet = 1.05;// +/- 0.20 SF_DY = 1.;//1.58; // 2.39 } else if (level.Contains("Veto")) { - SF_ZMet = 1.38;// +/- 0.17 + SF_ZMet = 1.05;// +/- 0.17 SF_DY = 1.;//1.58; // 2.39 } } @@ -101,32 +106,45 @@ void runPlotter(TString level, // Get the data //---------------------------------------------------------------------------- - plotter.AddData("01_Data", "data", color_Data); + //plotter.AddData("01_Data", "data", color_Data); // Add processes //---------------------------------------------------------------------------- //plotter.AddProcess("14_HZ", "HZ", color_HZ); /* if (inputdir.Contains("/ZZ") || inputdir.Contains("/WZ")) - plotter.AddProcess("14_ZZTo4L", "ZZ (#rightarrow 4l)", 49, roc_background, 1.256/1.212); //plotter.AddProcess("03_VZ", "VZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); - plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_ZZ, roc_background); - //plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_ZZ, roc_background, SF_ZMet); //plotter.AddProcess("11_Wg", "W#gamma", color_Wg); //plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); //plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background, SF_DY); - *///plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); //plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); - plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); + //plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); + plotter.AddProcess("03_ZZTo2l", "ZZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); + plotter.AddProcess("14_ZZTo4l", "ZZ (#rightarrow 4l)", 49, roc_background, SF_ZMet); + plotter.AddProcess("02_WZTo3LNu_toWW_NoZVeto", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); + plotter.AddProcess("02_WZTo3LNu_toWW", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); + */plotter.AddProcess("02_WZTo3LNu", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); + std::cout << "WZ" << std::endl; + plotter.AddProcess("06_WW", "WW", color_WW); + std::cout << "WW" << std::endl; + plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background); + std::cout << "ZJets" << std::endl; plotter.AddProcess("13_VVV", "VVV", color_VVV); - plotter.AddProcess("11_HWW", "HWW", color_HWW); - plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); + std::cout << "VVV" << std::endl; + plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); + std::cout << "ZZ" << std::endl; plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); - plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets, roc_background); + std::cout << "TTW" << std::endl; + plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); + std::cout << "TTZ" << std::endl; + plotter.AddProcess("11_HWW", "HWW", color_HWW); + std::cout << "HWW" << std::endl; + plotter.AddProcess("03_VZ_scaled", "VZ", color_VZ, roc_background, SF_ZMet); + std::cout << "VZ" << std::endl; plotter.AddProcess("05_ST", "tW", color_ST); + std::cout << "ST" << std::endl; plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); - plotter.AddProcess("02_WZTo3LNu", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); - plotter.AddProcess("06_WW", "WW", color_WW); + std::cout << "TTbar" << std::endl; if (inputdir.Contains("SS")) plotter.AddProcess("TTToSemiLepton", "t#bar{t} Semilep.", 41); // plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); @@ -290,19 +308,19 @@ 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 //-------------------------------------------------------------------- - /*plotter.Draw(prefix + "m2l" + suffix, "m_{" + sll + "}", m2l_ngroup, 0, "GeV", linY, true, m2l_xmin, m2l_xmax); + /* plotter.Draw(prefix + "m2L" + suffix, "m_{" + sll + "}", -1, 0, "GeV", linY); 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 + "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 + "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" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", linY, false, 0, 140); - //plotter.Draw(prefix + "MT2ll_fake" + suffix, "M_{T2}(" + sll + "_fake)", 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 + "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); @@ -314,11 +332,13 @@ void runPlotter(TString level, 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", linY); - plotter.Draw(prefix + "METphi" + suffix, "sm #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 + "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); - + */ + std::cout << "after plotter" << std::endl; + // Common histograms if (level.Contains("_SR3") && signal=="T2tt") plotter.Draw(prefix + "MT2llisr" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); if (dosystematics) continue; diff --git a/test/HistogramReader.C b/test/HistogramReader.C index 12d2330c..63eb196b 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -463,6 +463,7 @@ void HistogramReader::Draw(TString hname, if (ymin != -999) hfirst->SetMinimum(ymin); if (ymax != -999) hfirst->SetMaximum(ymax); + //hfirst ->SetMaximum(0.1); // Legend //---------------------------------------------------------------------------- @@ -496,7 +497,7 @@ void HistogramReader::Draw(TString hname, // Standard Model processes legend //---------------------------------------------------------------------------- - Int_t nrow = (_mchist.size() > 11) ? 5 : 4; + Int_t nrow = (_mchist.size() >= 11) ? 5 : 4; for (int i=0; i<_mchist.size(); i++) { From 4c0632355753485b785b0a8c45c5c5170e4df451 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 26 Oct 2017 15:32:06 +0200 Subject: [PATCH 07/28] before merging 26 Oct 2017 --- src/AnalysisStop.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AnalysisStop.C b/src/AnalysisStop.C index 3275f678..cd77c8c6 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -25429,7 +25429,7 @@ bool AnalysisStop::ShapeWZtoWW() return false; } else { - // Selection of the WW leptons + // 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; @@ -25473,7 +25473,7 @@ bool AnalysisStop::ShapeWZtoWW() } - if (fabs(_m2l - Z_MASS) < 15. && _channel != em) return false; + // if (fabs(_m2l - Z_MASS) < 15. && _channel != em) return false; return true; } From 6b8e8dc403882a932dc6a634468c6c7b398be139 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 26 Oct 2017 15:39:16 +0200 Subject: [PATCH 08/28] DY corr 26 Oct 2017 --- src/AnalysisStop.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/AnalysisStop.C b/src/AnalysisStop.C index 905175e1..58174e40 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -558,7 +558,8 @@ void AnalysisStop::Loop(TString analysis, TString filename, float luminosity, fl FillLevelHistograms(Stop_02_SRs_Tag, pass && (MET.Et()>=140.) && pass_blind && pass_masspoint); } - if (_njet<1 && fabs(dphill)<112.5) { + if (_njet<1) { + //if (_njet<1 && fabs(dphill)<112.5) { // To study the question about DY statistics on-Z and off-Z regions for dphi(l,l) distribution. //if (MET.Et()>140.) { //if (fabs(dphill)<2.5) cout << "Dminor " << dphill << endl; //else cout << "Dmayor " << dphill << endl; From bdf7bb6d0b6b56114e8360fc14463fe3101f09f0 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 26 Oct 2017 15:54:32 +0200 Subject: [PATCH 09/28] minitrees_samples_list --- .../stopSel/lxplus/multilepton_minitrees.txt | 32 ++++++++++ .../80x/stopSel/lxplus/nominal_minitrees.txt | 62 +++++++++++++++++++ stop/VetoMaker.C | 46 ++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 samples/80x/stopSel/lxplus/multilepton_minitrees.txt create mode 100644 samples/80x/stopSel/lxplus/nominal_minitrees.txt create mode 100644 stop/VetoMaker.C diff --git a/samples/80x/stopSel/lxplus/multilepton_minitrees.txt b/samples/80x/stopSel/lxplus/multilepton_minitrees.txt new file mode 100644 index 00000000..e2cd5829 --- /dev/null +++ b/samples/80x/stopSel/lxplus/multilepton_minitrees.txt @@ -0,0 +1,32 @@ +#3TightL_MinitreeVersion_26Oct2017 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/01_Data.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/02_WZTo3LNu.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/04_TTTo2L2Nu.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/05_ST.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/06_WW.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/07_ZJets.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/07_ZJetsHT.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/09_TTW.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/10_TTZ.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/11_HWW.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/13_VVV.root 1 +##/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/15_VZ.root 1 +#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 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Nu__part1.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part0.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part1.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part2.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2nu.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2mu2nu.root 1 +#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 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo4L__part1.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2mu.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2tau.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2mu2tau.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4e.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4mu.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4tau.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggHToZZTo4L.root 1 +/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/qqHToZZTo4L.root 1 diff --git a/samples/80x/stopSel/lxplus/nominal_minitrees.txt b/samples/80x/stopSel/lxplus/nominal_minitrees.txt new file mode 100644 index 00000000..6e085233 --- /dev/null +++ b/samples/80x/stopSel/lxplus/nominal_minitrees.txt @@ -0,0 +1,62 @@ +# 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 diff --git a/stop/VetoMaker.C b/stop/VetoMaker.C new file mode 100644 index 00000000..9f992f1f --- /dev/null +++ b/stop/VetoMaker.C @@ -0,0 +1,46 @@ +#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 "TFile.h" +#include "TPad.h" +#include "TCanvas.h" +#include "TH1F.h" +#include "TDirectory.h" +#include +#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(); +} From 448c8adde423c6d79573d77b6ab6d3e0d35a49d3 Mon Sep 17 00:00:00 2001 From: Barbara Date: Mon, 30 Oct 2017 11:20:36 +0100 Subject: [PATCH 10/28] Table for yields --- .../80x/stopSel/lxplus/nominal_minitrees.txt | 137 +++++++++-------- stop/merge.sh | 39 +++-- stop/runPlotter.C | 66 ++++---- test/HistogramReader.C | 142 +++++++++++++++++- 4 files changed, 274 insertions(+), 110 deletions(-) diff --git a/samples/80x/stopSel/lxplus/nominal_minitrees.txt b/samples/80x/stopSel/lxplus/nominal_minitrees.txt index 6e085233..7f418bf9 100644 --- a/samples/80x/stopSel/lxplus/nominal_minitrees.txt +++ b/samples/80x/stopSel/lxplus/nominal_minitrees.txt @@ -1,62 +1,77 @@ # 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/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 +/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 +/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/stop/merge.sh b/stop/merge.sh index b328b46d..53352f1c 100755 --- a/stop/merge.sh +++ b/stop/merge.sh @@ -12,20 +12,31 @@ 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_ZZTo2l.root ZZTo2L2Nu__part* ZZTo2L2Q__part* ggZZTo2e2nu.root ggZZTo2mu2nu.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 03_VZ.root ZZTo2L2Q__part*.root ZZTo2L2Nu__part*.root WZTo2L2Q__part*.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.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 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 + +# 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* 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 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 popd diff --git a/stop/runPlotter.C b/stop/runPlotter.C index fd75db54..edbbfe1c 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -7,20 +7,19 @@ const Bool_t allplots = false; const Bool_t dosystematics = true; const Bool_t postfitplots = false; -const TString inputdir = ""; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles/WZtoWW_veto/"; -//const TString inputdir = "../minitrees/rootfiles/nominal/"; +const TString inputdir = "../minitrees/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; //const TString inputdir = "../minitrees/rootfiles/ZpeakDYcorrections/"; //const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsTestAddBkg/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfitasimov/"; -const TString outputdir = "figures_Fakes/"; +const TString outputdir = "figures_TableTest/"; //const TString outputdir = "figures_WZtoWW_vetoNewCut2_CheckVeto2_Mt2ll/"; //const TString outputdir = "figures_WZtoWW_vetoNewCut2_ZVeto/"; //const TString outputdir = "figures_WW_Mimic/"; -const TString signal = ""; +const TString signal = "T2tt"; //const TString signal = "TChi"; const TString sl = "#font[12]{l}"; @@ -123,28 +122,18 @@ void runPlotter(TString level, plotter.AddProcess("14_ZZTo4l", "ZZ (#rightarrow 4l)", 49, roc_background, SF_ZMet); plotter.AddProcess("02_WZTo3LNu_toWW_NoZVeto", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); plotter.AddProcess("02_WZTo3LNu_toWW", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); - */plotter.AddProcess("02_WZTo3LNu", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); - std::cout << "WZ" << std::endl; - plotter.AddProcess("06_WW", "WW", color_WW); - std::cout << "WW" << std::endl; - plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background); - std::cout << "ZJets" << std::endl; + */ plotter.AddProcess("13_VVV", "VVV", color_VVV); - std::cout << "VVV" << std::endl; - plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); - std::cout << "ZZ" << std::endl; plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); - std::cout << "TTW" << std::endl; - plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); - std::cout << "TTZ" << std::endl; + plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background );//, SF_ttZ); plotter.AddProcess("11_HWW", "HWW", color_HWW); - std::cout << "HWW" << std::endl; - plotter.AddProcess("03_VZ_scaled", "VZ", color_VZ, roc_background, SF_ZMet); - std::cout << "VZ" << std::endl; + plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_VZ, roc_background); //, SF_ZMet); + plotter.AddProcess("15_VZ", "VZ", color_VZ, roc_background); //, SF_ZMet); + plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background); + plotter.AddProcess("02_WZTo3LNu", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background); //, 0.97); + plotter.AddProcess("06_WW", "WW", color_WW); plotter.AddProcess("05_ST", "tW", color_ST); - std::cout << "ST" << std::endl; plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); - std::cout << "TTbar" << std::endl; if (inputdir.Contains("SS")) plotter.AddProcess("TTToSemiLepton", "t#bar{t} Semilep.", 41); // plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); @@ -158,11 +147,24 @@ void runPlotter(TString level, //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm263", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=263)",6); //plotter.AddSignal("T2tt_mStop-150to250_Sm250_Xm125", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=250, m_{#tilde{#chi}^{0}_{1}}=125)",4); //plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); - 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_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); + */ + // Tabla Paper + + //plotter.AddSignal("T2tt_mStop-150to250_Sm150_Xm25", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=150, m_{#tilde{#chi}^{0}_{1}}=25)",4); + //plotter.AddSignal("T2tt_mStop-250to350_Sm275_Xm150", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=275, m_{#tilde{#chi}^{0}_{1}}=150)",4); + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",6); + //plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); + //plotter.AddSignal("TChiSlepExt_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); + //plotter.AddSignal("TChiSlep_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); + //plotter.AddSignal("TChiSWW_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); + //plotter.AddSignal("T2bW_Sm350_Xm225", "#tilde{t}#rightarrow bW (350,225)", 2); + + } else if (signal=="TChi") { @@ -311,27 +313,27 @@ void runPlotter(TString level, std::cout << "before plotter" << std::endl; // Common histograms //-------------------------------------------------------------------- + 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 + "lep1eta" + suffix, "leading lepton #eta", -1, 1, "NULL", scale); plotter.Draw(prefix + "lep2eta" + suffix, "trailing lepton #eta", -1, 1, "NULL", scale); 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" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", linY, 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 + "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", scale); plotter.Draw(prefix + "dphiLL" + suffix, "#Delta#phi(lep1,lep2)", 10, 0, "NULL", linY); - //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 + "MET" + suffix, sm, 1, 0, "GeV", scale, false, 50, 200); + 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 + "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 + "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 + "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 + "Lep1Pt" + suffix, "leading lepton p_{T}", 10, 0, "GeV", scale, true, 0, 250); diff --git a/test/HistogramReader.C b/test/HistogramReader.C index 63eb196b..83aa3076 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -146,7 +146,7 @@ void HistogramReader::AddSignal(const TString& filename, //------------------------------------------------------------------------------ void HistogramReader::AddSystematic(TString analysis, TString systematic) { - //_mycut = mycut; + // _mycut = mycut; _analysis = analysis; _systematics.push_back(systematic); } @@ -1771,9 +1771,10 @@ void FormatTableYields(float *YY, float *EY) { } + void HistogramReader::IncludeSystematics(TString hname) { - bool _verbose = false, _dotable = true; + bool _verbose = false, _dotable = false, _doPaperTable = true; float StatZero = 1.84102; @@ -2393,7 +2394,8 @@ void HistogramReader::IncludeSystematics(TString hname) cout << "ErrorY[" << ff << "] = " << _ErrorGr->GetErrorY(ff) << endl; } - if (_dotable && hname.Contains("h_MT2ll")) { + // Do expanded tables for Analysis Note + if (_dotable && hname.Contains("h_MT2ll")) { gSystem->mkdir("Tables/", kTRUE); TString TableFlag = hname; TableFlag.ReplaceAll("Stop/", "_"); TableFlag.ReplaceAll("/h", ""); std::ofstream inFile("Tables/Yields" + TableFlag + ".tex",std::ios::out); @@ -2467,4 +2469,138 @@ void HistogramReader::IncludeSystematics(TString hname) inFile.close(); } + // ------------------------------- + // 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; + + } } From f88c5084421e5c5e48125e085442a2582661a7d8 Mon Sep 17 00:00:00 2001 From: Barbara Date: Tue, 7 Nov 2017 11:54:31 +0100 Subject: [PATCH 11/28] added HistogramReader_2.C --- test/HistogramReader_2.C | 1998 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 1998 insertions(+) create mode 100644 test/HistogramReader_2.C diff --git a/test/HistogramReader_2.C b/test/HistogramReader_2.C new file mode 100644 index 00000000..43424ec8 --- /dev/null +++ b/test/HistogramReader_2.C @@ -0,0 +1,1998 @@ +#include "HistogramReader.h" +#include +#include + + +using namespace std; + + +//------------------------------------------------------------------------------ +// HistogramReader +//------------------------------------------------------------------------------ +HistogramReader::HistogramReader(const TString& inputdir, + const TString& outputdir) : + + _inputdir (inputdir), + _outputdir (outputdir), + _stackoption ("nostack,hist"), + _title ("inclusive"), + _luminosity_fb(-1), + _datanorm (false), + _drawratio (false), + _drawBinSigf (false), + _drawyield (false), + _minitreebased(false), //Used only to address the files of systematic folders + _publicstyle (false), + _savepdf (false), + _savepng (true), + _yieldTex (true) +{ + _mcfile.clear(); + _mccolor.clear(); + _mclabel.clear(); + _mcscale.clear(); + + _datafile = NULL; + _datahist = NULL; + _allmchist = NULL; + + TH1::SetDefaultSumw2(); +} + + +//------------------------------------------------------------------------------ +// AddData +//------------------------------------------------------------------------------ +void HistogramReader::AddData(const TString& filename, + const TString& label, + Color_t color) +{ + TString fullname = _inputdir + "/" + filename + ".root"; + + if (gSystem->AccessPathName(fullname)) + { + printf(" [HistogramReader::AddData] Cannot access %s\n", fullname.Data()); + return; + } + + TFile* file = new TFile(fullname, "read"); + + _datacolor = color; + _datafile = file; + _datafilename = filename; + _datalabel = label; +} + + +//------------------------------------------------------------------------------ +// AddProcess +//------------------------------------------------------------------------------ +void HistogramReader::AddProcess(const TString& filename, + const TString& label, + Color_t color, + Int_t kind, + Float_t scale) +{ + TString fullname = _inputdir + "/" + filename + ".root"; + + if (gSystem->AccessPathName(fullname)) + { + printf(" [HistogramReader::AddProcess] Cannot access %s\n", fullname.Data()); + return; + } + + TFile* file = new TFile(fullname, "read"); + + _mccolor.push_back(color); + _mcfile.push_back(file); + _mcfilename.push_back(filename); + _mclabel.push_back(label); + _mcscale.push_back(scale); + + if (scale > 0. && scale != 1.) + printf("\n [HistogramReader::AddProcess] Process %s will be scaled by %.2f\n\n", label.Data(), scale); + + if (kind == roc_signal) + { + _roc_signalfile.push_back(file); + _roc_signalscale.push_back(scale); + } + else if (kind == roc_background) + { + _roc_backgroundfile.push_back(file); + _roc_backgroundscale.push_back(scale); + } +} + + +//------------------------------------------------------------------------------ +// AddSignal +//------------------------------------------------------------------------------ +void HistogramReader::AddSignal(const TString& filename, + const TString& label, + Color_t color, + Int_t kind, + Float_t scale) +{ + TString fullname = _inputdir + "/" + filename + ".root"; + + if (gSystem->AccessPathName(fullname)) + { + printf(" [HistogramReader::AddSignal] Cannot access %s\n", fullname.Data()); + return; + } + + TFile* file = new TFile(fullname, "read"); + + _signalcolor.push_back(color); + _signalfile.push_back(file); + _signalfilename.push_back(filename); + _signallabel.push_back(label); + _signalscale.push_back(scale); + + if (scale > 0. && scale != 1.) + printf("\n [HistogramReader::AddSignal] Process %s will be scaled by %.2f\n\n", label.Data(), scale); + + if (kind == roc_signal) + { + _roc_signalfile.push_back(file); + _roc_signalscale.push_back(scale); + } + else if (kind == roc_background) + { + _roc_backgroundfile.push_back(file); + _roc_backgroundscale.push_back(scale); + } +} + + +//------------------------------------------------------------------------------ +// AddSystematic +//------------------------------------------------------------------------------ +void HistogramReader::AddSystematic(TString analysis, TString systematic, TString mycut) +{ + // For Stop analysis: + // BtagFSdo Btagdo Fakedo Fastsimdo Idisodo Idisoeleup Idisomuup Isrnjetdo JESdo JESup METdo METup PDFdo Pileupdo Q2do Recodo Topptdo Triggerdo nominal + // BtagFSup Btagup Fakeup Fastsimup Idisoeledo Idisomudo Idisoup Isrnjetup JESdoNoISR JESupNoISR METdoNoISR METupNoISR PDFup Pileupup Q2up Recoup Topptup Triggerup theory + _mycut = mycut; + _analysis = analysis; + _systematics.push_back(systematic); +} + + +//------------------------------------------------------------------------------ +// Draw +//------------------------------------------------------------------------------ +void HistogramReader::Draw(TString hname, + TString xtitle, + Int_t ngroup, + Int_t precision, + TString units, + Bool_t setlogy, + Bool_t moveoverflow, + Float_t xmin, + Float_t xmax, + Float_t ymin, + Float_t ymax) +{ + TString cname = hname; + + if (_stackoption.Contains("nostack")) cname += "_nostack"; + + if (setlogy) cname += "_log"; + + _writeyields = (hname.Contains("_evolution")) ? true : false; + + if (_writeyields) + { + _yields_table.open(_outputdir + "/" + cname + ".txt"); + + _writelabels = true; + } + + + TCanvas* canvas = NULL; + + TPad* pad1 = NULL; + TPad* pad2 = NULL; + + if (_drawratio && _datafile) + { + canvas = new TCanvas(cname, cname, 550, 720); + + pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); + + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.02); + pad1->Draw(); + + pad2->SetTopMargin (0.08); + pad2->SetBottomMargin(0.35); + pad2->Draw(); + } + + else if (_drawBinSigf) + { + canvas = new TCanvas(cname, cname, 550, 720); + + pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); + + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.02); + pad1->Draw(); + + pad2->SetTopMargin (0.08); + pad2->SetBottomMargin(0.35); + pad2->SetGridx(); + pad2->SetGridy(); + pad2->Draw(); + } + + else + { + canvas = new TCanvas(cname, cname, 550, 600); + + pad1 = new TPad("pad1", "pad1", 0, 0, 1, 1); + + pad1->Draw(); + } + + + //---------------------------------------------------------------------------- + // pad1 + //---------------------------------------------------------------------------- + pad1->cd(); + + pad1->SetLogy(setlogy); + + + // Stack processes + //---------------------------------------------------------------------------- + _mchist.clear(); + + THStack* mcstack = new THStack(hname + "_mcstack", hname + "_mcstack"); + + for (UInt_t i=0; i<_mcfile.size(); i++) { + + _mcfile[i]->cd(); + + TH1D* dummy = (TH1D*)_mcfile[i]->Get(hname); + + _mchist.push_back((TH1D*)dummy->Clone()); + + if (_luminosity_fb > 0 && _mcscale[i] > -999) _mchist[i]->Scale(_luminosity_fb); + + if (_mcscale[i] > 0) _mchist[i]->Scale(_mcscale[i]); + + SetHistogram(_mchist[i], _mccolor[i], 1001, kDot, kSolid, 0, ngroup, moveoverflow, xmin, xmax); + + mcstack->Add(_mchist[i]); + } + + + // Stack signals + //---------------------------------------------------------------------------- + _signalhist.clear(); + + THStack* signalstack = new THStack(hname + "_signalstack", hname + "_signalstack"); + + for (UInt_t i=0; i<_signalfile.size(); i++) { + + _signalfile[i]->cd(); + + TH1D* dummy = (TH1D*)_signalfile[i]->Get(hname); + + _signalhist.push_back((TH1D*)dummy->Clone()); + + if (_luminosity_fb > 0 && _signalscale[i] > -999) _signalhist[i]->Scale(_luminosity_fb); + + if (_signalscale[i] > 0) _signalhist[i]->Scale(_signalscale[i]); + + SetHistogram(_signalhist[i], _signalcolor[i], 0, kDot, kSolid, 3, ngroup, moveoverflow, xmin, xmax); + + signalstack->Add(_signalhist[i]); + } + + + // Get the data + //---------------------------------------------------------------------------- + if (_datafile) + { + _datafile->cd(); + + TH1D* dummy = (TH1D*)_datafile->Get(hname); + + _datahist = (TH1D*)dummy->Clone(); + + SetHistogram(_datahist, kBlack, 0, kFullCircle, kSolid, 1, ngroup, moveoverflow, xmin, xmax); + } + + + // Normalize MC to data + //---------------------------------------------------------------------------- + if (_datahist && _datanorm) + { + Float_t mcnorm = Yield((TH1D*)(mcstack->GetStack()->Last())); + Float_t datanorm = Yield(_datahist); + + for (UInt_t i=0; i<_mchist.size(); i++) + { + _mchist[i]->Scale(datanorm / mcnorm); + } + + mcstack->Modified(); + } + + + // hfirst will contain the axis settings + //---------------------------------------------------------------------------- + TH1D* hfirst = (TH1D*)_mchist[0]->Clone("hfirst"); + + hfirst->Reset(); + + hfirst->SetTitle(""); + + + // All MC + //---------------------------------------------------------------------------- + _allmchist = (TH1D*)_mchist[0]->Clone("allmchist"); + + _allmchist->SetName(_mchist[0]->GetName()); + + // Possible modification (how to deal with systematic uncertainties?) + // _allmchist = (TH1D*)(mcstack->GetStack()->Last()); + + for (Int_t ibin=0; ibin<=_allmchist->GetNbinsX(); ibin++) { + + Float_t binValue = 0.; + Float_t binError = 0.; + + for (UInt_t i=0; i<_mchist.size(); i++) { + + Float_t binContent = _mchist[i]->GetBinContent(ibin); + Float_t binStatError = _mchist[i]->GetBinError(ibin); + Float_t binSystError = 0; // To be updated + + binValue += binContent; + binError += (binStatError * binStatError); + binError += (binSystError * binSystError); + } + + binError = sqrt(binError); + + _allmchist->SetBinContent(ibin, binValue); + _allmchist->SetBinError (ibin, binError); + } + + _allmclabel = "stat"; + + _allmchist->SetFillColor (kGray+1); + _allmchist->SetFillStyle ( 3345); + _allmchist->SetLineColor (kGray+1); + _allmchist->SetMarkerColor(kGray+1); + _allmchist->SetMarkerSize ( 0); + + + // Include systematics with TGraphAsymmErrors + //---------------------------------------------------------------------------- + if (_systematics.size() > 0) IncludeSystematics(hname); + + // Draw + //---------------------------------------------------------------------------- + hfirst->Draw(); + + mcstack->Draw(_stackoption + ",same"); + + //if (_systematics.size() > 0 ) _gr->Draw("CF"); + //if (_systematics.size() > 0 ) _gr->Draw("3"); + //if (_systematics.size() > 0 ) _gr->Draw("P0"); + + + + if (_systematics.size() > 0 ) { + + _ErrorGr->Draw("e2,same"); + } + else { + + if (!_stackoption.Contains("nostack")) _allmchist->Draw("e2,same"); + } + + if (_signalfile.size() > 0) signalstack->Draw("nostack,hist,same"); + + if (_datahist) _datahist->Draw("ep,same"); + + + // Set xtitle and ytitle + //---------------------------------------------------------------------------- + TString ytitle = Form("events / %s.%df", "%", precision); + + ytitle = Form(ytitle.Data(), hfirst->GetBinWidth(0)); + + if (!units.Contains("NULL")) { + xtitle = Form("%s [%s]", xtitle.Data(), units.Data()); + ytitle = Form("%s %s", ytitle.Data(), units.Data()); + } + + + // Adjust xaxis and yaxis + //---------------------------------------------------------------------------- + hfirst->GetXaxis()->SetRangeUser(xmin, xmax); + + Float_t theMin = 0.0; + + Float_t theMax = (_datahist) ? GetMaximum(_datahist, xmin, xmax) : 0.0; + + Float_t theMaxMC = GetMaximum(_allmchist, xmin, xmax); + + if (_stackoption.Contains("nostack")) + { + for (UInt_t i=0; i<_mcfile.size(); i++) + { + Float_t mchist_i_max = GetMaximum(_mchist[i], xmin, xmax, false); + + if (mchist_i_max > theMaxMC) theMaxMC = mchist_i_max; + } + } + + if (theMaxMC > theMax) theMax = theMaxMC; + + Float_t theMaxSignal = 0.0; + + if (_signalfile.size() > 0) + { + for (UInt_t i=0; i<_signalfile.size(); i++) + { + Float_t signalhist_i_max = GetMaximum(_signalhist[i], xmin, xmax, false); + + if (signalhist_i_max > theMaxSignal) theMaxSignal = signalhist_i_max; + } + } + + if (theMaxSignal > theMax) theMax = theMaxSignal; + + if (pad1->GetLogy()) + { + theMin = 1e-5; + theMax = TMath::Power(10, TMath::Log10(theMax) + 6); + } + else if (!_stackoption.Contains("nostack")) + { + theMax *= 1.7; + } + + hfirst->SetMinimum(theMin); + hfirst->SetMaximum(theMax); + + if (ymin != -999) hfirst->SetMinimum(ymin); + if (ymax != -999) hfirst->SetMaximum(ymax); + + //if (_stackoption.Contains("nostack")) { hfirst->SetMinimum(0.00001); hfirst->SetMaximum(10000.0); } + + // Legend + //---------------------------------------------------------------------------- + Float_t x0 = 0.220; // x position of the data on the top left + Float_t y0 = 0.843; // y position of the data on the top left + Float_t xdelta = (_drawyield) ? 0.228 : 0.170; // x width between columns + Float_t ydelta = 0.050; // y width between rows + Int_t nx = 0; // column number + Int_t ny = 0; // row number + + TString opt = (_stackoption.Contains("nostack")) ? "l" : "f"; + + + // Data legend + //---------------------------------------------------------------------------- + if (_datahist) + { + DrawLegend(x0, y0, _datahist, _datalabel.Data(), "lp"); + ny++; + } + + + // All MC legend + //---------------------------------------------------------------------------- + if (!_stackoption.Contains("nostack")) + { + DrawLegend(x0, y0 - ny*ydelta, _allmchist, _allmclabel.Data(), opt); + ny++; + } + + + // Standard Model processes legend + //---------------------------------------------------------------------------- + Int_t nrow = (_mchist.size() > 10) ? 5 : 4; + + for (int i=0; i<_mchist.size(); i++) + { + if (ny == nrow) + { + ny = 0; + nx++; + } + + DrawLegend(x0 + nx*xdelta, y0 - ny*ydelta, _mchist[i], _mclabel[i].Data(), opt); + ny++; + } + + + // Search signals legend + //---------------------------------------------------------------------------- + for (int i=0; i<_signalhist.size(); i++) + { + DrawLegend(x0 + nx*xdelta, y0 - ny*ydelta, _signalhist[i], _signallabel[i].Data(), "l"); + ny++; + } + + + // Titles + //---------------------------------------------------------------------------- + Float_t xprelim; + if (_drawratio && _datafile) { xprelim = 0.288;} + else if (_drawBinSigf) { xprelim = 0.288;} + else { xprelim = 0.300;} + + if (_title.EqualTo("inclusive")) + { + DrawLatex(61, 0.190, 0.945, 0.050, 11, "CMS"); + DrawLatex(52, xprelim, 0.945, 0.030, 11, "Preliminary"); + } + else + { + DrawLatex(42, 0.190, 0.945, 0.050, 11, _title); + } + + if (_luminosity_fb > 0) + DrawLatex(42, 0.940, 0.945, 0.050, 31, Form("%.3f fb^{-1} (13TeV)", _luminosity_fb)); + else + DrawLatex(42, 0.940, 0.945, 0.050, 31, "(13TeV)"); + + SetAxis(hfirst, xtitle, ytitle, 1.5, 1.8); + if (hname.Contains("SR_MT2Met")) + { + // Special cosmetics + // + // set splitting lines + // done to be used with mc && signal, not with data + double xline1 = hfirst -> GetBinLowEdge(8); double xline2 = hfirst -> GetBinLowEdge(15); + double yline = theMaxSignal + theMaxMC ; + // this can be simplified with DrawLine function: https://root.cern.ch/doc/master/classTLine.html#a25778bcb26868e136825dbe836aa9c66 + //if (_stackoption.Contains("nostack")) yline = 1.5; + canvas ->Update(); + TLine* line1 = new TLine ( xline1, 0.0, xline1, yline ); TLine* line2 = new TLine ( xline2, 0.0, xline2, yline ); + line1 -> SetLineColor(kBlack);line2 -> SetLineColor(kBlack); + line1->Draw();line2->Draw(); + + // set latex information + TLatex* tl1 = new TLatex(0, yline, "SR1"); TLatex* tl2 = new TLatex(xline1, yline, "SR2"); TLatex* tl3 = new TLatex(xline2, yline, "SR3"); + tl1 -> Draw(); tl2 -> Draw(); tl3 -> Draw(); + // set bin legend + hfirst -> GetXaxis()->SetBinLabel(1, "20"); hfirst -> GetXaxis()->SetBinLabel(4, "80"); hfirst -> GetXaxis()->SetBinLabel(7, "140"); //SR1 + hfirst -> GetXaxis()->SetBinLabel(8, "20"); hfirst -> GetXaxis()->SetBinLabel(11, "80"); hfirst -> GetXaxis()->SetBinLabel(14,"140"); //SR2 + hfirst -> GetXaxis()->SetBinLabel(15,"20"); hfirst -> GetXaxis()->SetBinLabel(18, "80"); hfirst -> GetXaxis()->SetBinLabel(21,"140"); //SR3 + + 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; hfirst -> GetXaxis()->SetBinLabel(ibin1, " " + iValue); }} + + } + + //---------------------------------------------------------------------------- + // pad2 + //---------------------------------------------------------------------------- + if (_drawratio && _datafile) + { + pad2->cd(); + + + TH1D* ratio = (TH1D*)_datahist ->Clone("ratio"); + TH1D* uncertainty = (TH1D*)_allmchist->Clone("uncertainty"); + + for (Int_t ibin=1; ibin<=ratio->GetNbinsX(); ibin++) { + + Float_t dtValue = _datahist->GetBinContent(ibin); + Float_t dtError = _datahist->GetBinError (ibin); + + Float_t mcValue = _allmchist->GetBinContent(ibin); + Float_t mcError = _allmchist->GetBinError (ibin); + + Float_t ratioVal = 999; + Float_t ratioErr = 999; + Float_t uncertaintyError = 999; + + if (mcValue > 0) + { + ratioVal = dtValue / mcValue; + ratioErr = dtError / mcValue; + uncertaintyError = ratioVal * mcError / mcValue; + } + + ratio->SetBinContent(ibin, ratioVal); + ratio->SetBinError (ibin, ratioErr); + + uncertainty->SetBinContent(ibin, 1.); + uncertainty->SetBinError (ibin, uncertaintyError); + } + + ratio->SetTitle(""); + + ratio->Draw("ep"); + + ratio->GetXaxis()->SetRangeUser(xmin, xmax); + ratio->GetYaxis()->SetRangeUser(0.85, 1.3); + + uncertainty->Draw("e2,same"); + + ratio->Draw("ep,same"); + + SetAxis(ratio, xtitle, "data / MC", 1.4, 0.75); + } + + else if (_drawBinSigf ) + { + pad2->cd(); + + // Just for three signal, the first ones 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 << " " << "SignalValue = " << SignalValue << " " << "mcValue = " << mcValue << " " << "sqrt(mcValue) = " << sqrt(mcValue) << " " << "signfVal = " << signfVal << std::endl; + 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")){ + //signf0 -> GetXaxis()->SetBinLabel(7, "140"); //SR1 + //signf0 -> GetXaxis()->SetBinLabel(14,"140"); //SR2 + //signf0 -> GetXaxis()->SetBinLabel(21,"140"); //SR3 + + 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); + + + signf1->Draw("ep,same"); + signf2->Draw("ep,same"); + + SetAxis(signf0, xtitle, "S / B", 1.4, 0.75); + + + } + + //---------------------------------------------------------------------------- + // Save it + //---------------------------------------------------------------------------- + canvas->cd(); + + if (_savepdf) canvas->SaveAs(_outputdir + cname + ".pdf"); + if (_savepng) canvas->SaveAs(_outputdir + cname + ".png"); + if (hname.Contains("SR_MT2Met")) canvas->SaveAs(_outputdir + cname + ".C"); + + if (_writeyields) + { + _yields_table << std::endl; + + _yields_table.close(); + } +} + + +//------------------------------------------------------------------------------ +// CrossSection +//------------------------------------------------------------------------------ +void HistogramReader::CrossSection(TString level, + TString channel, + TString process, + Float_t branchingratio, + TString signal1_filename, + Float_t signal1_xs, + Float_t signal1_ngen, + TString signal2_filename, + Float_t signal2_xs, + Float_t signal2_ngen) +{ + if (_luminosity_fb < 0) + { + printf("\n [HistogramReader::CrossSection] Warning: reading negative luminosity\n\n"); + } + + + // Get the signal (example qqWW) + //---------------------------------------------------------------------------- + TFile* signal1_file = new TFile(_inputdir + "/" + signal1_filename + ".root"); + + float signal1_counterLum = Yield((TH1D*)signal1_file->Get(level + "/h_counterLum_" + channel)); + float signal1_counterRaw = Yield((TH1D*)signal1_file->Get(level + "/h_counterRaw_" + channel)); + + float counterSignal = signal1_counterLum * _luminosity_fb; + + float efficiency = signal1_counterRaw / signal1_ngen; + + + // Get the second signal (example ggWW) + //---------------------------------------------------------------------------- + if (!signal2_filename.Contains("NULL")) + { + TFile* signal2_file = new TFile(_inputdir + "/" + signal2_filename + ".root"); + + float signal2_counterLum = Yield((TH1D*)signal2_file->Get(level + "/h_counterLum_" + channel)); + float signal2_counterRaw = Yield((TH1D*)signal2_file->Get(level + "/h_counterRaw_" + channel)); + + counterSignal += (signal2_counterLum * _luminosity_fb); + + float signal1_fraction = signal1_xs / (signal1_xs + signal2_xs); + float signal2_fraction = 1. - signal1_fraction; + + float signal1_efficiency = signal1_counterRaw / signal1_ngen; + float signal2_efficiency = signal2_counterRaw / signal2_ngen; + + efficiency = signal1_fraction*signal1_efficiency + signal2_fraction*signal2_efficiency; + } + + + // Get the backgrounds + //---------------------------------------------------------------------------- + float counterBackground = 0; + + for (UInt_t i=0; i<_mcfile.size(); i++) { + + if (_mclabel[i].EqualTo(process)) continue; + + _mcfile[i]->cd(); + + TH1D* dummy = (TH1D*)_mcfile[i]->Get(level + "/h_counterLum_" + channel); + + float counterDummy = Yield(dummy); + + if (_luminosity_fb > 0 && _mcscale[i] > -999) counterDummy *= _luminosity_fb; + + if (_mcscale[i] > 0) counterDummy *= _mcscale[i]; + + counterBackground += counterDummy; + } + + + // Get the data + //---------------------------------------------------------------------------- + if (_datafile) + { + _datafile->cd(); + + TH1D* dummy = (TH1D*)_datafile->Get(level + "/h_counterLum_" + channel); + + _datahist = (TH1D*)dummy->Clone(); + } + + float counterData = Yield(_datahist); + + + // Cross-section calculation + //---------------------------------------------------------------------------- + float xs = (counterData - counterBackground) / (1e3 * _luminosity_fb * efficiency * branchingratio); + float mu = (counterData - counterBackground) / (counterSignal); + + + // Statistical error + //---------------------------------------------------------------------------- + float xsErrorStat = sqrt(counterData) / (1e3 * _luminosity_fb * efficiency * branchingratio); + float muErrorStat = sqrt(counterData) / (counterSignal); + + + // Print + //---------------------------------------------------------------------------- + printf(" channel = %s\n", channel.Data()); + printf(" ndata = %.0f\n", counterData); + printf(" nbkg = %.2f\n", counterBackground); + printf(" ndata - nbkg = %.2f\n", counterData - counterBackground); + printf(" nsignal = %.2f\n", counterSignal); + printf(" mu = (ndata - nbkg) / nsignal = %.2f +- %.2f (stat) +- %.2f (lumi)\n", mu, muErrorStat, mu * lumi_error_percent / 1e2); + printf(" lumi = %.0f pb\n", 1e3 * _luminosity_fb); + printf(" br = %f\n", branchingratio); + printf(" eff = %.4f\n", efficiency); + printf(" xs = (ndata - nbkg) / (lumi * eff * br) = %.2f +- %.2f (stat) +- %.2f (lumi) pb\n\n", xs, xsErrorStat, xs * lumi_error_percent / 1e2); +} + + +//----------------------------------------------------------------------------- +// DrawLatex +//------------------------------------------------------------------------------ +void HistogramReader::DrawLatex(Font_t tfont, + Float_t x, + Float_t y, + Float_t tsize, + Short_t align, + const char* text, + Bool_t setndc) +{ + TLatex* tl = new TLatex(x, y, text); + + tl->SetNDC (setndc); + tl->SetTextAlign( align); + tl->SetTextFont ( tfont); + tl->SetTextSize ( tsize); + + tl->Draw("same"); +} + + +//------------------------------------------------------------------------------ +// DrawLegend +//------------------------------------------------------------------------------ +TLegend* HistogramReader::DrawLegend(Float_t x1, + Float_t y1, + TH1* hist, + TString label, + TString option, + Bool_t drawyield, + Float_t tsize, + Float_t xoffset, + Float_t yoffset) +{ + drawyield &= (_drawyield && !_publicstyle); + + TLegend* legend = new TLegend(x1, + y1, + x1 + xoffset, + y1 + yoffset); + + legend->SetBorderSize( 0); + legend->SetFillColor ( 0); + legend->SetTextAlign ( 12); + legend->SetTextFont ( 42); + legend->SetTextSize (tsize); + + TString final_label = Form(" %s", label.Data()); + + if (drawyield) + final_label = Form("%s (%.0f)", final_label.Data(), hist->Integral());// changed from Integral(-1,-1) + + if (Yield(hist) < 0) + printf("\n [HistogramReader::DrawLegend] Warning: %s %s yield = %f\n\n", + label.Data(), + hist->GetName(), + hist -> Integral());// changed from Integral(-1,-1) + + + /* std::cout << "-------------------------------------------------------------------\n" << std::endl; + + Int_t numbbins = hist->GetNbinsX(); + float n = hist->Integral(); + std::cout << "proccess " << final_label.Data() << " numbbins " << numbbins << " integral " << n << std::endl; + + std::cout << "-------------------------------------------------------------------\n" << std::endl; +*/ + legend->AddEntry(hist, final_label.Data(), option.Data()); + legend->Draw(); + + WriteYields(hist, label); + + return legend; +} + + +//------------------------------------------------------------------------------ +// GetMaximum +//------------------------------------------------------------------------------ +Float_t HistogramReader::GetMaximum(TH1* hist, + Float_t xmin, + Float_t xmax, + Bool_t binError) +{ + UInt_t nbins = hist->GetNbinsX(); + + TAxis* axis = (TAxis*)hist->GetXaxis(); + + Int_t firstBin = (xmin != -999) ? axis->FindBin(xmin) : 1; + Int_t lastBin = (xmax != -999) ? axis->FindBin(xmax) : nbins; + + Float_t hmax = 0; + + for (Int_t i=firstBin; i<=lastBin; i++) { + + Float_t binHeight = hist->GetBinContent(i); + + if (binError) binHeight += hist->GetBinError(i); + + if (binHeight > hmax) hmax = binHeight; + } + + return hmax; +} + + +//------------------------------------------------------------------------------ +// MoveOverflows +// +// For all histogram types: nbins, xlow, xup +// +// bin = 0; underflow bin +// bin = 1; first bin with low-edge xlow INCLUDED +// bin = nbins; last bin with upper-edge xup EXCLUDED +// bin = nbins+1; overflow bin +// +//------------------------------------------------------------------------------ +void HistogramReader::MoveOverflows(TH1* hist, + Float_t xmin, + Float_t xmax) +{ + int nentries = hist->GetEntries(); + int nbins = hist->GetNbinsX(); + + TAxis* xaxis = (TAxis*)hist->GetXaxis(); + + + // Underflow + //---------------------------------------------------------------------------- + if (xmin != -999) + { + Int_t firstBin = -1; + Float_t firstVal = 0; + Float_t firstErr = 0; + + for (Int_t i=0; i<=nbins+1; i++) + { + if (xaxis->GetBinLowEdge(i) < xmin) + { + firstVal += hist->GetBinContent(i); + firstErr += (hist->GetBinError(i)*hist->GetBinError(i)); + hist->SetBinContent(i, 0); + hist->SetBinError (i, 0); + } + else if (firstBin == -1) + { + firstVal += hist->GetBinContent(i); + firstErr += (hist->GetBinError(i)*hist->GetBinError(i)); + firstBin = i; + } + } + + firstErr = sqrt(firstErr); + + hist->SetBinContent(firstBin, firstVal); + hist->SetBinError (firstBin, firstErr); + } + + + // Overflow + //---------------------------------------------------------------------------- + if (xmax != -999) + { + Int_t lastBin = -1; + Float_t lastVal = 0; + Float_t lastErr = 0; + + for (Int_t i=nbins+1; i>=0; i--) + { + Float_t lowEdge = xaxis->GetBinLowEdge(i); + + if (lowEdge >= xmax) + { + lastVal += hist->GetBinContent(i); + lastErr += (hist->GetBinError(i)*hist->GetBinError(i)); + hist->SetBinContent(i, 0); + hist->SetBinError (i, 0); + } + else if (lastBin == -1) + { + lastVal += hist->GetBinContent(i); + lastErr += (hist->GetBinError(i)*hist->GetBinError(i)); + lastBin = i; + } + } + + lastErr = sqrt(lastErr); + + hist->SetBinContent(lastBin, lastVal); + hist->SetBinError (lastBin, lastErr); + } + + hist->SetEntries(nentries); +} + + +//------------------------------------------------------------------------------ +// SetAxis +//------------------------------------------------------------------------------ +void HistogramReader::SetAxis(TH1* hist, + TString xtitle, + TString ytitle, + Float_t xoffset, + Float_t yoffset) +{ + gPad->cd(); + gPad->Update(); + + // See https://root.cern.ch/doc/master/classTAttText.html#T4 + Float_t padw = gPad->XtoPixel(gPad->GetX2()); + Float_t padh = gPad->YtoPixel(gPad->GetY1()); + + Float_t size = (padw < padh) ? padw : padh; + + size = 20. / size; // Like this label size is always 20 pixels + + TAxis* xaxis = (TAxis*)hist->GetXaxis(); + TAxis* yaxis = (TAxis*)hist->GetYaxis(); + + xaxis->SetTitleOffset(xoffset); + yaxis->SetTitleOffset(yoffset); + + // xaxis->SetLabelOffset(5.*xaxis->GetLabelOffset()); // It works for Juan + // yaxis->SetLabelOffset(3.*yaxis->GetLabelOffset()); // It works for Juan + + xaxis->SetLabelSize(size); + yaxis->SetLabelSize(size); + xaxis->SetTitleSize(size); + yaxis->SetTitleSize(size); + + xaxis->SetTitle(xtitle); + yaxis->SetTitle(ytitle); + + yaxis->CenterTitle(); + + gPad->GetFrame()->DrawClone(); + gPad->RedrawAxis(); +} + + +//------------------------------------------------------------------------------ +// SetHistogram +//------------------------------------------------------------------------------ +void HistogramReader::SetHistogram(TH1* hist, + Color_t color, + Style_t fstyle, + Style_t mstyle, + Style_t lstyle, + Width_t lwidth, + Int_t ngroup, + Bool_t moveoverflow, + Float_t& xmin, + Float_t& xmax) +{ + if (!hist) + { + printf("\n [HistogramReader::SetHistogram] Error: histogram does not exist\n\n"); + return; + } + + if (xmin == -999) xmin = hist->GetXaxis()->GetXmin(); + if (xmax == -999) xmax = hist->GetXaxis()->GetXmax(); + + hist->SetFillColor(color ); + hist->SetFillStyle(fstyle); + + hist->SetLineColor(color ); + hist->SetLineStyle(lstyle); + hist->SetLineWidth(lwidth); + + hist->SetMarkerColor(color ); + hist->SetMarkerStyle(mstyle); + + if (_stackoption.Contains("nostack") && Yield(hist) > 0) + { + hist->SetFillStyle(0); + hist->SetLineWidth(2); + TString hname = hist->GetName(); + + if (hname.Contains("SR_MT2Met")) + { + int n = hist -> GetNbinsX(); + for (int ibin = 1; ibin <= n; ibin++ ){ + + float BinContent = hist->GetBinContent(ibin); + + int firstbin; if (ibin<=7) firstbin = 1; else if (ibin<=14) firstbin = 8; else if (ibin<=21) firstbin = 15; + + int lastbin; if (ibin<=7) lastbin = 7; else if (ibin<=14) lastbin = 14; else if (ibin<=21) lastbin = 21; + + float SRIntegral = hist->Integral(firstbin,lastbin); + + hist->SetBinContent(ibin, BinContent/SRIntegral); + } + } + else + { + hist->Scale(1. / Yield(hist)); + } + + } + + // Rebin and move overflow bins + //---------------------------------------------------------------------------- + if (ngroup > 0) hist->Rebin(ngroup); + + if (moveoverflow) MoveOverflows(hist, xmin, xmax); +} + + +//------------------------------------------------------------------------------ +// Yield +//------------------------------------------------------------------------------ +Float_t HistogramReader::Yield(TH1* hist) +{ + if (!hist) return 0; + + + Int_t nbins = hist->GetNbinsX(); + + + return hist->Integral(); // Change from Integral (-1,-1); +} + + +//------------------------------------------------------------------------------ +// Error +//------------------------------------------------------------------------------ +Float_t HistogramReader::Error(TH1* hist) +{ + if (!hist) return 0; + + Float_t hist_error = sqrt(hist->GetSumw2()->GetSum()); + + return hist_error; +} + + +//------------------------------------------------------------------------------ +// EventsByCut +//------------------------------------------------------------------------------ +void HistogramReader::EventsByCut(TFile* file, + TString analysis, + TString hname) +{ + // Check if the evolution histogram already exists + TH1D* test_hist = (TH1D*)file->Get(analysis + "/" + hname + "_evolution"); + + if (test_hist) return; + + + // Get the number of bins + Int_t nbins = 0; + + for (Int_t i=0; icd(analysis); + + TH1D* hist = new TH1D(hname + "_evolution", "", nbins, -0.5, nbins-0.5); + + for (Int_t i=0, bin=0; iGet(scut[i] + "/" + hname); + + bin++; + + hist->SetBinContent(bin, Yield(dummy)); + hist->SetBinError (bin, Error(dummy)); + + + // Change the evolution histogram x-axis labels + TString tok, icut; + + Ssiz_t from = 0; + + while (scut[i].Tokenize(tok, from, "_")) icut = tok; + + hist->GetXaxis()->SetBinLabel(bin, icut); + } + + + // Write the evolution histogram + hist->Write(); + file->cd(); +} + + +//------------------------------------------------------------------------------ +// LoopEventsByCut +//------------------------------------------------------------------------------ +void HistogramReader::LoopEventsByCut(TString analysis, TString hname) +{ + if (_datafile) EventsByCut(_datafile, analysis, hname); + + for (UInt_t i=0; i<_mcfile.size(); i++) EventsByCut(_mcfile[i], analysis, hname); + + for (UInt_t i=0; i<_signalfile.size(); i++) EventsByCut(_signalfile[i], analysis, hname); +} + + +//------------------------------------------------------------------------------ +// EventsByChannel +//------------------------------------------------------------------------------ +void HistogramReader::EventsByChannel(TFile* file, + TString level) +{ + // Check if the evolution histogram already exists + TH1D* test_hist = (TH1D*)file->Get(level + "/h_counterLum_evolution"); + + if (test_hist) return; + + + // Get the number of bins + Int_t firstchannel = (level.Contains("WZ/")) ? eee : ee; + Int_t lastchannel = (level.Contains("WZ/")) ? lll : ll; + + Int_t nbins = 0; + + for (Int_t i=firstchannel; i<=lastchannel; i++) nbins++; + + + // Create and fill the evolution histogram + file->cd(level); + + TH1D* hist = new TH1D("h_counterLum_evolution", "", nbins, -0.5, nbins-0.5); + + for (Int_t i=firstchannel, bin=0; i<=lastchannel; i++) + { + TH1D* dummy = (TH1D*)file->Get(level + "/h_counterLum_" + schannel[i]); + + bin++; + + hist->SetBinContent(bin, Yield(dummy)); + hist->SetBinError (bin, Error(dummy)); + + hist->GetXaxis()->SetBinLabel(bin, lchannel[i]); + } + + + // Write the evolution histogram + hist->Write(); + file->cd(); +} + + +//------------------------------------------------------------------------------ +// LoopEventsByChannel +//------------------------------------------------------------------------------ +void HistogramReader::LoopEventsByChannel(TString level) +{ + if (_datafile) EventsByChannel(_datafile, level); + + for (UInt_t i=0; i<_mcfile.size(); i++) EventsByChannel(_mcfile[i], level); + + for (UInt_t i=0; i<_signalfile.size(); i++) EventsByChannel(_signalfile[i], level); +} + + +//------------------------------------------------------------------------------ +// GetBestScoreX +//------------------------------------------------------------------------------ +Float_t HistogramReader::GetBestScoreX(TH1* sig_hist, + TH1* bkg_hist, + TString fom) +{ + Int_t nbins = sig_hist->GetNbinsX(); + + Float_t score_value = 0; + Float_t score_x = 0; + Float_t sig_total = Yield(sig_hist); + + + // For The Punzi Effect + // http://arxiv.org/pdf/physics/0308063v2.pdf + Float_t a = 5.; + Float_t b = 1.645; // Corresponds to a p-value equal to 0.05 + + + for (UInt_t k=0; kIntegral(k, nbins+1); + Float_t bkg_yield = bkg_hist->Integral(k, nbins+1); + + Float_t sig_eff = (sig_total > 0.) ? sig_yield / sig_total : -999; + + if (sig_yield > 0. && bkg_yield > 0.) + { + Float_t score = -999; + + if (fom.EqualTo("S / #sqrt{B}")) score = sig_yield / sqrt(bkg_yield); + if (fom.EqualTo("S / #sqrt{S+B}")) score = sig_yield / sqrt(sig_yield + bkg_yield); + if (fom.EqualTo("S / B")) score = sig_yield / bkg_yield; + if (fom.EqualTo("Punzi Eq.6")) score = sig_eff / (b*b + 2*a*sqrt(bkg_yield) + b*sqrt(b*b + 4*a*sqrt(b) + 4*bkg_yield)); + if (fom.EqualTo("Punzi Eq.7")) score = sig_eff / (a/2 + sqrt(bkg_yield)); + + if (score > score_value) + { + score_value = score; + score_x = sig_hist->GetBinCenter(k); + } + } + } + + + printf("\n [HistogramReader::GetBestScoreX] x = %.2f (%.2f < x < %.2f) has the best %s (%f)\n\n", + score_x, + sig_hist->GetXaxis()->GetXmin(), + sig_hist->GetXaxis()->GetXmax(), + fom.Data(), + score_value); + + + return score_x; +} + + +//------------------------------------------------------------------------------ +// GetBestSignalScoreX +//------------------------------------------------------------------------------ +Float_t HistogramReader::GetBestSignalScoreX(TString hname, + TString fom, + Int_t ngroup) +{ + printf("\n [HistogramReader::GetBestSignalScoreX] Warning: reading only the first signal\n"); + + + // Get the signals + //---------------------------------------------------------------------------- + _signalhist.clear(); + + for (UInt_t i=0; i<_signalfile.size(); i++) { + + _signalfile[i]->cd(); + + TH1D* dummy = (TH1D*)_signalfile[i]->Get(hname); + + _signalhist.push_back((TH1D*)dummy->Clone()); + + if (_luminosity_fb > 0) _signalhist[i]->Scale(_luminosity_fb); + + if (ngroup > 0) _signalhist[i]->Rebin(ngroup); + } + + + // Get the backgrounds + //---------------------------------------------------------------------------- + _mchist.clear(); + + THStack* mcstack = new THStack(hname + "_mcstack", hname + "_mcstack"); + + for (UInt_t i=0; i<_mcfile.size(); i++) { + + _mcfile[i]->cd(); + + TH1D* dummy = (TH1D*)_mcfile[i]->Get(hname); + + _mchist.push_back((TH1D*)dummy->Clone()); + + if (_luminosity_fb > 0 && _mcscale[i] > -999) _mchist[i]->Scale(_luminosity_fb); + + if (_mcscale[i] > 0) _mchist[i]->Scale(_mcscale[i]); + + if (ngroup > 0) _mchist[i]->Rebin(ngroup); + + mcstack->Add(_mchist[i]); + } + + + // Get the best score + //---------------------------------------------------------------------------- + TH1D* backgroundhist = (TH1D*)(mcstack->GetStack()->Last()); + + return GetBestScoreX(_signalhist[0], backgroundhist, fom); +} + + +//------------------------------------------------------------------------------ +// WriteYields +//------------------------------------------------------------------------------ +void HistogramReader::WriteYields(TH1* hist, + TString label) +{ + TString hname = hist->GetName(); + + if (!_writeyields) return; + + if (_writelabels) + { + _writelabels = false; + + _yields_table << Form("\n %14s", " "); + + for (int i=1; i<=hist->GetNbinsX(); i++) { + + TString binlabel = (TString)hist->GetXaxis()->GetBinLabel(i); + + _yields_table << Form(" | %-32s", binlabel.Data()); + } + + _yields_table << Form("\n"); + } + + _yields_table << Form(" %14s", label.Data()); + + for (int i=1; i<=hist->GetNbinsX(); i++) { + + float process_yield = hist->GetBinContent(i); + float process_error = sqrt(hist->GetSumw2()->At(i)); + + if (label.EqualTo("data")) + { + _yields_table << Form(" | %8.0f %14s", process_yield, " "); + } + else + { + _yields_table << Form(" | %11.2f +/- %7.2f", process_yield, process_error); + } + + int denominator = (hname.Contains("counterLum_evolution")) ? hist->GetNbinsX() : 1; + + float process_percent = 1e2 * process_yield / hist->GetBinContent(denominator); + + _yields_table << Form(" (%5.1f%s)", process_percent, "%"); + } + + _yields_table << Form("\n"); +} + + +//------------------------------------------------------------------------------ +// Roc +//------------------------------------------------------------------------------ +void HistogramReader::Roc(TString hname, + TString xtitle, + Int_t npoints, + TString units, + Float_t xmin, + Float_t xmax, + TString fom) +{ + // Get the signal + //---------------------------------------------------------------------------- + THStack* stack_sig = new THStack(hname + "_stack_sig", hname + "_stack_sig"); + + for (int i=0; i<_roc_signalfile.size(); ++i) + { + _roc_signalfile[i]->cd(); + + TH1D* dummy = (TH1D*)(_roc_signalfile[i]->Get(hname))->Clone(); + + if (_luminosity_fb > 0 && _roc_signalscale[i] > -999) dummy->Scale(_luminosity_fb); + + stack_sig->Add(dummy); + } + + TH1D* hSig = (TH1D*)(stack_sig->GetStack()->Last()); + + + // Get the backgrounds + //---------------------------------------------------------------------------- + THStack* stack_bkg = new THStack(hname + "_stack_bkg", hname + "_stack_bkg"); + + for (int j=0; j<_roc_backgroundfile.size(); ++j) + { + _roc_backgroundfile[j]->cd(); + + TH1D* dummy = (TH1D*)(_roc_backgroundfile[j]->Get(hname))->Clone(); + + if (_luminosity_fb > 0 && _roc_backgroundscale[j] > -999) dummy->Scale(_luminosity_fb); + + stack_bkg->Add(dummy); + } + + TH1D* hBkg = (TH1D*)(stack_bkg->GetStack()->Last()); + + + // For The Punzi Effect + // http://arxiv.org/pdf/physics/0308063v2.pdf + Float_t a = 5.; + Float_t b = 1.645; // Corresponds to a p-value equal to 0.05 + + + // Compute ROC and significance + //---------------------------------------------------------------------------- + float step = (xmax - xmin) / npoints; + + TGraph* rocGraph_min = new TGraph(); + TGraph* rocGraph_max = new TGraph(); + TGraph* sigGraph_min = new TGraph(); + TGraph* sigGraph_max = new TGraph(); + + Float_t score_value_min = 0; + Float_t score_value_max = 0; + Float_t score_x_min = 0; + Float_t score_x_max = 0; + + Float_t sigEff_score_x_min = -999; + Float_t bkgEff_score_x_min = -999; + Float_t sigEff_score_x_max = -999; + Float_t bkgEff_score_x_max = -999; + + Float_t sigTotal = hSig->Integral(-1, -1); + Float_t bkgTotal = hBkg->Integral(-1, -1); + + for (int s=0; s<=npoints; ++s) { + + Float_t sigYield_min = 0; + Float_t sigYield_max = 0; + Float_t bkgYield_min = 0; + Float_t bkgYield_max = 0; + + sigYield_max += hSig->Integral(-1, hSig->FindBin(xmin + s*step)); + bkgYield_max += hBkg->Integral(-1, hBkg->FindBin(xmin + s*step)); + + sigYield_min += hSig->Integral(hSig->FindBin(xmin + s*step), -1); + bkgYield_min += hBkg->Integral(hBkg->FindBin(xmin + s*step), -1); + + Float_t sigEff_max = (sigTotal != 0) ? sigYield_max / sigTotal : -999; + Float_t bkgEff_max = (bkgTotal != 0) ? bkgYield_max / bkgTotal : -999; + + Float_t sigEff_min = (sigTotal != 0) ? sigYield_min / sigTotal : -999; + Float_t bkgEff_min = (bkgTotal != 0) ? bkgYield_min / bkgTotal : -999; + + Float_t score_min = -999; + + if (sigYield_min > 0. && bkgYield_min > 0.) + { + if (fom.EqualTo("S / #sqrt{B}")) score_min = sigYield_min / sqrt(bkgYield_min); + if (fom.EqualTo("S / #sqrt{S+B}")) score_min = sigYield_min / sqrt(bkgYield_min + sigYield_min); + if (fom.EqualTo("S / B")) score_min = sigYield_min / bkgYield_min; + if (fom.EqualTo("Punzi Eq.6")) score_min = sigEff_min / (b*b + 2*a*sqrt(bkgYield_min) + b*sqrt(b*b + 4*a*sqrt(b) + 4*bkgYield_min)); + if (fom.EqualTo("Punzi Eq.7")) score_min = sigEff_min / (a/2 + sqrt(bkgYield_min)); + } + + Float_t score_max = -999; + + if (sigYield_max > 0. && bkgYield_max > 0.) + { + if (fom.EqualTo("S / #sqrt{B}")) score_max = sigYield_max / sqrt(bkgYield_max); + if (fom.EqualTo("S / #sqrt{S+B}")) score_max = sigYield_max / sqrt(bkgYield_max + sigYield_max); + if (fom.EqualTo("S / B")) score_max = sigYield_max / bkgYield_max; + if (fom.EqualTo("Punzi Eq.6")) score_max = sigEff_max / (b*b + 2*a*sqrt(bkgYield_max) + b*sqrt(b*b + 4*a*sqrt(b) + 4*bkgYield_max)); + if (fom.EqualTo("Punzi Eq.7")) score_max = sigEff_max / (a/2 + sqrt(bkgYield_max)); + } + + if (score_min > score_value_min) { + score_value_min = score_min; + score_x_min = xmin + s*step; + sigEff_score_x_min = sigEff_min; + bkgEff_score_x_min = bkgEff_min; + } + + if (score_max > score_value_max) { + score_value_max = score_max; + score_x_max = xmin + s*step; + sigEff_score_x_max = sigEff_max; + bkgEff_score_x_max = bkgEff_max; + } + + rocGraph_min->SetPoint(s, sigEff_min, 1 - bkgEff_min); + rocGraph_max->SetPoint(s, sigEff_max, 1 - bkgEff_max); + + sigGraph_min->SetPoint(s, xmin + s*step, score_min); + sigGraph_max->SetPoint(s, xmin + s*step, score_max); + } + + + printf("\n"); + printf(" [HistogramReader::Roc] Reading %s from %.2f to %.2f\n\n", hname.Data(), xmin, xmax); + printf(" The best %s (%f) corresponds to x > %7.2f %s (S_eff = %6.2f\%, B_eff = %6.2f\%)\n", + fom.Data(), + score_value_min, + score_x_min, + units.Data(), + 1e2 * sigEff_score_x_min, + 1e2 * bkgEff_score_x_min); + printf(" The best %s (%f) corresponds to x < %7.2f %s (S_eff = %6.2f\%, B_eff = %6.2f\%)\n", + fom.Data(), + score_value_max, + score_x_max, + units.Data(), + 1e2 * sigEff_score_x_max, + 1e2 * bkgEff_score_x_max); + printf("\n"); + + + // Draw and save ROC + //---------------------------------------------------------------------------- + Color_t color_min = kRed+1; + Color_t color_max = kBlack; + + Style_t style_min = kFullCircle; + Style_t style_max = kOpenCircle; + + TCanvas* rocCanvas = new TCanvas(hname + " ROC", hname + " ROC"); + + rocGraph_min->SetMarkerColor(color_min); + rocGraph_min->SetMarkerStyle(style_min); + rocGraph_min->SetMarkerSize(0.5); + + rocGraph_max->SetMarkerColor(color_max); + rocGraph_max->SetMarkerStyle(style_max); + rocGraph_max->SetMarkerSize(0.5); + + rocGraph_min->Draw("ap"); + rocGraph_max->Draw("psame"); + + rocGraph_min->GetXaxis()->SetRangeUser(0, 1); + rocGraph_min->GetYaxis()->SetRangeUser(0, 1); + + DrawLatex(42, 0.190, 0.945, 0.050, 11, _title); + + SetAxis(rocGraph_min->GetHistogram(), xtitle + " signal efficiency", xtitle + " background rejection", 1.5, 1.8); + + if (_savepdf) rocCanvas->SaveAs(_outputdir + hname + "_ROC.pdf"); + if (_savepng) rocCanvas->SaveAs(_outputdir + hname + "_ROC.png"); + + + // Draw and save significance + //---------------------------------------------------------------------------- + TCanvas *sigCanvas = new TCanvas(hname + " significance", hname + " significance"); + + TString myxtitle = (!units.Contains("NULL")) ? xtitle + " [" + units + "]" : xtitle; + + sigGraph_min->SetMarkerColor(color_min); + sigGraph_min->SetMarkerStyle(style_min); + sigGraph_min->SetMarkerSize(0.5); + + sigGraph_max->SetMarkerColor(color_max); + sigGraph_max->SetMarkerStyle(style_max); + sigGraph_max->SetMarkerSize(0.5); + + sigGraph_min->Draw("ap"); + sigGraph_max->Draw("psame"); + + Float_t ymax = (score_value_min > score_value_max) ? score_value_min : score_value_max; + + ymax *= 1.5; + + sigGraph_min->GetXaxis()->SetRangeUser(xmin, xmax); + sigGraph_min->GetYaxis()->SetRangeUser( 0, ymax); + + DrawLatex(42, 0.190, 0.945, 0.050, 11, _title); + + TH1F* dummy_min = new TH1F("dummy_min", "", 1, 0, 1); + TH1F* dummy_max = new TH1F("dummy_max", "", 1, 0, 1); + + dummy_min->SetLineColor (color_min); + dummy_min->SetMarkerColor(color_min); + dummy_min->SetMarkerStyle(style_min); + + dummy_max->SetLineColor (color_max); + dummy_max->SetMarkerColor(color_max); + dummy_max->SetMarkerStyle(style_max); + + DrawLegend(0.22, 0.84, dummy_min, Form("%s > x", xtitle.Data()), "lp", false); + DrawLegend(0.22, 0.77, dummy_max, Form("%s < x", xtitle.Data()), "lp", false); + + SetAxis(sigGraph_min->GetHistogram(), myxtitle, fom, 1.5, 2.1); + + if (_savepdf) sigCanvas->SaveAs(_outputdir + hname + "_significance.pdf"); + if (_savepng) sigCanvas->SaveAs(_outputdir + hname + "_significance.png"); + + dummy_min->Delete(); + dummy_max->Delete(); +} + + +// ----------------------------------------------------------------------------- +// IncludeSystematics +//------------------------------------------------------------------------------ +void HistogramReader::IncludeSystematics(TString hname) +{ + int nsystematics = _systematics.size(); + int nbins = _mchist[0]->GetNbinsX(); + int nprocess = _mchist.size(); + + // Table variables + float yieldTab [nprocess][nbins]; + float errStatTab [nprocess][nbins]; + float errsystTab_do [nprocess][nsystematics][nbins]; + float errsystTab_up [nprocess][nsystematics][nbins]; + for (int i=0; i < nsystematics; i++){for (int j=1; j<=nbins; j++){ for (int k=0; k Get( hname );//nominal + TH1D* dummy1 = (TH1D*)myfile1->Get( hname );//up + TH1D* dummy2 = (TH1D*)myfile2->Get( hname );//down + + if (_luminosity_fb > 0 && _mcscale[kproce] > -999) + { + dummy0->Scale(_luminosity_fb); + dummy1->Scale(_luminosity_fb); + dummy2->Scale(_luminosity_fb); + } + + if (_mcscale[kproce] > 0) + { + dummy0->Scale(_mcscale[kproce]); + dummy1->Scale(_mcscale[kproce]); + dummy2->Scale(_mcscale[kproce]); + } + + // Print Process name + printf( " \n"); + printf("process name %s\n", _mcfilename.at(kproce).Data()); + printf( " \n"); + + // Loop over all bins (Underflow is not included) + //-------------------------------------------------------------------- + for (int ibin=1; ibin<=nbins; ibin++) + { + errSystUp [isyst][ibin] += (dummy1->GetBinContent(ibin) - dummy0->GetBinContent(ibin)); + errSystDo [isyst][ibin] += (dummy2->GetBinContent(ibin) - dummy0->GetBinContent(ibin)); + + yieldTab [kproce][ibin] = dummy0->GetBinContent(ibin); + errStatTab [kproce][ibin] = dummy0->GetSumw2()->At(ibin); + errsystTab_up[kproce][isyst][ibin] = dummy1->GetBinContent(ibin) - dummy0->GetBinContent(ibin); + errsystTab_do[kproce][isyst][ibin] = dummy2->GetBinContent(ibin) - dummy0->GetBinContent(ibin); + // Print Bin Information per process + printf( "Print Bin Information per process \n"); + printf( " \n"); + printf( " bin number = %i\n", ibin ); + printf( " \n"); + printf( " nominal = %f\n", dummy0->GetBinContent(ibin)); + printf( " SF+ errUp = %f\n", dummy1->GetBinContent(ibin)); + printf( " SF+ errDo = %f\n", dummy2->GetBinContent(ibin)); + // Print Systematic Error per process + printf( "Print Systematic Error per process \n"); + printf( " \n"); + printf( " ErrsystUp = %.5f\n", (dummy1->GetBinContent(ibin) - dummy0->GetBinContent(ibin)) ); + printf( " ErrsystDo = %.5f\n", (dummy2->GetBinContent(ibin) - dummy0->GetBinContent(ibin)) ); + printf( " rel_ErrsystUp = %.5f %\n", (dummy1->GetBinContent(ibin) - dummy0->GetBinContent(ibin)) / dummy0->GetBinContent(ibin) ); + printf( " rel_ErrsystDo = %.5f %\n", (dummy2->GetBinContent(ibin) - dummy0->GetBinContent(ibin)) / dummy0->GetBinContent(ibin) ); + + // + + } + + + myfile0->Close(); + myfile1->Close(); + myfile2->Close(); + + } + } + + std::ofstream inFile("Yields_" + _mycut +".tex",std::ios::out); + // Process | nbins = 7; + inFile << "\\begin{tabular}{|c|c|c|c|c|c|c|c|}" << endl; + inFile << "\\hline" << endl; + inFile << _mycut << endl; + //Yield & stat_error & systematic_error & total_error" << endl; + inFile << "\\hline" << endl; + inFile << "ibin &"; + for (int ibin=1; ibin<=nbins; ibin++) + { + inFile << ibin << "&"; + } + inFile << "\\hline" << endl; + for (int kproce=0; kproceGetSumw2()->At(ibin)); + x [ibin] = _allmchist ->GetXaxis()->GetBinCenter(ibin); + y [ibin] = _allmchist ->GetBinContent(ibin); + errLumi [ibin] = y[ibin] * lumi_error_percent/1e2; + errTrig [ibin] = y[ibin] * 1/1e2; + exl [ibin] = (_allmchist -> GetXaxis() -> GetBinWidth(ibin))/2; + exh [ibin] = exl[ibin]; + + //Print Stat and flat errors per bin + printf( "bin number = %i\n", ibin ); + printf( " \n"); + printf( "--------------------- Flat errors ----------------------------\n" ); + printf( "---------------------------------------------------------\n"); + printf( " \n"); + printf( "errStat = %f\n", errStat [ibin] ); + printf( "errLumi = %f\n", errLumi [ibin] ); + printf( "errTrig = %f\n", errTrig [ibin] ); + printf( "rel_errStat = %f %\n", errStat [ibin] / y [ibin] ); + printf( "rel_errLumi = %f %\n", errLumi [ibin] / y [ibin]); + printf( "rel_errTrig = %f %\n", errTrig [ibin] / y [ibin]); + printf( " \n"); + printf( "--------------------------------------------------------\n" ); + + + float systUp2 = 0; + float systDo2 = 0; + float systSym2 = 0; + + for (int isyst =0; isyst< nsystematics; isyst++) + { + + if ( errSystUp [isyst][ibin] * errSystDo [isyst][ibin] > 0 ) + { + printf( "WARNING! errSystUp and errSystDo have the same sign!\n") ; + printf( "The systematic is %s, the bin is %i \n\n", _systematics.at(isyst).Data(), ibin); + printf( "errSystUp = %f\n errSystDo = %f\n", errSystUp [isyst][ibin], errSystDo [isyst][ibin]); + } + + // Assymetric errors + if ( errSystUp [isyst][ibin] < 0 && errSystDo [isyst][ibin] > 0 ) + { + float midErrUp = errSystUp [isyst][ibin]; + float midErrDo = errSystDo[isyst][ibin]; + errSystUp [isyst][ibin] = midErrDo; + errSystDo [isyst][ibin] = midErrUp; + } + + systUp2 += errSystUp [isyst][ibin] * errSystUp [isyst][ibin]; + systDo2 += errSystDo [isyst][ibin] * errSystDo [isyst][ibin]; + // Symmetric errors + //systSym2 += sqrt( (errSystUp [isyst][ibin] + errSystDo [isyst][ibin]) * (errSystUp [isyst][ibin] + errSystDo [isyst][ibin]) ) / 2 ; + + // Print Systematic Total Errors (sum over all processe---s) + printf( " \n"); + printf( "---- %s Systematic Total Error\n", _systematics.at(isyst).Data()); +// printf( "systematic name %s \n", _systematics.at(isyst).Data() ); + printf( " \n"); + printf( "ErrsystUp = %.5f\n", errSystUp [isyst][ibin] ); + printf( "ErrsystDo = %.5f\n", errSystDo [isyst][ibin] ); + printf( "rel_ErrsystUp = %.5f %\n", errSystUp [isyst][ibin] / y [ibin] ); + printf( "rel_ErrsystDo = %.5f %\n", errSystDo [isyst][ibin] / y [ibin] ); + printf( "ErrsystSym = %.5f\n", fabs(errSystUp [isyst][ibin])/2 + fabs(errSystDo [isyst][ibin])/2 ); + printf( "----------------------------------------------------------\n"); + printf( " \n"); + + } + + eyl [ibin] = sqrt( errStat[ibin] * errStat[ibin] + errLumi[ibin]*errLumi[ibin] + systDo2); + eyh [ibin] = sqrt( errStat[ibin] * errStat[ibin] + errLumi[ibin]*errLumi[ibin] + systUp2); + + //Print Total Error per bin + printf( "----------------------- Total Error -------------------\n"); + printf( "err_up = %.5f\n", eyh [ibin] ); + printf( "err_down = %.5f\n", eyl [ibin] ); + printf( "rel_err_down = %.5f %\n", eyl [ibin] / y [ibin] ); + printf( "rel_err_up = %.5f %\n", eyh [ibin] / y [ibin]); + printf( "----------------------------------------------------------\n"); + printf( " \n"); + + + } + + _ErrorGr = new TGraphAsymmErrors(nbins,x,y,exl,exh,eyl,eyh); + + _ErrorGr->SetMarkerColor(kGray+1); + _ErrorGr->SetMarkerSize ( 0); + _ErrorGr->SetLineColor (kGray+1); + _ErrorGr->SetFillColor (kGray+1); + _ErrorGr->SetFillStyle ( 3345); + + +} + From d44ca1e0f5324c7d6885b38a62db6f2454b8f8ba Mon Sep 17 00:00:00 2001 From: Barbara Date: Tue, 7 Nov 2017 18:50:50 +0100 Subject: [PATCH 12/28] _drawsignificance in Barbara's stuff --- stop/runPlotter.C | 18 +++++---- test/HistogramReader.C | 88 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 98 insertions(+), 8 deletions(-) diff --git a/stop/runPlotter.C b/stop/runPlotter.C index edbbfe1c..4c68336d 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -14,7 +14,8 @@ const TString inputdir = "../minitrees/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles/ZpeakDYcorrections/"; //const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsTestAddBkg/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfitasimov/"; -const TString outputdir = "figures_TableTest/"; +const TString outputdir = "figure_05Paper/"; +//const TString outputdir = "figures_TableTest/"; //const TString outputdir = "figures_WZtoWW_vetoNewCut2_CheckVeto2_Mt2ll/"; //const TString outputdir = "figures_WZtoWW_vetoNewCut2_ZVeto/"; //const TString outputdir = "figures_WW_Mimic/"; @@ -83,7 +84,8 @@ void runPlotter(TString level, else { plotter.SetLuminosity(lumi, postfitplots); - plotter.SetDrawRatio (true); + //plotter.SetDrawRatio (true); + plotter.SetDrawSignificance(true); } float SF_ttZ = 1., SF_ZMet = 1., SF_DY = 1.; @@ -123,12 +125,13 @@ void runPlotter(TString level, plotter.AddProcess("02_WZTo3LNu_toWW_NoZVeto", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); plotter.AddProcess("02_WZTo3LNu_toWW", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); */ - plotter.AddProcess("13_VVV", "VVV", color_VVV); plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background );//, SF_ttZ); plotter.AddProcess("11_HWW", "HWW", color_HWW); plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_VZ, roc_background); //, SF_ZMet); - plotter.AddProcess("15_VZ", "VZ", color_VZ, roc_background); //, SF_ZMet); + //plotter.AddProcess("15_VZ", "VZ", color_VZ, roc_background); //, SF_ZMet); + //plotter.AddProcess("13_VVV", "VVV", color_VVV); + plotter.AddProcess("15_VZ3V", "VVV+VZ", color_VVV, roc_background); //, SF_ZMet); plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background); plotter.AddProcess("02_WZTo3LNu", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background); //, 0.97); plotter.AddProcess("06_WW", "WW", color_WW); @@ -156,9 +159,10 @@ void runPlotter(TString level, // Tabla Paper //plotter.AddSignal("T2tt_mStop-150to250_Sm150_Xm25", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=150, m_{#tilde{#chi}^{0}_{1}}=25)",4); - //plotter.AddSignal("T2tt_mStop-250to350_Sm275_Xm150", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=275, m_{#tilde{#chi}^{0}_{1}}=150)",4); + plotter.AddSignal("T2tt_mStop-250to350_Sm275_Xm150", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=275, m_{#tilde{#chi}^{0}_{1}}=150)",4); plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",6); - //plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); + plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); + //plotter.AddSignal("TChiSlepExt_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); //plotter.AddSignal("TChiSlep_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); //plotter.AddSignal("TChiSWW_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); @@ -313,7 +317,7 @@ void runPlotter(TString level, std::cout << "before plotter" << std::endl; // Common histograms //-------------------------------------------------------------------- - plotter.Draw(prefix + "MT2ll" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", linY, false, 0, 140); + plotter.Draw(prefix + "MT2ll" + suffix, "M_{T2}(" + sll + ")", 1, 0, "GeV", scale, false, 0, 140); /* plotter.Draw(prefix + "m2L" + suffix, "m_{" + sll + "}", -1, 0, "GeV", linY); plotter.Draw(prefix + "lep1eta" + suffix, "leading lepton #eta", -1, 1, "NULL", scale); plotter.Draw(prefix + "lep2eta" + suffix, "trailing lepton #eta", -1, 1, "NULL", scale); diff --git a/test/HistogramReader.C b/test/HistogramReader.C index 83aa3076..d8e03c79 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -497,7 +497,9 @@ void HistogramReader::Draw(TString hname, // Standard Model processes legend //---------------------------------------------------------------------------- - Int_t nrow = (_mchist.size() >= 11) ? 5 : 4; + + //Int_t nrow = (!_datahist=NULL && _mchist.size() >= 11) ? 5 : 4; + Int_t nrow = (_mchist.size() > 11) ? 5 : 4; for (int i=0; i<_mchist.size(); i++) { @@ -632,7 +634,91 @@ 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); + + signf1->Draw("ep,same"); + signf2->Draw("ep,same"); + + SetAxis(signf0, xtitle, "S / B", 1.4, 0.75); + } //---------------------------------------------------------------------------- From debafdef755fcb2fd3cd80505175e192405aac10 Mon Sep 17 00:00:00 2001 From: Barbara Date: Wed, 15 Nov 2017 16:05:28 +0100 Subject: [PATCH 13/28] my plotter --- stop/runPlotter.C | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/stop/runPlotter.C b/stop/runPlotter.C index 4c68336d..f9f8fab2 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -4,7 +4,7 @@ //------------------------------------------------------------------------------ const Bool_t datadriven = false; const Bool_t allplots = false; -const Bool_t dosystematics = true; +const Bool_t dosystematics = false; const Bool_t postfitplots = false; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; @@ -84,8 +84,8 @@ void runPlotter(TString level, else { plotter.SetLuminosity(lumi, postfitplots); - //plotter.SetDrawRatio (true); - plotter.SetDrawSignificance(true); + plotter.SetDrawRatio (true); + //plotter.SetDrawSignificance(true); } float SF_ttZ = 1., SF_ZMet = 1., SF_DY = 1.; @@ -132,7 +132,8 @@ void runPlotter(TString level, //plotter.AddProcess("15_VZ", "VZ", color_VZ, roc_background); //, SF_ZMet); //plotter.AddProcess("13_VVV", "VVV", color_VVV); plotter.AddProcess("15_VZ3V", "VVV+VZ", color_VVV, roc_background); //, SF_ZMet); - plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background); + plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets, roc_background); + //plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background); plotter.AddProcess("02_WZTo3LNu", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background); //, 0.97); plotter.AddProcess("06_WW", "WW", color_WW); plotter.AddProcess("05_ST", "tW", color_ST); @@ -145,9 +146,9 @@ void runPlotter(TString level, if (signal=="T2tt") { - //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm175", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=175)",2); - //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",3); - //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm263", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=263)",6); + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm175", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=175)",2); + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",3); + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm263", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=263)",6); //plotter.AddSignal("T2tt_mStop-150to250_Sm250_Xm125", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=250, m_{#tilde{#chi}^{0}_{1}}=125)",4); //plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); /* plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,225)",kViolet); @@ -159,9 +160,9 @@ void runPlotter(TString level, // Tabla Paper //plotter.AddSignal("T2tt_mStop-150to250_Sm150_Xm25", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=150, m_{#tilde{#chi}^{0}_{1}}=25)",4); - plotter.AddSignal("T2tt_mStop-250to350_Sm275_Xm150", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=275, m_{#tilde{#chi}^{0}_{1}}=150)",4); - plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",6); - plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); + //plotter.AddSignal("T2tt_mStop-250to350_Sm275_Xm150", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=275, m_{#tilde{#chi}^{0}_{1}}=150)",4); + //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",6); + //plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); //plotter.AddSignal("TChiSlepExt_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); //plotter.AddSignal("TChiSlep_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); @@ -178,8 +179,8 @@ void runPlotter(TString level, 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); 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); + //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); } @@ -263,7 +264,7 @@ void runPlotter(TString level, // Draw distributions //---------------------------------------------------------------------------- - if (!option.Contains("nostack")) plotter.SetDrawYield(true); + if (!option.Contains("nostack")) plotter.SetDrawYield(false); float m2l_xmin = (level.Contains("WZ")) ? 60 : 0; // [GeV] float m2l_xmax = (level.Contains("WZ")) ? 120 : 300; // [GeV] From 2d1fa22f4f8ca24b8439c7c1c63410095749281a Mon Sep 17 00:00:00 2001 From: Barbara Date: Wed, 15 Nov 2017 17:15:57 +0100 Subject: [PATCH 14/28] update 15 November v2 --- stop/runPlotter.C | 89 +- test/HistogramReader_2.C | 1998 -------------------------------------- 2 files changed, 4 insertions(+), 2083 deletions(-) delete mode 100644 test/HistogramReader_2.C diff --git a/stop/runPlotter.C b/stop/runPlotter.C index b896c1de..483e8f8c 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -9,17 +9,10 @@ const Bool_t dosystematics = false; const Bool_t postfitplots = false; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; -//const TString inputdir = "../minitrees/rootfiles/WZtoWW_veto/"; const TString inputdir = "../minitrees/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; -//const TString inputdir = "../minitrees/rootfiles/ZpeakDYcorrections/"; -//const TString inputdir = "../../PlotsConfigurations/Configurations/T2tt/DatacardsTestAddBkg/MassPoint2tt_mStop-350to400_Sm350_Xm225/Postfitasimov/"; const TString outputdir = "figure_05Paper/"; -//const TString outputdir = "figures_TableTest/"; -//const TString outputdir = "figures_WZtoWW_vetoNewCut2_CheckVeto2_Mt2ll/"; -//const TString outputdir = "figures_WZtoWW_vetoNewCut2_ZVeto/"; -//const TString outputdir = "figures_WW_Mimic/"; const TString signal = "T2tt"; //const TString signal = "TChi"; @@ -89,22 +82,6 @@ void runPlotter(TString level, //plotter.SetDrawSignificance(true); } -<<<<<<< HEAD - float SF_ttZ = 1., SF_ZMet = 1., SF_DY = 1.; - if (level.Contains("_SR") || level.Contains("_VRggg")) {// && inputdir.Contains("DYcorr"))) { - SF_ttZ = 1.44; - if (!postfitplots && !inputdir.Contains("Zpeakz") && !inputdir.Contains("ZZ")) { - if (level.Contains("NoJet")) { - SF_ZMet = 0.74; // +/- 0.14 - SF_DY = 1.;//4.06; // 2.39 - } else if (level.Contains("Tag")) { - SF_ZMet = 1.05;// +/- 0.20 - SF_DY = 1.;//1.58; // 2.39 - } else if (level.Contains("Veto")) { - SF_ZMet = 1.05;// +/- 0.17 - SF_DY = 1.;//1.58; // 2.39 - } -======= float SF_ttZ = 1., SF_ZMet = 1., SF_DY = 1., SF_WZ = 1.; if (!postfitplots) { if (level.Contains("_SR") || level.Contains("_VRggg")) {// && inputdir.Contains("DYcorr"))) { @@ -115,10 +92,9 @@ void runPlotter(TString level, } else if (level.Contains("NoTag")) { SF_ZMet = 1.21;// +/- 0.17 } else { - SF_ZMet = 1.06;// +/- 0.12 + SF_ZMet = 1.05;// +/- 0.12 } } ->>>>>>> upstream/master } } @@ -130,26 +106,15 @@ void runPlotter(TString level, // Add processes //---------------------------------------------------------------------------- -<<<<<<< HEAD - //plotter.AddProcess("14_HZ", "HZ", color_HZ); - /* if (inputdir.Contains("/ZZ") || inputdir.Contains("/WZ")) //plotter.AddProcess("03_VZ", "VZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); //plotter.AddProcess("11_Wg", "W#gamma", color_Wg); + //plotter.AddProcess("13_VVV", "VVV", color_VVV); + //plotter.AddProcess("14_HZ", "HZ", color_HZ); //plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); - //plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background, SF_DY); - //plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); - //plotter.AddProcess("02_WZTo3LNu_toWW", "WZ (#rightarrow 3l)toWW", color_WZTo3LNu, roc_background); - plotter.AddProcess("03_ZZTo2l", "ZZ (#rightarrow 2l)", color_VZ, roc_background, SF_ZMet); - plotter.AddProcess("14_ZZTo4l", "ZZ (#rightarrow 4l)", 49, roc_background, SF_ZMet); - plotter.AddProcess("02_WZTo3LNu_toWW_NoZVeto", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); - plotter.AddProcess("02_WZTo3LNu_toWW", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); - */ plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background );//, SF_ttZ); plotter.AddProcess("11_HWW", "HWW", color_HWW); plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_VZ, roc_background); //, SF_ZMet); - //plotter.AddProcess("15_VZ", "VZ", color_VZ, roc_background); //, SF_ZMet); - //plotter.AddProcess("13_VVV", "VVV", color_VVV); plotter.AddProcess("15_VZ3V", "VVV+VZ", color_VVV, roc_background); //, SF_ZMet); plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets, roc_background); //plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background); @@ -158,33 +123,17 @@ void runPlotter(TString level, plotter.AddProcess("05_ST", "tW", color_ST); plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); -======= - ////plotter.AddProcess("14_HZ", "HZ", color_HZ); - //plotter.AddProcess("13_VVV", "VVV", color_VVV); - plotter.AddProcess("15_VZ3V", "VVV + VZ", color_VVV); if (inputdir.Contains("/ZZ") || inputdir.Contains("/WZ") || inputdir.Contains("/ttZ")) { plotter.AddProcess("14_ZZTo4L", "ZZ (#rightarrow 4l)", color_ZZ4L, roc_background); ////plotter.AddProcess("14a_ZZTo4L", "qqZZ (#rightarrow 4l)", 49, roc_background);// 1.256/1.212); ////plotter.AddProcess("14b_ZZTo4L", "ggZZ (#rightarrow 4l)", 48, roc_background); ////plotter.AddProcess("14c_ZZTo4L", "H#rightarrow ZZ", 47, roc_background); } - //plotter.AddProcess("03_VZ", "VZ (#rightarrow 2l)", color_VZ, roc_background); if (!inputdir.Contains("/ZZ")) plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l2#nu)", color_VZ, roc_background, SF_ZMet); ////plotter.AddProcess("03a_ZZ", "qqZZ (#rightarrow 2l2#nu)", 48, roc_background); ////plotter.AddProcess("03b_ZZ", "ggZZ (#rightarrow 2l2#nu)", 47, roc_background); - //plotter.AddProcess("15_VZ", "VZ (#rightarrow 2l2q)", color_VZ2L2Q, roc_background); - //plotter.AddProcess("11_Wg", "W#gamma", color_Wg); - //plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); - plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); - plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); - plotter.AddProcess("11_HWW", "HWW", color_HWW); - plotter.AddProcess("02_WZTo3LNu", "WZ (#rightarrow 3l)", color_WZTo3LNu, roc_background, SF_WZ); - plotter.AddProcess("06_WW", "WW", color_WW); - plotter.AddProcess("05_ST", "tW", color_ST); - plotter.AddProcess("07_ZJetsHT" + DYCorr, "Z+jets", color_ZJets, roc_background);//, 0.683211799801126896); ->>>>>>> upstream/master if (inputdir.Contains("SS")) plotter.AddProcess("TTToSemiLepton", "t#bar{t} Semilep.", 41); -// plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); + //plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); //else plotter.AddProcess("TTJets", "#bar{t}t", color_TTTo2L2Nu); //if (inputdir.Contains("SS")) plotter.AddProcess("WJetsToLNu", "WJets", color_WJets); @@ -192,46 +141,16 @@ void runPlotter(TString level, if (postfitplots) plotter.AddPostfit("99_TotalBackground", "post-fit", kRed+2); if (signal=="T2tt") { -<<<<<<< HEAD plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm175", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=175)",2); plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",3); plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm263", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=263)",6); - //plotter.AddSignal("T2tt_mStop-150to250_Sm250_Xm125", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=250, m_{#tilde{#chi}^{0}_{1}}=125)",4); - //plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); - /* 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_Xm225", "#tilde{t} #tilde{t}, #tilde{t} #rightarrow t#tilde{#chi}^{0}_{1} (350,225)",kViolet); ->>>>>>> upstream/master - 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); - */ - // Tabla Paper - - //plotter.AddSignal("T2tt_mStop-150to250_Sm150_Xm25", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=150, m_{#tilde{#chi}^{0}_{1}}=25)",4); - //plotter.AddSignal("T2tt_mStop-250to350_Sm275_Xm150", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=275, m_{#tilde{#chi}^{0}_{1}}=150)",4); - //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",6); - //plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325","#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",7); - - //plotter.AddSignal("TChiSlepExt_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); - //plotter.AddSignal("TChiSlep_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); - //plotter.AddSignal("TChiSWW_Xm350_Xm225", "#tilde{#chi}^{#pm}#rightarrow #tilde{l}#tilde{#nu} (350,225)", 2); - //plotter.AddSignal("T2bW_Sm350_Xm225", "#tilde{t}#rightarrow bW (350,225)", 2); - - } else if (signal=="TChi") { 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); 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); - - } if (inputdir.Contains("rootfiles/nominalX")) { diff --git a/test/HistogramReader_2.C b/test/HistogramReader_2.C deleted file mode 100644 index 43424ec8..00000000 --- a/test/HistogramReader_2.C +++ /dev/null @@ -1,1998 +0,0 @@ -#include "HistogramReader.h" -#include -#include - - -using namespace std; - - -//------------------------------------------------------------------------------ -// HistogramReader -//------------------------------------------------------------------------------ -HistogramReader::HistogramReader(const TString& inputdir, - const TString& outputdir) : - - _inputdir (inputdir), - _outputdir (outputdir), - _stackoption ("nostack,hist"), - _title ("inclusive"), - _luminosity_fb(-1), - _datanorm (false), - _drawratio (false), - _drawBinSigf (false), - _drawyield (false), - _minitreebased(false), //Used only to address the files of systematic folders - _publicstyle (false), - _savepdf (false), - _savepng (true), - _yieldTex (true) -{ - _mcfile.clear(); - _mccolor.clear(); - _mclabel.clear(); - _mcscale.clear(); - - _datafile = NULL; - _datahist = NULL; - _allmchist = NULL; - - TH1::SetDefaultSumw2(); -} - - -//------------------------------------------------------------------------------ -// AddData -//------------------------------------------------------------------------------ -void HistogramReader::AddData(const TString& filename, - const TString& label, - Color_t color) -{ - TString fullname = _inputdir + "/" + filename + ".root"; - - if (gSystem->AccessPathName(fullname)) - { - printf(" [HistogramReader::AddData] Cannot access %s\n", fullname.Data()); - return; - } - - TFile* file = new TFile(fullname, "read"); - - _datacolor = color; - _datafile = file; - _datafilename = filename; - _datalabel = label; -} - - -//------------------------------------------------------------------------------ -// AddProcess -//------------------------------------------------------------------------------ -void HistogramReader::AddProcess(const TString& filename, - const TString& label, - Color_t color, - Int_t kind, - Float_t scale) -{ - TString fullname = _inputdir + "/" + filename + ".root"; - - if (gSystem->AccessPathName(fullname)) - { - printf(" [HistogramReader::AddProcess] Cannot access %s\n", fullname.Data()); - return; - } - - TFile* file = new TFile(fullname, "read"); - - _mccolor.push_back(color); - _mcfile.push_back(file); - _mcfilename.push_back(filename); - _mclabel.push_back(label); - _mcscale.push_back(scale); - - if (scale > 0. && scale != 1.) - printf("\n [HistogramReader::AddProcess] Process %s will be scaled by %.2f\n\n", label.Data(), scale); - - if (kind == roc_signal) - { - _roc_signalfile.push_back(file); - _roc_signalscale.push_back(scale); - } - else if (kind == roc_background) - { - _roc_backgroundfile.push_back(file); - _roc_backgroundscale.push_back(scale); - } -} - - -//------------------------------------------------------------------------------ -// AddSignal -//------------------------------------------------------------------------------ -void HistogramReader::AddSignal(const TString& filename, - const TString& label, - Color_t color, - Int_t kind, - Float_t scale) -{ - TString fullname = _inputdir + "/" + filename + ".root"; - - if (gSystem->AccessPathName(fullname)) - { - printf(" [HistogramReader::AddSignal] Cannot access %s\n", fullname.Data()); - return; - } - - TFile* file = new TFile(fullname, "read"); - - _signalcolor.push_back(color); - _signalfile.push_back(file); - _signalfilename.push_back(filename); - _signallabel.push_back(label); - _signalscale.push_back(scale); - - if (scale > 0. && scale != 1.) - printf("\n [HistogramReader::AddSignal] Process %s will be scaled by %.2f\n\n", label.Data(), scale); - - if (kind == roc_signal) - { - _roc_signalfile.push_back(file); - _roc_signalscale.push_back(scale); - } - else if (kind == roc_background) - { - _roc_backgroundfile.push_back(file); - _roc_backgroundscale.push_back(scale); - } -} - - -//------------------------------------------------------------------------------ -// AddSystematic -//------------------------------------------------------------------------------ -void HistogramReader::AddSystematic(TString analysis, TString systematic, TString mycut) -{ - // For Stop analysis: - // BtagFSdo Btagdo Fakedo Fastsimdo Idisodo Idisoeleup Idisomuup Isrnjetdo JESdo JESup METdo METup PDFdo Pileupdo Q2do Recodo Topptdo Triggerdo nominal - // BtagFSup Btagup Fakeup Fastsimup Idisoeledo Idisomudo Idisoup Isrnjetup JESdoNoISR JESupNoISR METdoNoISR METupNoISR PDFup Pileupup Q2up Recoup Topptup Triggerup theory - _mycut = mycut; - _analysis = analysis; - _systematics.push_back(systematic); -} - - -//------------------------------------------------------------------------------ -// Draw -//------------------------------------------------------------------------------ -void HistogramReader::Draw(TString hname, - TString xtitle, - Int_t ngroup, - Int_t precision, - TString units, - Bool_t setlogy, - Bool_t moveoverflow, - Float_t xmin, - Float_t xmax, - Float_t ymin, - Float_t ymax) -{ - TString cname = hname; - - if (_stackoption.Contains("nostack")) cname += "_nostack"; - - if (setlogy) cname += "_log"; - - _writeyields = (hname.Contains("_evolution")) ? true : false; - - if (_writeyields) - { - _yields_table.open(_outputdir + "/" + cname + ".txt"); - - _writelabels = true; - } - - - TCanvas* canvas = NULL; - - TPad* pad1 = NULL; - TPad* pad2 = NULL; - - if (_drawratio && _datafile) - { - canvas = new TCanvas(cname, cname, 550, 720); - - pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); - pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); - - pad1->SetTopMargin (0.08); - pad1->SetBottomMargin(0.02); - pad1->Draw(); - - pad2->SetTopMargin (0.08); - pad2->SetBottomMargin(0.35); - pad2->Draw(); - } - - else if (_drawBinSigf) - { - canvas = new TCanvas(cname, cname, 550, 720); - - pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); - pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); - - pad1->SetTopMargin (0.08); - pad1->SetBottomMargin(0.02); - pad1->Draw(); - - pad2->SetTopMargin (0.08); - pad2->SetBottomMargin(0.35); - pad2->SetGridx(); - pad2->SetGridy(); - pad2->Draw(); - } - - else - { - canvas = new TCanvas(cname, cname, 550, 600); - - pad1 = new TPad("pad1", "pad1", 0, 0, 1, 1); - - pad1->Draw(); - } - - - //---------------------------------------------------------------------------- - // pad1 - //---------------------------------------------------------------------------- - pad1->cd(); - - pad1->SetLogy(setlogy); - - - // Stack processes - //---------------------------------------------------------------------------- - _mchist.clear(); - - THStack* mcstack = new THStack(hname + "_mcstack", hname + "_mcstack"); - - for (UInt_t i=0; i<_mcfile.size(); i++) { - - _mcfile[i]->cd(); - - TH1D* dummy = (TH1D*)_mcfile[i]->Get(hname); - - _mchist.push_back((TH1D*)dummy->Clone()); - - if (_luminosity_fb > 0 && _mcscale[i] > -999) _mchist[i]->Scale(_luminosity_fb); - - if (_mcscale[i] > 0) _mchist[i]->Scale(_mcscale[i]); - - SetHistogram(_mchist[i], _mccolor[i], 1001, kDot, kSolid, 0, ngroup, moveoverflow, xmin, xmax); - - mcstack->Add(_mchist[i]); - } - - - // Stack signals - //---------------------------------------------------------------------------- - _signalhist.clear(); - - THStack* signalstack = new THStack(hname + "_signalstack", hname + "_signalstack"); - - for (UInt_t i=0; i<_signalfile.size(); i++) { - - _signalfile[i]->cd(); - - TH1D* dummy = (TH1D*)_signalfile[i]->Get(hname); - - _signalhist.push_back((TH1D*)dummy->Clone()); - - if (_luminosity_fb > 0 && _signalscale[i] > -999) _signalhist[i]->Scale(_luminosity_fb); - - if (_signalscale[i] > 0) _signalhist[i]->Scale(_signalscale[i]); - - SetHistogram(_signalhist[i], _signalcolor[i], 0, kDot, kSolid, 3, ngroup, moveoverflow, xmin, xmax); - - signalstack->Add(_signalhist[i]); - } - - - // Get the data - //---------------------------------------------------------------------------- - if (_datafile) - { - _datafile->cd(); - - TH1D* dummy = (TH1D*)_datafile->Get(hname); - - _datahist = (TH1D*)dummy->Clone(); - - SetHistogram(_datahist, kBlack, 0, kFullCircle, kSolid, 1, ngroup, moveoverflow, xmin, xmax); - } - - - // Normalize MC to data - //---------------------------------------------------------------------------- - if (_datahist && _datanorm) - { - Float_t mcnorm = Yield((TH1D*)(mcstack->GetStack()->Last())); - Float_t datanorm = Yield(_datahist); - - for (UInt_t i=0; i<_mchist.size(); i++) - { - _mchist[i]->Scale(datanorm / mcnorm); - } - - mcstack->Modified(); - } - - - // hfirst will contain the axis settings - //---------------------------------------------------------------------------- - TH1D* hfirst = (TH1D*)_mchist[0]->Clone("hfirst"); - - hfirst->Reset(); - - hfirst->SetTitle(""); - - - // All MC - //---------------------------------------------------------------------------- - _allmchist = (TH1D*)_mchist[0]->Clone("allmchist"); - - _allmchist->SetName(_mchist[0]->GetName()); - - // Possible modification (how to deal with systematic uncertainties?) - // _allmchist = (TH1D*)(mcstack->GetStack()->Last()); - - for (Int_t ibin=0; ibin<=_allmchist->GetNbinsX(); ibin++) { - - Float_t binValue = 0.; - Float_t binError = 0.; - - for (UInt_t i=0; i<_mchist.size(); i++) { - - Float_t binContent = _mchist[i]->GetBinContent(ibin); - Float_t binStatError = _mchist[i]->GetBinError(ibin); - Float_t binSystError = 0; // To be updated - - binValue += binContent; - binError += (binStatError * binStatError); - binError += (binSystError * binSystError); - } - - binError = sqrt(binError); - - _allmchist->SetBinContent(ibin, binValue); - _allmchist->SetBinError (ibin, binError); - } - - _allmclabel = "stat"; - - _allmchist->SetFillColor (kGray+1); - _allmchist->SetFillStyle ( 3345); - _allmchist->SetLineColor (kGray+1); - _allmchist->SetMarkerColor(kGray+1); - _allmchist->SetMarkerSize ( 0); - - - // Include systematics with TGraphAsymmErrors - //---------------------------------------------------------------------------- - if (_systematics.size() > 0) IncludeSystematics(hname); - - // Draw - //---------------------------------------------------------------------------- - hfirst->Draw(); - - mcstack->Draw(_stackoption + ",same"); - - //if (_systematics.size() > 0 ) _gr->Draw("CF"); - //if (_systematics.size() > 0 ) _gr->Draw("3"); - //if (_systematics.size() > 0 ) _gr->Draw("P0"); - - - - if (_systematics.size() > 0 ) { - - _ErrorGr->Draw("e2,same"); - } - else { - - if (!_stackoption.Contains("nostack")) _allmchist->Draw("e2,same"); - } - - if (_signalfile.size() > 0) signalstack->Draw("nostack,hist,same"); - - if (_datahist) _datahist->Draw("ep,same"); - - - // Set xtitle and ytitle - //---------------------------------------------------------------------------- - TString ytitle = Form("events / %s.%df", "%", precision); - - ytitle = Form(ytitle.Data(), hfirst->GetBinWidth(0)); - - if (!units.Contains("NULL")) { - xtitle = Form("%s [%s]", xtitle.Data(), units.Data()); - ytitle = Form("%s %s", ytitle.Data(), units.Data()); - } - - - // Adjust xaxis and yaxis - //---------------------------------------------------------------------------- - hfirst->GetXaxis()->SetRangeUser(xmin, xmax); - - Float_t theMin = 0.0; - - Float_t theMax = (_datahist) ? GetMaximum(_datahist, xmin, xmax) : 0.0; - - Float_t theMaxMC = GetMaximum(_allmchist, xmin, xmax); - - if (_stackoption.Contains("nostack")) - { - for (UInt_t i=0; i<_mcfile.size(); i++) - { - Float_t mchist_i_max = GetMaximum(_mchist[i], xmin, xmax, false); - - if (mchist_i_max > theMaxMC) theMaxMC = mchist_i_max; - } - } - - if (theMaxMC > theMax) theMax = theMaxMC; - - Float_t theMaxSignal = 0.0; - - if (_signalfile.size() > 0) - { - for (UInt_t i=0; i<_signalfile.size(); i++) - { - Float_t signalhist_i_max = GetMaximum(_signalhist[i], xmin, xmax, false); - - if (signalhist_i_max > theMaxSignal) theMaxSignal = signalhist_i_max; - } - } - - if (theMaxSignal > theMax) theMax = theMaxSignal; - - if (pad1->GetLogy()) - { - theMin = 1e-5; - theMax = TMath::Power(10, TMath::Log10(theMax) + 6); - } - else if (!_stackoption.Contains("nostack")) - { - theMax *= 1.7; - } - - hfirst->SetMinimum(theMin); - hfirst->SetMaximum(theMax); - - if (ymin != -999) hfirst->SetMinimum(ymin); - if (ymax != -999) hfirst->SetMaximum(ymax); - - //if (_stackoption.Contains("nostack")) { hfirst->SetMinimum(0.00001); hfirst->SetMaximum(10000.0); } - - // Legend - //---------------------------------------------------------------------------- - Float_t x0 = 0.220; // x position of the data on the top left - Float_t y0 = 0.843; // y position of the data on the top left - Float_t xdelta = (_drawyield) ? 0.228 : 0.170; // x width between columns - Float_t ydelta = 0.050; // y width between rows - Int_t nx = 0; // column number - Int_t ny = 0; // row number - - TString opt = (_stackoption.Contains("nostack")) ? "l" : "f"; - - - // Data legend - //---------------------------------------------------------------------------- - if (_datahist) - { - DrawLegend(x0, y0, _datahist, _datalabel.Data(), "lp"); - ny++; - } - - - // All MC legend - //---------------------------------------------------------------------------- - if (!_stackoption.Contains("nostack")) - { - DrawLegend(x0, y0 - ny*ydelta, _allmchist, _allmclabel.Data(), opt); - ny++; - } - - - // Standard Model processes legend - //---------------------------------------------------------------------------- - Int_t nrow = (_mchist.size() > 10) ? 5 : 4; - - for (int i=0; i<_mchist.size(); i++) - { - if (ny == nrow) - { - ny = 0; - nx++; - } - - DrawLegend(x0 + nx*xdelta, y0 - ny*ydelta, _mchist[i], _mclabel[i].Data(), opt); - ny++; - } - - - // Search signals legend - //---------------------------------------------------------------------------- - for (int i=0; i<_signalhist.size(); i++) - { - DrawLegend(x0 + nx*xdelta, y0 - ny*ydelta, _signalhist[i], _signallabel[i].Data(), "l"); - ny++; - } - - - // Titles - //---------------------------------------------------------------------------- - Float_t xprelim; - if (_drawratio && _datafile) { xprelim = 0.288;} - else if (_drawBinSigf) { xprelim = 0.288;} - else { xprelim = 0.300;} - - if (_title.EqualTo("inclusive")) - { - DrawLatex(61, 0.190, 0.945, 0.050, 11, "CMS"); - DrawLatex(52, xprelim, 0.945, 0.030, 11, "Preliminary"); - } - else - { - DrawLatex(42, 0.190, 0.945, 0.050, 11, _title); - } - - if (_luminosity_fb > 0) - DrawLatex(42, 0.940, 0.945, 0.050, 31, Form("%.3f fb^{-1} (13TeV)", _luminosity_fb)); - else - DrawLatex(42, 0.940, 0.945, 0.050, 31, "(13TeV)"); - - SetAxis(hfirst, xtitle, ytitle, 1.5, 1.8); - if (hname.Contains("SR_MT2Met")) - { - // Special cosmetics - // - // set splitting lines - // done to be used with mc && signal, not with data - double xline1 = hfirst -> GetBinLowEdge(8); double xline2 = hfirst -> GetBinLowEdge(15); - double yline = theMaxSignal + theMaxMC ; - // this can be simplified with DrawLine function: https://root.cern.ch/doc/master/classTLine.html#a25778bcb26868e136825dbe836aa9c66 - //if (_stackoption.Contains("nostack")) yline = 1.5; - canvas ->Update(); - TLine* line1 = new TLine ( xline1, 0.0, xline1, yline ); TLine* line2 = new TLine ( xline2, 0.0, xline2, yline ); - line1 -> SetLineColor(kBlack);line2 -> SetLineColor(kBlack); - line1->Draw();line2->Draw(); - - // set latex information - TLatex* tl1 = new TLatex(0, yline, "SR1"); TLatex* tl2 = new TLatex(xline1, yline, "SR2"); TLatex* tl3 = new TLatex(xline2, yline, "SR3"); - tl1 -> Draw(); tl2 -> Draw(); tl3 -> Draw(); - // set bin legend - hfirst -> GetXaxis()->SetBinLabel(1, "20"); hfirst -> GetXaxis()->SetBinLabel(4, "80"); hfirst -> GetXaxis()->SetBinLabel(7, "140"); //SR1 - hfirst -> GetXaxis()->SetBinLabel(8, "20"); hfirst -> GetXaxis()->SetBinLabel(11, "80"); hfirst -> GetXaxis()->SetBinLabel(14,"140"); //SR2 - hfirst -> GetXaxis()->SetBinLabel(15,"20"); hfirst -> GetXaxis()->SetBinLabel(18, "80"); hfirst -> GetXaxis()->SetBinLabel(21,"140"); //SR3 - - 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; hfirst -> GetXaxis()->SetBinLabel(ibin1, " " + iValue); }} - - } - - //---------------------------------------------------------------------------- - // pad2 - //---------------------------------------------------------------------------- - if (_drawratio && _datafile) - { - pad2->cd(); - - - TH1D* ratio = (TH1D*)_datahist ->Clone("ratio"); - TH1D* uncertainty = (TH1D*)_allmchist->Clone("uncertainty"); - - for (Int_t ibin=1; ibin<=ratio->GetNbinsX(); ibin++) { - - Float_t dtValue = _datahist->GetBinContent(ibin); - Float_t dtError = _datahist->GetBinError (ibin); - - Float_t mcValue = _allmchist->GetBinContent(ibin); - Float_t mcError = _allmchist->GetBinError (ibin); - - Float_t ratioVal = 999; - Float_t ratioErr = 999; - Float_t uncertaintyError = 999; - - if (mcValue > 0) - { - ratioVal = dtValue / mcValue; - ratioErr = dtError / mcValue; - uncertaintyError = ratioVal * mcError / mcValue; - } - - ratio->SetBinContent(ibin, ratioVal); - ratio->SetBinError (ibin, ratioErr); - - uncertainty->SetBinContent(ibin, 1.); - uncertainty->SetBinError (ibin, uncertaintyError); - } - - ratio->SetTitle(""); - - ratio->Draw("ep"); - - ratio->GetXaxis()->SetRangeUser(xmin, xmax); - ratio->GetYaxis()->SetRangeUser(0.85, 1.3); - - uncertainty->Draw("e2,same"); - - ratio->Draw("ep,same"); - - SetAxis(ratio, xtitle, "data / MC", 1.4, 0.75); - } - - else if (_drawBinSigf ) - { - pad2->cd(); - - // Just for three signal, the first ones 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 << " " << "SignalValue = " << SignalValue << " " << "mcValue = " << mcValue << " " << "sqrt(mcValue) = " << sqrt(mcValue) << " " << "signfVal = " << signfVal << std::endl; - 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")){ - //signf0 -> GetXaxis()->SetBinLabel(7, "140"); //SR1 - //signf0 -> GetXaxis()->SetBinLabel(14,"140"); //SR2 - //signf0 -> GetXaxis()->SetBinLabel(21,"140"); //SR3 - - 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); - - - signf1->Draw("ep,same"); - signf2->Draw("ep,same"); - - SetAxis(signf0, xtitle, "S / B", 1.4, 0.75); - - - } - - //---------------------------------------------------------------------------- - // Save it - //---------------------------------------------------------------------------- - canvas->cd(); - - if (_savepdf) canvas->SaveAs(_outputdir + cname + ".pdf"); - if (_savepng) canvas->SaveAs(_outputdir + cname + ".png"); - if (hname.Contains("SR_MT2Met")) canvas->SaveAs(_outputdir + cname + ".C"); - - if (_writeyields) - { - _yields_table << std::endl; - - _yields_table.close(); - } -} - - -//------------------------------------------------------------------------------ -// CrossSection -//------------------------------------------------------------------------------ -void HistogramReader::CrossSection(TString level, - TString channel, - TString process, - Float_t branchingratio, - TString signal1_filename, - Float_t signal1_xs, - Float_t signal1_ngen, - TString signal2_filename, - Float_t signal2_xs, - Float_t signal2_ngen) -{ - if (_luminosity_fb < 0) - { - printf("\n [HistogramReader::CrossSection] Warning: reading negative luminosity\n\n"); - } - - - // Get the signal (example qqWW) - //---------------------------------------------------------------------------- - TFile* signal1_file = new TFile(_inputdir + "/" + signal1_filename + ".root"); - - float signal1_counterLum = Yield((TH1D*)signal1_file->Get(level + "/h_counterLum_" + channel)); - float signal1_counterRaw = Yield((TH1D*)signal1_file->Get(level + "/h_counterRaw_" + channel)); - - float counterSignal = signal1_counterLum * _luminosity_fb; - - float efficiency = signal1_counterRaw / signal1_ngen; - - - // Get the second signal (example ggWW) - //---------------------------------------------------------------------------- - if (!signal2_filename.Contains("NULL")) - { - TFile* signal2_file = new TFile(_inputdir + "/" + signal2_filename + ".root"); - - float signal2_counterLum = Yield((TH1D*)signal2_file->Get(level + "/h_counterLum_" + channel)); - float signal2_counterRaw = Yield((TH1D*)signal2_file->Get(level + "/h_counterRaw_" + channel)); - - counterSignal += (signal2_counterLum * _luminosity_fb); - - float signal1_fraction = signal1_xs / (signal1_xs + signal2_xs); - float signal2_fraction = 1. - signal1_fraction; - - float signal1_efficiency = signal1_counterRaw / signal1_ngen; - float signal2_efficiency = signal2_counterRaw / signal2_ngen; - - efficiency = signal1_fraction*signal1_efficiency + signal2_fraction*signal2_efficiency; - } - - - // Get the backgrounds - //---------------------------------------------------------------------------- - float counterBackground = 0; - - for (UInt_t i=0; i<_mcfile.size(); i++) { - - if (_mclabel[i].EqualTo(process)) continue; - - _mcfile[i]->cd(); - - TH1D* dummy = (TH1D*)_mcfile[i]->Get(level + "/h_counterLum_" + channel); - - float counterDummy = Yield(dummy); - - if (_luminosity_fb > 0 && _mcscale[i] > -999) counterDummy *= _luminosity_fb; - - if (_mcscale[i] > 0) counterDummy *= _mcscale[i]; - - counterBackground += counterDummy; - } - - - // Get the data - //---------------------------------------------------------------------------- - if (_datafile) - { - _datafile->cd(); - - TH1D* dummy = (TH1D*)_datafile->Get(level + "/h_counterLum_" + channel); - - _datahist = (TH1D*)dummy->Clone(); - } - - float counterData = Yield(_datahist); - - - // Cross-section calculation - //---------------------------------------------------------------------------- - float xs = (counterData - counterBackground) / (1e3 * _luminosity_fb * efficiency * branchingratio); - float mu = (counterData - counterBackground) / (counterSignal); - - - // Statistical error - //---------------------------------------------------------------------------- - float xsErrorStat = sqrt(counterData) / (1e3 * _luminosity_fb * efficiency * branchingratio); - float muErrorStat = sqrt(counterData) / (counterSignal); - - - // Print - //---------------------------------------------------------------------------- - printf(" channel = %s\n", channel.Data()); - printf(" ndata = %.0f\n", counterData); - printf(" nbkg = %.2f\n", counterBackground); - printf(" ndata - nbkg = %.2f\n", counterData - counterBackground); - printf(" nsignal = %.2f\n", counterSignal); - printf(" mu = (ndata - nbkg) / nsignal = %.2f +- %.2f (stat) +- %.2f (lumi)\n", mu, muErrorStat, mu * lumi_error_percent / 1e2); - printf(" lumi = %.0f pb\n", 1e3 * _luminosity_fb); - printf(" br = %f\n", branchingratio); - printf(" eff = %.4f\n", efficiency); - printf(" xs = (ndata - nbkg) / (lumi * eff * br) = %.2f +- %.2f (stat) +- %.2f (lumi) pb\n\n", xs, xsErrorStat, xs * lumi_error_percent / 1e2); -} - - -//----------------------------------------------------------------------------- -// DrawLatex -//------------------------------------------------------------------------------ -void HistogramReader::DrawLatex(Font_t tfont, - Float_t x, - Float_t y, - Float_t tsize, - Short_t align, - const char* text, - Bool_t setndc) -{ - TLatex* tl = new TLatex(x, y, text); - - tl->SetNDC (setndc); - tl->SetTextAlign( align); - tl->SetTextFont ( tfont); - tl->SetTextSize ( tsize); - - tl->Draw("same"); -} - - -//------------------------------------------------------------------------------ -// DrawLegend -//------------------------------------------------------------------------------ -TLegend* HistogramReader::DrawLegend(Float_t x1, - Float_t y1, - TH1* hist, - TString label, - TString option, - Bool_t drawyield, - Float_t tsize, - Float_t xoffset, - Float_t yoffset) -{ - drawyield &= (_drawyield && !_publicstyle); - - TLegend* legend = new TLegend(x1, - y1, - x1 + xoffset, - y1 + yoffset); - - legend->SetBorderSize( 0); - legend->SetFillColor ( 0); - legend->SetTextAlign ( 12); - legend->SetTextFont ( 42); - legend->SetTextSize (tsize); - - TString final_label = Form(" %s", label.Data()); - - if (drawyield) - final_label = Form("%s (%.0f)", final_label.Data(), hist->Integral());// changed from Integral(-1,-1) - - if (Yield(hist) < 0) - printf("\n [HistogramReader::DrawLegend] Warning: %s %s yield = %f\n\n", - label.Data(), - hist->GetName(), - hist -> Integral());// changed from Integral(-1,-1) - - - /* std::cout << "-------------------------------------------------------------------\n" << std::endl; - - Int_t numbbins = hist->GetNbinsX(); - float n = hist->Integral(); - std::cout << "proccess " << final_label.Data() << " numbbins " << numbbins << " integral " << n << std::endl; - - std::cout << "-------------------------------------------------------------------\n" << std::endl; -*/ - legend->AddEntry(hist, final_label.Data(), option.Data()); - legend->Draw(); - - WriteYields(hist, label); - - return legend; -} - - -//------------------------------------------------------------------------------ -// GetMaximum -//------------------------------------------------------------------------------ -Float_t HistogramReader::GetMaximum(TH1* hist, - Float_t xmin, - Float_t xmax, - Bool_t binError) -{ - UInt_t nbins = hist->GetNbinsX(); - - TAxis* axis = (TAxis*)hist->GetXaxis(); - - Int_t firstBin = (xmin != -999) ? axis->FindBin(xmin) : 1; - Int_t lastBin = (xmax != -999) ? axis->FindBin(xmax) : nbins; - - Float_t hmax = 0; - - for (Int_t i=firstBin; i<=lastBin; i++) { - - Float_t binHeight = hist->GetBinContent(i); - - if (binError) binHeight += hist->GetBinError(i); - - if (binHeight > hmax) hmax = binHeight; - } - - return hmax; -} - - -//------------------------------------------------------------------------------ -// MoveOverflows -// -// For all histogram types: nbins, xlow, xup -// -// bin = 0; underflow bin -// bin = 1; first bin with low-edge xlow INCLUDED -// bin = nbins; last bin with upper-edge xup EXCLUDED -// bin = nbins+1; overflow bin -// -//------------------------------------------------------------------------------ -void HistogramReader::MoveOverflows(TH1* hist, - Float_t xmin, - Float_t xmax) -{ - int nentries = hist->GetEntries(); - int nbins = hist->GetNbinsX(); - - TAxis* xaxis = (TAxis*)hist->GetXaxis(); - - - // Underflow - //---------------------------------------------------------------------------- - if (xmin != -999) - { - Int_t firstBin = -1; - Float_t firstVal = 0; - Float_t firstErr = 0; - - for (Int_t i=0; i<=nbins+1; i++) - { - if (xaxis->GetBinLowEdge(i) < xmin) - { - firstVal += hist->GetBinContent(i); - firstErr += (hist->GetBinError(i)*hist->GetBinError(i)); - hist->SetBinContent(i, 0); - hist->SetBinError (i, 0); - } - else if (firstBin == -1) - { - firstVal += hist->GetBinContent(i); - firstErr += (hist->GetBinError(i)*hist->GetBinError(i)); - firstBin = i; - } - } - - firstErr = sqrt(firstErr); - - hist->SetBinContent(firstBin, firstVal); - hist->SetBinError (firstBin, firstErr); - } - - - // Overflow - //---------------------------------------------------------------------------- - if (xmax != -999) - { - Int_t lastBin = -1; - Float_t lastVal = 0; - Float_t lastErr = 0; - - for (Int_t i=nbins+1; i>=0; i--) - { - Float_t lowEdge = xaxis->GetBinLowEdge(i); - - if (lowEdge >= xmax) - { - lastVal += hist->GetBinContent(i); - lastErr += (hist->GetBinError(i)*hist->GetBinError(i)); - hist->SetBinContent(i, 0); - hist->SetBinError (i, 0); - } - else if (lastBin == -1) - { - lastVal += hist->GetBinContent(i); - lastErr += (hist->GetBinError(i)*hist->GetBinError(i)); - lastBin = i; - } - } - - lastErr = sqrt(lastErr); - - hist->SetBinContent(lastBin, lastVal); - hist->SetBinError (lastBin, lastErr); - } - - hist->SetEntries(nentries); -} - - -//------------------------------------------------------------------------------ -// SetAxis -//------------------------------------------------------------------------------ -void HistogramReader::SetAxis(TH1* hist, - TString xtitle, - TString ytitle, - Float_t xoffset, - Float_t yoffset) -{ - gPad->cd(); - gPad->Update(); - - // See https://root.cern.ch/doc/master/classTAttText.html#T4 - Float_t padw = gPad->XtoPixel(gPad->GetX2()); - Float_t padh = gPad->YtoPixel(gPad->GetY1()); - - Float_t size = (padw < padh) ? padw : padh; - - size = 20. / size; // Like this label size is always 20 pixels - - TAxis* xaxis = (TAxis*)hist->GetXaxis(); - TAxis* yaxis = (TAxis*)hist->GetYaxis(); - - xaxis->SetTitleOffset(xoffset); - yaxis->SetTitleOffset(yoffset); - - // xaxis->SetLabelOffset(5.*xaxis->GetLabelOffset()); // It works for Juan - // yaxis->SetLabelOffset(3.*yaxis->GetLabelOffset()); // It works for Juan - - xaxis->SetLabelSize(size); - yaxis->SetLabelSize(size); - xaxis->SetTitleSize(size); - yaxis->SetTitleSize(size); - - xaxis->SetTitle(xtitle); - yaxis->SetTitle(ytitle); - - yaxis->CenterTitle(); - - gPad->GetFrame()->DrawClone(); - gPad->RedrawAxis(); -} - - -//------------------------------------------------------------------------------ -// SetHistogram -//------------------------------------------------------------------------------ -void HistogramReader::SetHistogram(TH1* hist, - Color_t color, - Style_t fstyle, - Style_t mstyle, - Style_t lstyle, - Width_t lwidth, - Int_t ngroup, - Bool_t moveoverflow, - Float_t& xmin, - Float_t& xmax) -{ - if (!hist) - { - printf("\n [HistogramReader::SetHistogram] Error: histogram does not exist\n\n"); - return; - } - - if (xmin == -999) xmin = hist->GetXaxis()->GetXmin(); - if (xmax == -999) xmax = hist->GetXaxis()->GetXmax(); - - hist->SetFillColor(color ); - hist->SetFillStyle(fstyle); - - hist->SetLineColor(color ); - hist->SetLineStyle(lstyle); - hist->SetLineWidth(lwidth); - - hist->SetMarkerColor(color ); - hist->SetMarkerStyle(mstyle); - - if (_stackoption.Contains("nostack") && Yield(hist) > 0) - { - hist->SetFillStyle(0); - hist->SetLineWidth(2); - TString hname = hist->GetName(); - - if (hname.Contains("SR_MT2Met")) - { - int n = hist -> GetNbinsX(); - for (int ibin = 1; ibin <= n; ibin++ ){ - - float BinContent = hist->GetBinContent(ibin); - - int firstbin; if (ibin<=7) firstbin = 1; else if (ibin<=14) firstbin = 8; else if (ibin<=21) firstbin = 15; - - int lastbin; if (ibin<=7) lastbin = 7; else if (ibin<=14) lastbin = 14; else if (ibin<=21) lastbin = 21; - - float SRIntegral = hist->Integral(firstbin,lastbin); - - hist->SetBinContent(ibin, BinContent/SRIntegral); - } - } - else - { - hist->Scale(1. / Yield(hist)); - } - - } - - // Rebin and move overflow bins - //---------------------------------------------------------------------------- - if (ngroup > 0) hist->Rebin(ngroup); - - if (moveoverflow) MoveOverflows(hist, xmin, xmax); -} - - -//------------------------------------------------------------------------------ -// Yield -//------------------------------------------------------------------------------ -Float_t HistogramReader::Yield(TH1* hist) -{ - if (!hist) return 0; - - - Int_t nbins = hist->GetNbinsX(); - - - return hist->Integral(); // Change from Integral (-1,-1); -} - - -//------------------------------------------------------------------------------ -// Error -//------------------------------------------------------------------------------ -Float_t HistogramReader::Error(TH1* hist) -{ - if (!hist) return 0; - - Float_t hist_error = sqrt(hist->GetSumw2()->GetSum()); - - return hist_error; -} - - -//------------------------------------------------------------------------------ -// EventsByCut -//------------------------------------------------------------------------------ -void HistogramReader::EventsByCut(TFile* file, - TString analysis, - TString hname) -{ - // Check if the evolution histogram already exists - TH1D* test_hist = (TH1D*)file->Get(analysis + "/" + hname + "_evolution"); - - if (test_hist) return; - - - // Get the number of bins - Int_t nbins = 0; - - for (Int_t i=0; icd(analysis); - - TH1D* hist = new TH1D(hname + "_evolution", "", nbins, -0.5, nbins-0.5); - - for (Int_t i=0, bin=0; iGet(scut[i] + "/" + hname); - - bin++; - - hist->SetBinContent(bin, Yield(dummy)); - hist->SetBinError (bin, Error(dummy)); - - - // Change the evolution histogram x-axis labels - TString tok, icut; - - Ssiz_t from = 0; - - while (scut[i].Tokenize(tok, from, "_")) icut = tok; - - hist->GetXaxis()->SetBinLabel(bin, icut); - } - - - // Write the evolution histogram - hist->Write(); - file->cd(); -} - - -//------------------------------------------------------------------------------ -// LoopEventsByCut -//------------------------------------------------------------------------------ -void HistogramReader::LoopEventsByCut(TString analysis, TString hname) -{ - if (_datafile) EventsByCut(_datafile, analysis, hname); - - for (UInt_t i=0; i<_mcfile.size(); i++) EventsByCut(_mcfile[i], analysis, hname); - - for (UInt_t i=0; i<_signalfile.size(); i++) EventsByCut(_signalfile[i], analysis, hname); -} - - -//------------------------------------------------------------------------------ -// EventsByChannel -//------------------------------------------------------------------------------ -void HistogramReader::EventsByChannel(TFile* file, - TString level) -{ - // Check if the evolution histogram already exists - TH1D* test_hist = (TH1D*)file->Get(level + "/h_counterLum_evolution"); - - if (test_hist) return; - - - // Get the number of bins - Int_t firstchannel = (level.Contains("WZ/")) ? eee : ee; - Int_t lastchannel = (level.Contains("WZ/")) ? lll : ll; - - Int_t nbins = 0; - - for (Int_t i=firstchannel; i<=lastchannel; i++) nbins++; - - - // Create and fill the evolution histogram - file->cd(level); - - TH1D* hist = new TH1D("h_counterLum_evolution", "", nbins, -0.5, nbins-0.5); - - for (Int_t i=firstchannel, bin=0; i<=lastchannel; i++) - { - TH1D* dummy = (TH1D*)file->Get(level + "/h_counterLum_" + schannel[i]); - - bin++; - - hist->SetBinContent(bin, Yield(dummy)); - hist->SetBinError (bin, Error(dummy)); - - hist->GetXaxis()->SetBinLabel(bin, lchannel[i]); - } - - - // Write the evolution histogram - hist->Write(); - file->cd(); -} - - -//------------------------------------------------------------------------------ -// LoopEventsByChannel -//------------------------------------------------------------------------------ -void HistogramReader::LoopEventsByChannel(TString level) -{ - if (_datafile) EventsByChannel(_datafile, level); - - for (UInt_t i=0; i<_mcfile.size(); i++) EventsByChannel(_mcfile[i], level); - - for (UInt_t i=0; i<_signalfile.size(); i++) EventsByChannel(_signalfile[i], level); -} - - -//------------------------------------------------------------------------------ -// GetBestScoreX -//------------------------------------------------------------------------------ -Float_t HistogramReader::GetBestScoreX(TH1* sig_hist, - TH1* bkg_hist, - TString fom) -{ - Int_t nbins = sig_hist->GetNbinsX(); - - Float_t score_value = 0; - Float_t score_x = 0; - Float_t sig_total = Yield(sig_hist); - - - // For The Punzi Effect - // http://arxiv.org/pdf/physics/0308063v2.pdf - Float_t a = 5.; - Float_t b = 1.645; // Corresponds to a p-value equal to 0.05 - - - for (UInt_t k=0; kIntegral(k, nbins+1); - Float_t bkg_yield = bkg_hist->Integral(k, nbins+1); - - Float_t sig_eff = (sig_total > 0.) ? sig_yield / sig_total : -999; - - if (sig_yield > 0. && bkg_yield > 0.) - { - Float_t score = -999; - - if (fom.EqualTo("S / #sqrt{B}")) score = sig_yield / sqrt(bkg_yield); - if (fom.EqualTo("S / #sqrt{S+B}")) score = sig_yield / sqrt(sig_yield + bkg_yield); - if (fom.EqualTo("S / B")) score = sig_yield / bkg_yield; - if (fom.EqualTo("Punzi Eq.6")) score = sig_eff / (b*b + 2*a*sqrt(bkg_yield) + b*sqrt(b*b + 4*a*sqrt(b) + 4*bkg_yield)); - if (fom.EqualTo("Punzi Eq.7")) score = sig_eff / (a/2 + sqrt(bkg_yield)); - - if (score > score_value) - { - score_value = score; - score_x = sig_hist->GetBinCenter(k); - } - } - } - - - printf("\n [HistogramReader::GetBestScoreX] x = %.2f (%.2f < x < %.2f) has the best %s (%f)\n\n", - score_x, - sig_hist->GetXaxis()->GetXmin(), - sig_hist->GetXaxis()->GetXmax(), - fom.Data(), - score_value); - - - return score_x; -} - - -//------------------------------------------------------------------------------ -// GetBestSignalScoreX -//------------------------------------------------------------------------------ -Float_t HistogramReader::GetBestSignalScoreX(TString hname, - TString fom, - Int_t ngroup) -{ - printf("\n [HistogramReader::GetBestSignalScoreX] Warning: reading only the first signal\n"); - - - // Get the signals - //---------------------------------------------------------------------------- - _signalhist.clear(); - - for (UInt_t i=0; i<_signalfile.size(); i++) { - - _signalfile[i]->cd(); - - TH1D* dummy = (TH1D*)_signalfile[i]->Get(hname); - - _signalhist.push_back((TH1D*)dummy->Clone()); - - if (_luminosity_fb > 0) _signalhist[i]->Scale(_luminosity_fb); - - if (ngroup > 0) _signalhist[i]->Rebin(ngroup); - } - - - // Get the backgrounds - //---------------------------------------------------------------------------- - _mchist.clear(); - - THStack* mcstack = new THStack(hname + "_mcstack", hname + "_mcstack"); - - for (UInt_t i=0; i<_mcfile.size(); i++) { - - _mcfile[i]->cd(); - - TH1D* dummy = (TH1D*)_mcfile[i]->Get(hname); - - _mchist.push_back((TH1D*)dummy->Clone()); - - if (_luminosity_fb > 0 && _mcscale[i] > -999) _mchist[i]->Scale(_luminosity_fb); - - if (_mcscale[i] > 0) _mchist[i]->Scale(_mcscale[i]); - - if (ngroup > 0) _mchist[i]->Rebin(ngroup); - - mcstack->Add(_mchist[i]); - } - - - // Get the best score - //---------------------------------------------------------------------------- - TH1D* backgroundhist = (TH1D*)(mcstack->GetStack()->Last()); - - return GetBestScoreX(_signalhist[0], backgroundhist, fom); -} - - -//------------------------------------------------------------------------------ -// WriteYields -//------------------------------------------------------------------------------ -void HistogramReader::WriteYields(TH1* hist, - TString label) -{ - TString hname = hist->GetName(); - - if (!_writeyields) return; - - if (_writelabels) - { - _writelabels = false; - - _yields_table << Form("\n %14s", " "); - - for (int i=1; i<=hist->GetNbinsX(); i++) { - - TString binlabel = (TString)hist->GetXaxis()->GetBinLabel(i); - - _yields_table << Form(" | %-32s", binlabel.Data()); - } - - _yields_table << Form("\n"); - } - - _yields_table << Form(" %14s", label.Data()); - - for (int i=1; i<=hist->GetNbinsX(); i++) { - - float process_yield = hist->GetBinContent(i); - float process_error = sqrt(hist->GetSumw2()->At(i)); - - if (label.EqualTo("data")) - { - _yields_table << Form(" | %8.0f %14s", process_yield, " "); - } - else - { - _yields_table << Form(" | %11.2f +/- %7.2f", process_yield, process_error); - } - - int denominator = (hname.Contains("counterLum_evolution")) ? hist->GetNbinsX() : 1; - - float process_percent = 1e2 * process_yield / hist->GetBinContent(denominator); - - _yields_table << Form(" (%5.1f%s)", process_percent, "%"); - } - - _yields_table << Form("\n"); -} - - -//------------------------------------------------------------------------------ -// Roc -//------------------------------------------------------------------------------ -void HistogramReader::Roc(TString hname, - TString xtitle, - Int_t npoints, - TString units, - Float_t xmin, - Float_t xmax, - TString fom) -{ - // Get the signal - //---------------------------------------------------------------------------- - THStack* stack_sig = new THStack(hname + "_stack_sig", hname + "_stack_sig"); - - for (int i=0; i<_roc_signalfile.size(); ++i) - { - _roc_signalfile[i]->cd(); - - TH1D* dummy = (TH1D*)(_roc_signalfile[i]->Get(hname))->Clone(); - - if (_luminosity_fb > 0 && _roc_signalscale[i] > -999) dummy->Scale(_luminosity_fb); - - stack_sig->Add(dummy); - } - - TH1D* hSig = (TH1D*)(stack_sig->GetStack()->Last()); - - - // Get the backgrounds - //---------------------------------------------------------------------------- - THStack* stack_bkg = new THStack(hname + "_stack_bkg", hname + "_stack_bkg"); - - for (int j=0; j<_roc_backgroundfile.size(); ++j) - { - _roc_backgroundfile[j]->cd(); - - TH1D* dummy = (TH1D*)(_roc_backgroundfile[j]->Get(hname))->Clone(); - - if (_luminosity_fb > 0 && _roc_backgroundscale[j] > -999) dummy->Scale(_luminosity_fb); - - stack_bkg->Add(dummy); - } - - TH1D* hBkg = (TH1D*)(stack_bkg->GetStack()->Last()); - - - // For The Punzi Effect - // http://arxiv.org/pdf/physics/0308063v2.pdf - Float_t a = 5.; - Float_t b = 1.645; // Corresponds to a p-value equal to 0.05 - - - // Compute ROC and significance - //---------------------------------------------------------------------------- - float step = (xmax - xmin) / npoints; - - TGraph* rocGraph_min = new TGraph(); - TGraph* rocGraph_max = new TGraph(); - TGraph* sigGraph_min = new TGraph(); - TGraph* sigGraph_max = new TGraph(); - - Float_t score_value_min = 0; - Float_t score_value_max = 0; - Float_t score_x_min = 0; - Float_t score_x_max = 0; - - Float_t sigEff_score_x_min = -999; - Float_t bkgEff_score_x_min = -999; - Float_t sigEff_score_x_max = -999; - Float_t bkgEff_score_x_max = -999; - - Float_t sigTotal = hSig->Integral(-1, -1); - Float_t bkgTotal = hBkg->Integral(-1, -1); - - for (int s=0; s<=npoints; ++s) { - - Float_t sigYield_min = 0; - Float_t sigYield_max = 0; - Float_t bkgYield_min = 0; - Float_t bkgYield_max = 0; - - sigYield_max += hSig->Integral(-1, hSig->FindBin(xmin + s*step)); - bkgYield_max += hBkg->Integral(-1, hBkg->FindBin(xmin + s*step)); - - sigYield_min += hSig->Integral(hSig->FindBin(xmin + s*step), -1); - bkgYield_min += hBkg->Integral(hBkg->FindBin(xmin + s*step), -1); - - Float_t sigEff_max = (sigTotal != 0) ? sigYield_max / sigTotal : -999; - Float_t bkgEff_max = (bkgTotal != 0) ? bkgYield_max / bkgTotal : -999; - - Float_t sigEff_min = (sigTotal != 0) ? sigYield_min / sigTotal : -999; - Float_t bkgEff_min = (bkgTotal != 0) ? bkgYield_min / bkgTotal : -999; - - Float_t score_min = -999; - - if (sigYield_min > 0. && bkgYield_min > 0.) - { - if (fom.EqualTo("S / #sqrt{B}")) score_min = sigYield_min / sqrt(bkgYield_min); - if (fom.EqualTo("S / #sqrt{S+B}")) score_min = sigYield_min / sqrt(bkgYield_min + sigYield_min); - if (fom.EqualTo("S / B")) score_min = sigYield_min / bkgYield_min; - if (fom.EqualTo("Punzi Eq.6")) score_min = sigEff_min / (b*b + 2*a*sqrt(bkgYield_min) + b*sqrt(b*b + 4*a*sqrt(b) + 4*bkgYield_min)); - if (fom.EqualTo("Punzi Eq.7")) score_min = sigEff_min / (a/2 + sqrt(bkgYield_min)); - } - - Float_t score_max = -999; - - if (sigYield_max > 0. && bkgYield_max > 0.) - { - if (fom.EqualTo("S / #sqrt{B}")) score_max = sigYield_max / sqrt(bkgYield_max); - if (fom.EqualTo("S / #sqrt{S+B}")) score_max = sigYield_max / sqrt(bkgYield_max + sigYield_max); - if (fom.EqualTo("S / B")) score_max = sigYield_max / bkgYield_max; - if (fom.EqualTo("Punzi Eq.6")) score_max = sigEff_max / (b*b + 2*a*sqrt(bkgYield_max) + b*sqrt(b*b + 4*a*sqrt(b) + 4*bkgYield_max)); - if (fom.EqualTo("Punzi Eq.7")) score_max = sigEff_max / (a/2 + sqrt(bkgYield_max)); - } - - if (score_min > score_value_min) { - score_value_min = score_min; - score_x_min = xmin + s*step; - sigEff_score_x_min = sigEff_min; - bkgEff_score_x_min = bkgEff_min; - } - - if (score_max > score_value_max) { - score_value_max = score_max; - score_x_max = xmin + s*step; - sigEff_score_x_max = sigEff_max; - bkgEff_score_x_max = bkgEff_max; - } - - rocGraph_min->SetPoint(s, sigEff_min, 1 - bkgEff_min); - rocGraph_max->SetPoint(s, sigEff_max, 1 - bkgEff_max); - - sigGraph_min->SetPoint(s, xmin + s*step, score_min); - sigGraph_max->SetPoint(s, xmin + s*step, score_max); - } - - - printf("\n"); - printf(" [HistogramReader::Roc] Reading %s from %.2f to %.2f\n\n", hname.Data(), xmin, xmax); - printf(" The best %s (%f) corresponds to x > %7.2f %s (S_eff = %6.2f\%, B_eff = %6.2f\%)\n", - fom.Data(), - score_value_min, - score_x_min, - units.Data(), - 1e2 * sigEff_score_x_min, - 1e2 * bkgEff_score_x_min); - printf(" The best %s (%f) corresponds to x < %7.2f %s (S_eff = %6.2f\%, B_eff = %6.2f\%)\n", - fom.Data(), - score_value_max, - score_x_max, - units.Data(), - 1e2 * sigEff_score_x_max, - 1e2 * bkgEff_score_x_max); - printf("\n"); - - - // Draw and save ROC - //---------------------------------------------------------------------------- - Color_t color_min = kRed+1; - Color_t color_max = kBlack; - - Style_t style_min = kFullCircle; - Style_t style_max = kOpenCircle; - - TCanvas* rocCanvas = new TCanvas(hname + " ROC", hname + " ROC"); - - rocGraph_min->SetMarkerColor(color_min); - rocGraph_min->SetMarkerStyle(style_min); - rocGraph_min->SetMarkerSize(0.5); - - rocGraph_max->SetMarkerColor(color_max); - rocGraph_max->SetMarkerStyle(style_max); - rocGraph_max->SetMarkerSize(0.5); - - rocGraph_min->Draw("ap"); - rocGraph_max->Draw("psame"); - - rocGraph_min->GetXaxis()->SetRangeUser(0, 1); - rocGraph_min->GetYaxis()->SetRangeUser(0, 1); - - DrawLatex(42, 0.190, 0.945, 0.050, 11, _title); - - SetAxis(rocGraph_min->GetHistogram(), xtitle + " signal efficiency", xtitle + " background rejection", 1.5, 1.8); - - if (_savepdf) rocCanvas->SaveAs(_outputdir + hname + "_ROC.pdf"); - if (_savepng) rocCanvas->SaveAs(_outputdir + hname + "_ROC.png"); - - - // Draw and save significance - //---------------------------------------------------------------------------- - TCanvas *sigCanvas = new TCanvas(hname + " significance", hname + " significance"); - - TString myxtitle = (!units.Contains("NULL")) ? xtitle + " [" + units + "]" : xtitle; - - sigGraph_min->SetMarkerColor(color_min); - sigGraph_min->SetMarkerStyle(style_min); - sigGraph_min->SetMarkerSize(0.5); - - sigGraph_max->SetMarkerColor(color_max); - sigGraph_max->SetMarkerStyle(style_max); - sigGraph_max->SetMarkerSize(0.5); - - sigGraph_min->Draw("ap"); - sigGraph_max->Draw("psame"); - - Float_t ymax = (score_value_min > score_value_max) ? score_value_min : score_value_max; - - ymax *= 1.5; - - sigGraph_min->GetXaxis()->SetRangeUser(xmin, xmax); - sigGraph_min->GetYaxis()->SetRangeUser( 0, ymax); - - DrawLatex(42, 0.190, 0.945, 0.050, 11, _title); - - TH1F* dummy_min = new TH1F("dummy_min", "", 1, 0, 1); - TH1F* dummy_max = new TH1F("dummy_max", "", 1, 0, 1); - - dummy_min->SetLineColor (color_min); - dummy_min->SetMarkerColor(color_min); - dummy_min->SetMarkerStyle(style_min); - - dummy_max->SetLineColor (color_max); - dummy_max->SetMarkerColor(color_max); - dummy_max->SetMarkerStyle(style_max); - - DrawLegend(0.22, 0.84, dummy_min, Form("%s > x", xtitle.Data()), "lp", false); - DrawLegend(0.22, 0.77, dummy_max, Form("%s < x", xtitle.Data()), "lp", false); - - SetAxis(sigGraph_min->GetHistogram(), myxtitle, fom, 1.5, 2.1); - - if (_savepdf) sigCanvas->SaveAs(_outputdir + hname + "_significance.pdf"); - if (_savepng) sigCanvas->SaveAs(_outputdir + hname + "_significance.png"); - - dummy_min->Delete(); - dummy_max->Delete(); -} - - -// ----------------------------------------------------------------------------- -// IncludeSystematics -//------------------------------------------------------------------------------ -void HistogramReader::IncludeSystematics(TString hname) -{ - int nsystematics = _systematics.size(); - int nbins = _mchist[0]->GetNbinsX(); - int nprocess = _mchist.size(); - - // Table variables - float yieldTab [nprocess][nbins]; - float errStatTab [nprocess][nbins]; - float errsystTab_do [nprocess][nsystematics][nbins]; - float errsystTab_up [nprocess][nsystematics][nbins]; - for (int i=0; i < nsystematics; i++){for (int j=1; j<=nbins; j++){ for (int k=0; k Get( hname );//nominal - TH1D* dummy1 = (TH1D*)myfile1->Get( hname );//up - TH1D* dummy2 = (TH1D*)myfile2->Get( hname );//down - - if (_luminosity_fb > 0 && _mcscale[kproce] > -999) - { - dummy0->Scale(_luminosity_fb); - dummy1->Scale(_luminosity_fb); - dummy2->Scale(_luminosity_fb); - } - - if (_mcscale[kproce] > 0) - { - dummy0->Scale(_mcscale[kproce]); - dummy1->Scale(_mcscale[kproce]); - dummy2->Scale(_mcscale[kproce]); - } - - // Print Process name - printf( " \n"); - printf("process name %s\n", _mcfilename.at(kproce).Data()); - printf( " \n"); - - // Loop over all bins (Underflow is not included) - //-------------------------------------------------------------------- - for (int ibin=1; ibin<=nbins; ibin++) - { - errSystUp [isyst][ibin] += (dummy1->GetBinContent(ibin) - dummy0->GetBinContent(ibin)); - errSystDo [isyst][ibin] += (dummy2->GetBinContent(ibin) - dummy0->GetBinContent(ibin)); - - yieldTab [kproce][ibin] = dummy0->GetBinContent(ibin); - errStatTab [kproce][ibin] = dummy0->GetSumw2()->At(ibin); - errsystTab_up[kproce][isyst][ibin] = dummy1->GetBinContent(ibin) - dummy0->GetBinContent(ibin); - errsystTab_do[kproce][isyst][ibin] = dummy2->GetBinContent(ibin) - dummy0->GetBinContent(ibin); - // Print Bin Information per process - printf( "Print Bin Information per process \n"); - printf( " \n"); - printf( " bin number = %i\n", ibin ); - printf( " \n"); - printf( " nominal = %f\n", dummy0->GetBinContent(ibin)); - printf( " SF+ errUp = %f\n", dummy1->GetBinContent(ibin)); - printf( " SF+ errDo = %f\n", dummy2->GetBinContent(ibin)); - // Print Systematic Error per process - printf( "Print Systematic Error per process \n"); - printf( " \n"); - printf( " ErrsystUp = %.5f\n", (dummy1->GetBinContent(ibin) - dummy0->GetBinContent(ibin)) ); - printf( " ErrsystDo = %.5f\n", (dummy2->GetBinContent(ibin) - dummy0->GetBinContent(ibin)) ); - printf( " rel_ErrsystUp = %.5f %\n", (dummy1->GetBinContent(ibin) - dummy0->GetBinContent(ibin)) / dummy0->GetBinContent(ibin) ); - printf( " rel_ErrsystDo = %.5f %\n", (dummy2->GetBinContent(ibin) - dummy0->GetBinContent(ibin)) / dummy0->GetBinContent(ibin) ); - - // - - } - - - myfile0->Close(); - myfile1->Close(); - myfile2->Close(); - - } - } - - std::ofstream inFile("Yields_" + _mycut +".tex",std::ios::out); - // Process | nbins = 7; - inFile << "\\begin{tabular}{|c|c|c|c|c|c|c|c|}" << endl; - inFile << "\\hline" << endl; - inFile << _mycut << endl; - //Yield & stat_error & systematic_error & total_error" << endl; - inFile << "\\hline" << endl; - inFile << "ibin &"; - for (int ibin=1; ibin<=nbins; ibin++) - { - inFile << ibin << "&"; - } - inFile << "\\hline" << endl; - for (int kproce=0; kproceGetSumw2()->At(ibin)); - x [ibin] = _allmchist ->GetXaxis()->GetBinCenter(ibin); - y [ibin] = _allmchist ->GetBinContent(ibin); - errLumi [ibin] = y[ibin] * lumi_error_percent/1e2; - errTrig [ibin] = y[ibin] * 1/1e2; - exl [ibin] = (_allmchist -> GetXaxis() -> GetBinWidth(ibin))/2; - exh [ibin] = exl[ibin]; - - //Print Stat and flat errors per bin - printf( "bin number = %i\n", ibin ); - printf( " \n"); - printf( "--------------------- Flat errors ----------------------------\n" ); - printf( "---------------------------------------------------------\n"); - printf( " \n"); - printf( "errStat = %f\n", errStat [ibin] ); - printf( "errLumi = %f\n", errLumi [ibin] ); - printf( "errTrig = %f\n", errTrig [ibin] ); - printf( "rel_errStat = %f %\n", errStat [ibin] / y [ibin] ); - printf( "rel_errLumi = %f %\n", errLumi [ibin] / y [ibin]); - printf( "rel_errTrig = %f %\n", errTrig [ibin] / y [ibin]); - printf( " \n"); - printf( "--------------------------------------------------------\n" ); - - - float systUp2 = 0; - float systDo2 = 0; - float systSym2 = 0; - - for (int isyst =0; isyst< nsystematics; isyst++) - { - - if ( errSystUp [isyst][ibin] * errSystDo [isyst][ibin] > 0 ) - { - printf( "WARNING! errSystUp and errSystDo have the same sign!\n") ; - printf( "The systematic is %s, the bin is %i \n\n", _systematics.at(isyst).Data(), ibin); - printf( "errSystUp = %f\n errSystDo = %f\n", errSystUp [isyst][ibin], errSystDo [isyst][ibin]); - } - - // Assymetric errors - if ( errSystUp [isyst][ibin] < 0 && errSystDo [isyst][ibin] > 0 ) - { - float midErrUp = errSystUp [isyst][ibin]; - float midErrDo = errSystDo[isyst][ibin]; - errSystUp [isyst][ibin] = midErrDo; - errSystDo [isyst][ibin] = midErrUp; - } - - systUp2 += errSystUp [isyst][ibin] * errSystUp [isyst][ibin]; - systDo2 += errSystDo [isyst][ibin] * errSystDo [isyst][ibin]; - // Symmetric errors - //systSym2 += sqrt( (errSystUp [isyst][ibin] + errSystDo [isyst][ibin]) * (errSystUp [isyst][ibin] + errSystDo [isyst][ibin]) ) / 2 ; - - // Print Systematic Total Errors (sum over all processe---s) - printf( " \n"); - printf( "---- %s Systematic Total Error\n", _systematics.at(isyst).Data()); -// printf( "systematic name %s \n", _systematics.at(isyst).Data() ); - printf( " \n"); - printf( "ErrsystUp = %.5f\n", errSystUp [isyst][ibin] ); - printf( "ErrsystDo = %.5f\n", errSystDo [isyst][ibin] ); - printf( "rel_ErrsystUp = %.5f %\n", errSystUp [isyst][ibin] / y [ibin] ); - printf( "rel_ErrsystDo = %.5f %\n", errSystDo [isyst][ibin] / y [ibin] ); - printf( "ErrsystSym = %.5f\n", fabs(errSystUp [isyst][ibin])/2 + fabs(errSystDo [isyst][ibin])/2 ); - printf( "----------------------------------------------------------\n"); - printf( " \n"); - - } - - eyl [ibin] = sqrt( errStat[ibin] * errStat[ibin] + errLumi[ibin]*errLumi[ibin] + systDo2); - eyh [ibin] = sqrt( errStat[ibin] * errStat[ibin] + errLumi[ibin]*errLumi[ibin] + systUp2); - - //Print Total Error per bin - printf( "----------------------- Total Error -------------------\n"); - printf( "err_up = %.5f\n", eyh [ibin] ); - printf( "err_down = %.5f\n", eyl [ibin] ); - printf( "rel_err_down = %.5f %\n", eyl [ibin] / y [ibin] ); - printf( "rel_err_up = %.5f %\n", eyh [ibin] / y [ibin]); - printf( "----------------------------------------------------------\n"); - printf( " \n"); - - - } - - _ErrorGr = new TGraphAsymmErrors(nbins,x,y,exl,exh,eyl,eyh); - - _ErrorGr->SetMarkerColor(kGray+1); - _ErrorGr->SetMarkerSize ( 0); - _ErrorGr->SetLineColor (kGray+1); - _ErrorGr->SetFillColor (kGray+1); - _ErrorGr->SetFillStyle ( 3345); - - -} - From e8617cb39ab27d8be2ef44e1e32946255f8e4e24 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 23 Nov 2017 18:41:17 +0100 Subject: [PATCH 15/28] my changes in stop/runPlotter 22Nov2017 --- stop/runPlotter.C | 79 ++++++++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/stop/runPlotter.C b/stop/runPlotter.C index 483e8f8c..22af2815 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -3,18 +3,22 @@ // Constants //------------------------------------------------------------------------------ -const Bool_t datadriven = false; -const Bool_t allplots = false; -const Bool_t dosystematics = false; -const Bool_t postfitplots = false; +const Bool_t datadriven = false; +const Bool_t allplots = false; +const Bool_t dosystematics = true; +const Bool_t postfitplots = false; +const Bool_t applySF = false; +const TString inputdir = "rootfiles/nominal/"; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; -const TString inputdir = "../minitrees/rootfiles/nominal/"; +//const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; +//const TString inputdir = "../minitrees/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; -const TString outputdir = "figure_05Paper/"; +const TString outputdir = "figures_ValidationRegion_Systematics/"; -const TString signal = "T2tt"; +const TString signal = ""; +//const TString signal = "T2tt"; //const TString signal = "TChi"; const TString sl = "#font[12]{l}"; @@ -92,12 +96,11 @@ void runPlotter(TString level, } else if (level.Contains("NoTag")) { SF_ZMet = 1.21;// +/- 0.17 } else { - SF_ZMet = 1.05;// +/- 0.12 + SF_ZMet = 1.06;// +/- 0.12 } } } } - // Get the data //---------------------------------------------------------------------------- plotter.AddData("01_Data", "data", color_Data); @@ -112,13 +115,13 @@ void runPlotter(TString level, //plotter.AddProcess("14_HZ", "HZ", color_HZ); //plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); - plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background );//, SF_ttZ); + plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); plotter.AddProcess("11_HWW", "HWW", color_HWW); - plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l)", color_VZ, roc_background); //, SF_ZMet); - plotter.AddProcess("15_VZ3V", "VVV+VZ", color_VVV, roc_background); //, SF_ZMet); - plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets, roc_background); + plotter.AddProcess("15_VZ3V", "VVV+VZ", color_VVV, roc_background); + plotter.AddProcess("07_ZJetsHT" + DYCorr, "Z+jets", color_ZJets, roc_background); + //plotter.AddProcess("07_ZJetsHT", "Z+jets", color_ZJets, roc_background); //plotter.AddProcess("07_ZJetsHT_DYcorr", "Z+jets", color_ZJets, roc_background); - plotter.AddProcess("02_WZTo3LNu", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background); //, 0.97); + plotter.AddProcess("02_WZTo3LNu", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); plotter.AddProcess("06_WW", "WW", color_WW); plotter.AddProcess("05_ST", "tW", color_ST); plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); @@ -151,8 +154,12 @@ void runPlotter(TString level, 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); plotter.AddSignal("TChiSlep_Xm800_Xm400", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (800,400)", kOrange); - } + } else if (signal==""){ + + printf("No signal"); + } + if (inputdir.Contains("rootfiles/nominalX")) { // Draw events by cut @@ -203,41 +210,50 @@ void runPlotter(TString level, plotter.AddSystematic("Stop", "MT2llTop"); plotter.AddSystematic("Stop", "MT2llWW"); plotter.AddSystematic("Stop", "Fake"); + std::cout << "1" << std::endl; plotter.AddSystematic("Stop", "Idiso"); + std::cout << "2" << std::endl; plotter.AddSystematic("Stop", "JES"); + std::cout << "3" << std::endl; plotter.AddSystematic("Stop", "MET"); - plotter.AddSystematic("Stop", "PDF"); - plotter.AddSystematic("Stop", "Q2"); + std::cout << "4" << std::endl; + //plotter.AddSystematic("Stop", "PDF"); + std::cout << "5" << std::endl; + //plotter.AddSystematic("Stop", "Q2"); + std::cout << "6" << std::endl; plotter.AddSystematic("Stop", "Reco"); + std::cout << "7" << std::endl; plotter.AddSystematic("Stop", "Toppt"); + std::cout << "8" << std::endl; plotter.AddSystematic("Stop", "Isrnjet"); - plotter.AddSystematic("Stop", "Metfastsim"); + std::cout << "9" << std::endl; + //plotter.AddSystematic("Stop", "Metfastsim"); plotter.AddSystematic("Stop", "Pileup"); - plotter.AddSystematic("Stop", "Fastsim"); - plotter.AddSystematic("Stop", "BtagFS"); - plotter.AddSystematic("Stop", "Btag"); + //plotter.AddSystematic("Stop", "Fastsim"); + //plotter.AddSystematic("Stop", "BtagFS"); + /* plotter.AddSystematic("Stop", "Btag"); plotter.AddSystematic("Stop", "Btaglight"); - plotter.AddSystematic("Stop", "ttZSF"); - plotter.AddSystematic("Stop", "WZSF"); - plotter.AddSystematic("Stop", "ZZSF"); - plotter.AddSystematic("Stop", "ZZshape"); + //plotter.AddSystematic("Stop", "ttZSF"); + //plotter.AddSystematic("Stop", "WZSF"); + //plotter.AddSystematic("Stop", "ZZSF"); + //plotter.AddSystematic("Stop", "ZZshape"); ////plotter.AddSystematic("Stop", "DYSF"); - plotter.AddSystematic("Stop", "DYshape"); - plotter.AddSystematic("Stop", "DYnojet"); + //plotter.AddSystematic("Stop", "DYshape"); + //plotter.AddSystematic("Stop", "DYnojet"); ////plotter.AddSystematic("Stop", "normWZ"); ////plotter.AddSystematic("Stop", "normWW"); ///plotter.AddSystematic("Stop", "normTtbar"); ///plotter.AddSystematic("Stop", "normTW"); - plotter.AddSystematic("Stop", "normDY"); + //plotter.AddSystematic("Stop", "normDY"); ///plotter.AddSystematic("Stop", "normTTW"); ///plotter.AddSystematic("Stop", "normHWW"); ///plotter.AddSystematic("Stop", "normVVV"); - } + */ } } // Draw distributions //---------------------------------------------------------------------------- - if (!option.Contains("nostack")) plotter.SetDrawYield(false); + if (!option.Contains("nostack")) plotter.SetDrawYield(true); float m2l_xmin = (level.Contains("WZ")) ? 60 : 0; // [GeV] float m2l_xmax = (level.Contains("WZ")) ? 120 : 300; // [GeV] @@ -255,6 +271,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"; @@ -323,7 +340,7 @@ 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 + "MET" + suffix, sm, 1, 0, "GeV", scale, true, 0, 400); //continue; if (inputdir.Contains("../rootfiles/nominalX")) { plotter.Draw(prefix + "mt2ll" + suffix, "M_{T2}(" + sll + ")", 10, 0, "GeV", scale, true, 0, 400); From 563ee950a2bf165aea03af4a4146bcc17428a323 Mon Sep 17 00:00:00 2001 From: Barbara Date: Fri, 24 Nov 2017 14:14:35 +0100 Subject: [PATCH 16/28] 23 Nov 2017 --- test/HistogramReader.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/HistogramReader.C b/test/HistogramReader.C index 9dd25ccf..e58f050f 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -263,6 +263,7 @@ void HistogramReader::Draw(TString hname, } else { + //canvas = new TCanvas(cname, cname, 550, 740); canvas = new TCanvas(cname, cname, 550, 600); pad1 = new TPad("pad1", "pad1", 0, 0, 1, 1); @@ -650,6 +651,7 @@ 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"); ny++; } From 1d968fa9722ccc8bd69558ee2ce917bf28e19714 Mon Sep 17 00:00:00 2001 From: Barbara Date: Mon, 4 Dec 2017 11:14:55 +0100 Subject: [PATCH 17/28] update 4 Dic --- .../80x/stopSel/lxplus/nominal_minitrees.txt | 20 +++++--- stop/runPlotter.C | 51 ++++++++++--------- test/HistogramReader.C | 12 +++-- 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/samples/80x/stopSel/lxplus/nominal_minitrees.txt b/samples/80x/stopSel/lxplus/nominal_minitrees.txt index 7f418bf9..6e3149bd 100644 --- a/samples/80x/stopSel/lxplus/nominal_minitrees.txt +++ b/samples/80x/stopSel/lxplus/nominal_minitrees.txt @@ -64,14 +64,18 @@ #/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 -/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 -/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 +#/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/stop/runPlotter.C b/stop/runPlotter.C index b4cb2af0..9d4d23b1 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -7,22 +7,23 @@ const Bool_t datadriven = false; const Bool_t allplots = false; const Bool_t dosystematics = false; const Bool_t postfitplots = false; -const Bool_t paperstyle = true; +const Bool_t paperstyle = false; const Bool_t regionlegend = true; -const TString inputdir = "rootfiles/nominal/"; +const TString inputdir = "../rootfiles/nominal/"; +//const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; -const TString outputdir = "figures_ValidationRegion_Systematics/"; +const TString outputdir = "PreapprovalTalk_Yieldls/"; +//const TString outputdir = "TBTHanns_ValidatSyst_YSF_22Nov17/"; +//const TString outputdir = "Paperfigures_22Nov17_DrawSign/"; //const TString signal = ""; -const TString signal = "T2tt"; -//const TString signal = "TChi"; -//======= -//const TString inputdir = "../minitrees/rootfiles/nominal/"; +//const TString signal = "T2tt"; +const TString signal = "TChi"; const TString sl = "#font[12]{l}"; const TString sll = "#font[12]{ll}"; @@ -90,12 +91,13 @@ void runPlotter(TString level, { plotter.SetLuminosity(lumi, postfitplots); plotter.SetDrawRatio (false); - //plotter.SetDrawSignificance(true); + plotter.SetDrawSignificance(false); } float SF_ttZ = 1., SF_ZMet = 1., SF_DY = 1., SF_WZ = 1.; - if (!postfitplots) { + /*if (!postfitplots) { if (level.Contains("_SR") || level.Contains("_VRggg")) {// && inputdir.Contains("DYcorr"))) { + //if (level.Contains("_SR") || level.Contains("_VRggg") || level.Contains("_VR1")) {// && inputdir.Contains("DYcorr"))) { SF_ttZ = 1.44, SF_WZ = 0.97; if (!postfitplots && !inputdir.Contains("Zpeakk") && !inputdir.Contains("ZZ")) { if (level.Contains("NoJet")) { @@ -107,10 +109,11 @@ void runPlotter(TString level, } } } - } + }*/ + // Get the data //---------------------------------------------------------------------------- - plotter.AddData("01_Data", "data", color_Data); +// plotter.AddData("01_Data", "data", color_Data); TString DYCorr = "_DYcorr"; if (!level.Contains("_SR")) DYCorr = ""; @@ -133,7 +136,7 @@ void runPlotter(TString level, plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); plotter.AddProcess("11_HWW", "HWW", color_HWW); - plotter.AddProcess("02_WZTo3LNu", "WZtoWW (#rightarrow 3l)", color_WZTo3LNu, roc_background, 0.97); + plotter.AddProcess("02_WZTo3LNu", "WZ (#rightarrow 3l)", color_WZTo3LNu, roc_background, SF_WZ); plotter.AddProcess("06_WW", "WW", color_WW); plotter.AddProcess("05_ST", "tW", color_ST); plotter.AddProcess("07_ZJetsHT" + DYCorr, "Z+jets", color_ZJets, roc_background); @@ -191,7 +194,7 @@ void runPlotter(TString level, // Draw events by channel //---------------------------------------------------------------------------- - plotter.SetDrawYield(false); + plotter.SetDrawYield(true); for (int j=0; j<=njetbin; j++) { @@ -225,9 +228,9 @@ void runPlotter(TString level, std::cout << "3" << std::endl; plotter.AddSystematic("Stop", "MET"); std::cout << "4" << std::endl; - //plotter.AddSystematic("Stop", "PDF"); + plotter.AddSystematic("Stop", "PDF"); std::cout << "5" << std::endl; - //plotter.AddSystematic("Stop", "Q2"); + plotter.AddSystematic("Stop", "Q2"); std::cout << "6" << std::endl; plotter.AddSystematic("Stop", "Reco"); std::cout << "7" << std::endl; @@ -235,19 +238,19 @@ void runPlotter(TString level, std::cout << "8" << std::endl; plotter.AddSystematic("Stop", "Isrnjet"); std::cout << "9" << std::endl; - //plotter.AddSystematic("Stop", "Metfastsim"); + plotter.AddSystematic("Stop", "Metfastsim"); plotter.AddSystematic("Stop", "Pileup"); //plotter.AddSystematic("Stop", "Fastsim"); //plotter.AddSystematic("Stop", "BtagFS"); - /* plotter.AddSystematic("Stop", "Btag"); + plotter.AddSystematic("Stop", "Btag"); plotter.AddSystematic("Stop", "Btaglight"); - //plotter.AddSystematic("Stop", "ttZSF"); - //plotter.AddSystematic("Stop", "WZSF"); - //plotter.AddSystematic("Stop", "ZZSF"); - //plotter.AddSystematic("Stop", "ZZshape"); + plotter.AddSystematic("Stop", "ttZSF"); + plotter.AddSystematic("Stop", "WZSF"); + plotter.AddSystematic("Stop", "ZZSF"); + plotter.AddSystematic("Stop", "ZZshape"); ////plotter.AddSystematic("Stop", "DYSF"); - //plotter.AddSystematic("Stop", "DYshape"); - //plotter.AddSystematic("Stop", "DYnojet"); + plotter.AddSystematic("Stop", "DYshape"); + plotter.AddSystematic("Stop", "DYnojet"); ////plotter.AddSystematic("Stop", "normWZ"); ////plotter.AddSystematic("Stop", "normWW"); ///plotter.AddSystematic("Stop", "normTtbar"); @@ -256,7 +259,7 @@ void runPlotter(TString level, ///plotter.AddSystematic("Stop", "normTTW"); ///plotter.AddSystematic("Stop", "normHWW"); ///plotter.AddSystematic("Stop", "normVVV"); - */ } + } } // Draw distributions diff --git a/test/HistogramReader.C b/test/HistogramReader.C index c8c648be..a98f463f 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -263,11 +263,12 @@ void HistogramReader::Draw(TString hname, } else { - //canvas = new TCanvas(cname, cname, 550, 740); 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(); } @@ -551,8 +552,8 @@ void HistogramReader::Draw(TString hname, if (pad1->GetLogy()) { theMin = 1e-2; // 1e-5 - int maxOrder = 4; - if (_signalfilename.size()>1 && hname.Contains("Tag/")) maxOrder = 5; + int maxOrder = 6; + if (_signalfilename.size()>1 && hname.Contains("Tag/")) maxOrder = 6; if (_signalfilename.size()<1) maxOrder--; if (_drawyield) maxOrder++; theMax = TMath::Power(10, TMath::Log10(theMax) + maxOrder); // 6); @@ -567,6 +568,7 @@ void HistogramReader::Draw(TString hname, if (ymin != -999) hfirst->SetMinimum(ymin); if (ymax != -999) hfirst->SetMaximum(ymax); + //hfirst ->SetMaximum(0.1); From a40186566bd621563ce3bf67d0ddf0e1b1021bc8 Mon Sep 17 00:00:00 2001 From: Barbara Date: Tue, 5 Dec 2017 12:02:38 +0100 Subject: [PATCH 18/28] 5 Dec 2017 --- include/AnalysisCMS.h | 3 ++ src/AnalysisCMS.C | 75 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 64 insertions(+), 14 deletions(-) diff --git a/include/AnalysisCMS.h b/include/AnalysisCMS.h index 137422af..77a91ec0 100644 --- a/include/AnalysisCMS.h +++ b/include/AnalysisCMS.h @@ -15,6 +15,7 @@ #include #include #include +#include enum {Loose, Tight}; @@ -172,6 +173,7 @@ class AnalysisCMS : public AnalysisBase void GetScaleAndResolution(); + TRandom3* rand_; // Data members //---------------------------------------------------------------------------- @@ -217,6 +219,7 @@ class AnalysisCMS : public AnalysisBase bool _systematic_toppt; bool _applytopptreweighting; + TString _analysis; TString _dataperiod; TString _isdatadriven; diff --git a/src/AnalysisCMS.C b/src/AnalysisCMS.C index 0ea41bad..cf74d5ed 100644 --- a/src/AnalysisCMS.C +++ b/src/AnalysisCMS.C @@ -13,7 +13,7 @@ AnalysisCMS::AnalysisCMS(TTree* tree, TString systematic) : AnalysisBase(tree) { if (_verbosity > 0) printf(" <<< Entering [AnalysisCMS::AnalysisCMS]\n"); - _verbosity = 0; // Set it to 1 for debugging + _verbosity = 1; // Set it to 1 for debugging _ismc = true; _saveminitree = false; @@ -47,26 +47,72 @@ bool AnalysisCMS::PassTrigger() { if (_verbosity > 0) printf(" <<< Entering [AnalysisCMS::PassTrigger]\n"); - if (_ismc) return true; // Need to study, Summer16 does have the trigger info + // if (_ismc) return true; // Need to study, Summer16 does have the trigger info //bool passtrgmc = (std_vector_trigger->at(6) || std_vector_trigger->at(8)) || (std_vector_trigger->at(11) || std_vector_trigger->at(13)) || //(std_vector_trigger->at(42) || std_vector_trigger->at(43)) || (std_vector_trigger->at(0) || std_vector_trigger->at(56)) || //(std_vector_trigger->at(46)); //return passtrgmc; - if (_sample.Contains("MuonEG")) return ( trig_EleMu); - else if (_sample.Contains("DoubleMuon")) return (!trig_EleMu && trig_DbleMu); - else if (_sample.Contains("SingleMuon")) return (!trig_EleMu && !trig_DbleMu && trig_SnglMu); - else if (_sample.Contains("DoubleEG")) return (!trig_EleMu && !trig_DbleMu && !trig_SnglMu && trig_DbleEle); - else if (_sample.Contains("SingleElectron")) return (!trig_EleMu && !trig_DbleMu && !trig_SnglMu && !trig_DbleEle && trig_SnglEle); - else if (_sample.Contains("MET")) { - int METtriggers[] = {63, 64, 65, 66, 68, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92}; - for(int a = 0; a < 18; a++) { - if(std_vector_trigger->at(METtriggers[a]) != 0) return true; - } - return false; + + + + if (_ismc){ + + // MC trigged for "Full2016" + bool passtrgmc; + //Print Warning + int MCtrigger[11] = {6,8,11,13,44,45,46,57,93,97,112}; + for (int a=0; a<11; a++){ + if (std_vector_trigger->at(MCtrigger[a]) <0) { + printf (" WARNING: this trigger is not present in this mC sample %int, MCtrigger[a]"); + return false; + } + } + // Pass the trigger selection + rand_ = new TRandom3(0); + //throw die + float coin = rand_->Uniform(1.); + float lumiEra = _luminosity*coin; + if (lumiEra < 18.0) bool passtrgmc = ((std_vector_trigger->at(6) || std_vector_trigger->at(8)) || + (std_vector_trigger->at(11) || std_vector_trigger->at(13))|| + (std_vector_trigger->at(44) || std_vector_trigger->at(45))|| + std_vector_trigger ->at(46) || + (std_vector_trigger->at(93) || std_vector_trigger->at(112))); + + if (18.0 < lumiEra < 28.0) bool passtrgmc = ((std_vector_trigger->at(57) || std_vector_trigger->at(97))|| + (std_vector_trigger->at(11) || std_vector_trigger->at(13))|| + (std_vector_trigger->at(44) || std_vector_trigger->at(45))|| + std_vector_trigger ->at(46) || + (std_vector_trigger->at(93) || std_vector_trigger->at(112))); + + if (28.0 < lumiEra < 36.0) bool passtrgmc = ((std_vector_trigger->at(57) || std_vector_trigger->at(97))|| + (std_vector_trigger->at(10) || std_vector_trigger->at(12))|| + (std_vector_trigger->at(44) || std_vector_trigger->at(45))|| + std_vector_trigger ->at(46) || + (std_vector_trigger->at(93) || std_vector_trigger->at(112))); + + + return passtrgmc; + + + }else{ + + if (_sample.Contains("MuonEG")) return ( trig_EleMu); + else if (_sample.Contains("DoubleMuon")) return (!trig_EleMu && trig_DbleMu); + else if (_sample.Contains("SingleMuon")) return (!trig_EleMu && !trig_DbleMu && trig_SnglMu); + else if (_sample.Contains("DoubleEG")) return (!trig_EleMu && !trig_DbleMu && !trig_SnglMu && trig_DbleEle); + else if (_sample.Contains("SingleElectron")) return (!trig_EleMu && !trig_DbleMu && !trig_SnglMu && !trig_DbleEle && trig_SnglEle); + else if (_sample.Contains("MET")) { + int METtriggers[] = {63, 64, 65, 66, 68, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92}; + for(int a = 0; a < 18; a++) { + if(std_vector_trigger->at(METtriggers[a]) != 0) return true; + } + return false; + } + else return true; } - else return true; + } @@ -645,6 +691,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) From 4b8eb28f368d2a52d3447b38e4de2f9cb3ce0766 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 7 Dec 2017 12:16:19 +0100 Subject: [PATCH 19/28] 7 Dec 2017 --- include/AnalysisCMS.h | 3 ++- src/AnalysisCMS.C | 35 +++++++++++++++++++---------------- src/AnalysisStop.C | 13 +++++++------ 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/include/AnalysisCMS.h b/include/AnalysisCMS.h index 77a91ec0..a7d5c0f8 100644 --- a/include/AnalysisCMS.h +++ b/include/AnalysisCMS.h @@ -173,7 +173,8 @@ class AnalysisCMS : public AnalysisBase void GetScaleAndResolution(); - TRandom3* rand_; + TRandom3* _rand; + TRandom3* _rand2; // Data members //---------------------------------------------------------------------------- diff --git a/src/AnalysisCMS.C b/src/AnalysisCMS.C index cf74d5ed..48c1c422 100644 --- 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 = 1; // Set it to 1 for debugging + _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; @@ -33,7 +34,7 @@ AnalysisCMS::AnalysisCMS(TTree* tree, TString systematic) : AnalysisBase(tree) _systematic_toppt = (systematic.Contains("Toppt")) ? true : false; _systematic = systematic; - + _minitreepath = ""; } @@ -53,40 +54,41 @@ bool AnalysisCMS::PassTrigger() //(std_vector_trigger->at(42) || std_vector_trigger->at(43)) || (std_vector_trigger->at(0) || std_vector_trigger->at(56)) || //(std_vector_trigger->at(46)); //return passtrgmc; - - - if (_ismc){ // MC trigged for "Full2016" bool passtrgmc; //Print Warning - int MCtrigger[11] = {6,8,11,13,44,45,46,57,93,97,112}; - for (int a=0; a<11; a++){ + int MCtrigger[13] = {6,8,10,11,12,13,44,45,46,57,93,97,112}; + for (int a=0; a<13; a++){ if (std_vector_trigger->at(MCtrigger[a]) <0) { - printf (" WARNING: this trigger is not present in this mC sample %int, MCtrigger[a]"); + printf (" WARNING: this trigger is not present in this mC sample %i\n, MCtrigger[a]"); return false; } } // Pass the trigger selection - rand_ = new TRandom3(0); + _rand2 = new TRandom3(0); + float coin2 = _rand2 -> Uniform(1.); + //std::cout<<" coin2 "<< coin2 <Uniform(1.); - float lumiEra = _luminosity*coin; - if (lumiEra < 18.0) bool passtrgmc = ((std_vector_trigger->at(6) || std_vector_trigger->at(8)) || + float coin = _rand->Uniform(1.); + //std::cout<<" coin_real "<< coin <at(6) || std_vector_trigger->at(8)) || (std_vector_trigger->at(11) || std_vector_trigger->at(13))|| (std_vector_trigger->at(44) || std_vector_trigger->at(45))|| std_vector_trigger ->at(46) || (std_vector_trigger->at(93) || std_vector_trigger->at(112))); - if (18.0 < lumiEra < 28.0) bool passtrgmc = ((std_vector_trigger->at(57) || std_vector_trigger->at(97))|| + if (17.68 < lumiEra < 27.261) passtrgmc = ((std_vector_trigger->at(57) || std_vector_trigger->at(97))|| (std_vector_trigger->at(11) || std_vector_trigger->at(13))|| (std_vector_trigger->at(44) || std_vector_trigger->at(45))|| std_vector_trigger ->at(46) || (std_vector_trigger->at(93) || std_vector_trigger->at(112))); - if (28.0 < lumiEra < 36.0) bool passtrgmc = ((std_vector_trigger->at(57) || std_vector_trigger->at(97))|| + if (27.261 < lumiEra < 35.867) passtrgmc = ((std_vector_trigger->at(57) || std_vector_trigger->at(97))|| (std_vector_trigger->at(10) || std_vector_trigger->at(12))|| (std_vector_trigger->at(44) || std_vector_trigger->at(45))|| std_vector_trigger ->at(46) || @@ -592,7 +594,8 @@ void AnalysisCMS::ApplyWeights() // trigger scale factors //---------------------------------------------------------------------------- - float sf_trigger = effTrigW; // To be updated for WZ + float sf_trigger = 1; // To be updated for WZ + //float sf_trigger = effTrigW; // To be updated for WZ float sf_trigger_up = effTrigW_Up; float sf_trigger_do = effTrigW_Down; diff --git a/src/AnalysisStop.C b/src/AnalysisStop.C index 339f63a9..a136f947 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", ""); if (systematic=="nominal") { @@ -114,11 +115,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 //---------------------------------------------------------------------------- From acc0118d254f7ce370fc3c553cf0e53343ff9073 Mon Sep 17 00:00:00 2001 From: Barbara Date: Fri, 8 Dec 2017 18:03:29 +0100 Subject: [PATCH 20/28] 8 december 2017 --- make | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make b/make index 9c1de5a7..95bd8f0e 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 runAnalysisMiniTrees runAnalysisMiniTrees.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` From b1160cb35446935ac60aeaa67bb877da2f2191b3 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 14 Dec 2017 17:40:19 +0100 Subject: [PATCH 21/28] added stop/MCtrigger_Shapes.C --- stop/MCtrigger_Shapes.C | 110 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 stop/MCtrigger_Shapes.C diff --git a/stop/MCtrigger_Shapes.C b/stop/MCtrigger_Shapes.C new file mode 100644 index 00000000..3906e0af --- /dev/null +++ b/stop/MCtrigger_Shapes.C @@ -0,0 +1,110 @@ +#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 MCtrigger_Shapes(TString ProcessName, TString channel, TString cut = "Stop/02_SRs/", TString HistoDirectoryi1 = "../freezing_rootfiles/nominal/Stop/", TString HistoDirectoryi2 = "../MCtrigger_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; + } + //TString HistoDirectory = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/"; + + TH1F *h_1; TH1F *h_2; TH1F *h_3; + + TFile *_file1 = TFile::Open(HistoDirectoryi2 + ProcessName + ".root"); // MC trigger selection + TFile *_file2 = TFile::Open(HistoDirectoryi1 + 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); + } + + gSystem->mkdir("MCTrigger_Eff/", kTRUE); + TCanvas* c = new TCanvas ( "MCtrigger", "", 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", ""); + + h_1->SetLineColor(2); + h_2->SetLineColor(4); + + float min = h_1->GetMinimum(); + h_3->SetMinimum(0.9*min); + float max = h_2->GetMaximum(); + h_3->SetMaximum(2*max); + //HCN->SetMaximum(1.2*max); + + h_3 -> SetTitle(title + "_" + channel); + h_3 -> 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(h_3, "No trigger weight" , "lp"); + leg -> AddEntry(h_1, "MC trigger select." , "lp"); + leg -> AddEntry(h_2, "trigger eff from Data" , "lp"); + + gPad->SetLogy(); + + h_3->Draw(); + h_1->Draw("same"); + // h_2->Draw("same"); + leg -> Draw(); + + if (verbose) { + cout << "bin MC trigger select/trigger eff from Data" <GetNbinsX(); ibin++) + { + cout << ibin << " " << h_1->GetBinContent(ibin)/h_2->GetBinContent(ibin) << endl; + } + cout << "Total MC trigger select." << h_1->Integral()<< endl; + cout << "Total No trigger weight" << h_3->Integral()<< endl; + cout << "Total trigger eff from Data" << h_2->Integral()<< endl; + } + c -> Print("MCTrigger_Eff/MCTrigger_"+ title + "_" + channel +".png"); +} + + From da47b578e155d57b7acc314a1581e0dd989f7a9a Mon Sep 17 00:00:00 2001 From: Barbara Date: Wed, 28 Feb 2018 16:16:20 +0100 Subject: [PATCH 22/28] 28 Febrero --- src/AnalysisCMS.C | 38 +++++++++++------ src/AnalysisStop.C | 20 +++++++-- stop/merge.sh | 6 ++- stop/runPlotter.C | 92 +++++++++++++++++++++++++++--------------- test/HistogramReader.C | 9 +++-- 5 files changed, 112 insertions(+), 53 deletions(-) mode change 100644 => 100755 src/AnalysisCMS.C diff --git a/src/AnalysisCMS.C b/src/AnalysisCMS.C old mode 100644 new mode 100755 index 9a7c69ec..aa581bac --- a/src/AnalysisCMS.C +++ b/src/AnalysisCMS.C @@ -48,14 +48,25 @@ bool AnalysisCMS::PassTrigger() { if (_verbosity > 0) printf(" <<< Entering [AnalysisCMS::PassTrigger]\n"); - // if (_ismc) return true; // Need to study, Summer16 does have the trigger info - - //bool passtrgmc = (std_vector_trigger->at(6) || std_vector_trigger->at(8)) || (std_vector_trigger->at(11) || std_vector_trigger->at(13)) || - //(std_vector_trigger->at(42) || std_vector_trigger->at(43)) || (std_vector_trigger->at(0) || std_vector_trigger->at(56)) || - //(std_vector_trigger->at(46)); - //return passtrgmc; + if (_ismc) return true; // Need to study, Summer16 does have the trigger info - if (_ismc){ + if (_sample.Contains("MuonEG")) return ( trig_EleMu); + else if (_sample.Contains("DoubleMuon")) return (!trig_EleMu && trig_DbleMu); + else if (_sample.Contains("SingleMuon")) return (!trig_EleMu && !trig_DbleMu && trig_SnglMu); + else if (_sample.Contains("DoubleEG")) return (!trig_EleMu && !trig_DbleMu && !trig_SnglMu && trig_DbleEle); + else if (_sample.Contains("SingleElectron")) return (!trig_EleMu && !trig_DbleMu && !trig_SnglMu && !trig_DbleEle && trig_SnglEle); + else if (_sample.Contains("MET")) { + int METtriggers[] = {63, 64, 65, 66, 68, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92}; + for(int a = 0; a < 18; a++) { + if(std_vector_trigger->at(METtriggers[a]) != 0) return true; + } + return false; + } + else return true; + + /*// MonteCarlo trigger selection + // ------------------------------ + if (_ismc){ // MC trigged for "Full2016" bool passtrgmc; @@ -98,8 +109,10 @@ bool AnalysisCMS::PassTrigger() return passtrgmc; - }else{ - + }else{ + + // Data trigger selection + // ---------------------- if (_sample.Contains("MuonEG")) return ( trig_EleMu); else if (_sample.Contains("DoubleMuon")) return (!trig_EleMu && trig_DbleMu); else if (_sample.Contains("SingleMuon")) return (!trig_EleMu && !trig_DbleMu && trig_SnglMu); @@ -113,7 +126,7 @@ bool AnalysisCMS::PassTrigger() return false; } else return true; - } + }*/ } @@ -594,8 +607,8 @@ void AnalysisCMS::ApplyWeights() // trigger scale factors //---------------------------------------------------------------------------- - float sf_trigger = 1; // To estimate the trigger eff on MC - //float sf_trigger = effTrigW; // To be updated for WZ + //float sf_trigger = 1; // To estimate the trigger eff on MC + float sf_trigger = effTrigW; // To be updated for WZ float sf_trigger_up = effTrigW_Up; float sf_trigger_do = effTrigW_Down; @@ -3684,4 +3697,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 a136f947..d193a2b1 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -252,12 +252,15 @@ void AnalysisStop::Loop(TString analysis, TString filename, float luminosity, fl //if (!_systematic.Contains("SS") && !_systematic.Contains("multilepton") && Lepton1.flavour * Lepton2.flavour > 0) continue; if (_systematic.Contains("SS") && Lepton1.flavour * 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; @@ -448,7 +451,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); @@ -492,7 +501,9 @@ void AnalysisStop::Loop(TString analysis, TString filename, float luminosity, fl // Look in the Z-peak 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 + //************************************ //bool Zveto = ( _channel == em || fabs(_m2l - Z_MASS) > 15. ); //if (_systematic.Contains("Zveto") && !Zveto) continue; @@ -983,6 +994,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") && ijet3) return false; - float DMZCut = 10.; + float DMZCut = 100.;//Roberto's checking cut + //float DMZCut = 10.;//nominal cut if (_systematic.Contains("DM15")) DMZCut = 15.; float DMZ = 999.; int Wlep1 = -1, Wlep2 = -1, Lostlep = -1; diff --git a/stop/merge.sh b/stop/merge.sh index 53352f1c..540a4bb7 100755 --- a/stop/merge.sh +++ b/stop/merge.sh @@ -23,7 +23,8 @@ 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* 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 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 @@ -31,7 +32,7 @@ hadd -f -k 07_ZJetsHT_DYcorr.root DYJetsToLL_M-10to50-LO_DYcorr.root DYJetsToL 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 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 @@ -39,4 +40,5 @@ 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_VZV3.root 15_VZ.root 13_VVV.root popd diff --git a/stop/runPlotter.C b/stop/runPlotter.C index f38d3b35..2add41b2 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -5,13 +5,16 @@ //------------------------------------------------------------------------------ const Bool_t datadriven = false; const Bool_t allplots = false; -const Bool_t dosystematics = true; +const Bool_t dosystematics = false; const Bool_t postfitplots = false; const Bool_t paperstyle = false; -const Bool_t regionlegend = true; -const Bool_t relativeratio = true; +const Bool_t regionlegend = false; +const Bool_t relativeratio = false; -const TString inputdir = "../freezing_rootfiles/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 = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; @@ -19,14 +22,18 @@ const TString inputdir = "../freezing_rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; //const TString outputdir = "Paperfigures_7Dec17/"; -const TString outputdir = "DYcorr_ZZcorr_MT2ll/"; -//const TString outputdir = "DYcorr/"; +//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"; @@ -95,11 +102,11 @@ 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 = 0.74, SF_DY = 1., SF_WZ = 1.; + float SF_ttZ = 1., SF_ZMet = 1., SF_DY = 1., SF_WZ = 1.; /*if (!postfitplots && !inputdir.Contains("fake") && !inputdir.Contains("SS")) { if (level.Contains("_SR") || level.Contains("_VRggg")) {// && inputdir.Contains("DYcorr"))) { //if (level.Contains("_SR") || level.Contains("_VRggg") || level.Contains("_VR1")) {// && inputdir.Contains("DYcorr"))) { @@ -114,12 +121,17 @@ 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); - + //plotter.AddData("01_Data", "data", color_Data); TString DYCorr = "_DYcorr"; //if (!level.Contains("_SR")) DYCorr = ""; if (inputdir.Contains("/WZ") || inputdir.Contains("fake") || inputdir.Contains("SS")) DYCorr = ""; @@ -135,7 +147,7 @@ void runPlotter(TString level, if (inputdir.Contains("SS")) plotter.AddProcess("13_VVV", "VVV", color_VVV); else - plotter.AddProcess("15_VZ3V", "VVV + VZ", color_VVV); + plotter.AddProcess("15_VZV3", "VVV + VZ", color_VVV); if (inputdir.Contains("/ZZ") || inputdir.Contains("/WZ") || inputdir.Contains("/ttZ")) { plotter.AddProcess("14_ZZTo4L", "ZZ (#rightarrow 4l)", color_ZZ4L, roc_background); ////plotter.AddProcess("14a_ZZTo4L", "qqZZ (#rightarrow 4l)", 49, roc_background);// 1.256/1.212); @@ -145,19 +157,19 @@ void runPlotter(TString level, if (inputdir.Contains("SS")) plotter.AddProcess("03_VZ", "VZ (#rightarrow 2l)", color_VZ, roc_background); else if (!inputdir.Contains("/ZZ")) plotter.AddProcess("03_ZZ", "ZZ (#rightarrow 2l2#nu)", color_VZ, roc_background, SF_ZMet); - ////plotter.AddProcess("03a_ZZ", "qqZZ (#rightarrow 2l2#nu)", 48, roc_background); - ////plotter.AddProcess("03b_ZZ", "ggZZ (#rightarrow 2l2#nu)", 47, roc_background); - //plotter.AddProcess("15_VZ", "VZ (#rightarrow 2l2q)", color_VZ2L2Q, roc_background); - //plotter.AddProcess("11_Wg", "W#gamma", color_Wg); - //plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); + ////plotter.AddProcess("03a_ZZ", "qqZZ (#rightarrow 2l2#nu)", 48, roc_background); + ////plotter.AddProcess("03b_ZZ", "ggZZ (#rightarrow 2l2#nu)", 47, roc_background); + ////plotter.AddProcess("15_VZ", "VZ (#rightarrow 2l2q)", color_VZ2L2Q, roc_background); + ////plotter.AddProcess("11_Wg", "W#gamma", color_Wg); + ////plotter.AddProcess("15_WgStar", "W#gamma*", color_WgStar); plotter.AddProcess("09_TTW", "t#bar{t}W", color_TTV); plotter.AddProcess("10_TTZ", "t#bar{t}Z", color_TTZ, roc_background, SF_ttZ); plotter.AddProcess("11_HWW", "HWW", color_HWW); if (!inputdir.Contains("/WZ")) plotter.AddProcess("02_WZTo3LNu", "WZ (#rightarrow 3l)", color_WZTo3LNu, roc_background, SF_WZ); plotter.AddProcess("06_WW", "WW", color_WW); plotter.AddProcess("05_ST", "tW", color_ST); - plotter.AddProcess("07_ZJetsHT" + DYCorr, "Z+jets", color_ZJets, roc_background);//, 0.683211799801126896); - //plotter.AddProcess("07_ZJetsHT" , "Z+jets", color_ZJets, roc_background);//, 0.683211799801126896); + //plotter.AddProcess("07_ZJetsHT" + DYCorr, "Z+jets", color_ZJets, roc_background);//, 0.683211799801126896); + plotter.AddProcess("07_ZJetsHT" , "Z+jets", color_ZJets, roc_background);//, 0.683211799801126896); if (inputdir.Contains("SS")) plotter.AddProcess("TTToSemiLepton", "t#bar{t} Semilep.", 41, roc_background, 38./49.); plotter.AddProcess("04_TTTo2L2Nu", "t#bar{t}", color_TTTo2L2Nu); @@ -175,11 +187,21 @@ void runPlotter(TString level, plotter.AddPostfit("99_TotalBackground", "post-fit", kRed+2); } - if (signal=="T2tt") { + /* if (signal=="mix"){ + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225_Sm350_Xm263", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=263)",2); + plotter.AddSignal("TChiSlep_Xm350_Xm225_Xm300_Xm200", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (300, 200)", kRed); + + }else*/ + if (signal=="T2tt") { + - plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm175", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=175)",2); - plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",3); - plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm263", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=263)",6); + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",2); + plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225_Sm350_Xm263", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=263)",6); + plotter.AddSignal("TChiSlep_Xm350_Xm225_Xm300_Xm200", "#tilde{#chi}^{#pm}#tilde{#chi}^{#pm}, #tilde{#chi}^{#pm}#rightarrow l#nu#tilde{#chi}^{0}_{1} (300, 200)",9); + //plotter.AddSignal("T2tt_mStop-250to350_Sm275_Xm150_Sm275_Xm150", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=275, m_{#tilde{#chi}^{0}_{1}}=150)",2); + //plotter.AddSignal("T2tt_mStop-400to1200_Sm450_Xm325_Sm450_Xm325", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=450, m_{#tilde{#chi}^{0}_{1}}=325)",6); + //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm225", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=225)",3); + //plotter.AddSignal("T2tt_mStop-350to400_Sm350_Xm263", "#tilde{t}#rightarrow t#tilde{#chi}^{0}_{1} (m_{#tilde{t}}=350, m_{#tilde{#chi}^{0}_{1}}=263)",6); } else if (signal=="TChi") { @@ -236,7 +258,7 @@ void runPlotter(TString level, if (postfitplots) { plotter.AddSystematic("Stop", "Postfit"); } else { - //plotter.AddSystematic("Stop", "Statistics"); + plotter.AddSystematic("Stop", "Statistics"); //plotter.AddSystematic("Stop", "Luminosity"); //plotter.AddSystematic("Stop", "Trigger"); plotter.AddSystematic("Stop", "MT2llTop"); @@ -267,8 +289,8 @@ void runPlotter(TString level, //plotter.AddSystematic("Stop", "Btaglight"); //plotter.AddSystematic("Stop", "ttZSF"); //plotter.AddSystematic("Stop", "WZSF"); - plotter.AddSystematic("Stop", "ZZSF"); - plotter.AddSystematic("Stop", "ZZshape"); + // plotter.AddSystematic("Stop", "ZZSF"); + // plotter.AddSystematic("Stop", "ZZshape"); ////plotter.AddSystematic("Stop", "DYSF"); plotter.AddSystematic("Stop", "DYshape"); if (level.Contains("_SR")) plotter.AddSystematic("Stop", "DYnojet"); @@ -340,11 +362,19 @@ void runPlotter(TString level, plotter.Draw(prefix + "dphiLLbin5" + suffix, "#Delta#phi(lep1,lep2)", 10, 0, "NULL", scale); continue; } - std::cout << "before plotter" << std::endl; + std::cout << " before plotter" << std::endl; // Common histograms //-------------------------------------------------------------------- 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); + std::cout << "pass the plotter" << std::endl; + /* plotter.Draw(prefix + "m2L" + suffix, "m_{" + sll + "}", -1, 0, "GeV", linY); plotter.Draw(prefix + "lep1eta" + suffix, "leading lepton #eta", -1, 1, "NULL", scale); plotter.Draw(prefix + "lep2eta" + suffix, "trailing lepton #eta", -1, 1, "NULL", scale); @@ -358,17 +388,15 @@ void runPlotter(TString level, 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 + "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 + "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 + "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 + "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); diff --git a/test/HistogramReader.C b/test/HistogramReader.C index 1dd1c1e5..a986f5dd 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -894,10 +894,10 @@ void HistogramReader::Draw(TString hname, 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 = " << 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); @@ -924,6 +924,7 @@ void HistogramReader::Draw(TString hname, 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"); @@ -2082,7 +2083,7 @@ void FormatTableYields(float *YY, float *EY) { void HistogramReader::IncludeSystematics(TString hname) { - bool _verbose = false, _dotable = true, _dotablebkg = false, _doPaperTable = true; + bool _verbose = false, _dotable = true, _dotablebkg = true, _doPaperTable = true; float StatZero = 1.84102; @@ -2640,6 +2641,8 @@ void HistogramReader::IncludeSystematics(TString hname) printf( "--------------------------------------------------------\n" ); } + printf( "errStat = %f\n", errStat [ibin] ); + float systUp2 = 0; float systDo2 = 0; float systSym2 = 0; From a859c700caa4ad837a572a2feddd83638fe42333 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 1 Mar 2018 18:52:25 +0100 Subject: [PATCH 23/28] Tables paper 1-March2018 --- include/AnalysisCMS.h | 1 - stop/runPlotter.C | 83 ++++++++++++++----------------- test/HistogramReader.C | 108 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 133 insertions(+), 59 deletions(-) diff --git a/include/AnalysisCMS.h b/include/AnalysisCMS.h index 6c734b05..bda8f66c 100644 --- a/include/AnalysisCMS.h +++ b/include/AnalysisCMS.h @@ -221,7 +221,6 @@ class AnalysisCMS : public AnalysisBase bool _applytopptreweighting; bool _applytriggeremulation; - TRandom3* _rand; TString _analysis; diff --git a/stop/runPlotter.C b/stop/runPlotter.C index f1da0728..5c1c6ec1 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -4,22 +4,21 @@ //------------------------------------------------------------------------------ const Bool_t datadriven = false; const Bool_t allplots = false; -const Bool_t dosystematics = false; +const Bool_t dosystematics = true; const Bool_t postfitplots = false; -const Bool_t paperstyle = false; +const Bool_t paperstyle = true; const Bool_t regionlegend = false; -const Bool_t relativeratio = false; +const Bool_t relativeratio = true; -const TString inputdir = "../minitrees/rootfiles/WZtoWW/"; +//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 = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/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/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; +const TString outputdir = "ForPaperTables_1March18/"; //const TString outputdir = "Paperfigures_7Dec17/"; //const TString outputdir = "DYcorr_ZZcorr_MT2ll/"; //const TString outputdir = "DYcorr_MT2ll/"; @@ -28,7 +27,7 @@ const TString inputdir = "../minitrees/rootfiles/WZtoWW/"; //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 = "Zpeak_WZtoWWmimc_Roberto/"; //const TString outputdir = "LeptonPt_selection/"; const TString signal = ""; @@ -111,7 +110,6 @@ void runPlotter(TString level, 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"))) { - //if (level.Contains("_SR") || level.Contains("_VRggg") || level.Contains("_VR1")) {// && inputdir.Contains("DYcorr"))) { SF_ttZ = 1.44, SF_WZ = 0.97; if (!postfitplots && !inputdir.Contains("Zpeakk") && !inputdir.Contains("ZZ")) { if (level.Contains("NoJet")) { @@ -303,38 +301,29 @@ void runPlotter(TString level, plotter.AddSystematic("Stop", "Postfit"); } else { plotter.AddSystematic("Stop", "Statistics"); - //plotter.AddSystematic("Stop", "Luminosity"); - //plotter.AddSystematic("Stop", "Trigger"); + plotter.AddSystematic("Stop", "Luminosity"); + plotter.AddSystematic("Stop", "Trigger"); plotter.AddSystematic("Stop", "MT2llTop"); plotter.AddSystematic("Stop", "MT2llWW"); - //plotter.AddSystematic("Stop", "Fake"); - //std::cout << "1" << std::endl; - //plotter.AddSystematic("Stop", "Idiso"); - //std::cout << "2" << std::endl; - //plotter.AddSystematic("Stop", "JES"); - //std::cout << "3" << std::endl; - //plotter.AddSystematic("Stop", "MET"); - //std::cout << "4" << std::endl; - //plotter.AddSystematic("Stop", "PDF"); - //std::cout << "5" << std::endl; - //plotter.AddSystematic("Stop", "Q2"); - //std::cout << "6" << std::endl; - //plotter.AddSystematic("Stop", "Reco"); - //std::cout << "7" << std::endl; - //plotter.AddSystematic("Stop", "Toppt"); - //std::cout << "8" << std::endl; - //plotter.AddSystematic("Stop", "Isrnjet"); - //std::cout << "9" << std::endl; - //plotter.AddSystematic("Stop", "Metfastsim"); - //plotter.AddSystematic("Stop", "Pileup"); - ////plotter.AddSystematic("Stop", "Fastsim"); - ////plotter.AddSystematic("Stop", "BtagFS"); - //plotter.AddSystematic("Stop", "Btag"); - //plotter.AddSystematic("Stop", "Btaglight"); - //plotter.AddSystematic("Stop", "ttZSF"); - //plotter.AddSystematic("Stop", "WZSF"); - // plotter.AddSystematic("Stop", "ZZSF"); - // plotter.AddSystematic("Stop", "ZZshape"); + plotter.AddSystematic("Stop", "Fake"); + plotter.AddSystematic("Stop", "Idiso"); + plotter.AddSystematic("Stop", "JES"); + 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"); + plotter.AddSystematic("Stop", "Btaglight"); + plotter.AddSystematic("Stop", "ttZSF"); + plotter.AddSystematic("Stop", "WZSF"); + plotter.AddSystematic("Stop", "ZZSF"); + plotter.AddSystematic("Stop", "ZZshape"); ////plotter.AddSystematic("Stop", "DYSF"); plotter.AddSystematic("Stop", "DYshape"); if (level.Contains("_SR")) plotter.AddSystematic("Stop", "DYnojet"); @@ -413,14 +402,6 @@ void runPlotter(TString level, std::cout << " before plotter" << std::endl; // Common histograms //-------------------------------------------------------------------- - 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); std::cout << "pass the plotter" << std::endl; if (inputdir.Contains("/ttZ/")) { @@ -432,6 +413,14 @@ void runPlotter(TString level, plotter.Draw(prefix + "M2ll" + suffix, "m_{ll}", 4, 0, "GeV", linY, false, 0, 180); continue; } + 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); diff --git a/test/HistogramReader.C b/test/HistogramReader.C index c3cca763..12b34585 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -2163,7 +2163,7 @@ void FormatTableYields(float *YY, float *EY) { void HistogramReader::IncludeSystematics(TString hname) { - bool _verbose = false, _dotable = true, _dotablebkg = true, _dotablesyst = true; _doPaperTable = true; + bool _verbose = false, _dotable = true, _dotablebkg = true, _dotablesyst = true, _mergeNbins = true, _doPaperTable = true; float StatZero = 1.84102; @@ -2177,10 +2177,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 GetEntries()>0.) 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; @@ -2927,10 +2936,11 @@ void HistogramReader::IncludeSystematics(TString hname) if (ThisLabel=="t#bar{t}") ThisLabel = "\\ttbar"; /*inFile << ThisLabel; */ inFile << " & " << ThisLabel; - //inFile << _mclabel[kproce].Data(); + //inFile << _mclabel[kproce].Data(); + float ThisYield, ThisError; 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.; + ThisYield = yieldTab[kproce][ibin]; + ThisError = (sqrt(errBackTab_up[kproce][ibin])+sqrt(errBackTab_do[kproce][ibin]))/2.; FormatTableYields(&ThisYield, &ThisError); inFile << " & $" << ThisYield << " \\pm " << ThisError << "$"; } @@ -2990,6 +3000,82 @@ 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); + } + 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(); } From 208621b00604387d0ebb41799ebd41c9f42cb379 Mon Sep 17 00:00:00 2001 From: Barbara Date: Fri, 2 Mar 2018 16:27:57 +0100 Subject: [PATCH 24/28] 2 march 2018 --- stop/runPlotter.C | 2 +- test/HistogramReader.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stop/runPlotter.C b/stop/runPlotter.C index 5c1c6ec1..87e34bcd 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -13,7 +13,7 @@ const Bool_t relativeratio = true; //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 = "../freezing_rootfiles/nominal/"; //const TString inputdir = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles/nominal/"; //const TString inputdir = "../minitrees/rootfiles3R/nominal/"; diff --git a/test/HistogramReader.C b/test/HistogramReader.C index 12b34585..ad43f61a 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -2163,7 +2163,7 @@ void FormatTableYields(float *YY, float *EY) { void HistogramReader::IncludeSystematics(TString hname) { - bool _verbose = false, _dotable = true, _dotablebkg = true, _dotablesyst = true, _mergeNbins = true, _doPaperTable = true; + bool _verbose = false, _dotable = true, _dotablebkg = true, _dotablesyst = true, _mergeNbins = false, _doPaperTable = false; float StatZero = 1.84102; From 7d1d962941ab7ec67463df9a7fdb6abac93704dd Mon Sep 17 00:00:00 2001 From: Barbara Date: Sun, 23 Jun 2019 15:34:54 +0200 Subject: [PATCH 25/28] update 24 June 2019 --- src/AnalysisStop.C | 10 +- stop/FakeStudies.C | 2 +- stop/MCtrigger_Shapes.C | 205 ++++++++++++++++++++++++++++++++-------- 3 files changed, 171 insertions(+), 46 deletions(-) diff --git a/src/AnalysisStop.C b/src/AnalysisStop.C index cf73d22c..9bbf6c4f 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -32,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); @@ -853,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); @@ -1179,7 +1181,7 @@ void AnalysisStop::FillAnalysisHistograms(int ichannel, int ijet) { - _event_weight = _event_weight/effTrigW; + //_event_weight = _event_weight/effTrigW; if (ichannel != ll) FillAnalysisHistograms(ll, icut, ijet); if ((_SaveHistograms>=2 || _systematic!="nominal") && ijetFill(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); diff --git a/stop/FakeStudies.C b/stop/FakeStudies.C index 71601331..70a108d5 100644 --- a/stop/FakeStudies.C +++ b/stop/FakeStudies.C @@ -25,7 +25,7 @@ void FakeStudies(TString Selection, TString channel) { TString Channel[nChannels] = {"_ee", "_mm", "_em", "_ll"}; TString Variable[nVariables] = {"MT2ll"}; //TString MetCut[nMetCuts] = {"02_VR1", "02_SR1", "02_SR2", "02_SR3"}; - TString MetCut[nMetCuts] = {"02_VR1"}; + TString MetCut[nMetCuts] = {"02_SR1_Tag"}; TString BtagCut[nBtagCuts] = {"_Veto"}; gSystem->mkdir("FakesPlots", kTRUE); diff --git a/stop/MCtrigger_Shapes.C b/stop/MCtrigger_Shapes.C index 3906e0af..90b91eb7 100644 --- a/stop/MCtrigger_Shapes.C +++ b/stop/MCtrigger_Shapes.C @@ -1,6 +1,6 @@ -#include"TString.h" -#include"TH1F.h" -#include"TFile.h" +#include "TString.h" +#include "TH1F.h" +#include "TFile.h" #include #include #include "TCanvas.h" @@ -8,29 +8,42 @@ #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(TString ProcessName, TString channel, TString cut = "Stop/02_SRs/", TString HistoDirectoryi1 = "../freezing_rootfiles/nominal/Stop/", TString HistoDirectoryi2 = "../MCtrigger_rootfiles/nominal/Stop/", TString HistoDirectoryi3 = "../minitrees/rootfiles/nominal/Stop/", bool sameFlavour = false) { +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 << "HistoDirectoryi3 " << HistoDirectoryi3 << std::endl; std::cout << "---------------------------------------------------------------------" << std::endl; std::cout << "channel "<< channel << std::endl; std::cout << "---------------------------------------------------------------------" << std::endl; } - //TString HistoDirectory = "/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/rootfiles/"; TH1F *h_1; TH1F *h_2; TH1F *h_3; - TFile *_file1 = TFile::Open(HistoDirectoryi2 + ProcessName + ".root"); // MC trigger selection - TFile *_file2 = TFile::Open(HistoDirectoryi1 + ProcessName + ".root"); // Efficiency from Data - TFile *_file3 = TFile::Open(HistoDirectoryi3 + ProcessName + ".root"); // No trigger weight + 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){ @@ -38,11 +51,11 @@ void MCtrigger_Shapes(TString ProcessName, TString channel, TString cut = "Stop/ 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_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); +// h_3 -> Add(h_3_mm); channel = "_sameFlavour"; } @@ -52,59 +65,169 @@ void MCtrigger_Shapes(TString ProcessName, TString channel, TString cut = "Stop/ 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); +// h_3 = (TH1F*) _file3->Get(cut+"h_MT2ll_"+channel); } - gSystem->mkdir("MCTrigger_Eff/", kTRUE); - TCanvas* c = new TCanvas ( "MCtrigger", "", 1200,1000); - //TPad *pad1 = new TPad("pad1", "pad1", 0, 0, 1, 1); - //pad1->cd(); - //ad1->SetLogy(1); + // Normalization to unity + h_1->Scale(1/h_1->Integral()); + h_2->Scale(1/h_2->Integral()); - //TPad *pad1 = new TPad(); - //pad1->cd(); - //pad1->SetLogy(); + 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(); + - gStyle->SetOptStat(""); TString title = ProcessName.ReplaceAll(".root", ""); - h_1->SetLineColor(2); - h_2->SetLineColor(4); + + pad1->cd(); + gStyle->SetOptStat(""); + pad1->SetLogy(); + //gPad->SetLogy(); + float min = h_1->GetMinimum(); - h_3->SetMinimum(0.9*min); + h_1->SetMinimum(0.9*min); float max = h_2->GetMaximum(); - h_3->SetMaximum(2*max); + h_1->SetMaximum(2*max); //HCN->SetMaximum(1.2*max); - - h_3 -> SetTitle(title + "_" + channel); - h_3 -> SetXTitle ("MT2ll (GeV)"); + //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.75, 0.9, 0.9, 0.7); - leg -> AddEntry(h_3, "No trigger weight" , "lp"); - leg -> AddEntry(h_1, "MC trigger select." , "lp"); + 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"); - - gPad->SetLogy(); + //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); - h_3->Draw(); - h_1->Draw("same"); - // h_2->Draw("same"); + // 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) << endl; + 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 No trigger weight" << h_3->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 -> Print("MCTrigger_Eff/MCTrigger_"+ title + "_" + channel +".png"); + //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() < Date: Mon, 29 Jul 2019 23:30:42 +0200 Subject: [PATCH 26/28] Added auxiliar script --- stop/SystematicTables.C | 235 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 stop/SystematicTables.C 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 Date: Thu, 24 Oct 2019 13:37:07 +0200 Subject: [PATCH 27/28] commiting test --- test/HistogramReader.C | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/HistogramReader.C b/test/HistogramReader.C index ecc2fad3..07b6401a 100644 --- a/test/HistogramReader.C +++ b/test/HistogramReader.C @@ -2189,7 +2189,7 @@ void FormatTableYields(float *YY, float *EY) { void HistogramReader::IncludeSystematics(TString hname) { - bool _verbose = false, _dotable = true, _dotablebkg = true, _dotablesyst = true, _mergeNbins = false, _doPaperTable = false; + bool _verbose = false, _dotable = true, _dotablebkg = false, _dotablesyst = true, _mergeNbins = false, _doPaperTable = false; float StatZero = 1.84102; @@ -2265,7 +2265,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; @@ -2289,6 +2289,9 @@ void HistogramReader::IncludeSystematics(TString hname) if (_systematics.at(isyst)=="normVVV" && _mcfilename.at(kproce)!="13_VVV") continue; TString bckName = _mcfilename.at(kproce); + + if (_systematics.at(isyst)=="Pileup") bckName.ReplaceAll("_DYcorr", ""); + if (hname.Contains("VR1")) if (_systematics.at(isyst)=="JES" || (_systematics.at(isyst)=="MET")) bckName.ReplaceAll("_DYcorr", ""); TFile* myfile0 = myfile0 = new TFile(_inputdir + "/" + bckName + ".root", "read"); @@ -2761,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"); @@ -2778,6 +2781,7 @@ 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; @@ -2952,7 +2956,7 @@ void HistogramReader::IncludeSystematics(TString hname) inFile << "$\\ge$ " << (nbins-1)*20 << "~\\GeV \\\\" << endl; inFile << "\\hline" << endl; -/* + //for (int kproce=0; kproce=0; kproce--) { TString ThisLabel = _mclabel[kproce].Data(); @@ -2975,7 +2979,7 @@ void HistogramReader::IncludeSystematics(TString hname) 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); @@ -3132,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; From e7fd8c5479a6ffd3a57ddcefebf4d5adcbc29aa8 Mon Sep 17 00:00:00 2001 From: Barbara Date: Thu, 24 Oct 2019 13:44:43 +0200 Subject: [PATCH 28/28] last update --- make | 4 +- paths.txt | 8 + .../stopSel/lxplus/MCtriggers_minitrees.txt | 81 +++ .../stopSel/lxplus/My_nominal_minitrees.txt | 78 +++ .../stopSel/lxplus/multilepton_minitrees.txt | 67 ++- .../80x/stopSel/lxplus/nominal_minitrees.txt | 10 +- .../samples_chargino__Ghent_Summer16.txt | 3 + .../lxplus/samples_others_Ghent_Summer16.txt | 11 + samples_minitrees.txt | 7 + src/AnalysisStop.C | 7 +- stop/Compare_twoHistos.C | 305 ++++++++++ stop/Plotter.C | 178 ++++++ stop/TheoreticalVariations.C | 6 +- stop/ZZShapes.C | 568 ++++++++++++++++++ stop/runPlotter.C | 70 ++- 15 files changed, 1336 insertions(+), 67 deletions(-) create mode 100644 paths.txt create mode 100644 samples/80x/stopSel/lxplus/MCtriggers_minitrees.txt create mode 100644 samples/80x/stopSel/lxplus/My_nominal_minitrees.txt create mode 100644 samples/80x/stopSel/lxplus/samples_chargino__Ghent_Summer16.txt create mode 100644 samples_minitrees.txt create mode 100644 stop/Compare_twoHistos.C create mode 100644 stop/Plotter.C create mode 100644 stop/ZZShapes.C diff --git a/make b/make index 95bd8f0e..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 runAnalysisMiniTrees runAnalysisMiniTrees.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 index e2cd5829..aa758711 100644 --- a/samples/80x/stopSel/lxplus/multilepton_minitrees.txt +++ b/samples/80x/stopSel/lxplus/multilepton_minitrees.txt @@ -1,32 +1,41 @@ #3TightL_MinitreeVersion_26Oct2017 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/01_Data.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/02_WZTo3LNu.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/04_TTTo2L2Nu.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/05_ST.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/06_WW.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/07_ZJets.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/07_ZJetsHT.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/09_TTW.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/10_TTZ.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/11_HWW.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/13_VVV.root 1 -##/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/15_VZ.root 1 +#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 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Nu__part1.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part0.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part1.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo2L2Q__part2.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2nu.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2mu2nu.root 1 +/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 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ZZTo4L__part1.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2mu.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2e2tau.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo2mu2tau.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4e.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4mu.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggZZTo4tau.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/ggHToZZTo4L.root 1 -/eos/cms/store/user/scodella/Stop/MiniTrees/minitrees_36fb/multilepton/Stop/qqHToZZTo4L.root 1 +/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 index 69e416c0..ce56490d 100644 --- a/samples/80x/stopSel/lxplus/nominal_minitrees.txt +++ b/samples/80x/stopSel/lxplus/nominal_minitrees.txt @@ -67,13 +67,13 @@ /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 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/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/AnalysisStop.C b/src/AnalysisStop.C index 9bbf6c4f..4a61b43e 100644 --- a/src/AnalysisStop.C +++ b/src/AnalysisStop.C @@ -1055,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); 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() < 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/TheoreticalVariations.C b/stop/TheoreticalVariations.C index 740fe018..d4ea5014 100644 --- a/stop/TheoreticalVariations.C +++ b/stop/TheoreticalVariations.C @@ -23,7 +23,8 @@ void TheoreticalVariations() { - TString RootFilesDirectory = "../minitrees/rootfiles3R/"; + //TString RootFilesDirectory = "../minitrees/rootfiles3R/"; + TString RootFilesDirectory = "../minitrees/rootfiles/"; int const nUncertainties = 2; TString UncertaintyName[nUncertainties] = {"Q2", "PDF"}; @@ -35,7 +36,8 @@ void TheoreticalVariations() { "11_HWW", "13_VVV"}; */ int const nProcesses = 1; - TString ProcessName[nProcesses] = {"07_ZJetsHT_DYcorr"}; + //TString ProcessName[nProcesses] = {"07_ZJetsHT_DYcorr"}; + TString ProcessName[nProcesses] = {"05_ST"}; int const nObservables = 4; TString ObservableName[nObservables] = {"MT2ll", "MT2llgen", "MT2llisr", "MT2llisrgen"}; 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/runPlotter.C b/stop/runPlotter.C index 8640ede7..82567e04 100755 --- a/stop/runPlotter.C +++ b/stop/runPlotter.C @@ -5,7 +5,7 @@ const Bool_t datadriven = false; const Bool_t allplots = false; const Bool_t dosystematics = true; -const Bool_t postfitplots = true; +const Bool_t postfitplots = false; const Bool_t paperstyle = false; const Bool_t regionlegend = true; const Bool_t relativeratio = true; @@ -18,11 +18,15 @@ const Bool_t relativeratio = true; //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 = "../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 = "ForPaperv2Tables_2March18/"; +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/"; @@ -36,7 +40,7 @@ const TString outputdir = "ForPaperv2Tables_2March18/"; //const TString signal = ""; //const TString signal = "mix"; -//const TString signal = "T2tt"; +const TString signal = "T2tt"; //const TString signal = "TChi"; @@ -152,6 +156,7 @@ void runPlotter(TString level, level.ReplaceAll("_DYcorrVR1norm", ""); } + // Add processes //---------------------------------------------------------------------------- if (paperstyle) { @@ -213,18 +218,21 @@ void runPlotter(TString level, 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")) @@ -237,19 +245,25 @@ 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); @@ -304,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"); @@ -338,7 +352,7 @@ void runPlotter(TString level, ///plotter.AddSystematic("Stop", "normTTW"); ///plotter.AddSystematic("Stop", "normHWW"); ///plotter.AddSystematic("Stop", "normVVV"); - } + */ } } // Draw distributions