From 01db77b3d83e41ca033e384ad157fcd195a79328 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Wed, 21 Aug 2019 08:50:41 -0400 Subject: [PATCH 01/53] ZZ compiles --- Utilities/python/ConfigureJobs.py | 27 +- Utilities/python/SelectorTools.py | 3 + Utilities/scripts/makeHistFile.py | 20 +- interface/ZZBackgroundSelector.h | 40 ++ interface/ZZSelector.h | 91 ++++ interface/ZZSelectorBase.h | 218 ++++++++++ src/ZZBackgroundSelector.cc | 258 +++++++++++ src/ZZSelector.cc | 683 ++++++++++++++++++++++++++++++ src/ZZSelectorBase.cc | 573 +++++++++++++++++++++++++ src/classes.h | 6 + src/classes_def.xml | 3 + 11 files changed, 1905 insertions(+), 17 deletions(-) create mode 100644 interface/ZZBackgroundSelector.h create mode 100644 interface/ZZSelector.h create mode 100644 interface/ZZSelectorBase.h create mode 100644 src/ZZBackgroundSelector.cc create mode 100644 src/ZZSelector.cc create mode 100644 src/ZZSelectorBase.cc diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index 66a9d627..4ca02197 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -51,7 +51,7 @@ def getManagerPath(): raise ValueError("dataset_manager_path not specified in config file Template/config.%s" % os.environ["USER"]) except ValueError as e: - if os.path.isdir('AnalysisDatasetManager'): + if os.path.isdir('ZZ4lRun2DatasetManager'): return '.' raise e @@ -63,8 +63,19 @@ def getCombinePath(): raise ValueError("dataset_manager_path not specified in config file Template/config.%s" % os.environ["USER"]) return config['Setup']['combine_path'] + "/" -def getListOfEWKFilenames(): - return [ +def getListOfEWKFilenames(analysis): + if "ZZ4l" in analysis: + return [ + "zz4l-powheg", + "ggZZ4e", + "ggZZ4m", + "ggZZ4t", + "ggZZ2e2mu", + "ggZZ2e2tau", + "ggZZ2mu2tau", + ] + else: + return [ # "wz3lnu-powheg", # Use jet binned WZ samples for subtraction by default "wz3lnu-mgmlm-0j", @@ -86,7 +97,7 @@ def getListOfEWKFilenames(): "ggZZ4e", "ggZZ4m", "ggZZ2e2mu", - ] + ] def getListOfNonpromptFilenames(): return ["tt-lep", "st-schan", @@ -141,7 +152,7 @@ def getListOfHDFSFiles(file_path): def getListOfFiles(filelist, selection, manager_path=""): if manager_path is "": manager_path = getManagerPath() - data_path = "%s/AnalysisDatasetManager/FileInfo" % manager_path + data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path data_info = UserInput.readAllInfo("/".join([data_path, "data/*"])) mc_info = UserInput.readAllInfo("/".join([data_path, "montecarlo/*"])) valid_names = data_info.keys() + mc_info.keys() @@ -151,7 +162,7 @@ def getListOfFiles(filelist, selection, manager_path=""): names.append(name) elif "WZxsec2016" in name: dataset_file = manager_path + \ - "AnalysisDatasetManager/FileInfo/WZxsec2016/%s.json" % selection + "ZZ4lRun2DatasetManager/FileInfo/WZxsec2016/%s.json" % selection allnames = json.load(open(dataset_file)).keys() if "nodata" in name: nodata = [x for x in allnames if "data" not in x] @@ -185,7 +196,7 @@ def fillTemplatedFile(template_file_name, out_file_name, template_dict): def getListOfFilesWithXSec(filelist, manager_path=""): if manager_path is "": manager_path = getManagerPath() - data_path = "%s/AnalysisDatasetManager/FileInfo" % manager_path + data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path files = getListOfFiles(filelist, "ntuples", manager_path) mc_info = UserInput.readAllInfo("/".join([data_path, "montecarlo/*"])) info = {} @@ -248,7 +259,7 @@ def getInputFilesPath(sample_name, selection, analysis, manager_path=""): if ".root" in sample_name: print "INFO: using simple file %s" % sample_name return sample_name - data_path = "%s/AnalysisDatasetManager/FileInfo" % manager_path + data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path input_file_base_name = "/".join([data_path, analysis, selection]) input_file_name = getConfigFileName(input_file_base_name) input_files = UserInput.readInfo(input_file_name) diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 918bb2dc..32c3e176 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -21,6 +21,9 @@ def __init__(self, analysis, selection, input_tier, year): "Zstudy_2016" : "ZSelector", "Zstudy_2017" : "ZSelector", "ZZGen" : "ZZGenSelector", + "ZZ4l2016" : "ZZSelector", + "ZZ4l2017" : "ZZSelector", + "ZZ4l2018" : "ZZSelector", "WGen" : "WGenSelector", "ZGen" : "ZGenSelector", "ThreeLep" : "ThreeLepSelector", diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 034c0622..eeb9ee7f 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -34,7 +34,7 @@ def getComLineArgs(): parser.add_argument("-b", "--hist_names", type=lambda x : [i.strip() for i in x.split(',')], default=["all"], help="List of histograms, " - "as defined in AnalysisDatasetManager, separated " + "as defined in ZZ4lRun2DatasetManager, separated " "by commas") return vars(parser.parse_args()) @@ -44,7 +44,7 @@ def makeHistFile(args): manager_path = ConfigureJobs.getManagerPath() if manager_path not in sys.path: sys.path.insert(0, "/".join([manager_path, - "AnalysisDatasetManager", "Utilities/python"])) + "ZZ4lRun2DatasetManager", "Utilities/python"])) tmpFileName = args['output_file'] fOut = ROOT.TFile(tmpFileName, "recreate") @@ -131,19 +131,21 @@ def makeHistFile(args): sys.exit(0) alldata = HistTools.makeCompositeHists(fOut,"AllData", - ConfigureJobs.getListOfFilesWithXSec(["WZxsec2016data"], manager_path), args['lumi'], + ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"],, manager_path), args['lumi'], underflow=False, overflow=False) OutputTools.writeOutputListItem(alldata, fOut) alldata.Delete() - nonpromptmc = HistTools.makeCompositeHists(fOut, "NonpromptMC", ConfigureJobs.getListOfFilesWithXSec( - ConfigureJobs.getListOfNonpromptFilenames(), manager_path), args['lumi'], - underflow=False, overflow=False) - nonpromptmc.Delete() + if "ZZ4l" not in args['analysis']: + nonpromptmc = HistTools.makeCompositeHists(fOut, "NonpromptMC", ConfigureJobs.getListOfFilesWithXSec( + ConfigureJobs.getListOfNonpromptFilenames(), manager_path), args['lumi'], + underflow=False, overflow=False) + nonpromptmc.Delete() + + OutputTools.writeOutputListItem(nonpromptmc, fOut) - OutputTools.writeOutputListItem(nonpromptmc, fOut) ewkmc = HistTools.makeCompositeHists(fOut,"AllEWK", ConfigureJobs.getListOfFilesWithXSec( - ConfigureJobs.getListOfEWKFilenames(), manager_path), args['lumi'], + ConfigureJobs.getListOfEWKFilenames(args['analysis']), manager_path), args['lumi'], underflow=False, overflow=False) OutputTools.writeOutputListItem(ewkmc, fOut) ewkmc.Delete() diff --git a/interface/ZZBackgroundSelector.h b/interface/ZZBackgroundSelector.h new file mode 100644 index 00000000..c57f5f93 --- /dev/null +++ b/interface/ZZBackgroundSelector.h @@ -0,0 +1,40 @@ +#ifndef ZZBackgroundSelector_h +#define ZZBackgroundSelector_h + +#include +#include "Analysis/VVAnalysis/interface/ScaleFactor.h" +#include "Analysis/VVAnalysis/interface/ZZSelector.h" + +class ZZBackgroundSelector : public ZZSelector { +public : + ScaleFactor * fakeRate_allE_; + ScaleFactor * fakeRate_allMu_; + + //PPPF represents 3P1F CR and PPFF represents 2P1F CR + TH1D* Z1MassHistPPPF_; + TH1D* Z1MassHistPPFF_; + TH1D* Z2MassHistPPPF_; + TH1D* Z2MassHistPPFF_; + //4lMass Histogram + TH1D* MassHistPPPF_; + TH1D* MassHistPPFF_; + + TH1D* WeightsHistmmee_; + TH1D* WeightsHisteemm_; + + virtual void SetupNewDirectory() override; + virtual void SlaveBegin(TTree *tree) override; + + ClassDefOverride(ZZBackgroundSelector,0); +private: + float getl3FakeRate(Long64_t entry); + float getl4FakeRate(Long64_t entry); + //In ZZ we only care about 3P1F and 2P2F, contributions are extremely low from other regions like FFFF,PFFF etc + bool IsPPPFRegion(); + bool IsPPFFRegion(); + void SetZ1Z2Masses(); + float getEventWeight(Long64_t entry); + void LoadBranchesUWVV(Long64_t entry, std::pair variation) override; +}; + +#endif diff --git a/interface/ZZSelector.h b/interface/ZZSelector.h new file mode 100644 index 00000000..76d7b249 --- /dev/null +++ b/interface/ZZSelector.h @@ -0,0 +1,91 @@ +#ifndef ZZSelector_h +#define ZZSelector_h + +#include +#include "Analysis/VVAnalysis/interface/ZZSelectorBase.h" +#include + +class ZZSelector : public ZZSelectorBase { +public : + bool doSystematics_ = false; + bool applyFullSelection_ = true; + bool isaTGC_ = false; + bool doaTGC_ = false; + + std::vector* scaleWeights = NULL; + std::vector* pdfWeights = NULL; + std::vector lheWeights; + unsigned int weight_info_; + + + float dEtajj; + float dEtajj_jesUp; + float dEtajj_jesDown; + float dEtajj_jerUp; + float dEtajj_jerDown; + float dRjj; + float dRjj_jesUp; + float dRjj_jesDown; + float dRjj_jerUp; + float dRjj_jerDown; + float zep3l; + float zep3l_jesUp; + float zep3l_jesDown; + float zep3l_jerUp; + float zep3l_jerDown; + std::vector* jetEta = NULL; + std::vector* jetEta_jesUp = NULL; + std::vector* jetEta_jesDown = NULL; + std::vector* jetEta_jerUp = NULL; + std::vector* jetEta_jerDown = NULL; + std::vector* jetPhi = NULL; + std::vector* jetPhi_jesUp = NULL; + std::vector* jetPhi_jesDown = NULL; + std::vector* jetPhi_jerUp = NULL; + std::vector* jetPhi_jerDown = NULL; + std::vector* jetPt = NULL; + std::vector* jetPt_jesUp = NULL; + std::vector* jetPt_jesDown = NULL; + std::vector* jetPt_jerUp = NULL; + std::vector* jetPt_jerDown = NULL; + std::vector* jetCSVv2 = NULL; + UInt_t nvtx; + Float_t Mass; + Float_t Pt; + float dPhiZZ; //DeltaPhi between Z1 and Z2 + TBranch* b_nvtx; + TBranch* b_Mass; + TBranch* b_Pt; + int cen_count = 0; + float count = 0; + + // Readers to access the data (delete the ones you do not need). + virtual void Init(TTree *tree) override; + virtual void SetupNewDirectory() override; + + ClassDefOverride(ZZSelector,0); + +protected: + virtual void SetBranchesUWVV() override; + void LoadBranchesUWVV(Long64_t entry, std::pair variation) override; + void FillHistograms(Long64_t entry, std::pair variation) override; + void ApplyScaleFactors(); + bool PassesZZSelection(); + bool PassesHZZSelection(); + unsigned int GetLheWeightInfo(); + void SetVariables(Long64_t entry); + //bool DuplicatedEvent(); + bool TightZZLeptons(); + bool ZZSelection(); + bool Z4lSelection(); + bool ZSelection(); + bool HZZSIPSelection(); + //bool SmartCut(); + bool HZZLowMass(); + bool HZZMediumMass(); + bool TestMuons(); + void ShiftEfficiencies(Systematic variation); +}; + +#endif + diff --git a/interface/ZZSelectorBase.h b/interface/ZZSelectorBase.h new file mode 100644 index 00000000..4ae21b75 --- /dev/null +++ b/interface/ZZSelectorBase.h @@ -0,0 +1,218 @@ +#ifndef ZZSelectorBase_h +#define ZZSelectorBase_h + +#include +#include +#include +#include +#include +#include +#include +#include + +// Headers needed by this particular selector +#include +#include "Analysis/VVAnalysis/interface/ScaleFactor.h" +#include "Analysis/VVAnalysis/interface/SelectorBase.h" +#include "Analysis/VVAnalysis/interface/helpers.h" + +class ZZSelectorBase : public SelectorBase { +public : + ScaleFactor* pileupSF_; + ScaleFactor* eLowRecoSF_; + ScaleFactor* eRecoSF_; + ScaleFactor* eIdSF_; + ScaleFactor* eGapIdSF_; + ScaleFactor* mIdSF_; + //ScaleFactor* mIsoSF_; + + + //bool isVBS_; + //MC variable to check for duplication(this is a flag to differentiate between channels) + UInt_t run; + UInt_t lumi; + ULong64_t evt; + //Int_t duplicated; + Float_t weight; + Float_t genWeight; + Float_t nTruePU; + Float_t Z1mass; + Float_t Z2mass; + //Float_t Zamass; + //Float_t Zbmass; + Float_t Z1pt; + Float_t Z2pt; + Float_t Z1Phi; + Float_t Z2Phi; + Float_t type1_pfMETEt; + Float_t type1_pfMETPhi; + Float_t l1GenPt; + Float_t l2GenPt; + Float_t l3GenPt; + Float_t l4GenPt; + + Bool_t l1IsTight; + Bool_t l2IsTight; + Bool_t l3IsTight; + Bool_t l4IsTight; + Bool_t l1IsIso; + Bool_t l2IsIso; + Bool_t l3IsIso; + Bool_t l4IsIso; + + Bool_t l1IsGap; + Bool_t l2IsGap; + Bool_t l3IsGap; + Bool_t l4IsGap; + + Float_t l1Pt; + Float_t l2Pt; + Float_t l3Pt; + Float_t l4Pt; + Float_t l1Eta; + Float_t l2Eta; + Float_t l3Eta; + Float_t l4Eta; + Float_t l1Phi; + Float_t l2Phi; + Float_t l3Phi; + Float_t l4Phi; + Float_t l1SIP3D; + Float_t l2SIP3D; + Float_t l3SIP3D; + Float_t l4SIP3D; + Int_t l1PdgId; + Int_t l2PdgId; + Int_t l3PdgId; + Int_t l4PdgId; + Float_t l1Mass; + Float_t l2Mass; + Float_t l3Mass; + Float_t l4Mass; + + Float_t l1PVDXY; + Float_t l2PVDXY; + Float_t l3PVDXY; + Float_t l4PVDXY; + Float_t l1PVDZ; + Float_t l2PVDZ; + Float_t l3PVDZ; + Float_t l4PVDZ; + + Float_t l3MtToMET; + + TBranch* b_pdfWeights; + TBranch* b_scaleWeights; + //TBranch* b_duplicated; + TBranch* b_genWeight; + TBranch* b_Z1mass; + TBranch* b_Z2mass; + //Smart cut on 4e/4mu + //TBranch* b_Zamass; + //TBranch* b_Zbmass; + TBranch* b_Z1pt; + TBranch* b_Z2pt; + TBranch* b_Z1Phi; + TBranch* b_Z2Phi; + TBranch* b_nTruePU; + TBranch* b_type1_pfMETEt; + TBranch* b_type1_pfMETPhi; + TBranch* b_l1GenPt; + TBranch* b_l2GenPt; + TBranch* b_l3GenPt; + TBranch* b_l4GenPt; + + TBranch* b_run; + TBranch* b_lumi; + TBranch* b_evt; + + TBranch* b_l1IsTight; + TBranch* b_l2IsTight; + TBranch* b_l3IsTight; + TBranch* b_l4IsTight; + TBranch* b_l1IsIso; + TBranch* b_l2IsIso; + TBranch* b_l3IsIso; + TBranch* b_l4IsIso; + + TBranch* b_l1IsGap; + TBranch* b_l2IsGap; + TBranch* b_l3IsGap; + TBranch* b_l4IsGap; + + TBranch* b_l1Pt; + TBranch* b_l2Pt; + TBranch* b_l3Pt; + TBranch* b_l4Pt; + TBranch* b_l1Eta; + TBranch* b_l2Eta; + TBranch* b_l3Eta; + TBranch* b_l4Eta; + TBranch* b_l1Phi; + TBranch* b_l2Phi; + TBranch* b_l3Phi; + TBranch* b_l4Phi; + TBranch* b_l1SIP3D; + TBranch* b_l2SIP3D; + TBranch* b_l3SIP3D; + TBranch* b_l4SIP3D; + TBranch* b_l1Mass; + TBranch* b_l2Mass; + TBranch* b_l3Mass; + TBranch* b_l4Mass; + TBranch* b_l1PdgId; + TBranch* b_l2PdgId; + TBranch* b_l3PdgId; + TBranch* b_l4PdgId; + TBranch* b_l3MtToMET; + + // Readers to access the data (delete the ones you do not need). + virtual void SetScaleFactors() override; + virtual void Init(TTree *tree) override; + + ClassDefOverride(ZZSelectorBase,0); + + +protected: + std::vector nonprompt3l_ = { + "tt-lep", "st-schan", "st-tchan-t", "st-tchan-tbar", + "st-tw", "st-tbarw", "DYm50", "DYm50-1j", + "DYm50-2j","DYm50-3j","DYm50-4j", "DYm50__LO", + }; + + std::string name_ = "Unnamed"; + std::string channelName_ = "Unnamed"; + Channel channel_ = Unknown; + std::string selectionName_ = "tightleptons"; + Selection selection_ = tightleptons; + bool isMC_; + bool isNonpromptEstimate_; + bool isNonpromptMC_; + bool isZgamma_; + const float FR_MAX_PT_ = 80; + const float FR_MAX_ETA_ = 2.5; + const float MuSF_MAX_PT_ = 200; + const float EleSF_MAX_PT_ = 500; + virtual std::string GetNameFromFile() override; + virtual void SetBranchesNanoAOD() override; + virtual void SetBranchesUWVV() override; + void LoadBranchesUWVV(Long64_t entry, std::pair variation) override; + void LoadBranchesNanoAOD(Long64_t entry, std::pair variation) override; + bool e1e2IsZ1(Long64_t entry); + bool lep1IsTight(); + bool lep2IsTight(); + bool lep3IsTight(); + bool lep4IsTight(); + bool Z1PF(); + bool Z1FP(); + bool Z1FF(); + bool Z2PF(); + bool Z2FP(); + bool Z2FF(); + bool tightSIP(); + bool tightZ1Leptons(); + bool tightZ2Leptons(); +}; + +#endif + diff --git a/src/ZZBackgroundSelector.cc b/src/ZZBackgroundSelector.cc new file mode 100644 index 00000000..7b3642d8 --- /dev/null +++ b/src/ZZBackgroundSelector.cc @@ -0,0 +1,258 @@ +#include "Analysis/VVAnalysis/interface/ZZBackgroundSelector.h" +#include "TLorentzVector.h" +#include + +void ZZBackgroundSelector::SlaveBegin(TTree * /*tree*/) +{ + //systematics_ = { + // {jetEnergyScaleUp, "CMS_scale_jUp"}, + // {jetEnergyScaleDown, "CMS_scale_jDown"}, + // {jetEnergyResolutionUp, "CMS_res_jUp"}, + // {jetEnergyResolutionDown, "CMS_res_jDown"}, + //}; + //isNonpromptEstimate_ = true; + //doaQGC_ = false; + ZZSelector::SlaveBegin(0); + fakeRate_allE_ = (ScaleFactor *) GetInputList()->FindObject("fakeRate_allE"); + if (fakeRate_allE_ == nullptr ) Abort("Must pass electron fake rate to input list!"); + fakeRate_allMu_ = (ScaleFactor *) GetInputList()->FindObject("fakeRate_allMu"); + if (fakeRate_allMu_ == nullptr ) Abort("Must pass muon fake rate to input list!"); +} + +void ZZBackgroundSelector::SetupNewDirectory() +{ + ZZSelector::SetupNewDirectory(); + + // Insure that hist ranges are exactly the same as ZZSelector, just change name + for (const auto && obj : *currentHistDir_) { + std::string name = obj->GetName(); + //std::cout<<"histname: " <(obj); + named->SetName(name.insert(name.length()-4, "Fakes_").c_str()); + //std::cout<<"histname in BkgSelector: " <(Z1MassHistPPPF_, ("Z1Mass_PPPF_"+channelName_).c_str(), "Z1Mass; m_{Z_{1}} [GeV]; Events;", 60, 0, 120); + AddObject(Z1MassHistPPFF_, ("Z1Mass_PPFF_"+channelName_).c_str(), "Z1Mass; m_{Z_{1}} [GeV]; Events;", 60, 0, 120); + + AddObject(Z2MassHistPPPF_, ("Z2Mass_PPPF_"+channelName_).c_str(), "Z2Mass; m_{Z_{2}} [GeV]; Events;", 60, 0, 120); + AddObject(Z2MassHistPPFF_, ("Z2Mass_PPFF_"+channelName_).c_str(), "Z2Mass; m_{Z_{2}} [GeV]; Events;", 60, 0, 120); + + AddObject(MassHistPPPF_, ("Mass_PPPF_"+channelName_).c_str(), "Mass; m_{4l} [GeV]; Events;", 40, 70, 870); + AddObject(MassHistPPFF_, ("Mass_PPFF_"+channelName_).c_str(), "Mass; m_{4l} [GeV]; Events;", 40, 70, 870); + + AddObject(WeightsHistmmee_, ("Weights_mmee_"+channelName_).c_str(), "Weight; Event Weight; Events;", 10, -5, 5); + AddObject(WeightsHisteemm_, ("Weights_eemm_"+channelName_).c_str(), "Weight; Event Weight; Events;", 100, -5, 5); +} +float ZZBackgroundSelector::getEventWeight(Long64_t entry) { + float evtwgt = 0; + + if(channel_ == mmee && (e1e2IsZ1(entry))) + WeightsHistmmee_->Fill(1,weight); + + if(channel_ == eemm && !(e1e2IsZ1(entry))) + WeightsHisteemm_->Fill(1,weight); + + //if ((channel_ == eeee) || (channel_ == mmmm)){ + //} + //in eemm the e1e2IsZ1 function already sets the correct Z1,Z2 leptons and even the IDs from LoadBranches + //So only need to take care which is l3 and l4 + // if ((channel_ == eemm) || (channel_ == mmee)){ + // if(Z2FP()){ + // float templ3Pt = l3Pt; + // l3Pt = l4Pt; + // l4Pt = templ3Pt; + // float templ3Eta = l3Eta; + // l3Eta = l4Eta; + // l4Eta = templ3Eta; + // } + // } + //std::cout<<"Weight in Bkg Seletor getEventWeight function: "<Fill(Z1mass, weight); + Z2MassHistPPPF_->Fill(Z2mass, weight); + MassHistPPPF_->Fill(Mass,weight); + } + evtwgt = (getl4FakeRate(entry)*weight); + //WeightsHistPPPF_->Fill(1,evtwgt); + } + if (IsPPFFRegion()) { + if (true) { + //std::cout<<"Weight in PPFF: "<Fill(Z1mass, weight); + Z2MassHistPPFF_->Fill(Z2mass, weight); + MassHistPPFF_->Fill(Mass,weight); + } + evtwgt = ((-1*getl3FakeRate(entry)*getl4FakeRate(entry))*weight); + //evtwgt = ((getl3FakeRate(entry)*getl4FakeRate(entry))*weight); + //WeightsHistPPFF_->Fill(1,evtwgt); + } + //std::cout<<"eventWeight after Fake Rate: "< variation) { + ZZSelector::LoadBranches(entry, variation); + SetZ1Z2Masses(); + weight = getEventWeight(entry); +} +float ZZBackgroundSelector::getl3FakeRate(Long64_t entry) { + float pt_fillval = l3Pt < FR_MAX_PT_ ? l3Pt : FR_MAX_PT_ - 0.01; + float fr = 1; + if ((channel_ == eeee) || (channel_ == mmee && !(e1e2IsZ1(entry)))){ + fr = fakeRate_allE_->Evaluate2D(pt_fillval, std::abs(l3Eta)); + //fr = 0.03;//avg e fake rate + //std::cout<<"channel: "<Evaluate2D(pt_fillval, std::abs(l3Eta)); + //fr = 0.1;//avg mu fake rate + //std::cout<<"channel: "<Evaluate2D(pt_fillval, std::abs(l4Eta)); + //fr = 0.03;//avg e fake rate + //std::cout<<"channel: "<Evaluate2D(pt_fillval, std::abs(l4Eta)); + //fr = 0.1;//avg mu fake rate + //std::cout<<"channel: "< l3 + float templ1Pt = l1Pt; + l1Pt = l3Pt; + l3Pt = templ1Pt; + float templ1Eta = l1Eta; + l1Eta = l3Eta; + l3Eta = templ1Eta;} + else{ + } + } + else if(Z1PF() && Z2FP()){ + //Make sure I am not making a Z in eemm with an e and mu! + if ((channel_ == eeee) || (channel_ == mmmm)){ + Z1mass = (lepton1+lepton4).M(); + Z2mass = (lepton2+lepton3).M(); + Z1pt = (lepton1+lepton4).Pt(); + Z2pt = (lepton2+lepton3).Pt(); + //Here the two fakes are l2,l3 and we only need to relabel l2 -> l4 since this only matters in PPFF region so l3,l4 are interchangeable + float templ2Pt = l2Pt; + l2Pt = l4Pt; + l4Pt = templ2Pt; + float templ2Eta = l2Eta; + l2Eta = l4Eta; + l4Eta = templ2Eta; + } + else{ + } + } +} + diff --git a/src/ZZSelector.cc b/src/ZZSelector.cc new file mode 100644 index 00000000..eaf36636 --- /dev/null +++ b/src/ZZSelector.cc @@ -0,0 +1,683 @@ +#include "Analysis/VVAnalysis/interface/ZZSelector.h" +#include "TLorentzVector.h" +#include + +void ZZSelector::Init(TTree *tree) +{ + ZZSelectorBase::Init(tree); + + weight_info_ = 0; + if (isMC_) { + weight_info_ = GetLheWeightInfo(); + } + systematics_ = { + {electronRecoEffUp,"CMS_RecoEff_eUp"}, + {electronRecoEffDown,"CMS_RecoEff_eDown"}, + {electronEfficiencyUp, "CMS_eff_eUp"}, + {electronEfficiencyDown, "CMS_eff_eDown"}, + {muonEfficiencyUp, "CMS_eff_mUp"}, + {muonEfficiencyDown, "CMS_eff_mDown"}, + {pileupUp, "CMS_pileupUp"}, + {pileupDown, "CMS_pileupDown"}, + }; + + systHists_ = { + "yield", + "Mass", + "ZMass", + "ZZPt", + "Z1Pt", + "Z2Pt" + "ZPt", + "LepPt", + "Z1lep1_Pt", + "Z1lep2_Pt", + "Z2lep1_Pt", + "Z2lep2_Pt", + "nTruePU", + }; + hists1D_ = { + "yield", "backgroundControlYield","nTruePU","nvtx","ZMass","Z1Mass","Z2Mass","ZZPt", + "Z1Pt","Z2Pt","Z1Phi","Z2Phi","dPhiZ1Z2","ZPt","LepPt","LepEta","Lep12Pt","Lep12Eta", + "Lep34Pt","Lep34Eta","Z1lep1_Eta","Z1lep1_Phi","Z1lep1_Pt","Z1lep1_PdgId","Z1lep2_Eta", + "Z1lep2_Phi","Z1lep2_Pt","Z1lep2_PdgId","Z2lep1_Eta","Z2lep1_Phi","Z2lep1_Pt","Z2lep1_PdgId", + "Z2lep2_Eta","Z2lep2_Phi","Z2lep2_Pt","Z2lep2_PdgId","Mass","nJets", + }; + + ZZSelectorBase::Init(tree); +} + +void ZZSelector::SetBranchesUWVV() { + ZZSelectorBase::SetBranchesUWVV(); + if (isMC_) { + if (weight_info_ > 0) + fChain->SetBranchAddress("scaleWeights", &scaleWeights, &b_scaleWeights); + if ((weight_info_ == 2 || weight_info_ == 3) && doSystematics_) + fChain->SetBranchAddress("pdfWeights", &pdfWeights, &b_pdfWeights); + } + fChain->SetBranchAddress("Mass", &Mass, &b_Mass); + fChain->SetBranchAddress("Pt", &Pt, &b_Pt); +} + +unsigned int ZZSelector::GetLheWeightInfo() { + std::vector noLheWeights = { + "ggZZ2e2mu", "ggZZ4e", "ggZZ4m", "ggZZ4t", "ggZZ2e2tau","ggZZ2mu2tau" + }; + std::vector scaleAndPdfWeights = { + "wz3lnu-powheg", "wz3lnu-mg5amcnlo", + "ZZZ", "WZZ", "WWZ", + "zz4l-powheg", "zz4l-amcatnlo", + "ZZJJTo4L-EWK" + }; + std::vector allLheWeights = { + //"wzjj-aqgcft", "wzjj-aqgcfm", "wzjj-aqgcfs", + //"wz-atgc_pt0-200", "wz-atgc_pt200-300", + //"wz-atgc_pt300" + }; + + if (std::find(noLheWeights.begin(), noLheWeights.end(), name_) != noLheWeights.end()) + return 0; + if (std::find(scaleAndPdfWeights.begin(), scaleAndPdfWeights.end(), name_) != scaleAndPdfWeights.end()) + return 2; + if (std::find(allLheWeights.begin(), allLheWeights.end(), name_) != allLheWeights.end()) + return 3; + return 1; +} +void ZZSelector::LoadBranchesUWVV(Long64_t entry, std::pair variation) { + + ZZSelectorBase::LoadBranchesUWVV(entry, variation); + + //b_MtToMET->GetEntry(entry); + //b_l1Pt->GetEntry(entry); + //b_l2Pt->GetEntry(entry); + //b_l3Pt->GetEntry(entry); + b_Mass->GetEntry(entry); + b_Pt->GetEntry(entry); + //std::cout<<"channel in LoadBranches function: "< 0) { + b_scaleWeights->GetEntry(entry); + lheWeights = *scaleWeights; + if (weight_info_ == 2) { + b_pdfWeights->GetEntry(entry); + // Only keep NNPDF weights + lheWeights.insert(lheWeights.end(), pdfWeights->begin(), + pdfWeights->begin()+std::min(static_cast(103), pdfWeights->size())); + } + else if (weight_info_ == 3) { + b_pdfWeights->GetEntry(entry); + lheWeights.insert(lheWeights.end(), pdfWeights->begin(), pdfWeights->end()); + } + } + } + } + else if (isMC_) { + //Systematic uncertainties and creating shiftUp and shiftDown histograms + //Starting with lepton Efficiencies + if (variation.first == electronEfficiencyUp || variation.first == electronEfficiencyDown || variation.first == electronRecoEffUp || variation.first == electronRecoEffDown || + variation.first == muonEfficiencyUp || variation.first == muonEfficiencyDown) { + ShiftEfficiencies(variation.first); + } + else if (variation.first == pileupUp) { + weight *= pileupSF_->Evaluate1D(nTruePU, ScaleFactor::ShiftUp)/pileupSF_->Evaluate1D(nTruePU); + } + else if (variation.first == pileupDown) { + weight *= pileupSF_->Evaluate1D(nTruePU, ScaleFactor::ShiftDown)/pileupSF_->Evaluate1D(nTruePU); + } + } + + auto deltaPhiZZ = [](float phi1, float phi2) { + float pi = TMath::Pi(); + float dphi = fabs(phi1-phi2); + if(dphi>pi) + dphi = 2.0*pi - dphi; + return dphi; + }; + + dPhiZZ = deltaPhiZZ(Z1Phi,Z2Phi); +} + +void ZZSelector::ApplyScaleFactors() { + //In order to get around the Overflow issue, set the Pt, not ideal. + //std::cout<<"weight before SF: "<Evaluate2D(std::abs(l1Eta), pt_e1); + //std::cout<<"weight for GapE: "<Evaluate2D(std::abs(l1Eta), pt_e1); + } + if(l2IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + if(l3IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + if(l4IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + } + if (eRecoSF_ != nullptr and eLowRecoSF_ != nullptr ) { + //Applying Electron Reco SFs + if(l1Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l1Eta), l1Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + if(l2Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l2Eta), l2Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + if(l3Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l3Eta), l3Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + if(l4Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l4Eta), l4Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + } + } + else if (channel_ == eemm) { + float pt_e1 = l1Pt < EleSF_MAX_PT_ ? l1Pt : EleSF_MAX_PT_ - 0.01; + float pt_e2 = l2Pt < EleSF_MAX_PT_ ? l2Pt : EleSF_MAX_PT_ - 0.01; + float pt_m3 = l3Pt < MuSF_MAX_PT_ ? l3Pt : MuSF_MAX_PT_ - 0.01; + float pt_m4 = l4Pt < MuSF_MAX_PT_ ? l4Pt : MuSF_MAX_PT_ - 0.01; + if (eIdSF_ != nullptr and eGapIdSF_ != nullptr ) { + //In order to get around the Overflow issue, set the Pt, not ideal. + if(l1IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + if(l2IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + } + //Applying Electron Reco SFs + if (eRecoSF_ != nullptr and eLowRecoSF_ != nullptr ) { + if(l1Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l1Eta), l1Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + if(l2Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l2Eta), l2Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + } + if (mIdSF_ != nullptr) { + weight *= mIdSF_->Evaluate2D(std::abs(l3Eta), pt_m3); + weight *= mIdSF_->Evaluate2D(std::abs(l4Eta), pt_m4); + } + } + else if (channel_ == mmee) { + float pt_m1 = l1Pt < MuSF_MAX_PT_ ? l1Pt : MuSF_MAX_PT_ - 0.01; + float pt_m2 = l2Pt < MuSF_MAX_PT_ ? l2Pt : MuSF_MAX_PT_ - 0.01; + float pt_e3 = l3Pt < EleSF_MAX_PT_ ? l3Pt : EleSF_MAX_PT_ - 0.01; + float pt_e4 = l4Pt < EleSF_MAX_PT_ ? l4Pt : EleSF_MAX_PT_ - 0.01; + if (mIdSF_ != nullptr) { + weight *= mIdSF_->Evaluate2D(std::abs(l1Eta), pt_m1); + weight *= mIdSF_->Evaluate2D(std::abs(l2Eta), pt_m2); + } + if (eIdSF_ != nullptr and eGapIdSF_ != nullptr ) { + if(l3IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + if(l4IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + } + //Applying Electron Reco SFs + if (eRecoSF_ != nullptr and eLowRecoSF_ != nullptr ) { + if(l3Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l3Eta), l3Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + if(l4Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l4Eta), l4Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + } + } + else { + float pt_m1 = l1Pt < MuSF_MAX_PT_ ? l1Pt : MuSF_MAX_PT_ - 0.01; + float pt_m2 = l2Pt < MuSF_MAX_PT_ ? l2Pt : MuSF_MAX_PT_ - 0.01; + float pt_m3 = l3Pt < MuSF_MAX_PT_ ? l3Pt : MuSF_MAX_PT_ - 0.01; + float pt_m4 = l4Pt < MuSF_MAX_PT_ ? l4Pt : MuSF_MAX_PT_ - 0.01; + if (mIdSF_ != nullptr) { + weight *= mIdSF_->Evaluate2D(std::abs(l1Eta), pt_m1); + weight *= mIdSF_->Evaluate2D(std::abs(l2Eta), pt_m2); + weight *= mIdSF_->Evaluate2D(std::abs(l3Eta), pt_m3); + weight *= mIdSF_->Evaluate2D(std::abs(l4Eta), pt_m4); + } + } + if (pileupSF_ != nullptr) { + weight *= pileupSF_->Evaluate1D(nTruePU); + } +} +//Similar to Kenneth's SetShiftedMasses function which i will need later as well +void ZZSelector::SetVariables(Long64_t entry) { + if(!(e1e2IsZ1(entry))){ + //std::cout<<"e1e2IsZ1 is working"<Evaluate2D(std::abs(l1Eta), l1Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l1Eta), l1Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l1Eta), pt_e1,shift)/eRecoSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + if(l2Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l2Eta), l2Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l2Eta), l2Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l2Eta), pt_e2,shift)/eRecoSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + if(l3Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l3Eta), l3Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l3Eta), l3Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l3Eta), pt_e3,shift)/eRecoSF_->Evaluate2D(std::abs(l3Eta), pt_e3) ; + } + if(l4Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l4Eta), l4Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l4Eta), l4Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l4Eta), pt_e4,shift)/eRecoSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + } + //Applying Electron ID SFs Up/Down for ElectronIDEffSyst + else if (variation == electronEfficiencyUp || variation == electronEfficiencyDown) { + if(l1IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1, shift)/eGapIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1, shift)/eIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + if(l2IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2, shift)/eGapIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2, shift)/eIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + if(l3IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3, shift)/eGapIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3, shift)/eIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + if(l4IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4, shift)/eGapIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4, shift)/eIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + } + }//channel eeee + else if (channel_ == eemm) { + //In order to get around the Overflow issue, set the Pt, not ideal. + float pt_e1 = l1Pt < EleSF_MAX_PT_ ? l1Pt : EleSF_MAX_PT_ - 0.01; + float pt_e2 = l2Pt < EleSF_MAX_PT_ ? l2Pt : EleSF_MAX_PT_ - 0.01; + float pt_m3 = l3Pt < MuSF_MAX_PT_ ? l3Pt : MuSF_MAX_PT_ - 0.01; + float pt_m4 = l4Pt < MuSF_MAX_PT_ ? l4Pt : MuSF_MAX_PT_ - 0.01; + if (variation == electronRecoEffUp || variation == electronRecoEffDown) { + //Applying Electron Reco SFs Up/Down for ElectronRecoEffSyst + if(l1Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l1Eta), l1Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l1Eta), l1Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l1Eta), pt_e1,shift)/eRecoSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + if(l2Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l2Eta), l2Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l2Eta), l2Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l2Eta), pt_e2,shift)/eRecoSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + } + //Applying Electron ID SFs Up/Down for ElectronIDEffSyst + else if (variation == electronEfficiencyUp || variation == electronEfficiencyDown) { + if(l1IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1, shift)/eGapIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1, shift)/eIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1); + } + if(l2IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2, shift)/eGapIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2, shift)/eIdSF_->Evaluate2D(std::abs(l2Eta), pt_e2); + } + } + else if (variation == muonEfficiencyUp || variation == muonEfficiencyDown) { + weight *= mIdSF_->Evaluate2D(std::abs(l3Eta), pt_m3, shift)/mIdSF_->Evaluate2D(std::abs(l3Eta), pt_m3); + weight *= mIdSF_->Evaluate2D(std::abs(l4Eta), pt_m4, shift)/mIdSF_->Evaluate2D(std::abs(l4Eta), pt_m4); + } + } + else if (channel_ == mmee) { + float pt_m1 = l1Pt < MuSF_MAX_PT_ ? l1Pt : MuSF_MAX_PT_ - 0.01; + float pt_m2 = l2Pt < MuSF_MAX_PT_ ? l2Pt : MuSF_MAX_PT_ - 0.01; + float pt_e3 = l3Pt < EleSF_MAX_PT_ ? l3Pt : EleSF_MAX_PT_ - 0.01; + float pt_e4 = l4Pt < EleSF_MAX_PT_ ? l4Pt : EleSF_MAX_PT_ - 0.01; + if (variation == muonEfficiencyUp || variation == muonEfficiencyDown) { + weight *= mIdSF_->Evaluate2D(std::abs(l1Eta), pt_m1, shift)/mIdSF_->Evaluate2D(std::abs(l1Eta), pt_m1); + weight *= mIdSF_->Evaluate2D(std::abs(l2Eta), pt_m2, shift)/mIdSF_->Evaluate2D(std::abs(l2Eta), pt_m2); + } + else if (variation == electronRecoEffUp || variation == electronRecoEffDown) { + //Applying Electron Reco SFs Up/Down for ElectronRecoEffSyst + if(l3Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l3Eta), l3Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l3Eta), l3Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l3Eta), pt_e3,shift)/eRecoSF_->Evaluate2D(std::abs(l3Eta), pt_e3) ; + } + if(l4Pt < 20){ + weight *= eLowRecoSF_->Evaluate2D(std::abs(l4Eta), l4Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l4Eta), l4Pt); + } + else{ + weight *= eRecoSF_->Evaluate2D(std::abs(l4Eta), pt_e4,shift)/eRecoSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + } + //Applying Electron ID SFs Up/Down for ElectronIDEffSyst + else if (variation == electronEfficiencyUp || variation == electronEfficiencyDown) { + if(l3IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3, shift)/eGapIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3, shift)/eIdSF_->Evaluate2D(std::abs(l3Eta), pt_e3); + } + if(l4IsGap){ + weight *= eGapIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4, shift)/eGapIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + else{ + weight *= eIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4, shift)/eIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); + } + } + } + else if (channel_ == mmmm && (variation == muonEfficiencyUp || variation == muonEfficiencyDown)) { + float pt_m1 = l1Pt < MuSF_MAX_PT_ ? l1Pt : MuSF_MAX_PT_ - 0.01; + float pt_m2 = l2Pt < MuSF_MAX_PT_ ? l2Pt : MuSF_MAX_PT_ - 0.01; + float pt_m3 = l3Pt < MuSF_MAX_PT_ ? l3Pt : MuSF_MAX_PT_ - 0.01; + float pt_m4 = l4Pt < MuSF_MAX_PT_ ? l4Pt : MuSF_MAX_PT_ - 0.01; + weight *= mIdSF_->Evaluate2D(std::abs(l1Eta), pt_m1, shift)/mIdSF_->Evaluate2D(std::abs(l1Eta), pt_m1); + //std::cout<<"l1 Shift: "<< mIdSF_->Evaluate2D(std::abs(l1Eta), pt_m1, shift)<Evaluate2D(std::abs(l1Eta), pt_m1)<Evaluate2D(std::abs(l2Eta), pt_m2, shift)/mIdSF_->Evaluate2D(std::abs(l2Eta), pt_m2); + weight *= mIdSF_->Evaluate2D(std::abs(l3Eta), pt_m3, shift)/mIdSF_->Evaluate2D(std::abs(l3Eta), pt_m3); + //std::cout<<"l3 Shift: "<< mIdSF_->Evaluate2D(std::abs(l3Eta), pt_m3, shift)<Evaluate2D(std::abs(l3Eta), pt_m3)<Evaluate2D(std::abs(l4Eta), pt_m4, shift)/mIdSF_->Evaluate2D(std::abs(l4Eta), pt_m4); + } +} +bool ZZSelector::PassesZZSelection(){ + if (ZZSelection() && TightZZLeptons()) + return true; + else + return false; +} +bool ZZSelector::PassesHZZSelection(){ + if (ZSelection() && TightZZLeptons()) + return true; + else + return false; +} +bool ZZSelector::TightZZLeptons() { + if (tightZ1Leptons() && tightZ2Leptons()) + return true; + else + return false; +} +bool ZZSelector::ZZSelection() { + if ((Z1mass > 60.0 && Z1mass < 120.0) && (Z2mass > 60.0 && Z2mass < 120.0)) + return true; + else + return false; +} + +//We already require 4 < Z1,Z2 < 120 in the "Loose Skim" +bool ZZSelector::ZSelection() { + if (Z1mass > 40.0 && Z2mass > 12.0) + return true; + else + return false; +} +bool ZZSelector::Z4lSelection() { + if (Mass > 80.0 && Mass < 100.0) + return true; + else + return false; +} +//This is no longer needed as I apply SIP < 4.0 on electrons while skimming and we don't need SIP cut on muons with latest HZZID +bool ZZSelector::HZZSIPSelection(){ + if ((l1SIP3D < 4.0 && l2SIP3D < 4.0 && l3SIP3D < 4.0 && l4SIP3D < 4.0)) + return true; + else + return false; +} +bool ZZSelector::HZZLowMass() { + if (Mass > 70.0 && Mass < 110.0) + return true; + else + return false; +} +bool ZZSelector::HZZMediumMass() { + if (Mass > 138.0 && Mass < 300.0) + return true; + else + return false; +} +bool ZZSelector::TestMuons(){ + if ((Z1mass > 82.0 && Z1mass < 102.0) && (Z2mass < 40.0)) + return true; + else + return false; +} + +void ZZSelector::FillHistograms(Long64_t entry, std::pair variation) { + //bool noBlind = true; + //Applying the ZZ Selection here + if (!PassesZZSelection()) + return; + if ((variation.first == Central || (doaTGC_ && isaTGC_)) && isMC_){ + for (size_t i = 0; i < lheWeights.size(); i++) { + SafeHistFill(weighthists_, getHistName("yield", variation.second), 1, i, lheWeights[i]/lheWeights[0]*weight); + SafeHistFill(weighthists_, getHistName("Mass", variation.second), Mass, i, lheWeights[i]/lheWeights[0]*weight); + SafeHistFill(weighthists_, getHistName("Pt", variation.second), Pt, i, lheWeights[i]/lheWeights[0]*weight); + } + } + SafeHistFill(histMap1D_, getHistName("yield", variation.second), 1, weight); + SafeHistFill(histMap1D_, getHistName("Mass", variation.second), Mass,weight); + SafeHistFill(histMap1D_, getHistName("ZMass", variation.second), Z1mass, weight); + SafeHistFill(histMap1D_, getHistName("ZMass", variation.second), Z2mass, weight); + //Making LeptonPt and Eta plots + SafeHistFill(histMap1D_, getHistName("LepPt", variation.second), l1Pt, weight); + SafeHistFill(histMap1D_, getHistName("LepPt", variation.second), l2Pt, weight); + SafeHistFill(histMap1D_, getHistName("LepPt", variation.second), l3Pt, weight); + SafeHistFill(histMap1D_, getHistName("LepPt", variation.second), l4Pt, weight); + SafeHistFill(histMap1D_, getHistName("LepEta", variation.second), l1Eta, weight); + SafeHistFill(histMap1D_, getHistName("LepEta", variation.second), l2Eta, weight); + SafeHistFill(histMap1D_, getHistName("LepEta", variation.second), l3Eta, weight); + SafeHistFill(histMap1D_, getHistName("LepEta", variation.second), l4Eta, weight); + // Summing 12,34 leptons + SafeHistFill(histMap1D_, getHistName("Lep12Pt", variation.second), l1Pt, weight); + SafeHistFill(histMap1D_, getHistName("Lep12Pt", variation.second), l2Pt, weight); + SafeHistFill(histMap1D_, getHistName("Lep34Pt", variation.second), l3Pt, weight); + SafeHistFill(histMap1D_, getHistName("Lep34Pt", variation.second), l4Pt, weight); + SafeHistFill(histMap1D_, getHistName("Lep12Eta", variation.second), l1Eta, weight); + SafeHistFill(histMap1D_, getHistName("Lep12Eta", variation.second), l2Eta, weight); + SafeHistFill(histMap1D_, getHistName("Le34Eta", variation.second), l3Eta, weight); + SafeHistFill(histMap1D_, getHistName("Lep34Eta", variation.second), l4Eta, weight); + SafeHistFill(histMap1D_, getHistName("Z1Mass", variation.second), Z1mass, weight); + SafeHistFill(histMap1D_, getHistName("Z2Mass", variation.second), Z2mass, weight); + SafeHistFill(histMap1D_, getHistName("ZPt", variation.second), Z1pt, weight); + SafeHistFill(histMap1D_, getHistName("ZPt", variation.second), Z2pt, weight); + SafeHistFill(histMap1D_, getHistName("Z1Pt", variation.second), Z1pt, weight); + SafeHistFill(histMap1D_, getHistName("Z2Pt", variation.second), Z2pt, weight); + SafeHistFill(histMap1D_, getHistName("Z1Phi", variation.second), Z1Phi, weight); + SafeHistFill(histMap1D_, getHistName("Z2Phi", variation.second), Z2Phi, weight); + SafeHistFill(histMap1D_, getHistName("dPhiZ1Z2", variation.second), dPhiZZ, weight); + SafeHistFill(histMap1D_, getHistName("ZZPt", variation.second), Pt, weight); + SafeHistFill(histMap1D_, getHistName("Z1lep1_Pt", variation.second), l1Pt, weight); + SafeHistFill(histMap1D_, getHistName("Z1lep1_Eta", variation.second), l1Eta, weight); + SafeHistFill(histMap1D_, getHistName("Z1lep1_Phi", variation.second), l1Phi, weight); + SafeHistFill(histMap1D_, getHistName("Z1lep1_PdgId", variation.second), l1PdgId, weight); + SafeHistFill(histMap1D_, getHistName("Z1lep2_Pt", variation.second), l2Pt, weight); + SafeHistFill(histMap1D_, getHistName("Z1lep2_Eta", variation.second), l2Eta, weight); + SafeHistFill(histMap1D_, getHistName("Z1lep2_Phi", variation.second), l2Phi, weight); + SafeHistFill(histMap1D_, getHistName("Z1lep2_PdgId", variation.second), l2PdgId, weight); + SafeHistFill(histMap1D_, getHistName("Z2lep1_Pt", variation.second), l3Pt, weight); + SafeHistFill(histMap1D_, getHistName("Z2lep1_Eta", variation.second), l3Eta, weight); + SafeHistFill(histMap1D_, getHistName("Z2lep1_Phi", variation.second), l3Phi, weight); + SafeHistFill(histMap1D_, getHistName("Z2lep1_PdgId", variation.second), l3PdgId, weight); + SafeHistFill(histMap1D_, getHistName("Z2lep2_Pt", variation.second), l4Pt, weight); + SafeHistFill(histMap1D_, getHistName("Z2lep2_Eta", variation.second), l4Eta, weight); + SafeHistFill(histMap1D_, getHistName("Z2lep2_Phi", variation.second), l4Phi, weight); + SafeHistFill(histMap1D_, getHistName("Z2lep2_PdgId", variation.second), l4PdgId, weight); + SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Pt",variation.second),l1Pt,l2Pt,weight); + SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Eta",variation.second),l1Eta,l2Eta,weight); + SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Phi",variation.second),l1Phi,l2Phi,weight); + SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Pt",variation.second),l3Pt,l4Pt,weight); + SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Eta",variation.second),l3Eta,l4Eta,weight); + SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Phi",variation.second),l3Phi,l4Phi,weight); + //2D Z1 vs Z2 + SafeHistFill(hists2D_, getHistName("Z1Mass_Z2Mass",variation.second),Z1mass,Z2mass,weight); + + if (histMap1D_[getHistName("nvtx", variation.second)] != nullptr) { + b_nvtx->GetEntry(entry); + histMap1D_[getHistName("nvtx", variation.second)]->Fill(nvtx, weight); + } + if (isMC_) + SafeHistFill(histMap1D_, getHistName("nTruePU", variation.second), nTruePU, weight); +} + + +void ZZSelector::SetupNewDirectory() +{ + SelectorBase::SetupNewDirectory(); + isaTGC_ = name_.find("atgc") != std::string::npos; + + InitializeHistogramsFromConfig(); +} diff --git a/src/ZZSelectorBase.cc b/src/ZZSelectorBase.cc new file mode 100644 index 00000000..e2816516 --- /dev/null +++ b/src/ZZSelectorBase.cc @@ -0,0 +1,573 @@ +#include "Analysis/VVAnalysis/interface/ZZSelectorBase.h" +#include +#include +#include "TParameter.h" + +std::string ZZSelectorBase::GetNameFromFile() { + std::regex expr = std::regex("201[0-9]-[0-9][0-9]-[0-9][0-9]-(.*)-ZZ4l2018"); + std::smatch matches; + std::string fileName = fChain->GetTree()->GetDirectory()->GetFile()->GetName(); + + std::regex_search(fileName, matches, expr); + return std::string(matches.str(1)); +} +void ZZSelectorBase::SetScaleFactors() +{ + pileupSF_ = (ScaleFactor *) GetInputList()->FindObject("pileupSF"); + if (pileupSF_ == nullptr ) + std::invalid_argument("Must pass pileup weights SF"); + eLowRecoSF_ = (ScaleFactor *) GetInputList()->FindObject("electronLowReco19SF"); + if (eLowRecoSF_ == nullptr ) + std::invalid_argument("Must pass electron LowReco18 SF"); + eRecoSF_ = (ScaleFactor *) GetInputList()->FindObject("electronReco19SF"); + if (eRecoSF_ == nullptr ) + std::invalid_argument("Must pass electron Reco18 SF"); + eIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronMoriond19SF"); + if (eIdSF_ == nullptr ) + std::invalid_argument("Must pass electron Moriond19 SF"); + eGapIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronMoriond19GapSF"); + if (eGapIdSF_ == nullptr ) + std::invalid_argument("Must pass electronGap Moriond19 SF"); + mIdSF_ = (ScaleFactor *) GetInputList()->FindObject("muonMoriond19SF"); + if (mIdSF_ == nullptr ) + std::invalid_argument("Must pass muon Moriond19 SF"); + + //There are L1Prefiring weight and uncertainity in the ZZ UWVV ntuples + //prefireEff_ = (TEfficiency*) GetInputList()->FindObject("prefireEfficiencyMap"); + //if (prefireEff_ == nullptr ) + // std::invalid_argument("Must pass prefiring efficiency map"); +} + +void ZZSelectorBase::Init(TTree *tree) +{ + + allChannels_ = {"eeee","eemm","mmee","mmmm","eee", "eem", "emm", "mmm"}; + + SelectorBase::Init(tree); +} + +void ZZSelectorBase::SetBranchesUWVV() { + if (isMC_){ + fChain->SetBranchAddress("genWeight", &genWeight, &b_genWeight); + fChain->SetBranchAddress("nTruePU", &nTruePU, &b_nTruePU); + } + else { + //fChain->SetBranchAddress("Flag_duplicateMuonsPass", Flag_duplicateMuonsPass); + //fChain->SetBranchAddress("Flag_badMuonsPass", Flag_badMuonsPass); + } + //std::cout<<"channelName: "<SetBranchAddress("run", &run, &b_run); + fChain->SetBranchAddress("lumi", &lumi, &b_lumi); + fChain->SetBranchAddress("evt", &evt, &b_evt); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + //fChain->SetBranchAddress("e1IsFall17isoV2wpHZZ", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + //fChain->SetBranchAddress("e2IsFall17isoV2wpHZZ", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); + //fChain->SetBranchAddress("e3IsFall17isoV2wpHZZ", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("e3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("e3ZZIsoPass", &l3IsIso, &b_l3IsIso); + //fChain->SetBranchAddress("e4IsFall17isoV2wpHZZ", &l4IsTight, &b_l4IsTight); + fChain->SetBranchAddress("e4ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); + fChain->SetBranchAddress("e4ZZIsoPass", &l4IsIso, &b_l4IsIso); + fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); + fChain->SetBranchAddress("e3_e4_Mass", &Z2mass, &b_Z2mass); + //fChain->SetBranchAddress("e1_e3_Mass", &Zamass, &b_Zamass); + //fChain->SetBranchAddress("e2_e4_Mass", &Zbmass, &b_Zbmass); + fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("e3_e4_Pt", &Z2pt, &b_Z2pt); + fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); + fChain->SetBranchAddress("e3_e4_Phi", &Z2Phi, &b_Z2Phi); + fChain->SetBranchAddress("e1Pt", &l1Pt, &b_l1Pt); + fChain->SetBranchAddress("e2Pt", &l2Pt, &b_l2Pt); + fChain->SetBranchAddress("e3Pt", &l3Pt, &b_l3Pt); + fChain->SetBranchAddress("e4Pt", &l4Pt, &b_l4Pt); + fChain->SetBranchAddress("e1Eta", &l1Eta, &b_l1Eta); + fChain->SetBranchAddress("e2Eta", &l2Eta, &b_l2Eta); + fChain->SetBranchAddress("e3Eta", &l3Eta, &b_l3Eta); + fChain->SetBranchAddress("e4Eta", &l4Eta, &b_l4Eta); + fChain->SetBranchAddress("e1Phi", &l1Phi, &b_l1Phi); + fChain->SetBranchAddress("e2Phi", &l2Phi, &b_l2Phi); + fChain->SetBranchAddress("e3Phi", &l3Phi, &b_l3Phi); + fChain->SetBranchAddress("e4Phi", &l4Phi, &b_l4Phi); + fChain->SetBranchAddress("e1SIP3D", &l1SIP3D, &b_l1SIP3D); + fChain->SetBranchAddress("e2SIP3D", &l2SIP3D, &b_l2SIP3D); + fChain->SetBranchAddress("e3SIP3D", &l3SIP3D, &b_l3SIP3D); + fChain->SetBranchAddress("e4SIP3D", &l4SIP3D, &b_l4SIP3D); + fChain->SetBranchAddress("e1PdgId", &l1PdgId, &b_l1PdgId); + fChain->SetBranchAddress("e2PdgId", &l2PdgId, &b_l2PdgId); + fChain->SetBranchAddress("e3PdgId", &l3PdgId, &b_l3PdgId); + fChain->SetBranchAddress("e4PdgId", &l4PdgId, &b_l4PdgId); + fChain->SetBranchAddress("e1Mass", &l1Mass, &b_l1Mass); + fChain->SetBranchAddress("e2Mass", &l2Mass, &b_l2Mass); + fChain->SetBranchAddress("e3Mass", &l3Mass, &b_l3Mass); + fChain->SetBranchAddress("e4Mass", &l4Mass, &b_l4Mass); + fChain->SetBranchAddress("e1IsGap", &l1IsGap, &b_l1IsGap); + fChain->SetBranchAddress("e2IsGap", &l2IsGap, &b_l2IsGap); + fChain->SetBranchAddress("e3IsGap", &l3IsGap, &b_l3IsGap); + fChain->SetBranchAddress("e4IsGap", &l4IsGap, &b_l4IsGap); + } + //Add 2e2mu channel also but it still needs to differentiate which one is Z1Mass and which one is Z2Mass leptons + //This is done with a flag at the time of Process for each event on the fly + else if (channelName_ == "eemm") { + channel_ = eemm; + //fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("run", &run, &b_run); + fChain->SetBranchAddress("lumi", &lumi, &b_lumi); + fChain->SetBranchAddress("evt", &evt, &b_evt); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + //fChain->SetBranchAddress("e1IsFall17isoV2wpHZZ", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + //fChain->SetBranchAddress("e2IsFall17isoV2wpHZZ", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m1ZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); + fChain->SetBranchAddress("m2ZZIsoPass", &l4IsIso, &b_l4IsIso); + fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); + fChain->SetBranchAddress("m1_m2_Mass", &Z2mass, &b_Z2mass); + fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("m1_m2_Pt", &Z2pt, &b_Z2pt); + fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); + fChain->SetBranchAddress("m1_m2_Phi", &Z2Phi, &b_Z2Phi); + fChain->SetBranchAddress("e1Pt", &l1Pt, &b_l1Pt); + fChain->SetBranchAddress("e2Pt", &l2Pt, &b_l2Pt); + fChain->SetBranchAddress("m1Pt", &l3Pt, &b_l3Pt); + fChain->SetBranchAddress("m2Pt", &l4Pt, &b_l4Pt); + fChain->SetBranchAddress("e1Eta", &l1Eta, &b_l1Eta); + fChain->SetBranchAddress("e2Eta", &l2Eta, &b_l2Eta); + fChain->SetBranchAddress("m1Eta", &l3Eta, &b_l3Eta); + fChain->SetBranchAddress("m2Eta", &l4Eta, &b_l4Eta); + fChain->SetBranchAddress("e1Phi", &l1Phi, &b_l1Phi); + fChain->SetBranchAddress("e2Phi", &l2Phi, &b_l2Phi); + fChain->SetBranchAddress("e1SIP3D", &l1SIP3D, &b_l1SIP3D); + fChain->SetBranchAddress("e2SIP3D", &l2SIP3D, &b_l2SIP3D); + fChain->SetBranchAddress("m1Phi", &l3Phi, &b_l3Phi); + fChain->SetBranchAddress("m2Phi", &l4Phi, &b_l4Phi); + fChain->SetBranchAddress("m1SIP3D", &l3SIP3D, &b_l3SIP3D); + fChain->SetBranchAddress("m2SIP3D", &l4SIP3D, &b_l4SIP3D); + fChain->SetBranchAddress("e1PdgId", &l1PdgId, &b_l1PdgId); + fChain->SetBranchAddress("e2PdgId", &l2PdgId, &b_l2PdgId); + fChain->SetBranchAddress("m1PdgId", &l3PdgId, &b_l3PdgId); + fChain->SetBranchAddress("m2PdgId", &l4PdgId, &b_l4PdgId); + fChain->SetBranchAddress("e1Mass", &l1Mass, &b_l1Mass); + fChain->SetBranchAddress("e2Mass", &l2Mass, &b_l2Mass); + fChain->SetBranchAddress("m1Mass", &l3Mass, &b_l3Mass); + fChain->SetBranchAddress("m2Mass", &l4Mass, &b_l4Mass); + fChain->SetBranchAddress("e1IsGap", &l1IsGap, &b_l1IsGap); + fChain->SetBranchAddress("e2IsGap", &l2IsGap, &b_l2IsGap); + //There are 2 different SFs for electrons depending on whether the electron is from the crack + //in ECAL crystals or not but we need a dummy for the muons? Makes life easier later + fChain->SetBranchAddress("m1IsLoose", &l3IsGap, &b_l3IsGap); + fChain->SetBranchAddress("m2IsLoose", &l4IsGap, &b_l4IsGap); + } + else if (channelName_ == "mmee") { + channel_ = mmee; + fChain->SetBranchAddress("run", &run, &b_run); + fChain->SetBranchAddress("lumi", &lumi, &b_lumi); + fChain->SetBranchAddress("evt", &evt, &b_evt); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + //fChain->SetBranchAddress("e1IsFall17isoV2wpHZZ", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + //fChain->SetBranchAddress("e2IsFall17isoV2wpHZZ", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m1ZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); + fChain->SetBranchAddress("m2ZZIsoPass", &l4IsIso, &b_l4IsIso); + fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); + fChain->SetBranchAddress("m1_m2_Mass", &Z2mass, &b_Z2mass); + fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("m1_m2_Pt", &Z2pt, &b_Z2pt); + fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); + fChain->SetBranchAddress("m1_m2_Phi", &Z2Phi, &b_Z2Phi); + fChain->SetBranchAddress("e1Pt", &l1Pt, &b_l1Pt); + fChain->SetBranchAddress("e2Pt", &l2Pt, &b_l2Pt); + fChain->SetBranchAddress("m1Pt", &l3Pt, &b_l3Pt); + fChain->SetBranchAddress("m2Pt", &l4Pt, &b_l4Pt); + fChain->SetBranchAddress("e1Eta", &l1Eta, &b_l1Eta); + fChain->SetBranchAddress("e2Eta", &l2Eta, &b_l2Eta); + fChain->SetBranchAddress("m1Eta", &l3Eta, &b_l3Eta); + fChain->SetBranchAddress("m2Eta", &l4Eta, &b_l4Eta); + fChain->SetBranchAddress("e1Phi", &l1Phi, &b_l1Phi); + fChain->SetBranchAddress("e2Phi", &l2Phi, &b_l2Phi); + fChain->SetBranchAddress("e1SIP3D", &l1SIP3D, &b_l1SIP3D); + fChain->SetBranchAddress("e2SIP3D", &l2SIP3D, &b_l2SIP3D); + fChain->SetBranchAddress("m1Phi", &l3Phi, &b_l3Phi); + fChain->SetBranchAddress("m2Phi", &l4Phi, &b_l4Phi); + fChain->SetBranchAddress("m1SIP3D", &l3SIP3D, &b_l3SIP3D); + fChain->SetBranchAddress("m2SIP3D", &l4SIP3D, &b_l4SIP3D); + fChain->SetBranchAddress("e1PdgId", &l1PdgId, &b_l1PdgId); + fChain->SetBranchAddress("e2PdgId", &l2PdgId, &b_l2PdgId); + fChain->SetBranchAddress("m1PdgId", &l3PdgId, &b_l3PdgId); + fChain->SetBranchAddress("m2PdgId", &l4PdgId, &b_l4PdgId); + fChain->SetBranchAddress("e1Mass", &l1Mass, &b_l1Mass); + fChain->SetBranchAddress("e2Mass", &l2Mass, &b_l2Mass); + fChain->SetBranchAddress("m1Mass", &l3Mass, &b_l3Mass); + fChain->SetBranchAddress("m2Mass", &l4Mass, &b_l4Mass); + fChain->SetBranchAddress("e1IsGap", &l1IsGap, &b_l1IsGap); + fChain->SetBranchAddress("e2IsGap", &l2IsGap, &b_l2IsGap); + fChain->SetBranchAddress("m1IsLoose", &l3IsGap, &b_l3IsGap); + fChain->SetBranchAddress("m2IsLoose", &l4IsGap, &b_l4IsGap); + } + else if (channelName_ == "mmmm") { + channel_ = mmmm; + fChain->SetBranchAddress("run", &run, &b_run); + fChain->SetBranchAddress("lumi", &lumi, &b_lumi); + fChain->SetBranchAddress("evt", &evt, &b_evt); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("m2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m3ZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("m4ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); + fChain->SetBranchAddress("m4ZZIsoPass", &l4IsIso, &b_l4IsIso); + fChain->SetBranchAddress("m1_m2_Mass", &Z1mass, &b_Z1mass); + fChain->SetBranchAddress("m3_m4_Mass", &Z2mass, &b_Z2mass); + //fChain->SetBranchAddress("m1_m3_Mass", &Zamass, &b_Zamass); + //fChain->SetBranchAddress("m2_m4_Mass", &Zbmass, &b_Zbmass); + fChain->SetBranchAddress("m1_m2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("m3_m4_Pt", &Z2pt, &b_Z2pt); + fChain->SetBranchAddress("m1_m2_Phi", &Z1Phi, &b_Z1Phi); + fChain->SetBranchAddress("m3_m4_Phi", &Z2Phi, &b_Z2Phi); + fChain->SetBranchAddress("m1Pt", &l1Pt, &b_l1Pt); + fChain->SetBranchAddress("m2Pt", &l2Pt, &b_l2Pt); + fChain->SetBranchAddress("m3Pt", &l3Pt, &b_l3Pt); + fChain->SetBranchAddress("m4Pt", &l4Pt, &b_l4Pt); + fChain->SetBranchAddress("m1Eta", &l1Eta, &b_l1Eta); + fChain->SetBranchAddress("m2Eta", &l2Eta, &b_l2Eta); + fChain->SetBranchAddress("m3Eta", &l3Eta, &b_l3Eta); + fChain->SetBranchAddress("m4Eta", &l4Eta, &b_l4Eta); + fChain->SetBranchAddress("m1Phi", &l1Phi, &b_l1Phi); + fChain->SetBranchAddress("m2Phi", &l2Phi, &b_l2Phi); + fChain->SetBranchAddress("m3Phi", &l3Phi, &b_l3Phi); + fChain->SetBranchAddress("m4Phi", &l4Phi, &b_l4Phi); + fChain->SetBranchAddress("m1SIP3D", &l1SIP3D, &b_l1SIP3D); + fChain->SetBranchAddress("m2SIP3D", &l2SIP3D, &b_l2SIP3D); + fChain->SetBranchAddress("m3SIP3D", &l3SIP3D, &b_l3SIP3D); + fChain->SetBranchAddress("m4SIP3D", &l4SIP3D, &b_l4SIP3D); + fChain->SetBranchAddress("m1PdgId", &l1PdgId, &b_l1PdgId); + fChain->SetBranchAddress("m2PdgId", &l2PdgId, &b_l2PdgId); + fChain->SetBranchAddress("m3PdgId", &l3PdgId, &b_l3PdgId); + fChain->SetBranchAddress("m4PdgId", &l4PdgId, &b_l4PdgId); + fChain->SetBranchAddress("m1Mass", &l1Mass, &b_l1Mass); + fChain->SetBranchAddress("m2Mass", &l2Mass, &b_l2Mass); + fChain->SetBranchAddress("m3Mass", &l3Mass, &b_l3Mass); + fChain->SetBranchAddress("m4Mass", &l4Mass, &b_l4Mass); + } + else if (channelName_ == "eee") { + channel_ = eee; + fChain->SetBranchAddress("run", &run, &b_run); + fChain->SetBranchAddress("lumi", &lumi, &b_lumi); + fChain->SetBranchAddress("evt", &evt, &b_evt); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("e3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("e3ZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); + fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); + fChain->SetBranchAddress("e1Pt", &l1Pt, &b_l1Pt); + fChain->SetBranchAddress("e2Pt", &l2Pt, &b_l2Pt); + fChain->SetBranchAddress("e3Pt", &l3Pt, &b_l3Pt); + fChain->SetBranchAddress("e1Eta", &l1Eta, &b_l1Eta); + fChain->SetBranchAddress("e2Eta", &l2Eta, &b_l2Eta); + fChain->SetBranchAddress("e3Eta", &l3Eta, &b_l3Eta); + fChain->SetBranchAddress("e1Phi", &l1Phi, &b_l1Phi); + fChain->SetBranchAddress("e2Phi", &l2Phi, &b_l2Phi); + fChain->SetBranchAddress("e3Phi", &l3Phi, &b_l3Phi); + fChain->SetBranchAddress("e1SIP3D", &l1SIP3D, &b_l1SIP3D); + fChain->SetBranchAddress("e2SIP3D", &l2SIP3D, &b_l2SIP3D); + fChain->SetBranchAddress("e3SIP3D", &l3SIP3D, &b_l3SIP3D); + fChain->SetBranchAddress("e1PdgId", &l1PdgId, &b_l1PdgId); + fChain->SetBranchAddress("e2PdgId", &l2PdgId, &b_l2PdgId); + fChain->SetBranchAddress("e3PdgId", &l3PdgId, &b_l3PdgId); + fChain->SetBranchAddress("e3MtToMET", &l3MtToMET, &b_l3MtToMET); + } + else if (channelName_ == "eem") { + channel_ = eem; + fChain->SetBranchAddress("run", &run, &b_run); + fChain->SetBranchAddress("lumi", &lumi, &b_lumi); + fChain->SetBranchAddress("evt", &evt, &b_evt); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("mZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("mZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); + fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); + fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("e1Pt", &l1Pt, &b_l1Pt); + fChain->SetBranchAddress("e2Pt", &l2Pt, &b_l2Pt); + fChain->SetBranchAddress("e1Eta", &l1Eta, &b_l1Eta); + fChain->SetBranchAddress("e2Eta", &l2Eta, &b_l2Eta); + fChain->SetBranchAddress("e1Phi", &l1Phi, &b_l1Phi); + fChain->SetBranchAddress("e2Phi", &l2Phi, &b_l2Phi); + fChain->SetBranchAddress("mPt", &l3Pt, &b_l3Pt); + fChain->SetBranchAddress("mEta", &l3Eta, &b_l3Eta); + fChain->SetBranchAddress("mPhi", &l3Phi, &b_l3Phi); + fChain->SetBranchAddress("e1SIP3D", &l1SIP3D, &b_l1SIP3D); + fChain->SetBranchAddress("e2SIP3D", &l2SIP3D, &b_l2SIP3D); + fChain->SetBranchAddress("mSIP3D", &l3SIP3D, &b_l3SIP3D); + fChain->SetBranchAddress("e1PdgId", &l1PdgId, &b_l1PdgId); + fChain->SetBranchAddress("e2PdgId", &l2PdgId, &b_l2PdgId); + fChain->SetBranchAddress("mPdgId", &l3PdgId, &b_l3PdgId); + fChain->SetBranchAddress("mMtToMET", &l3MtToMET, &b_l3MtToMET); + } + else if (channelName_ == "emm") { + channel_ = emm; + fChain->SetBranchAddress("run", &run, &b_run); + fChain->SetBranchAddress("lumi", &lumi, &b_lumi); + fChain->SetBranchAddress("evt", &evt, &b_evt); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + fChain->SetBranchAddress("eZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("eZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("m2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m1_m2_Mass", &Z1mass, &b_Z1mass); + fChain->SetBranchAddress("m1_m2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("m1_m2_Phi", &Z1Phi, &b_Z1Phi); + fChain->SetBranchAddress("m1Pt", &l1Pt, &b_l1Pt); + fChain->SetBranchAddress("m2Pt", &l2Pt, &b_l2Pt); + fChain->SetBranchAddress("m1Eta", &l1Eta, &b_l1Eta); + fChain->SetBranchAddress("m2Eta", &l2Eta, &b_l2Eta); + fChain->SetBranchAddress("m1Phi", &l1Phi, &b_l1Phi); + fChain->SetBranchAddress("m2Phi", &l2Phi, &b_l2Phi); + fChain->SetBranchAddress("ePt", &l3Pt, &b_l3Pt); + fChain->SetBranchAddress("eEta", &l3Eta, &b_l3Eta); + fChain->SetBranchAddress("ePhi", &l3Phi, &b_l3Phi); + fChain->SetBranchAddress("m1SIP3D", &l1SIP3D, &b_l1SIP3D); + fChain->SetBranchAddress("m2SIP3D", &l2SIP3D, &b_l2SIP3D); + fChain->SetBranchAddress("eSIP3D", &l3SIP3D, &b_l3SIP3D); + fChain->SetBranchAddress("m1PdgId", &l1PdgId, &b_l1PdgId); + fChain->SetBranchAddress("m2PdgId", &l2PdgId, &b_l2PdgId); + fChain->SetBranchAddress("ePdgId", &l3PdgId, &b_l3PdgId); + fChain->SetBranchAddress("eMtToMET", &l3MtToMET, &b_l3MtToMET); + } + else if (channelName_ == "mmm") { + channel_ = mmm; + fChain->SetBranchAddress("run", &run, &b_run); + fChain->SetBranchAddress("lumi", &lumi, &b_lumi); + fChain->SetBranchAddress("evt", &evt, &b_evt); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("m2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m3ZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("m1_m2_Mass", &Z1mass, &b_Z1mass); + fChain->SetBranchAddress("m1_m2_Pt", &Z1pt, &b_Z1pt); + fChain->SetBranchAddress("m1_m2_Phi", &Z1Phi, &b_Z1Phi); + fChain->SetBranchAddress("m1Pt", &l1Pt, &b_l1Pt); + fChain->SetBranchAddress("m2Pt", &l2Pt, &b_l2Pt); + fChain->SetBranchAddress("m3Pt", &l3Pt, &b_l3Pt); + fChain->SetBranchAddress("m1Eta", &l1Eta, &b_l1Eta); + fChain->SetBranchAddress("m2Eta", &l2Eta, &b_l2Eta); + fChain->SetBranchAddress("m3Eta", &l3Eta, &b_l3Eta); + fChain->SetBranchAddress("m1Phi", &l1Phi, &b_l1Phi); + fChain->SetBranchAddress("m2Phi", &l2Phi, &b_l2Phi); + fChain->SetBranchAddress("m3Phi", &l3Phi, &b_l3Phi); + fChain->SetBranchAddress("m1SIP3D", &l1SIP3D, &b_l1SIP3D); + fChain->SetBranchAddress("m2SIP3D", &l2SIP3D, &b_l2SIP3D); + fChain->SetBranchAddress("m3SIP3D", &l3SIP3D, &b_l3SIP3D); + fChain->SetBranchAddress("m1PdgId", &l1PdgId, &b_l1PdgId); + fChain->SetBranchAddress("m2PdgId", &l2PdgId, &b_l2PdgId); + fChain->SetBranchAddress("m3PdgId", &l3PdgId, &b_l3PdgId); + fChain->SetBranchAddress("m3MtToMET", &l3MtToMET, &b_l3MtToMET); + } + else + throw std::invalid_argument("Invalid channel choice!"); + + fChain->SetBranchAddress("type1_pfMETEt", &type1_pfMETEt, &b_type1_pfMETEt); +} + +void ZZSelectorBase::LoadBranchesNanoAOD(Long64_t entry, std::pair variation) { + throw std::domain_error("NanoAOD ntuples not supported for ZZSelector!"); +} + +void ZZSelectorBase::SetBranchesNanoAOD() { + throw std::domain_error("NanoAOD ntuples not supported for ZZSelector!"); +} + +void ZZSelectorBase::LoadBranchesUWVV(Long64_t entry, std::pair variation) { + weight = 1; + b_l1Pt->GetEntry(entry); + b_l2Pt->GetEntry(entry); + b_l3Pt->GetEntry(entry); + b_l1Eta->GetEntry(entry); + b_l2Eta->GetEntry(entry); + b_l3Eta->GetEntry(entry); + b_l1Phi->GetEntry(entry); + b_l2Phi->GetEntry(entry); + b_l3Phi->GetEntry(entry); + b_l1SIP3D->GetEntry(entry); + b_l2SIP3D->GetEntry(entry); + b_l3SIP3D->GetEntry(entry); + b_l1PdgId->GetEntry(entry); + b_l2PdgId->GetEntry(entry); + b_l3PdgId->GetEntry(entry); + b_run->GetEntry(entry); + b_lumi->GetEntry(entry); + b_evt->GetEntry(entry); + if (channel_ == eeee || channel_ == eemm || channel_ == mmee || channel_ == mmmm) { + b_l4Pt->GetEntry(entry); + b_l4Eta->GetEntry(entry); + b_l4Phi->GetEntry(entry); + b_l4SIP3D->GetEntry(entry); + b_l4PdgId->GetEntry(entry); + b_l1Mass->GetEntry(entry); + b_l2Mass->GetEntry(entry); + b_l3Mass->GetEntry(entry); + b_l4Mass->GetEntry(entry); + b_l4IsTight->GetEntry(entry); + b_l4IsIso->GetEntry(entry); + //b_l4PVDXY->GetEntry(entry); + //b_l4PVDZ->GetEntry(entry); + b_Z2mass->GetEntry(entry); + b_Z2pt->GetEntry(entry); + b_Z2Phi->GetEntry(entry); + } + b_Z1mass->GetEntry(entry); + b_Z1pt->GetEntry(entry); + b_Z1Phi->GetEntry(entry); + b_type1_pfMETEt->GetEntry(entry); + b_l1IsTight->GetEntry(entry); + b_l1IsIso->GetEntry(entry); + b_l2IsTight->GetEntry(entry); + b_l2IsIso->GetEntry(entry); + b_l3IsTight->GetEntry(entry); + b_l3IsIso->GetEntry(entry); + if (channel_ == eeee || channel_ == eemm || channel_ == mmee){ + b_l1IsGap->GetEntry(entry); + b_l2IsGap->GetEntry(entry); + b_l3IsGap->GetEntry(entry); + b_l4IsGap->GetEntry(entry); + } + if (channel_ == eee || channel_ == eem || channel_ == emm || channel_ == mmm) { + b_l3MtToMET->GetEntry(entry); + } + //std::cout<<"IsMC: "<GetEntry(entry); + b_nTruePU->GetEntry(entry); + weight = genWeight; + } + if(channel_ == mmee){ + if(e1e2IsZ1(entry)) + weight=0.0; + //Makes weight 0 if Z1 is ee hence should not go in _mmee histos + } + else if(channel_ == eemm){ + if(!(e1e2IsZ1(entry))) + weight=0.0; + //Makes weight 0 if Z1 is mm hence should not go in _eemm + } +} + +//This condition identifies the Z1 candidate +//Required for the 2e2mu state +//Can I save some kind of flag to identify the order of leptons for each event +//I think this part might need to be added to the ZZSelector and BackgroundSelector and the condition checked at +//process time for each event. +bool ZZSelectorBase::e1e2IsZ1(Long64_t entry){ + //4P Signal region logic where I need to differentiate between two tight pairs and assign Z1 depending on which is closer to mZ + if(tightZ1Leptons() && tightZ2Leptons()){ + if(fabs(Z1mass-91.1876) < fabs(Z2mass-91.1876)) + return true; + else + return false; + } + //In CRs it doesn't matter, the tight pair builds the Z and the other pair is X in Z+X. + else if(tightZ1Leptons() && !tightZ2Leptons()){ + return true;} + + else if(!tightZ1Leptons() && tightZ2Leptons()){ + return false;} + else + return false; +} +// Meant to be a wrapper for the tight ID just in case it changes +// To be a function of multiple variables +bool ZZSelectorBase::lep1IsTight() { + return (l1IsTight && l1IsIso); +} + +bool ZZSelectorBase::lep2IsTight() { + return (l2IsTight && l2IsIso); +} +bool ZZSelectorBase::tightSIP() { + if ((l1SIP3D < 4.0 && l2SIP3D < 4.0 && l3SIP3D < 4.0)) + return true; + else + return false; +} +bool ZZSelectorBase::tightZ1Leptons() { + return lep1IsTight() && lep2IsTight(); +} +bool ZZSelectorBase::lep3IsTight() { + return (l3IsTight && l3IsIso); +} +bool ZZSelectorBase::lep4IsTight() { + return (l4IsTight && l4IsIso); +} +bool ZZSelectorBase::tightZ2Leptons() { + return lep3IsTight() && lep4IsTight(); +} +bool ZZSelectorBase::Z1PF(){ + if(lep1IsTight() && !lep2IsTight()) + return true; + else + return false; +} +bool ZZSelectorBase::Z1FP(){ + if(lep2IsTight() && !lep1IsTight()) + return true; + else + return false; +} +bool ZZSelectorBase::Z1FF(){ + if(!lep1IsTight() && !lep2IsTight()) + return true; + else + return false; +} +bool ZZSelectorBase::Z2PF(){ + if(lep3IsTight() && !lep4IsTight()) + return true; + else + return false; +} +bool ZZSelectorBase::Z2FP(){ + if(lep4IsTight() && !lep3IsTight()) + return true; + else + return false; +} +bool ZZSelectorBase::Z2FF(){ + if(!lep3IsTight() && !lep4IsTight()) + return true; + else + return false; +} diff --git a/src/classes.h b/src/classes.h index ca6357d4..0c6ec2d6 100644 --- a/src/classes.h +++ b/src/classes.h @@ -2,6 +2,9 @@ #include "Analysis/VVAnalysis/interface/SelectorBase.h" #include "Analysis/VVAnalysis/interface/ZSelector.h" #include "Analysis/VVAnalysis/interface/ZZGenSelector.h" +#include "Analysis/VVAnalysis/interface/ZZSelectorBase.h" +#include "Analysis/VVAnalysis/interface/ZZSelector.h" +#include "Analysis/VVAnalysis/interface/ZZBackgroundSelector.h" #include "Analysis/VVAnalysis/interface/WGenSelector.h" #include "Analysis/VVAnalysis/interface/ZGenSelector.h" #include "Analysis/VVAnalysis/interface/NanoGenSelectorBase.h" @@ -23,6 +26,9 @@ namespace{ WZSelector pWZSelector; NanoGenSelectorBase pNanoGenSelectorBase; ZZGenSelector pZZGenSelector; + ZZSelectorBase pZZSelectorBase; + ZZBackgroundSelector pZZBackgroundSelector; + ZZSelector pZZSelector; WGenSelector pWGenSelector; ZGenSelector pZGenSelector; WZBackgroundSelector pWZBackgroundSelector; diff --git a/src/classes_def.xml b/src/classes_def.xml index ec99ee64..8638ce3e 100644 --- a/src/classes_def.xml +++ b/src/classes_def.xml @@ -6,6 +6,9 @@ + + + From e3e83b71dd364d5c38dc4c421b5504b7e0c606f8 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Wed, 21 Aug 2019 12:49:11 -0400 Subject: [PATCH 02/53] Working as expected - validated with 2016 signal file --- Utilities/python/ConfigureJobs.py | 36 ++++++++++++++++++++++++++++++ Utilities/python/UserInput.py | 8 +++---- Utilities/scripts/makeHistFile.py | 2 +- interface/SelectorBase.h | 4 ++++ interface/ZZSelectorBase.h | 6 ----- runTest.sh | 1 + src/SelectorBase.cc | 16 +++++++++++-- src/ZZSelector.cc | 14 +++++++----- src/ZZSelectorBase.cc | 37 ++++++++++++++++--------------- 9 files changed, 88 insertions(+), 36 deletions(-) create mode 100755 runTest.sh diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index 4ca02197..a00cc5bc 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -171,6 +171,42 @@ def getListOfFiles(filelist, selection, manager_path=""): names += [x for x in allnames if "data" in x] else: names += allnames + elif "ZZ4l2016" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2016/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames + elif "ZZ4l2017" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2017/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames + elif "ZZ4l2018" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2018/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames elif "*" in name: names += fnmatch.filter(valid_names, name) else: diff --git a/Utilities/python/UserInput.py b/Utilities/python/UserInput.py index d7f4b835..edebfe2a 100644 --- a/Utilities/python/UserInput.py +++ b/Utilities/python/UserInput.py @@ -25,7 +25,7 @@ def getDefaultParser(): input_group.add_argument("-f", "--filenames", type=lambda x : [i.strip() for i in x.split(',')], help="List of input file names, " - "as defined in AnalysisDatasetManager, separated " + "as defined in ZZ4lRun2DatasetManager, separated " "by commas") input_group.add_argument("--inputs_from_file", nargs=3, metavar=('filelist', 'nPerJob', 'jobNum'), @@ -82,7 +82,7 @@ def readJson(json_file_name): print(err) return json_info -# Depends on AnalysisDatasetManagerModule +# Depends on ZZ4lRun2DatasetManagerModule def getHistInfo(analysis, input_hists, noConfig=False): if noConfig: print "INFO: assuming histogram information is specified in selector" @@ -90,7 +90,7 @@ def getHistInfo(analysis, input_hists, noConfig=False): manager_path = ConfigureJobs.getManagerPath() ConfigHistTools = imp.load_source("ConfigHistTools", - "/".join([manager_path, "AnalysisDatasetManager/Utilities/python/ConfigHistTools.py"])) + "/".join([manager_path, "ZZ4lRun2DatasetManager/Utilities/python/ConfigHistTools.py"])) # For histograms produced with some postprocessing on the hist file excludedHistPatterns = ["wCR", "unrolled", "YieldByChannel"] config_hists = ConfigHistTools.getAllHistNames(manager_path, analysis) \ @@ -104,7 +104,7 @@ def getHistInfo(analysis, input_hists, noConfig=False): def getHistExpr(hist_names, selection): manager_path = ConfigureJobs.getManagerPath() ConfigHistTools = imp.load_source("ConfigHistTools", - "/".join([manager_path, "AnalysisDatasetManager/Utilities/python/ConfigHistTools.py"])) + "/".join([manager_path, "ZZ4lRun2DatasetManager/Utilities/python/ConfigHistTools.py"])) info = ROOT.TList() info.SetName("histinfo") diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index eeb9ee7f..0b0ce71c 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -131,7 +131,7 @@ def makeHistFile(args): sys.exit(0) alldata = HistTools.makeCompositeHists(fOut,"AllData", - ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"],, manager_path), args['lumi'], + ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"], manager_path), args['lumi'], underflow=False, overflow=False) OutputTools.writeOutputListItem(alldata, fOut) alldata.Delete() diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index e2818b12..785884a0 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -48,6 +48,7 @@ class SelectorBase : public TSelector { enum Selection { tightleptons, ZZGenFiducial, + ZZselection, Wselection, Zselection, Wselection_Full, FakeRateSelectionLoose, FakeRateSelectionTight, VBSselection_Loose, @@ -72,6 +73,7 @@ class SelectorBase : public TSelector { metUnclusteredEnergyUp, metUnclusteredEnergyDown, muonEfficiencyUp, muonEfficiencyDown, muonScaleUp, muonScaleDown, + electronRecoEffUp, electronRecoEffDown, electronEfficiencyUp, electronEfficiencyDown, electronScaleUp, electronScaleDown, pileupUp, pileupDown, @@ -91,6 +93,8 @@ class SelectorBase : public TSelector { {"ZZGenFiducial", ZZGenFiducial}, {"Wselection", Wselection}, {"Zselection", Zselection}, + {"ZZselection", ZZselection}, + {"SignalSync", ZZselection}, {"Wselection_Full", Wselection_Full}, {"FakeRateSelectionLoose", FakeRateSelectionLoose}, {"FakeRateSelectionTight", FakeRateSelectionTight}, diff --git a/interface/ZZSelectorBase.h b/interface/ZZSelectorBase.h index 4ae21b75..77aad9c1 100644 --- a/interface/ZZSelectorBase.h +++ b/interface/ZZSelectorBase.h @@ -180,12 +180,6 @@ public : "DYm50-2j","DYm50-3j","DYm50-4j", "DYm50__LO", }; - std::string name_ = "Unnamed"; - std::string channelName_ = "Unnamed"; - Channel channel_ = Unknown; - std::string selectionName_ = "tightleptons"; - Selection selection_ = tightleptons; - bool isMC_; bool isNonpromptEstimate_; bool isNonpromptMC_; bool isZgamma_; diff --git a/runTest.sh b/runTest.sh new file mode 100755 index 00000000..a6292de6 --- /dev/null +++ b/runTest.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s SignalSync --output_file testSignal2016.root --test --uwvv -c eeee,eemm,mmee,mmmm -f 2016SignalSync diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index 4c81bbc7..eb45d031 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -71,13 +71,17 @@ void SelectorBase::Init(TTree *tree) } } + //std::cout<<"In SelectorBase"<(fOutput->FindObject(name_.c_str())); - if (channelMap_.find(channelName_) != channelMap_.end()) + if (channelMap_.find(channelName_) != channelMap_.end()){ channel_ = channelMap_[channelName_]; + //std::cout<<"In SelectorBase"< variation) { //bool noBlind = true; //Applying the ZZ Selection here - if (!PassesZZSelection()) - return; + //std::cout<<"Is fillHistograms working?"<SetBranchAddress("Flag_duplicateMuonsPass", Flag_duplicateMuonsPass); //fChain->SetBranchAddress("Flag_badMuonsPass", Flag_badMuonsPass); } + //std::cout<<"In ZZSelectorBase"<SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); @@ -116,8 +117,8 @@ void ZZSelectorBase::SetBranchesUWVV() { } //Add 2e2mu channel also but it still needs to differentiate which one is Z1Mass and which one is Z2Mass leptons //This is done with a flag at the time of Process for each event on the fly - else if (channelName_ == "eemm") { - channel_ = eemm; + else if (channel_ == eemm) { + //channel_ = eemm; //fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); @@ -170,8 +171,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("m1IsLoose", &l3IsGap, &b_l3IsGap); fChain->SetBranchAddress("m2IsLoose", &l4IsGap, &b_l4IsGap); } - else if (channelName_ == "mmee") { - channel_ = mmee; + else if (channel_ == mmee) { + //channel_ = mmee; fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); fChain->SetBranchAddress("evt", &evt, &b_evt); @@ -221,8 +222,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("m1IsLoose", &l3IsGap, &b_l3IsGap); fChain->SetBranchAddress("m2IsLoose", &l4IsGap, &b_l4IsGap); } - else if (channelName_ == "mmmm") { - channel_ = mmmm; + else if (channel_ == mmmm) { + //channel_ = mmmm; fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); fChain->SetBranchAddress("evt", &evt, &b_evt); @@ -268,8 +269,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("m3Mass", &l3Mass, &b_l3Mass); fChain->SetBranchAddress("m4Mass", &l4Mass, &b_l4Mass); } - else if (channelName_ == "eee") { - channel_ = eee; + else if (channel_ == eee) { + //channel_ = eee; fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); fChain->SetBranchAddress("evt", &evt, &b_evt); @@ -300,8 +301,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("e3PdgId", &l3PdgId, &b_l3PdgId); fChain->SetBranchAddress("e3MtToMET", &l3MtToMET, &b_l3MtToMET); } - else if (channelName_ == "eem") { - channel_ = eem; + else if (channel_ == eem) { + //channel_ = eem; fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); fChain->SetBranchAddress("evt", &evt, &b_evt); @@ -333,8 +334,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("mPdgId", &l3PdgId, &b_l3PdgId); fChain->SetBranchAddress("mMtToMET", &l3MtToMET, &b_l3MtToMET); } - else if (channelName_ == "emm") { - channel_ = emm; + else if (channel_ == emm) { + //channel_ = emm; fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); fChain->SetBranchAddress("evt", &evt, &b_evt); @@ -365,8 +366,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("ePdgId", &l3PdgId, &b_l3PdgId); fChain->SetBranchAddress("eMtToMET", &l3MtToMET, &b_l3MtToMET); } - else if (channelName_ == "mmm") { - channel_ = mmm; + else if (channel_ == mmm) { + //channel_ = mmm; fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); fChain->SetBranchAddress("evt", &evt, &b_evt); @@ -398,7 +399,7 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("m3MtToMET", &l3MtToMET, &b_l3MtToMET); } else - throw std::invalid_argument("Invalid channel choice!"); + throw std::invalid_argument("Invalid channel choice in ZZSelectorBase!"); fChain->SetBranchAddress("type1_pfMETEt", &type1_pfMETEt, &b_type1_pfMETEt); } From 594311ceb6b1d2798d96de969a3aa94d4a216aa1 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 26 Aug 2019 13:11:50 -0400 Subject: [PATCH 03/53] ZZSelector running but makeComposite function not working --- ConfigureJobs.py | 286 ++++++++++++++++++++++++++++++ Utilities/python/HistTools.py | 6 +- Utilities/scripts/makeHistFile.py | 9 +- interface/SelectorBase.h | 1 + makeHistFile.py | 169 ++++++++++++++++++ runTest.sh | 2 +- runZZ4l2016.sh | 1 + src/ZZSelector.cc | 2 +- 8 files changed, 471 insertions(+), 5 deletions(-) create mode 100644 ConfigureJobs.py create mode 100755 makeHistFile.py create mode 100755 runZZ4l2016.sh diff --git a/ConfigureJobs.py b/ConfigureJobs.py new file mode 100644 index 00000000..faf38728 --- /dev/null +++ b/ConfigureJobs.py @@ -0,0 +1,286 @@ +import datetime +import UserInput +import fnmatch +import glob +import os +import json +import array +import string +import configparser + +def get2DBinning(xvar="mjj", yvar="etajj", analysis='WZ'): + #return (array.array('d', [500, 1000,1500, 2000, 2500]), + # [0, 150, 300, 450] # for MT(WZ) +# return (array.array('d', [500, 1000, 1350, 1750, 2000, 2500]), + xbinning = [] + ybinning = [] + if xvar == "mjj": + xbinning = array.array('d', [500, 1000,1500, 2000, 2500]) + #xbinning = array.array('d', [500, 1000, 1350, 1750, 2500]) + + if yvar == 'etajj': + ybinning = [2.5, 4, 5, 20] + #if yvar == 'etajj': + # ybinning = [2.5, 4, 5.5, 20] + elif yvar == 'dRjj': + ybinning = [0, 5, 6, 20] + return (xbinning, ybinning) + +def getChannels(analysis='ZZ'): + if analysis == 'ZZ': + return ["eeee", "eemm", "mmee", "mmmm"] +def getManagerPath(): + config = configparser.ConfigParser() + config.read_file(open("Templates/config.%s" % os.environ["USER"])) + if "dataset_manager_path" not in config['Setup']: + raise ValueError("dataset_manager_path not specified in config file Template/config.%s" + % os.environ["USER"]) + return config['Setup']['dataset_manager_path'] + "/" +def getCombinePath(): + config = configparser.ConfigParser() + config.read_file(open("Templates/config.%s" % os.environ["USER"])) + if "combine_path" not in config['Setup']: + raise ValueError("dataset_manager_path not specified in config file Template/config.%s" + % os.environ["USER"]) + return config['Setup']['combine_path'] + "/" +def getListOfEWKFilenames(): + return [ + #"wz3lnu-amcnlo",#old 2018 ntuples + "wz3lnu-powheg",#New 2018 ntuples + # Use jet binned WZ samples for subtraction by default + #"wz3lnu-mgmlm-0j", + #"wz3lnu-mgmlm-1j", + #"wz3lnu-mgmlm-2j", + #"wz3lnu-mgmlm-3j", + #"wlljj-ewk", + "zz4l-powheg", + #"zz4ljj-ewk", + #"zz2l2vjj-ewk", + #"tzq", + #"ttz", + #"ttw", + #"zzz", + #"wwz", + #"www", + #"ww", + #"zg", + "ggZZ4e", + "ggZZ4m", + "ggZZ4t", + "ggZZ2e2mu", + "ggZZ2e2tau", + "ggZZ2mu2tau", + ] + +def getListOfEWK(): + return [ + "zz4l-powheg", + "ggZZ4e", + "ggZZ4m", + "ggZZ4t", + "ggZZ2e2mu", + "ggZZ2e2tau", + "ggZZ2mu2tau", + ] +def getListOfDYFilenames(): + return[ + "DYJetsToLL_M10to50", + "DYJetsToLLM-50", + ] +def getListOfNonpromptFilenames(): + return ["tt-lep", + "tt-jets", + #"st-schan", + #"st-tchan-t", + #"st-tchan-tbar", + #"st-tw", + #"st-tbarw", + ##"DYm50", + #"DYm50-1j", + #"DYm50-2j", + #"DYm50-3j", + #"DYm50-4j", + ] +def getListOfHZZFilenames(): + return ["ggHZZ", + "vbfHZZ", + "ttH_HToZZ_4L", + "WminusHToZZ", + "WplusHToZZ", + "ZHToZZ_4L" + ] +def getListOfggZZFilenames(): + return ["ggZZ4e", + "ggZZ4m", + "ggZZ4t", + "ggZZ2e2mu", + "ggZZ2e2tau", + "ggZZ2mu2tau" + ] +def getJobName(sample_name, analysis, selection, version): + date = '{:%Y-%m-%d}'.format(datetime.date.today()) + selection = selection.replace(";",",") + selections = selection.split(",") + selection_name = "To".join([selections[0],selections[-1]]) \ + if len(selections) > 1 else selections[0] + return '-'.join([date, sample_name, analysis, selection_name, + ("v%s" % version) if version.isdigit() else version]) +def getNumberAndSizeOfLocalFiles(path_to_files): + file_list = glob.glob(path_to_files) + return (len(file_list), sum([os.path.getsize(f)/1000000 for f in file_list])) +def getNumberAndSizeOfHDFSFiles(file_path): + file_info = [] + for line in out.splitlines(): + split = line.split() + if len(split) != 9: + continue + file_info.append(float(split[4].rstrip("mkg"))) + return (0,0) if len(file_info) == 0 else (len(file_info), sum(file_info)) +def getListOfHDFSFiles(file_path): + try: + out = subprocess.check_output(["hdfs", "dfs", "-ls", file_path.replace("/hdfs", "")]) + except subprocess.CalledProcessError as error: + logging.warning(error) + return [] + files = [] + for line in out.splitlines(): + split = line.split(" ", 1) + if len(split) != 2: + continue + elif "root" in split[1]: + files.append("/"+split[1]) + return files +def getListOfFiles(filelist, selection, manager_path=""): + if manager_path is "": + manager_path = getManagerPath() + data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path + data_info = UserInput.readAllJson("/".join([data_path, "%s.json" % "data/*"])) + mc_info = UserInput.readAllJson("/".join([data_path, "%s.json" % "montecarlo/*"])) + valid_names = data_info.keys() + mc_info.keys() + names = [] + for name in filelist: + if "ZZ4l2016" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2016/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames + elif "ZZ4l2017" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2017/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames + elif "ZZ4l2018" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2018/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames + elif "*" in name: + names += fnmatch.filter(valid_names, name) + else: + if name.split("__")[0] not in valid_names: + print "%s is not a valid name" % name + continue + names += [name] + return [str(i) for i in names] +def fillTemplatedFile(template_file_name, out_file_name, template_dict): + with open(template_file_name, "r") as templateFile: + source = string.Template(templateFile.read()) + result = source.substitute(template_dict) + with open(out_file_name, "w") as outFile: + outFile.write(result) +def getListOfFilesWithXSec(filelist, manager_path=""): + if manager_path is "": + manager_path = getManagerPath() + data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path + files = getListOfFiles(filelist, "ntuples", manager_path) + #files = getListOfFiles(filelist, "2018Data", manager_path) + mc_info = UserInput.readAllJson("/".join([data_path, "%s.json" % "montecarlo/*"])) + info = {} + for file_name in files: + if "data" in file_name: + info.update({file_name : 1}) + else: + file_info = mc_info[file_name.split("__")[0]] + kfac = file_info["kfactor"] if "kfactor" in file_info.keys() else 1 + info.update({file_name : file_info["cross_section"]*kfac}) + return info +def getPreviousStep(selection, analysis): + selection_map = {} + if analysis == "ZZ4l2016": + selection_map = { "ntuples" : "ntuples", + "preselection" : "ntuples", + "4lCRBase" : "ntuples" + } + elif analysis == "ZplusL2016": + selection_map = { "ntuples": "ntuples", + "ZplusLBase" : "ntuples" + } + elif analysis == "ZZ4l2017": + selection_map = { "ntuples" : "ntuples", + "preselection" : "ntuples", + "4lCRBase" : "ntuples" + } + elif analysis == "ZplusL2017": + selection_map = { "ntuples": "ntuples", + "ZplusLBase" : "ntuples" + } + elif analysis == "ZZ4l2018": + selection_map = { "ntuples" : "ntuples", + "preselection" : "ntuples", + "4lCRBase" : "ntuples" + } + elif analysis == "ZplusL2018": + selection_map = { "ntuples": "ntuples", + "ZplusLBase" : "ntuples" + } + selection = selection.replace(";",",") + first_selection = selection.split(",")[0].strip() + if first_selection not in selection_map.keys(): + if "preselection" in first_selection: + first_selection = "preselection" + else: + raise ValueError("Invalid selection '%s'. Valid selections are:" + "%s" % (first_selection, selection_map.keys())) + return selection_map[first_selection] +def getInputFilesPath(sample_name, selection, analysis, manager_path=""): + if manager_path is "": + manager_path = getManagerPath() + data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path + input_file_name = "/".join([data_path, analysis, "%s.json" % + selection]) + input_files = UserInput.readJson(input_file_name) + if sample_name not in input_files.keys(): + raise ValueError("Invalid input file %s. Input file must correspond" + " to a definition in %s" % (sample_name, input_file_name)) + filename = input_files[sample_name]['file_path'] + return filename +def getCutsJsonName(selection, analysis): + return "/".join(["Cuts", analysis, selection + ".json"]) +def getTriggerName(sample_name, analysis, selection): + trigger_names = ["MuonEG", "DoubleMuon", "DoubleEG", "SingleMuon", "SingleElectron"] + if "data" in sample_name and getPreviousStep(selection, analysis) == "ntuples": + for name in trigger_names: + if name in sample_name: + return "-t " + name + return "-t MonteCarlo" diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index 00c6408e..65d75cb8 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -244,11 +244,15 @@ def addOverflowAndUnderflow(hist, underflow=True, overflow=True): def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False, overflow=True, rebin=None): composite = ROOT.TList() composite.SetName(name) + print "members for CompositeHists: ",members + print "hist_file:",hist_file for directory in [str(i) for i in members.keys()]: # For aQGC, the different plot groups should already be in their own files if "aqgc" in directory: directory = name - if not hist_file.Get(directory): + print "directory:",directory + print "directory:",type(directory) + if not hist_file.Get(str(directory)): print "Skipping invalid filename %s" % directory continue if hists == []: diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 0b0ce71c..54866da5 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -8,6 +8,7 @@ import os import logging import sys +import datetime def getComLineArgs(): parser = UserInput.getDefaultParser() @@ -46,7 +47,9 @@ def makeHistFile(args): sys.path.insert(0, "/".join([manager_path, "ZZ4lRun2DatasetManager", "Utilities/python"])) - tmpFileName = args['output_file'] + today = datetime.date.today().strftime("%d%b%Y") + tmpFileName = "Hists%s-%s.root" % (today, args['output_file']) if args['selection'] == "SignalSync" \ + else "Hists%s-%s.root" % (today, args['analysis']) fOut = ROOT.TFile(tmpFileName, "recreate") addScaleFacs = False @@ -133,6 +136,7 @@ def makeHistFile(args): alldata = HistTools.makeCompositeHists(fOut,"AllData", ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"], manager_path), args['lumi'], underflow=False, overflow=False) + print "alldata:", alldata OutputTools.writeOutputListItem(alldata, fOut) alldata.Delete() @@ -143,7 +147,8 @@ def makeHistFile(args): nonpromptmc.Delete() OutputTools.writeOutputListItem(nonpromptmc, fOut) - + + print "fOut: ",fOut ewkmc = HistTools.makeCompositeHists(fOut,"AllEWK", ConfigureJobs.getListOfFilesWithXSec( ConfigureJobs.getListOfEWKFilenames(args['analysis']), manager_path), args['lumi'], underflow=False, overflow=False) diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index 785884a0..bf48d98a 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -95,6 +95,7 @@ class SelectorBase : public TSelector { {"Zselection", Zselection}, {"ZZselection", ZZselection}, {"SignalSync", ZZselection}, + {"LooseLeptons", ZZselection}, {"Wselection_Full", Wselection_Full}, {"FakeRateSelectionLoose", FakeRateSelectionLoose}, {"FakeRateSelectionTight", FakeRateSelectionTight}, diff --git a/makeHistFile.py b/makeHistFile.py new file mode 100755 index 00000000..30849309 --- /dev/null +++ b/makeHistFile.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python +import ROOT +from python import SelectorTools +from python import UserInput +from python import OutputTools +from python import ConfigureJobs +from python import HistTools +import os +import sys +import datetime +channels = ["eeee", "eemm","mmee","mmmm"] +#channels = ["eeee"] +def getComLineArgs(): + parser = UserInput.getDefaultParser() + parser.add_argument("--proof", "-p", + action='store_true', help="Don't use proof") + parser.add_argument("--lumi", "-l", type=float, + default=41.5, help="luminosity value (in fb-1)") + parser.add_argument("--output_file", "-o", type=str, + default="", help="Output file name") + parser.add_argument("--scalefactors_file", "-sf", type=str, + default="", help="ScaleFactors file name") + parser.add_argument("--leptonSelections", "-ls", type=str, + default="TightLeptons", help="Either All Loose or Tight") + parser.add_argument("--test", action='store_true', + help="Run test job (no background estimate)") + parser.add_argument("--output_selection", type=str, + default="", help="Selection stage of output file " + "(Same as input if not give)") + parser.add_argument("-b", "--hist_names", + type=lambda x : [i.strip() for i in x.split(',')], + default=["all"], help="List of histograms, " + "as defined in ZZ4lRun2DatasetManager, separated " + "by commas") + return vars(parser.parse_args()) + +def getHistExpr(hist_names, selection): + info = ROOT.TList() + info.SetName("histinfo") + for hist_name in hist_names: + bin_info = ConfigHistTools.getHistBinInfo(manager_path, selection, hist_name) + if "TH1" in ConfigHistTools.getHistType(manager_path, selection, hist_name): + bin_expr = "{nbins}, {xmin}, {xmax}".format(**bin_info) + else: + bin_expr = "{nbinsx}, {xmin}, {xmax}, {nbinsy}, {ymin}, {ymax}".format(**bin_info) + info.Add(ROOT.TNamed(hist_name, " $ ".join([hist_name, bin_expr]))) + return info + +ROOT.gROOT.SetBatch(True) + +args = getComLineArgs() +manager_path = ConfigureJobs.getManagerPath() +sys.path.append("/".join([manager_path, + "ZZ4lRun2DatasetManager", "Utilities/python"])) +import ConfigHistTools + +today = datetime.date.today().strftime("%d%b%Y") +tmpFileName = "HistFiles/Hists%s-%s.root" % (today, args['leptonSelections']) if args['output_file'] == "" \ + else args['output_file'] +fOut = ROOT.TFile(tmpFileName, "recreate") + +fScales = ROOT.TFile(args['scalefactors_file']) +mZZTightFakeRate = fScales.Get("mZZTightFakeRate") +eZZTightFakeRate = fScales.Get("eZZTightFakeRate") +#fakeRateFile=ROOT.TFile('data/fakeRate18Dec2018-ZplusLSkimZZ2018Data.root') +#eZZTightFakeRate=fakeRateFile.Get('DataEWKCorrected/ratioE2D_allE') +#mZZTightFakeRate=fakeRateFile.Get('DataEWKCorrected/ratioMu2D_allMu') +#useSvenjasFRs = False +#useJakobsFRs = False +#if useSvenjasFRs: +# mZZTightFakeRate = fScales.Get("mZZTightFakeRate_Svenja") +# eZZTightFakeRate = fScales.Get("eZZTightFakeRate_Svenja") +#elif useJakobsFRs: +# mZZTightFakeRate = fScales.Get("mZZTightFakeRate_Jakob") +# eZZTightFakeRate = fScales.Get("eZZTightFakeRate_Jakob") +## For medium muons +##mZZMedFakeRate.SetName("fakeRate_allMu") +if mZZTightFakeRate: + #print "Yes muon fake rates" + mZZTightFakeRate.SetName("fakeRate_allMu") +if eZZTightFakeRate: + #print "Yes electron fake rates" + eZZTightFakeRate.SetName("fakeRate_allE") +# +#muonIsoSF = fScales.Get('muonIsoSF') +muonMoriond19SF= fScales.Get('muonMoriond19SF') +#Electron Reco SF (POG) https://twiki.cern.ch/twiki/bin/viewauth/CMS/Egamma2018DataRecommendations +electronLowReco19SF = fScales.Get('electronLowReco19SF') +electronReco19SF = fScales.Get('electronReco19SF') +#Electron ID + SIP HZZ Scale factors +electronMoriond19SF = fScales.Get('electronMoriond19SF') +electronMoriond19GapSF = fScales.Get('electronMoriond19GapSF') +pileupSF = fScales.Get('pileupSF') + +fr_inputs = [eZZTightFakeRate, mZZTightFakeRate,] +sf_inputs = [electronLowReco19SF,electronReco19SF,electronMoriond19SF, electronMoriond19GapSF,muonMoriond19SF,pileupSF] +#sf_inputs=[pileupSF] +selection = args['selection'].replace("LooseLeptons", "") \ + if args['output_selection'] == "" else args['output_selection'].split("_")[0] +if selection == "": + selection = "LooseLeptons" + print "Info: Using BasicZZSelections for hist defintions" +analysis = "/".join([args['analysis'], selection]) +hists = ConfigHistTools.getAllHistNames(manager_path, analysis) \ + if "all" in args['hist_names'] else args['hist_names'] + +hists = [h for h in hists if "unrolled" not in h and "wCR" not in h and h not in ["YieldByChannel", "CutFlow"]] +#print "hists: ", hists +hist_inputs = [getHistExpr(hists, analysis)] +#print "hist_inputs: ",hist_inputs +tselection = [ROOT.TNamed("selection", args['output_selection'])] +#print "tselection: ",tselection +if args['proof']: + ROOT.TProof.Open('workers=12') + +if "FakeRate" not in args['output_selection'] and not args['test']: + # background = SelectorTools.applySelector(["ZZ4l2018data"] + + # ConfigureJobs.getListOfEWK() + ["wz3lnu-powheg"] + + # ConfigureJobs.getListOfNonpromptFilenames(),channels, + # "WZBackgroundSelector", args['selection'], fOut, + # extra_inputs=sf_inputs+fr_inputs+hist_inputs+tselection, + # addSumweights=False, + # proof=args['proof']) + background = SelectorTools.applySelector([args['analysis']+"data"] + + ConfigureJobs.getListOfEWKFilenames()+ConfigureJobs.getListOfDYFilenames()+ConfigureJobs.getListOfNonpromptFilenames()+ConfigureJobs.getListOfHZZFilenames(),channels, + "ZZBackgroundSelector", args['selection'], fOut,args['analysis'], + extra_inputs=sf_inputs+fr_inputs+hist_inputs+tselection, + addSumweights=False, + proof=args['proof']) +mc = SelectorTools.applySelector(args['filenames'],channels, "ZZSelector", args['selection'], fOut,args['analysis'], + extra_inputs=sf_inputs+hist_inputs+tselection, + addSumweights=True, proof=args['proof']) +if args['test']: + exit(0) + +alldata = HistTools.makeCompositeHists(fOut,"AllData", + ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"], manager_path), args['lumi'], + underflow=False, overflow=False) +OutputTools.writeOutputListItem(alldata, fOut) +alldata.Delete() + +#nonpromptmc = HistTools.makeCompositeHists(fOut, "NonpromptMC", ConfigureJobs.getListOfFilesWithXSec( +# ConfigureJobs.getListOfNonpromptFilenames(), manager_path), args['lumi'], +# underflow=False, overflow=False) +#nonpromptmc.Delete() +# +#OutputTools.writeOutputListItem(nonpromptmc, fOut) + +#allggZZmc= HistTools.makeCompositeHists(fOut,"ggZZ", ConfigureJobs.getListOfFilesWithXSec( +# ConfigureJobs.getListOfggZZFilenames(), manager_path), args['lumi'], +# underflow=False, overflow=False) +#OutputTools.writeOutputListItem(allggZZmc, fOut) +#allggZZmc.Delete() +# +#allSignal= HistTools.makeCompositeHists(fOut,"HZZ-signal", ConfigureJobs.getListOfFilesWithXSec( +# ConfigureJobs.getListOfHZZFilenames(), manager_path), args['lumi'], +# underflow=False, overflow=False) +#OutputTools.writeOutputListItem(allSignal, fOut) +#allSignal.Delete() + +ewkmc = HistTools.makeCompositeHists(fOut,"AllEWK", ConfigureJobs.getListOfFilesWithXSec( + ConfigureJobs.getListOfEWK(), manager_path), args['lumi'], + underflow=False, overflow=False) +OutputTools.writeOutputListItem(ewkmc, fOut) +ewkmc.Delete() + +ewkcorr = HistTools.getDifference(fOut, "DataEWKCorrected", "AllData", "AllEWK") +OutputTools.writeOutputListItem(ewkcorr, fOut) +ewkcorr.Delete() diff --git a/runTest.sh b/runTest.sh index a6292de6..5f264810 100755 --- a/runTest.sh +++ b/runTest.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s SignalSync --output_file testSignal2016.root --test --uwvv -c eeee,eemm,mmee,mmmm -f 2016SignalSync +./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s SignalSync --output_file testSignal2018.root --test --uwvv -c eeee,eemm,mmee,mmmm -f 2018SignalSync diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh new file mode 100755 index 00000000..fb287864 --- /dev/null +++ b/runZZ4l2016.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 diff --git a/src/ZZSelector.cc b/src/ZZSelector.cc index db81f6df..4bb7622a 100644 --- a/src/ZZSelector.cc +++ b/src/ZZSelector.cc @@ -599,7 +599,7 @@ void ZZSelector::FillHistograms(Long64_t entry, std::pair Date: Tue, 27 Aug 2019 05:41:35 -0400 Subject: [PATCH 04/53] Make sure file is open before writing --- Utilities/scripts/makeHistFile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 54866da5..4f55a3fd 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -133,6 +133,8 @@ def makeHistFile(args): fOut.Close() sys.exit(0) + if not ROOT.gROOT.GetListOfFiles().FindObject(tmpFileName): + fOut = ROOT.TFile.Open(tmpFileName, "update") alldata = HistTools.makeCompositeHists(fOut,"AllData", ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"], manager_path), args['lumi'], underflow=False, overflow=False) From b036f9aea84ef0c4ff69e711fb770c8fc7a8b686 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Tue, 27 Aug 2019 07:36:26 -0400 Subject: [PATCH 05/53] Ok this works... --- Utilities/scripts/makeHistFile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 4f55a3fd..4da018a6 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -133,8 +133,8 @@ def makeHistFile(args): fOut.Close() sys.exit(0) - if not ROOT.gROOT.GetListOfFiles().FindObject(tmpFileName): - fOut = ROOT.TFile.Open(tmpFileName, "update") + fOut.Close() + fOut = ROOT.TFile.Open(tmpFileName, "update") alldata = HistTools.makeCompositeHists(fOut,"AllData", ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"], manager_path), args['lumi'], underflow=False, overflow=False) From 5ee02b9eff15f339c890e14ab6d275534c381eaa Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Wed, 28 Aug 2019 05:29:33 -0400 Subject: [PATCH 06/53] ZZ4l Full Run 2 up and running --- Utilities/python/ConfigureJobs.py | 2 +- Utilities/python/HistTools.py | 10 +++++----- Utilities/python/SelectorTools.py | 2 +- Utilities/scripts/makeHistFile.py | 15 ++++++++++----- runZZ4l2017.sh | 1 + runZZ4l2018.sh | 1 + 6 files changed, 19 insertions(+), 12 deletions(-) create mode 100755 runZZ4l2017.sh create mode 100755 runZZ4l2018.sh diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index a00cc5bc..e1499579 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -72,7 +72,7 @@ def getListOfEWKFilenames(analysis): "ggZZ4t", "ggZZ2e2mu", "ggZZ2e2tau", - "ggZZ2mu2tau", + #"ggZZ2mu2tau", ] else: return [ diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index 65d75cb8..bdcb7978 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -244,15 +244,15 @@ def addOverflowAndUnderflow(hist, underflow=True, overflow=True): def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False, overflow=True, rebin=None): composite = ROOT.TList() composite.SetName(name) - print "members for CompositeHists: ",members - print "hist_file:",hist_file + #print "members for CompositeHists: ",members + #print "hist_file:",hist_file for directory in [str(i) for i in members.keys()]: # For aQGC, the different plot groups should already be in their own files if "aqgc" in directory: directory = name - print "directory:",directory - print "directory:",type(directory) - if not hist_file.Get(str(directory)): + #print "directory:",directory + #print "directory:",type(directory) + if not hist_file.Get(directory): print "Skipping invalid filename %s" % directory continue if hists == []: diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 32c3e176..c594a860 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -160,7 +160,7 @@ def processDataset(self, dataset, file_path, chan): self.outfile = ROOT.TFile.Open(self.outfile_name) sumweights_hist = self.outfile.Get("%s/sumweights" % dataset) if not sumweights_hist: - sumweights_hist = ROOT.TH1D("sumweights", "sumweights", 100, 0, 100) + sumweights_hist = ROOT.TH1D("sumweights", "sumweights", 1000, 0, 1000) sumweights_hist.SetDirectory(ROOT.gROOT) self.processLocalFiles(select, file_path, addSumweights, chan) output_list = select.GetOutputList() diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 54866da5..57783f59 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -48,8 +48,12 @@ def makeHistFile(args): "ZZ4lRun2DatasetManager", "Utilities/python"])) today = datetime.date.today().strftime("%d%b%Y") - tmpFileName = "Hists%s-%s.root" % (today, args['output_file']) if args['selection'] == "SignalSync" \ - else "Hists%s-%s.root" % (today, args['analysis']) + + if args['test']: + tmpFileName = "Hists%s-%s.root" % (today, args['output_file']) + else: + tmpFileName = "Hists%s-%s.root" % (today, args['output_file']) if args['selection'] == "SignalSync" \ + else "Hists%s-%s.root" % (today, args['analysis']) fOut = ROOT.TFile(tmpFileName, "recreate") addScaleFacs = False @@ -132,11 +136,13 @@ def makeHistFile(args): if args['test']: fOut.Close() sys.exit(0) - + + fOut.Close() + fOut = ROOT.TFile.Open(tmpFileName, "update") + alldata = HistTools.makeCompositeHists(fOut,"AllData", ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"], manager_path), args['lumi'], underflow=False, overflow=False) - print "alldata:", alldata OutputTools.writeOutputListItem(alldata, fOut) alldata.Delete() @@ -148,7 +154,6 @@ def makeHistFile(args): OutputTools.writeOutputListItem(nonpromptmc, fOut) - print "fOut: ",fOut ewkmc = HistTools.makeCompositeHists(fOut,"AllEWK", ConfigureJobs.getListOfFilesWithXSec( ConfigureJobs.getListOfEWKFilenames(args['analysis']), manager_path), args['lumi'], underflow=False, overflow=False) diff --git a/runZZ4l2017.sh b/runZZ4l2017.sh new file mode 100755 index 00000000..4b2d187d --- /dev/null +++ b/runZZ4l2017.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 diff --git a/runZZ4l2018.sh b/runZZ4l2018.sh new file mode 100755 index 00000000..25c83250 --- /dev/null +++ b/runZZ4l2018.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file zzPowheg2018 --test --uwvv -c eeee,eemm,mmee,mmmm -f zz4l-powheg From 5ad446113167d6155ae49c4e6df0d55c0a93875a Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Wed, 28 Aug 2019 10:25:37 -0400 Subject: [PATCH 07/53] Adding master version of selectorbase --- interface/SelectorBase.h | 13 +++++------ src/SelectorBase.cc | 50 ++++++++++++++++++---------------------- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index bf48d98a..93488d14 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -48,7 +48,6 @@ class SelectorBase : public TSelector { enum Selection { tightleptons, ZZGenFiducial, - ZZselection, Wselection, Zselection, Wselection_Full, FakeRateSelectionLoose, FakeRateSelectionTight, VBSselection_Loose, @@ -73,7 +72,6 @@ class SelectorBase : public TSelector { metUnclusteredEnergyUp, metUnclusteredEnergyDown, muonEfficiencyUp, muonEfficiencyDown, muonScaleUp, muonScaleDown, - electronRecoEffUp, electronRecoEffDown, electronEfficiencyUp, electronEfficiencyDown, electronScaleUp, electronScaleDown, pileupUp, pileupDown, @@ -93,9 +91,6 @@ class SelectorBase : public TSelector { {"ZZGenFiducial", ZZGenFiducial}, {"Wselection", Wselection}, {"Zselection", Zselection}, - {"ZZselection", ZZselection}, - {"SignalSync", ZZselection}, - {"LooseLeptons", ZZselection}, {"Wselection_Full", Wselection_Full}, {"FakeRateSelectionLoose", FakeRateSelectionLoose}, {"FakeRateSelectionTight", FakeRateSelectionTight}, @@ -191,9 +186,11 @@ class SelectorBase : public TSelector { std::map histMap1D_ = {}; //TODO change the name to map and don't break things std::map hists2D_ = {}; - std::map weighthists_ = {}; - std::map weighthists2D_ {}; + std::map weighthistMap1D_ = {}; + std::map weighthistMap2D_ {}; + std::vector hists1D_ = {}; + std::vector weighthists1D_ = {}; // The histograms for which you also want systematic variations std::vector systHists_ = {}; std::vector systHists2D_ = {}; @@ -224,6 +221,8 @@ class SelectorBase : public TSelector { std::vector ReadHistDataFromConfig(std::string histDataString); std::string getHistName(std::string histName, std::string variationName, std::string channel); std::string getHistName(std::string histName, std::string variationName); + template + void InitializeHistMap(std::vector& labels, std::map& histMap); // Filling Functions template diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index eb45d031..bb471879 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -71,17 +71,13 @@ void SelectorBase::Init(TTree *tree) } } - //std::cout<<"In SelectorBase"<(fOutput->FindObject(name_.c_str())); - if (channelMap_.find(channelName_) != channelMap_.end()){ + if (channelMap_.find(channelName_) != channelMap_.end()) channel_ = channelMap_[channelName_]; - //std::cout<<"In SelectorBase"<FindObject("histinfo"); - if (histInfo == nullptr ) - throw std::domain_error("Can't initialize histograms without passing histogram information to TSelector"); - - //std::cout<<"SelectorBase: Does it enter this function"< +void SelectorBase::InitializeHistMap(std::vector& labels, std::map& histMap) { + for (auto& label : labels) { if (channel_ != Inclusive) { auto histName = getHistName(label, "", channelName_); - histMap1D_[histName] = {}; - //std::cout<<"SelectorBase: Do Histos get initialized"<FindObject("histinfo"); + if (histInfo == nullptr ) + throw std::domain_error("Can't initialize histograms without passing histogram information to TSelector"); + + InitializeHistMap(hists1D_, histMap1D_); + InitializeHistMap(weighthists1D_, weighthistMap1D_); for (auto && entry : *histInfo) { TNamed* currentHistInfo = dynamic_cast(entry); @@ -248,17 +242,17 @@ void SelectorBase::InitializeHistogramFromConfig(std::string name, std::string c AddObject(histMap1D_[syst_histName], syst_histName.c_str(), histData[0].c_str(),nbins, xmin, xmax); // TODO: Cleaner way to determine if you want to store systematics for weighted entries - //if (isaQGC_ && doaQGC_ && (weighthists_.find(name) != weighthists_.end())) { + //if (isaQGC_ && doaQGC_ && (weighthistMap1D_.find(name) != weighthistMap1D_.end())) { // std::string weightsyst_histName = name+"_lheWeights_"+syst.second; - // AddObject(weighthists_[syst_histName], + // AddObject(weighthistMap1D_[syst_histName], // (weightsyst_histName+"_"+channel).c_str(), histData[0].c_str(), // nbins, xmin, xmax, 1000, 0, 1000); //} } } // Weight hists must be subset of 1D hists! - if (isMC_ && (weighthists_.find(histName) != weighthists_.end())) { - AddObject(weighthists_[histName], + if (isMC_ && (weighthistMap1D_.find(histName) != weighthistMap1D_.end())) { + AddObject(weighthistMap1D_[histName], (name+"_lheWeights_"+channel).c_str(), histData[0].c_str(), nbins, xmin, xmax, 1000, 0, 1000); } @@ -278,8 +272,8 @@ void SelectorBase::InitializeHistogramFromConfig(std::string name, std::string c } } // 3D weight hists must be subset of 2D hists! - if (isMC_ && (weighthists2D_.find(histName) != weighthists2D_.end())) { - AddObject(weighthists2D_[histName], + if (isMC_ && (weighthistMap2D_.find(histName) != weighthistMap2D_.end())) { + AddObject(weighthistMap2D_[histName], (name+"_lheWeights_"+channel).c_str(), histData[0].c_str(), nbins, xmin, xmax, nbinsy, ymin, ymax, 1000, 0, 1000); } From bc9fba95bee174ac3ce88d83b5565d60875fab3f Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Wed, 28 Aug 2019 10:47:28 -0400 Subject: [PATCH 08/53] Fix some missing things for ZZ --- interface/SelectorBase.h | 6 +++++- src/WZSelector.cc | 32 ++++++++++++++++---------------- src/ZZSelector.cc | 6 +++--- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index 93488d14..468ce516 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -48,6 +48,7 @@ class SelectorBase : public TSelector { enum Selection { tightleptons, ZZGenFiducial, + ZZselection, Wselection, Zselection, Wselection_Full, FakeRateSelectionLoose, FakeRateSelectionTight, VBSselection_Loose, @@ -72,6 +73,7 @@ class SelectorBase : public TSelector { metUnclusteredEnergyUp, metUnclusteredEnergyDown, muonEfficiencyUp, muonEfficiencyDown, muonScaleUp, muonScaleDown, + electronRecoEffUp, electronRecoEffDown, electronEfficiencyUp, electronEfficiencyDown, electronScaleUp, electronScaleDown, pileupUp, pileupDown, @@ -91,6 +93,9 @@ class SelectorBase : public TSelector { {"ZZGenFiducial", ZZGenFiducial}, {"Wselection", Wselection}, {"Zselection", Zselection}, + {"ZZselection", ZZselection}, + {"SignalSync", ZZselection}, + {"LooseLeptons", ZZselection}, {"Wselection_Full", Wselection_Full}, {"FakeRateSelectionLoose", FakeRateSelectionLoose}, {"FakeRateSelectionTight", FakeRateSelectionTight}, @@ -130,7 +135,6 @@ class SelectorBase : public TSelector { std::vector allChannels_ = {}; - std::vector hists1D_ = {}; std::map variations_ = {{Central, ""}}; std::map systematics_ = {}; diff --git a/src/WZSelector.cc b/src/WZSelector.cc index b782728f..4f8a71ce 100644 --- a/src/WZSelector.cc +++ b/src/WZSelector.cc @@ -602,24 +602,24 @@ void WZSelector::FillHistograms(Long64_t entry, std::pair Date: Wed, 28 Aug 2019 10:58:28 -0400 Subject: [PATCH 09/53] latest tmp branch --- Utilities/python/SelectorTools.py | 1 + Utilities/scripts/makeHistFile.py | 105 +++++++++++++++++++++--------- interface/ZZSelector.h | 1 - src/SelectorBase.cc | 5 ++ src/ZZSelector.cc | 44 ++++++++----- src/ZZSelectorBase.cc | 20 +++--- 6 files changed, 116 insertions(+), 60 deletions(-) diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index c594a860..c7d42ae9 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -146,6 +146,7 @@ def applySelector(self): def processDataset(self, dataset, file_path, chan): logging.info("Processing dataset %s" % dataset) + print "Processing dataset: ", dataset select = getattr(ROOT, self.selector_name)() select.SetInputList(self.inputs) self.addTNamed("name", dataset) diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 57783f59..6e76dff6 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -28,6 +28,8 @@ def getComLineArgs(): default="", help="Selection stage of input files") parser.add_argument("--year", type=str, default="default", help="Year of Analysis") + parser.add_argument("--scalefactors_file", "-sf", type=str, + default="", help="ScaleFactors file name") parser.add_argument("-c", "--channels", type=lambda x : [i.strip() for i in x.split(',')], default=["eee","eem","emm","mmm"], help="List of channels" @@ -59,40 +61,81 @@ def makeHistFile(args): addScaleFacs = False if args['analysis'] == "WZxsec2016" or args['analysis'] == 'Zstudy_2016': addScaleFacs = True - addScaleFacs=False + + if "ZZ4l" in args['scalefactors_file']: + addScaleFacs=True + else: + addScaleFacs = False + sf_inputs = [ROOT.TParameter(bool)("applyScaleFacs", False)] if addScaleFacs: - fScales = ROOT.TFile('data/scaleFactors.root') - mCBTightFakeRate = fScales.Get("mCBTightFakeRate") - eCBTightFakeRate = fScales.Get("eCBTightFakeRate") - useSvenjasFRs = False - useJakobsFRs = False - if useSvenjasFRs: - mCBTightFakeRate = fScales.Get("mCBTightFakeRate_Svenja") - eCBTightFakeRate = fScales.Get("eCBTightFakeRate_Svenja") - elif useJakobsFRs: - mCBTightFakeRate = fScales.Get("mCBTightFakeRate_Jakob") - eCBTightFakeRate = fScales.Get("eCBTightFakeRate_Jakob") - # For medium muons - #mCBMedFakeRate.SetName("fakeRate_allMu") - if mCBTightFakeRate: - mCBTightFakeRate.SetName("fakeRate_allMu") - if eCBTightFakeRate: - eCBTightFakeRate.SetName("fakeRate_allE") - - muonIsoSF = fScales.Get('muonIsoSF') - muonIdSF = fScales.Get('muonTightIdSF') - electronTightIdSF = fScales.Get('electronTightIdSF') - electronGsfSF = fScales.Get('electronGsfSF') - pileupSF = fScales.Get('pileupSF') - - #fPrefireEfficiency = ROOT.TFile('data/Map_Jet_L1FinOReff_bxm1_looseJet_JetHT_Run2016B-H.root') - fPrefireEfficiency = ROOT.TFile('data/Map_Jet_L1FinOReff_bxm1_looseJet_SingleMuon_Run2016B-H.root') - prefireEff = fPrefireEfficiency.Get('prefireEfficiencyMap') - - fr_inputs = [eCBTightFakeRate, mCBTightFakeRate,] - sf_inputs = [electronTightIdSF, electronGsfSF, muonIsoSF, muonIdSF, pileupSF, prefireEff] + fScales = ROOT.TFile(args['scalefactors_file']) + if "ZZ4l" in args['analysis']: + mZZTightFakeRate = fScales.Get("mZZTightFakeRate") + eZZTightFakeRate = fScales.Get("eZZTightFakeRate") + if mZZTightFakeRate: + mZZTightFakeRate.SetName("fakeRate_allMu") + if eZZTightFakeRate: + eZZTightFakeRate.SetName("fakeRate_allE") + if "2018" in args['scalefactors_file']: + muonMoriondSF= fScales.Get('muonMoriond19SF') + muonMoriondSF.SetName("muonMoriondSF") + electronLowRecoSF = fScales.Get('electronLowReco19SF') + electronLowRecoSF.SetName("electronLowRecoSF") + electronRecoSF = fScales.Get('electronReco19SF') + electronRecoSF.SetName("electronRecoSF") + electronMoriondSF = fScales.Get('electronMoriond19SF') + electronMoriondSF.SetName("electronMoriondSF") + electronMoriondGapSF = fScales.Get('electronMoriond19GapSF') + electronMoriondGapSF.SetName("electronMoriondGapSF") + else: + muonMoriondSF= fScales.Get('muonMoriond18SF') + muonMoriondSF.SetName("muonMoriondSF") + electronLowRecoSF = fScales.Get('electronLowReco18SF') + electronLowRecoSF.SetName("electronLowRecoSF") + electronRecoSF = fScales.Get('electronReco18SF') + electronRecoSF.SetName("electronRecoSF") + electronMoriondSF = fScales.Get('electronMoriond18SF') + electronMoriondSF.SetName("electronMoriondSF") + electronMoriondGapSF = fScales.Get('electronMoriond18GapSF') + electronMoriondGapSF.SetName("electronMoriondGapSF") + pileupSF = fScales.Get('pileupSF') + + fr_inputs = [eZZTightFakeRate, mZZTightFakeRate,] + sf_inputs = [electronLowRecoSF,electronRecoSF,electronMoriondSF, electronMoriondGapSF,muonMoriondSF,pileupSF] + else: + fScales = ROOT.TFile('data/scaleFactors.root') + mCBTightFakeRate = fScales.Get("mCBTightFakeRate") + eCBTightFakeRate = fScales.Get("eCBTightFakeRate") + useSvenjasFRs = False + useJakobsFRs = False + if useSvenjasFRs: + mCBTightFakeRate = fScales.Get("mCBTightFakeRate_Svenja") + eCBTightFakeRate = fScales.Get("eCBTightFakeRate_Svenja") + elif useJakobsFRs: + mCBTightFakeRate = fScales.Get("mCBTightFakeRate_Jakob") + eCBTightFakeRate = fScales.Get("eCBTightFakeRate_Jakob") + # For medium muons + #mCBMedFakeRate.SetName("fakeRate_allMu") + if mCBTightFakeRate: + mCBTightFakeRate.SetName("fakeRate_allMu") + if eCBTightFakeRate: + eCBTightFakeRate.SetName("fakeRate_allE") + + muonIsoSF = fScales.Get('muonIsoSF') + muonIdSF = fScales.Get('muonTightIdSF') + electronTightIdSF = fScales.Get('electronTightIdSF') + electronGsfSF = fScales.Get('electronGsfSF') + pileupSF = fScales.Get('pileupSF') + + #fPrefireEfficiency = ROOT.TFile('data/Map_Jet_L1FinOReff_bxm1_looseJet_JetHT_Run2016B-H.root') + fPrefireEfficiency = ROOT.TFile('data/Map_Jet_L1FinOReff_bxm1_looseJet_SingleMuon_Run2016B-H.root') + prefireEff = fPrefireEfficiency.Get('prefireEfficiencyMap') + + fr_inputs = [eCBTightFakeRate, mCBTightFakeRate,] + sf_inputs = [electronTightIdSF, electronGsfSF, muonIsoSF, muonIdSF, pileupSF, prefireEff] + sf_inputs.append(ROOT.TParameter(bool)("applyScaleFacs", True)) if args['input_tier'] == '': diff --git a/interface/ZZSelector.h b/interface/ZZSelector.h index 76d7b249..f7740d0d 100644 --- a/interface/ZZSelector.h +++ b/interface/ZZSelector.h @@ -7,7 +7,6 @@ class ZZSelector : public ZZSelectorBase { public : - bool doSystematics_ = false; bool applyFullSelection_ = true; bool isaTGC_ = false; bool doaTGC_ = false; diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index eb45d031..a7ae6141 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -241,8 +241,13 @@ void SelectorBase::InitializeHistogramFromConfig(std::string name, std::string c if (histData.size() == 4) { AddObject(histMap1D_[histName], histName.c_str(), histData[0].c_str(),nbins, xmin, xmax); + std::cout<<"doSystematics: "<(histMap1D_[syst_histName], syst_histName.c_str(), diff --git a/src/ZZSelector.cc b/src/ZZSelector.cc index 4bb7622a..9660c6dc 100644 --- a/src/ZZSelector.cc +++ b/src/ZZSelector.cc @@ -11,28 +11,29 @@ void ZZSelector::Init(TTree *tree) systematics_ = { {electronRecoEffUp,"CMS_RecoEff_eUp"}, {electronRecoEffDown,"CMS_RecoEff_eDown"}, - {electronEfficiencyUp, "CMS_eff_eUp"}, - {electronEfficiencyDown, "CMS_eff_eDown"}, - {muonEfficiencyUp, "CMS_eff_mUp"}, - {muonEfficiencyDown, "CMS_eff_mDown"}, - {pileupUp, "CMS_pileupUp"}, - {pileupDown, "CMS_pileupDown"}, - }; + //{electronEfficiencyUp, "CMS_eff_eUp"}, + //{electronEfficiencyDown, "CMS_eff_eDown"}, + //{muonEfficiencyUp, "CMS_eff_mUp"}, + //{muonEfficiencyDown, "CMS_eff_mDown"}, + //{pileupUp, "CMS_pileupUp"}, + //{pileupDown, "CMS_pileupDown"}, + }; + doSystematics_ = true; systHists_ = { "yield", "Mass", - "ZMass", + //"ZMass", "ZZPt", - "Z1Pt", - "Z2Pt" + //"Z1Pt", + //"Z2Pt" "ZPt", - "LepPt", - "Z1lep1_Pt", - "Z1lep2_Pt", - "Z2lep1_Pt", - "Z2lep2_Pt", - "nTruePU", + //"LepPt", + //"Z1lep1_Pt", + //"Z1lep2_Pt", + //"Z2lep1_Pt", + //"Z2lep2_Pt", + //"nTruePU", }; hists1D_ = { "yield", "backgroundControlYield","nTruePU","nvtx","ZMass","Z1Mass","Z2Mass","ZZPt", @@ -59,7 +60,7 @@ void ZZSelector::SetBranchesUWVV() { unsigned int ZZSelector::GetLheWeightInfo() { std::vector noLheWeights = { - "ggZZ2e2mu", "ggZZ4e", "ggZZ4m", "ggZZ4t", "ggZZ2e2tau","ggZZ2mu2tau" + "ggZZ2e2mu", "ggZZ4e", "ggZZ4m", "ggZZ4t", "ggZZ2e2tau","ggZZ2mu2tau","zz4l-sherpa","ZZJJTo2e2mu-EWK-phantom","ZZJJTo4e-EWK-phantom","ZZJJTo4mu-EWK-phantom" }; std::vector scaleAndPdfWeights = { "wz3lnu-powheg", "wz3lnu-mg5amcnlo", @@ -73,7 +74,7 @@ unsigned int ZZSelector::GetLheWeightInfo() { //"wz-atgc_pt300" }; - if (std::find(noLheWeights.begin(), noLheWeights.end(), name_) != noLheWeights.end()) + if ((std::find(noLheWeights.begin(), noLheWeights.end(), name_) != noLheWeights.end()) || (isaTGC_)) return 0; if (std::find(scaleAndPdfWeights.begin(), scaleAndPdfWeights.end(), name_) != scaleAndPdfWeights.end()) return 2; @@ -379,7 +380,10 @@ void ZZSelector::ShiftEfficiencies(Systematic variation) { float pt_e2 = l2Pt < EleSF_MAX_PT_ ? l2Pt : EleSF_MAX_PT_ - 0.01; float pt_e3 = l3Pt < EleSF_MAX_PT_ ? l3Pt : EleSF_MAX_PT_ - 0.01; float pt_e4 = l4Pt < EleSF_MAX_PT_ ? l4Pt : EleSF_MAX_PT_ - 0.01; + //std::cout<Evaluate2D(std::abs(l1Eta), l1Pt,shift)/eLowRecoSF_->Evaluate2D(std::abs(l1Eta), l1Pt); @@ -406,8 +410,10 @@ void ZZSelector::ShiftEfficiencies(Systematic variation) { weight *= eRecoSF_->Evaluate2D(std::abs(l4Eta), pt_e4,shift)/eRecoSF_->Evaluate2D(std::abs(l4Eta), pt_e4); } } + } //Applying Electron ID SFs Up/Down for ElectronIDEffSyst else if (variation == electronEfficiencyUp || variation == electronEfficiencyDown) { + if (eIdSF_ != nullptr and eGapIdSF_ != nullptr ) { if(l1IsGap){ weight *= eGapIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1, shift)/eGapIdSF_->Evaluate2D(std::abs(l1Eta), pt_e1); } @@ -433,6 +439,7 @@ void ZZSelector::ShiftEfficiencies(Systematic variation) { weight *= eIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4, shift)/eIdSF_->Evaluate2D(std::abs(l4Eta), pt_e4); } } + } }//channel eeee else if (channel_ == eemm) { //In order to get around the Overflow issue, set the Pt, not ideal. @@ -609,6 +616,7 @@ void ZZSelector::FillHistograms(Long64_t entry, std::pairFindObject("pileupSF"); if (pileupSF_ == nullptr ) std::invalid_argument("Must pass pileup weights SF"); - eLowRecoSF_ = (ScaleFactor *) GetInputList()->FindObject("electronLowReco19SF"); + eLowRecoSF_ = (ScaleFactor *) GetInputList()->FindObject("electronLowRecoSF"); if (eLowRecoSF_ == nullptr ) - std::invalid_argument("Must pass electron LowReco18 SF"); - eRecoSF_ = (ScaleFactor *) GetInputList()->FindObject("electronReco19SF"); + std::invalid_argument("Must pass electron LowReco SF"); + eRecoSF_ = (ScaleFactor *) GetInputList()->FindObject("electronRecoSF"); if (eRecoSF_ == nullptr ) - std::invalid_argument("Must pass electron Reco18 SF"); - eIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronMoriond19SF"); + std::invalid_argument("Must pass electron Reco SF"); + eIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronMoriondSF"); if (eIdSF_ == nullptr ) - std::invalid_argument("Must pass electron Moriond19 SF"); - eGapIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronMoriond19GapSF"); + std::invalid_argument("Must pass electron Moriond SF"); + eGapIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronMoriondGapSF"); if (eGapIdSF_ == nullptr ) - std::invalid_argument("Must pass electronGap Moriond19 SF"); - mIdSF_ = (ScaleFactor *) GetInputList()->FindObject("muonMoriond19SF"); + std::invalid_argument("Must pass electronGap Moriond SF"); + mIdSF_ = (ScaleFactor *) GetInputList()->FindObject("muonMoriondSF"); if (mIdSF_ == nullptr ) - std::invalid_argument("Must pass muon Moriond19 SF"); + std::invalid_argument("Must pass muon Moriond SF"); //There are L1Prefiring weight and uncertainity in the ZZ UWVV ntuples //prefireEff_ = (TEfficiency*) GetInputList()->FindObject("prefireEfficiencyMap"); From ba6b5ffdfe8578183f0412c5aebb005aca4cd69a Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Wed, 28 Aug 2019 10:59:12 -0400 Subject: [PATCH 10/53] Add syst hists to 1D map --- src/SelectorBase.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index bb471879..4c2c421f 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -194,7 +194,9 @@ void SelectorBase::InitializeHistogramsFromConfig() { if (histInfo == nullptr ) throw std::domain_error("Can't initialize histograms without passing histogram information to TSelector"); - InitializeHistMap(hists1D_, histMap1D_); + std::vector allhists1D = hists1D_; + allhists1D.insert(allhists1D.end(), systHists_.begin(), systHists_.end()); + InitializeHistMap(allhists1D, histMap1D_); InitializeHistMap(weighthists1D_, weighthistMap1D_); for (auto && entry : *histInfo) { From 4534c7b24395b1f0d6ea0f35b2af8fcacc798f62 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Wed, 28 Aug 2019 13:11:46 -0400 Subject: [PATCH 11/53] ZZBackground Selector not working --- Utilities/python/SelectorTools.py | 8 ++ Utilities/scripts/makeHistFile.py | 29 ++++-- interface/ZZSelector.h | 5 + runZZ4l2016.sh | 2 +- src/SelectorBase.cc | 12 +-- src/ZZBackgroundSelector.cc | 4 +- src/ZZSelector.cc | 161 +++++++++++++++++++----------- src/ZZSelectorBase.cc | 1 + 8 files changed, 142 insertions(+), 80 deletions(-) diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index c7d42ae9..cecfeb8a 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -24,6 +24,9 @@ def __init__(self, analysis, selection, input_tier, year): "ZZ4l2016" : "ZZSelector", "ZZ4l2017" : "ZZSelector", "ZZ4l2018" : "ZZSelector", + "ZZ4l2016Bkg" : "ZZBackgroundSelector", + "ZZ4l2017Bkg" : "ZZBackgroundSelector", + "ZZ4l2018Bkg" : "ZZBackgroundSelector", "WGen" : "WGenSelector", "ZGen" : "ZGenSelector", "ThreeLep" : "ThreeLepSelector", @@ -88,6 +91,9 @@ def setNtupeType(self, ntupleType): def setNumCores(self, numCores): self.numCores = numCores + def setSumWeights(self, addSumweights): + self.addSumweights = addSumweights + def setFileList(self, list_of_files, nPerJob, jobNum): if not os.path.isfile(list_of_files): raise ValueError("%s is not a valid file." % list_of_files) @@ -123,6 +129,8 @@ def setDatasets(self, datalist): if "@" in dataset: dataset, file_path = [f.strip() for f in dataset.split("@")] else: + if "Bkg" in self.analysis: + self.analysis=self.analysis[:-3] try: file_path = ConfigureJobs.getInputFilesPath(dataset, self.input_tier, self.analysis) diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index bc4dcbfa..2f981477 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -148,17 +148,24 @@ def makeHistFile(args): analysis = "/".join([args['analysis'], selection]) hists, hist_inputs = UserInput.getHistInfo(analysis, args['hist_names'], args['noHistConfig']) - #if "WZxsec2016" in analysis and "FakeRate" not in args['output_selection'] and not args['test']: - # background = SelectorTools.applySelector(["WZxsec2016data"] + - # ConfigureJobs.getListOfEWKFilenames() + ["wz3lnu-powheg"] + - # ConfigureJobs.getListOfNonpromptFilenames(), - # "WZBackgroundSelector", args['selection'], fOut, - # extra_inputs=sf_inputs+fr_inputs+hist_inputs+tselection, - # channels=channels, - # addSumweights=False, - # nanoAOD=nanoAOD, - # parallel=args['parallel'], - # ) + if not args['test']: + + bkgselector = SelectorTools.SelectorDriver(args['analysis']+"Bkg", args['selection'], args['input_tier'], args['year']) + bkgselector.setOutputfile(fOut.GetName()) + bkgselector.setInputs(sf_inputs+fr_inputs+hist_inputs) + bkgselector.setSumWeights(False) + bkgselector.setNtupeType("UWVV" if args['uwvv'] else "NanoAOD") + if args['uwvv']: + logging.debug("Processing channels " % args['channels']) + bkgselector.setChannels(args['channels']) + bkgselector.setNumCores(args['numCores']) + + if args['filenames']: + bkgselector.setDatasets(args['filenames']) + else: + bkgselector.setFileList(*args['inputs_from_file']) + + background = bkgselector.applySelector() selector = SelectorTools.SelectorDriver(args['analysis'], args['selection'], args['input_tier'], args['year']) selector.setOutputfile(fOut.GetName()) diff --git a/interface/ZZSelector.h b/interface/ZZSelector.h index f7740d0d..9e922ad9 100644 --- a/interface/ZZSelector.h +++ b/interface/ZZSelector.h @@ -32,6 +32,7 @@ public : float zep3l_jesDown; float zep3l_jerUp; float zep3l_jerDown; + Float_t mjj; std::vector* jetEta = NULL; std::vector* jetEta_jesUp = NULL; std::vector* jetEta_jesDown = NULL; @@ -55,6 +56,9 @@ public : TBranch* b_nvtx; TBranch* b_Mass; TBranch* b_Pt; + TBranch* b_jetPt; + TBranch* b_jetEta; + TBranch* b_mjj; int cen_count = 0; float count = 0; @@ -70,6 +74,7 @@ public : void FillHistograms(Long64_t entry, std::pair variation) override; void ApplyScaleFactors(); bool PassesZZSelection(); + bool PassesZZjjSelection(); bool PassesHZZSelection(); unsigned int GetLheWeightInfo(); void SetVariables(Long64_t entry); diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index fb287864..5c0df6fa 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -sf data/scaleFactorsZZ4l2017.root -j 12 diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index d63c2e0f..4a1d288a 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -235,13 +235,13 @@ void SelectorBase::InitializeHistogramFromConfig(std::string name, std::string c if (histData.size() == 4) { AddObject(histMap1D_[histName], histName.c_str(), histData[0].c_str(),nbins, xmin, xmax); - std::cout<<"doSystematics: "<(histMap1D_[syst_histName], syst_histName.c_str(), diff --git a/src/ZZBackgroundSelector.cc b/src/ZZBackgroundSelector.cc index 7b3642d8..aad4392d 100644 --- a/src/ZZBackgroundSelector.cc +++ b/src/ZZBackgroundSelector.cc @@ -26,10 +26,10 @@ void ZZBackgroundSelector::SetupNewDirectory() // Insure that hist ranges are exactly the same as ZZSelector, just change name for (const auto && obj : *currentHistDir_) { std::string name = obj->GetName(); - //std::cout<<"histname: " <(obj); named->SetName(name.insert(name.length()-4, "Fakes_").c_str()); - //std::cout<<"histname in BkgSelector: " <(Z1MassHistPPPF_, ("Z1Mass_PPPF_"+channelName_).c_str(), "Z1Mass; m_{Z_{1}} [GeV]; Events;", 60, 0, 120); AddObject(Z1MassHistPPFF_, ("Z1Mass_PPFF_"+channelName_).c_str(), "Z1Mass; m_{Z_{1}} [GeV]; Events;", 60, 0, 120); diff --git a/src/ZZSelector.cc b/src/ZZSelector.cc index 18eae2de..3075dbf0 100644 --- a/src/ZZSelector.cc +++ b/src/ZZSelector.cc @@ -11,36 +11,42 @@ void ZZSelector::Init(TTree *tree) systematics_ = { {electronRecoEffUp,"CMS_RecoEff_eUp"}, {electronRecoEffDown,"CMS_RecoEff_eDown"}, - //{electronEfficiencyUp, "CMS_eff_eUp"}, - //{electronEfficiencyDown, "CMS_eff_eDown"}, - //{muonEfficiencyUp, "CMS_eff_mUp"}, - //{muonEfficiencyDown, "CMS_eff_mDown"}, + {electronEfficiencyUp, "CMS_eff_eUp"}, + {electronEfficiencyDown, "CMS_eff_eDown"}, + {muonEfficiencyUp, "CMS_eff_mUp"}, + {muonEfficiencyDown, "CMS_eff_mDown"}, //{pileupUp, "CMS_pileupUp"}, //{pileupDown, "CMS_pileupDown"}, }; - doSystematics_ = true; + doSystematics_ = false; systHists_ = { "yield", "Mass", - //"ZMass", + "ZMass", "ZZPt", //"Z1Pt", //"Z2Pt" "ZPt", - //"LepPt", + "LepPt", + "LepEta" //"Z1lep1_Pt", //"Z1lep2_Pt", //"Z2lep1_Pt", //"Z2lep2_Pt", //"nTruePU", }; + //hists1D_ = { + // "yield", "backgroundControlYield","nTruePU","nvtx","ZMass","Z1Mass","Z2Mass","ZZPt", + // "Z1Pt","Z2Pt","Z1Phi","Z2Phi","dPhiZ1Z2","ZPt","LepPt","LepEta","Lep12Pt","Lep12Eta", + // "Lep34Pt","Lep34Eta","Z1lep1_Eta","Z1lep1_Phi","Z1lep1_Pt","Z1lep1_PdgId","Z1lep2_Eta", + // "Z1lep2_Phi","Z1lep2_Pt","Z1lep2_PdgId","Z2lep1_Eta","Z2lep1_Phi","Z2lep1_Pt","Z2lep1_PdgId", + // "Z2lep2_Eta","Z2lep2_Phi","Z2lep2_Pt","Z2lep2_PdgId","Mass","nJets", + //}; + hists1D_ = { - "yield", "backgroundControlYield","nTruePU","nvtx","ZMass","Z1Mass","Z2Mass","ZZPt", - "Z1Pt","Z2Pt","Z1Phi","Z2Phi","dPhiZ1Z2","ZPt","LepPt","LepEta","Lep12Pt","Lep12Eta", - "Lep34Pt","Lep34Eta","Z1lep1_Eta","Z1lep1_Phi","Z1lep1_Pt","Z1lep1_PdgId","Z1lep2_Eta", - "Z1lep2_Phi","Z1lep2_Pt","Z1lep2_PdgId","Z2lep1_Eta","Z2lep1_Phi","Z2lep1_Pt","Z2lep1_PdgId", - "Z2lep2_Eta","Z2lep2_Phi","Z2lep2_Pt","Z2lep2_PdgId","Mass","nJets", + "yield", "ZMass","ZZPt","dPhiZ1Z2","ZPt","LepPt","LepEta", + "Mass","nJets","jetPt[0]","jetPt[1]","jetEta[0]","jetEta[1]","mjj","dEtajj" }; ZZSelectorBase::Init(tree); @@ -56,6 +62,9 @@ void ZZSelector::SetBranchesUWVV() { } fChain->SetBranchAddress("Mass", &Mass, &b_Mass); fChain->SetBranchAddress("Pt", &Pt, &b_Pt); + fChain->SetBranchAddress("jetPt", &jetPt, &b_jetPt); + fChain->SetBranchAddress("jetEta", &jetEta, &b_jetEta); + fChain->SetBranchAddress("mjj", &mjj, &b_mjj); } unsigned int ZZSelector::GetLheWeightInfo() { @@ -92,6 +101,9 @@ void ZZSelector::LoadBranchesUWVV(Long64_t entry, std::pairGetEntry(entry); b_Mass->GetEntry(entry); b_Pt->GetEntry(entry); + b_jetPt->GetEntry(entry); + b_jetEta->GetEntry(entry); + b_mjj->GetEntry(entry); //std::cout<<"channel in LoadBranches function: "<* jEta) { + if (jEta->size() < 2) + return -1.; + double etaDiff = jEta->at(0) - jEta->at(1); + return std::abs(etaDiff); + }; + dEtajj = deltaEtajj(jetEta); dPhiZZ = deltaPhiZZ(Z1Phi,Z2Phi); } @@ -537,6 +556,13 @@ void ZZSelector::ShiftEfficiencies(Systematic variation) { weight *= mIdSF_->Evaluate2D(std::abs(l4Eta), pt_m4, shift)/mIdSF_->Evaluate2D(std::abs(l4Eta), pt_m4); } } + +bool ZZSelector::PassesZZjjSelection() { + if ((jetPt->size() != jetEta->size() || jetPt->size() < 2) || (mjj < 100)) + return false; + else + return true; +} bool ZZSelector::PassesZZSelection(){ if (ZZSelection() && TightZZLeptons()) return true; @@ -621,6 +647,11 @@ void ZZSelector::FillHistograms(Long64_t entry, std::pairsize(), weight); + if (jetPt->size() > 0 && jetPt->size() == jetEta->size()) { + SafeHistFill(histMap1D_, getHistName("jetPt[0]", variation.second), jetPt->at(0), weight); + SafeHistFill(histMap1D_, getHistName("jetEta[0]", variation.second), jetEta->at(0), weight); + } + if (jetPt->size() > 1 && jetPt->size() == jetEta->size()) { + SafeHistFill(histMap1D_, getHistName("jetPt[1]", variation.second), jetPt->at(1), weight); + SafeHistFill(histMap1D_, getHistName("jetEta[1]", variation.second), jetEta->at(1), weight); + } + if (!PassesZZjjSelection()){ + return; + } + SafeHistFill(histMap1D_, getHistName("mjj", variation.second), mjj, weight); + SafeHistFill(histMap1D_, getHistName("dEtajj", variation.second), dEtajj, weight); // Summing 12,34 leptons - SafeHistFill(histMap1D_, getHistName("Lep12Pt", variation.second), l1Pt, weight); - SafeHistFill(histMap1D_, getHistName("Lep12Pt", variation.second), l2Pt, weight); - SafeHistFill(histMap1D_, getHistName("Lep34Pt", variation.second), l3Pt, weight); - SafeHistFill(histMap1D_, getHistName("Lep34Pt", variation.second), l4Pt, weight); - SafeHistFill(histMap1D_, getHistName("Lep12Eta", variation.second), l1Eta, weight); - SafeHistFill(histMap1D_, getHistName("Lep12Eta", variation.second), l2Eta, weight); - SafeHistFill(histMap1D_, getHistName("Le34Eta", variation.second), l3Eta, weight); - SafeHistFill(histMap1D_, getHistName("Lep34Eta", variation.second), l4Eta, weight); - SafeHistFill(histMap1D_, getHistName("Z1Mass", variation.second), Z1mass, weight); - SafeHistFill(histMap1D_, getHistName("Z2Mass", variation.second), Z2mass, weight); - SafeHistFill(histMap1D_, getHistName("ZPt", variation.second), Z1pt, weight); - SafeHistFill(histMap1D_, getHistName("ZPt", variation.second), Z2pt, weight); - SafeHistFill(histMap1D_, getHistName("Z1Pt", variation.second), Z1pt, weight); - SafeHistFill(histMap1D_, getHistName("Z2Pt", variation.second), Z2pt, weight); - SafeHistFill(histMap1D_, getHistName("Z1Phi", variation.second), Z1Phi, weight); - SafeHistFill(histMap1D_, getHistName("Z2Phi", variation.second), Z2Phi, weight); - SafeHistFill(histMap1D_, getHistName("dPhiZ1Z2", variation.second), dPhiZZ, weight); - SafeHistFill(histMap1D_, getHistName("ZZPt", variation.second), Pt, weight); - SafeHistFill(histMap1D_, getHistName("Z1lep1_Pt", variation.second), l1Pt, weight); - SafeHistFill(histMap1D_, getHistName("Z1lep1_Eta", variation.second), l1Eta, weight); - SafeHistFill(histMap1D_, getHistName("Z1lep1_Phi", variation.second), l1Phi, weight); - SafeHistFill(histMap1D_, getHistName("Z1lep1_PdgId", variation.second), l1PdgId, weight); - SafeHistFill(histMap1D_, getHistName("Z1lep2_Pt", variation.second), l2Pt, weight); - SafeHistFill(histMap1D_, getHistName("Z1lep2_Eta", variation.second), l2Eta, weight); - SafeHistFill(histMap1D_, getHistName("Z1lep2_Phi", variation.second), l2Phi, weight); - SafeHistFill(histMap1D_, getHistName("Z1lep2_PdgId", variation.second), l2PdgId, weight); - SafeHistFill(histMap1D_, getHistName("Z2lep1_Pt", variation.second), l3Pt, weight); - SafeHistFill(histMap1D_, getHistName("Z2lep1_Eta", variation.second), l3Eta, weight); - SafeHistFill(histMap1D_, getHistName("Z2lep1_Phi", variation.second), l3Phi, weight); - SafeHistFill(histMap1D_, getHistName("Z2lep1_PdgId", variation.second), l3PdgId, weight); - SafeHistFill(histMap1D_, getHistName("Z2lep2_Pt", variation.second), l4Pt, weight); - SafeHistFill(histMap1D_, getHistName("Z2lep2_Eta", variation.second), l4Eta, weight); - SafeHistFill(histMap1D_, getHistName("Z2lep2_Phi", variation.second), l4Phi, weight); - SafeHistFill(histMap1D_, getHistName("Z2lep2_PdgId", variation.second), l4PdgId, weight); - SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Pt",variation.second),l1Pt,l2Pt,weight); - SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Eta",variation.second),l1Eta,l2Eta,weight); - SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Phi",variation.second),l1Phi,l2Phi,weight); - SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Pt",variation.second),l3Pt,l4Pt,weight); - SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Eta",variation.second),l3Eta,l4Eta,weight); - SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Phi",variation.second),l3Phi,l4Phi,weight); - //2D Z1 vs Z2 - SafeHistFill(hists2D_, getHistName("Z1Mass_Z2Mass",variation.second),Z1mass,Z2mass,weight); + //SafeHistFill(histMap1D_, getHistName("Lep12Pt", variation.second), l1Pt, weight); + //SafeHistFill(histMap1D_, getHistName("Lep12Pt", variation.second), l2Pt, weight); + //SafeHistFill(histMap1D_, getHistName("Lep34Pt", variation.second), l3Pt, weight); + //SafeHistFill(histMap1D_, getHistName("Lep34Pt", variation.second), l4Pt, weight); + //SafeHistFill(histMap1D_, getHistName("Lep12Eta", variation.second), l1Eta, weight); + //SafeHistFill(histMap1D_, getHistName("Lep12Eta", variation.second), l2Eta, weight); + //SafeHistFill(histMap1D_, getHistName("Le34Eta", variation.second), l3Eta, weight); + //SafeHistFill(histMap1D_, getHistName("Lep34Eta", variation.second), l4Eta, weight); + //SafeHistFill(histMap1D_, getHistName("Z1Mass", variation.second), Z1mass, weight); + //SafeHistFill(histMap1D_, getHistName("Z2Mass", variation.second), Z2mass, weight); + //SafeHistFill(histMap1D_, getHistName("Z1Pt", variation.second), Z1pt, weight); + //SafeHistFill(histMap1D_, getHistName("Z2Pt", variation.second), Z2pt, weight); + //SafeHistFill(histMap1D_, getHistName("Z1Phi", variation.second), Z1Phi, weight); + //SafeHistFill(histMap1D_, getHistName("Z2Phi", variation.second), Z2Phi, weight); + //SafeHistFill(histMap1D_, getHistName("Z1lep1_Pt", variation.second), l1Pt, weight); + //SafeHistFill(histMap1D_, getHistName("Z1lep1_Eta", variation.second), l1Eta, weight); + //SafeHistFill(histMap1D_, getHistName("Z1lep1_Phi", variation.second), l1Phi, weight); + //SafeHistFill(histMap1D_, getHistName("Z1lep1_PdgId", variation.second), l1PdgId, weight); + //SafeHistFill(histMap1D_, getHistName("Z1lep2_Pt", variation.second), l2Pt, weight); + //SafeHistFill(histMap1D_, getHistName("Z1lep2_Eta", variation.second), l2Eta, weight); + //SafeHistFill(histMap1D_, getHistName("Z1lep2_Phi", variation.second), l2Phi, weight); + //SafeHistFill(histMap1D_, getHistName("Z1lep2_PdgId", variation.second), l2PdgId, weight); + //SafeHistFill(histMap1D_, getHistName("Z2lep1_Pt", variation.second), l3Pt, weight); + //SafeHistFill(histMap1D_, getHistName("Z2lep1_Eta", variation.second), l3Eta, weight); + //SafeHistFill(histMap1D_, getHistName("Z2lep1_Phi", variation.second), l3Phi, weight); + //SafeHistFill(histMap1D_, getHistName("Z2lep1_PdgId", variation.second), l3PdgId, weight); + //SafeHistFill(histMap1D_, getHistName("Z2lep2_Pt", variation.second), l4Pt, weight); + //SafeHistFill(histMap1D_, getHistName("Z2lep2_Eta", variation.second), l4Eta, weight); + //SafeHistFill(histMap1D_, getHistName("Z2lep2_Phi", variation.second), l4Phi, weight); + //SafeHistFill(histMap1D_, getHistName("Z2lep2_PdgId", variation.second), l4PdgId, weight); + //SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Pt",variation.second),l1Pt,l2Pt,weight); + //SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Eta",variation.second),l1Eta,l2Eta,weight); + //SafeHistFill(hists2D_, getHistName("Z1lep1_Z1lep2_Phi",variation.second),l1Phi,l2Phi,weight); + //SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Pt",variation.second),l3Pt,l4Pt,weight); + //SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Eta",variation.second),l3Eta,l4Eta,weight); + //SafeHistFill(hists2D_, getHistName("Z2lep1_Z2lep2_Phi",variation.second),l3Phi,l4Phi,weight); + ////2D Z1 vs Z2 + //SafeHistFill(hists2D_, getHistName("Z1Mass_Z2Mass",variation.second),Z1mass,Z2mass,weight); - if (histMap1D_[getHistName("nvtx", variation.second)] != nullptr) { - b_nvtx->GetEntry(entry); - histMap1D_[getHistName("nvtx", variation.second)]->Fill(nvtx, weight); - } - if (isMC_) - SafeHistFill(histMap1D_, getHistName("nTruePU", variation.second), nTruePU, weight); + //if (histMap1D_[getHistName("nvtx", variation.second)] != nullptr) { + // b_nvtx->GetEntry(entry); + // histMap1D_[getHistName("nvtx", variation.second)]->Fill(nvtx, weight); + //} + //if (isMC_) + // SafeHistFill(histMap1D_, getHistName("nTruePU", variation.second), nTruePU, weight); } diff --git a/src/ZZSelectorBase.cc b/src/ZZSelectorBase.cc index a007e3d7..e02e4c30 100644 --- a/src/ZZSelectorBase.cc +++ b/src/ZZSelectorBase.cc @@ -402,6 +402,7 @@ void ZZSelectorBase::SetBranchesUWVV() { throw std::invalid_argument("Invalid channel choice in ZZSelectorBase!"); fChain->SetBranchAddress("type1_pfMETEt", &type1_pfMETEt, &b_type1_pfMETEt); + } void ZZSelectorBase::LoadBranchesNanoAOD(Long64_t entry, std::pair variation) { From ae7e69e6607ea4a229e7954da61a7fdec4c322f4 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Thu, 29 Aug 2019 08:48:12 -0400 Subject: [PATCH 12/53] Add option for background estimation --- Utilities/python/SelectorTools.py | 10 +++---- Utilities/scripts/makeHistFile.py | 45 ++++++++++++------------------- runZZ4l2016.sh | 2 +- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index cecfeb8a..4930488e 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -24,9 +24,6 @@ def __init__(self, analysis, selection, input_tier, year): "ZZ4l2016" : "ZZSelector", "ZZ4l2017" : "ZZSelector", "ZZ4l2018" : "ZZSelector", - "ZZ4l2016Bkg" : "ZZBackgroundSelector", - "ZZ4l2017Bkg" : "ZZBackgroundSelector", - "ZZ4l2018Bkg" : "ZZBackgroundSelector", "WGen" : "WGenSelector", "ZGen" : "ZGenSelector", "ThreeLep" : "ThreeLepSelector", @@ -59,11 +56,14 @@ def tempfileName(self, dataset): def setChannels(self, channels): self.channels = channels + def isBackground(self): + self.selector_name = self.selector_name.replace("Selector", "BackgroundSelector") + def setOutputfile(self, outfile_name): self.outfile_name = outfile_name self.outfile = ROOT.gROOT.FindObject(outfile_name) if not self.outfile: - self.outfile = ROOT.TFile.Open(outfile_name) + self.outfile = ROOT.TFile.Open(outfile_name, "recreate") self.current_file = self.outfile def addTNamed(self, name, title): @@ -222,7 +222,7 @@ def getTreeName(self, chan): def combineParallelFiles(self, tempfiles, chan): tempfiles = filter(os.path.isfile, tempfiles) outfile = self.outfile_name - if chan != "Inclusive": + if chan != "Inclusive" and len(self.channels) != 1: outfile = self.outfile_name.replace(".root", "_%s.root" % chan) rval = subprocess.call(["hadd", "-f", outfile] + tempfiles) if rval == 0: diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 2f981477..1764eea4 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -9,6 +9,7 @@ import logging import sys import datetime +import subprocess def getComLineArgs(): parser = UserInput.getDefaultParser() @@ -20,6 +21,8 @@ def getComLineArgs(): help="Run test job (no background estimate)") parser.add_argument("--uwvv", action='store_true', help="Use UWVV format ntuples in stead of NanoAOD") + parser.add_argument("--with_background", action='store_true', + help="Don't run background selector") parser.add_argument("--noHistConfig", action='store_true', help="Don't rely on config file to specify hist info") parser.add_argument("-j", "--numCores", type=int, default=1, @@ -56,19 +59,14 @@ def makeHistFile(args): else: tmpFileName = "Hists%s-%s.root" % (today, args['output_file']) if args['selection'] == "SignalSync" \ else "Hists%s-%s.root" % (today, args['analysis']) - fOut = ROOT.TFile(tmpFileName, "recreate") + fOut = ROOT.TFile(tmpFileName if not args['with_background'] else tmpFileName.replace(".root", "sel.root"), "recreate") addScaleFacs = False - if args['analysis'] == "WZxsec2016" or args['analysis'] == 'Zstudy_2016': + if args['analysis'] == "WZxsec2016" or args['analysis'] == 'Zstudy_2016' or args['scalefactors_file']: addScaleFacs = True - if "ZZ4l" in args['scalefactors_file']: - addScaleFacs=True - else: - addScaleFacs = False - sf_inputs = [ROOT.TParameter(bool)("applyScaleFacs", False)] - + fr_inputs = [] if addScaleFacs: fScales = ROOT.TFile(args['scalefactors_file']) if "ZZ4l" in args['analysis']: @@ -148,25 +146,6 @@ def makeHistFile(args): analysis = "/".join([args['analysis'], selection]) hists, hist_inputs = UserInput.getHistInfo(analysis, args['hist_names'], args['noHistConfig']) - if not args['test']: - - bkgselector = SelectorTools.SelectorDriver(args['analysis']+"Bkg", args['selection'], args['input_tier'], args['year']) - bkgselector.setOutputfile(fOut.GetName()) - bkgselector.setInputs(sf_inputs+fr_inputs+hist_inputs) - bkgselector.setSumWeights(False) - bkgselector.setNtupeType("UWVV" if args['uwvv'] else "NanoAOD") - if args['uwvv']: - logging.debug("Processing channels " % args['channels']) - bkgselector.setChannels(args['channels']) - bkgselector.setNumCores(args['numCores']) - - if args['filenames']: - bkgselector.setDatasets(args['filenames']) - else: - bkgselector.setFileList(*args['inputs_from_file']) - - background = bkgselector.applySelector() - selector = SelectorTools.SelectorDriver(args['analysis'], args['selection'], args['input_tier'], args['year']) selector.setOutputfile(fOut.GetName()) selector.setInputs(sf_inputs+hist_inputs) @@ -187,6 +166,16 @@ def makeHistFile(args): fOut.Close() sys.exit(0) + if args['with_background']: + selector.isBackground() + selector.setInputs(sf_inputs+hist_inputs+fr_inputs) + selector.setOutputfile(tmpFileName.replace(".root", "bkgd.root")) + nonprompt = selector.applySelector() + tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd"]] + rval = subprocess.call(["hadd", "-f", tmpFileName] + tempfiles) + if rval == 0: + map(os.remove, tempfiles) + fOut.Close() fOut = ROOT.TFile.Open(tmpFileName, "update") @@ -203,7 +192,7 @@ def makeHistFile(args): nonpromptmc.Delete() OutputTools.writeOutputListItem(nonpromptmc, fOut) - + ewkmc = HistTools.makeCompositeHists(fOut,"AllEWK", ConfigureJobs.getListOfFilesWithXSec( ConfigureJobs.getListOfEWKFilenames(args['analysis']), manager_path), args['lumi'], underflow=False, overflow=False) diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index 5c0df6fa..8b8866fd 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -sf data/scaleFactorsZZ4l2017.root -j 12 +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_background -c mmmm -sf data/scaleFactorsZZ4l2017.root From 9b2a39d6254fc3871c55d0abdf966c821a35bf50 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Thu, 29 Aug 2019 17:48:24 -0400 Subject: [PATCH 13/53] Call proper load branches function in background selector --- runZZ4l2016.sh | 2 +- src/ZZBackgroundSelector.cc | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index 8b8866fd..44c97bbe 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_background -c mmmm -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_background -sf data/scaleFactorsZZ4l2017.root diff --git a/src/ZZBackgroundSelector.cc b/src/ZZBackgroundSelector.cc index aad4392d..cbc9ddd5 100644 --- a/src/ZZBackgroundSelector.cc +++ b/src/ZZBackgroundSelector.cc @@ -26,10 +26,8 @@ void ZZBackgroundSelector::SetupNewDirectory() // Insure that hist ranges are exactly the same as ZZSelector, just change name for (const auto && obj : *currentHistDir_) { std::string name = obj->GetName(); - std::cout<<"histname: " <(obj); named->SetName(name.insert(name.length()-4, "Fakes_").c_str()); - std::cout<<"histname in BkgSelector: " <(Z1MassHistPPPF_, ("Z1Mass_PPPF_"+channelName_).c_str(), "Z1Mass; m_{Z_{1}} [GeV]; Events;", 60, 0, 120); AddObject(Z1MassHistPPFF_, ("Z1Mass_PPFF_"+channelName_).c_str(), "Z1Mass; m_{Z_{1}} [GeV]; Events;", 60, 0, 120); @@ -93,7 +91,7 @@ float ZZBackgroundSelector::getEventWeight(Long64_t entry) { } void ZZBackgroundSelector::LoadBranchesUWVV(Long64_t entry, std::pair variation) { - ZZSelector::LoadBranches(entry, variation); + ZZSelector::LoadBranchesUWVV(entry, variation); SetZ1Z2Masses(); weight = getEventWeight(entry); } From 14deb0235be3343338ad484475dffec404074bb1 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Fri, 30 Aug 2019 05:21:34 -0400 Subject: [PATCH 14/53] Merge my combine refactoring stuff Also make the treatment of dataset manager name more modular --- .../ZZSelection/ZZ_template2016_all.txt | 33 +++ .../ZZSelection/ZZ_template2016_eeee.txt | 36 +++ .../ZZSelection/ZZ_template2016_eemm.txt | 37 ++++ .../ZZSelection/ZZ_template2016_mmee.txt | 37 ++++ .../ZZSelection/ZZ_template2016_mmmm.txt | 35 +++ .../ZZSelection/ZZ_template2017_all.txt | 33 +++ .../ZZSelection/ZZ_template2017_eeee.txt | 36 +++ .../ZZSelection/ZZ_template2017_eemm.txt | 37 ++++ .../ZZSelection/ZZ_template2017_mmee.txt | 37 ++++ .../ZZSelection/ZZ_template2017_mmmm.txt | 35 +++ .../ZZSelection/ZZ_template2018_all.txt | 33 +++ .../ZZSelection/ZZ_template2018_eeee.txt | 36 +++ .../ZZSelection/ZZ_template2018_eemm.txt | 37 ++++ .../ZZSelection/ZZ_template2018_mmee.txt | 37 ++++ .../ZZSelection/ZZ_template2018_mmmm.txt | 35 +++ .../ZZSelection/runCombine_Template2017.sh | 17 ++ .../ZZSelection/runCombine_Template2018.sh | 17 ++ Templates/config.kelong | 1 + Utilities/python/CombineCardTools.py | 205 ++++++++++++++++++ Utilities/python/ConfigureJobs.py | 147 ++++++------- Utilities/python/HistTools.py | 36 +-- Utilities/scripts/setupZZCombine.py | 64 ++++++ 22 files changed, 930 insertions(+), 91 deletions(-) create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt create mode 100644 Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt create mode 100755 Templates/CombineCards/ZZSelection/runCombine_Template2017.sh create mode 100755 Templates/CombineCards/ZZSelection/runCombine_Template2018.sh create mode 100644 Utilities/python/CombineCardTools.py create mode 100644 Utilities/scripts/setupZZCombine.py diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt new file mode 100644 index 00000000..72bf515e --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt @@ -0,0 +1,33 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin all +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin all all all all all +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 2 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt new file mode 100644 index 00000000..187cdee7 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt @@ -0,0 +1,36 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eeee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin eeee eeee eeee eeee eeee +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 2 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------- +bkg_eeee_17 lnN - - - - 1.2 +bkg_ee_17 lnN - - - - 1.2 +trigger_eeee_17 lnN 1.01 1.01 1.01 1.01 - +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt new file mode 100644 index 00000000..90267a19 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt @@ -0,0 +1,37 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eemm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin eemm eemm eemm eemm eemm +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------------- +bkg_mm_17 lnN - - - - 1.1 +bkg_ee_17 lnN - - - - 1.1 +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt new file mode 100644 index 00000000..667228dc --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt @@ -0,0 +1,37 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin mmee mmee mmee mmee mmee +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------- ------------------------------- +bkg_mm_17 lnN - - - - 1.1 +bkg_ee_17 lnN - - - - 1.1 +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt new file mode 100644 index 00000000..31455a37 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt @@ -0,0 +1,35 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmmm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin mmmm mmmm mmmm mmmm mmmm +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------- +bkg_mmmm_17 lnN - - - - 1.2 +bkg_mm_17 lnN - - - - 1.2 +trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt new file mode 100644 index 00000000..72bf515e --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt @@ -0,0 +1,33 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin all +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin all all all all all +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 2 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt new file mode 100644 index 00000000..1d132199 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt @@ -0,0 +1,36 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eeee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin eeee eeee eeee eeee eeee +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 2 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------- +bkg_eeee_17 lnN - - - - 1.2 +bkg_ee_17 lnN - - - - 1.2 +trigger_eeee_17 lnN 1.01 1.01 1.01 1.01 - +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt new file mode 100644 index 00000000..90267a19 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt @@ -0,0 +1,37 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eemm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin eemm eemm eemm eemm eemm +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------------- +bkg_mm_17 lnN - - - - 1.1 +bkg_ee_17 lnN - - - - 1.1 +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt new file mode 100644 index 00000000..667228dc --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt @@ -0,0 +1,37 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin mmee mmee mmee mmee mmee +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------- ------------------------------- +bkg_mm_17 lnN - - - - 1.1 +bkg_ee_17 lnN - - - - 1.1 +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt new file mode 100644 index 00000000..31455a37 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt @@ -0,0 +1,35 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmmm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin mmmm mmmm mmmm mmmm mmmm +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------- +bkg_mmmm_17 lnN - - - - 1.2 +bkg_mm_17 lnN - - - - 1.2 +trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt new file mode 100644 index 00000000..607497a4 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt @@ -0,0 +1,33 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable} HZZ_signal/${fit_variable}_$$SYSTEMATIC +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable} qqZZ_powheg/${fit_variable}_$$SYSTEMATIC +shapes ggZZ * ${output_file} ggZZ/${fit_variable} ggZZ/${fit_variable}_$$SYSTEMATIC +shapes VVV * ${output_file} VVV/${fit_variable} VVV/${fit_variable}_$$SYSTEMATIC + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC +shapes data_obs * ${output_file} data/${fit_variable} + +bin all +observation -1 + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin all all all all all +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 2 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt new file mode 100644 index 00000000..d2f0d167 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt @@ -0,0 +1,36 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eeee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin eeee eeee eeee eeee eeee +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 2 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------- +bkg_eeee_18 lnN - - - - 1.2 +bkg_ee_18 lnN - - - - 1.2 +trigger_eeee_18 lnN 1.01 1.01 1.01 1.01 - +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt new file mode 100644 index 00000000..9d4dbeeb --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt @@ -0,0 +1,37 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eemm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin eemm eemm eemm eemm eemm +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------------- +bkg_mm_18 lnN - - - - 1.1 +bkg_ee_18 lnN - - - - 1.1 +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt new file mode 100644 index 00000000..fd821077 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt @@ -0,0 +1,37 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin mmee mmee mmee mmee mmee +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------- ------------------------------- +bkg_mm_18 lnN - - - - 1.1 +bkg_ee_18 lnN - - - - 1.1 +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt new file mode 100644 index 00000000..4ce6f909 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt @@ -0,0 +1,35 @@ +imax 1 number of channels +jmax 4 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmmm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin +bin mmmm mmmm mmmm mmmm mmmm +process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -2 -1 0 1 1 +rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------- +bkg_mmmm_18 lnN - - - - 1.2 +bkg_mm_18 lnN - - - - 1.2 +trigger_mmmm_18 lnN 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 diff --git a/Templates/CombineCards/ZZSelection/runCombine_Template2017.sh b/Templates/CombineCards/ZZSelection/runCombine_Template2017.sh new file mode 100755 index 00000000..3920b0ce --- /dev/null +++ b/Templates/CombineCards/ZZSelection/runCombine_Template2017.sh @@ -0,0 +1,17 @@ +combineCards.py eeee=ZZ2017_eeee.txt eemm=ZZ2017_eemm.txt mmee=ZZ2017_mmee.txt mmmm=ZZ2017_mmmm.txt > ZZ2017.txt +text2workspace.py ZZ2017.txt -m 999 -o ZZ2017.root + +if [[ $$1 == "impacts" ]]; then + rm -rf impact + mkdir impact + pushd impact + card="../ZZ2017.root" + combineTool.py -M Impacts -m 125 -d $$card --doInitialFit + combineTool.py -M Impacts -m 125 -d $$card --allPars --doFits --parallel 12 + combineTool.py -M Impacts -m 125 -d $$card --allPars -o impacts.json + plotImpacts.py -i impacts.json -o impacts + popd +else + combine -M MaxLikelihoodFit -d ZZ2017.root $$1 +fi + diff --git a/Templates/CombineCards/ZZSelection/runCombine_Template2018.sh b/Templates/CombineCards/ZZSelection/runCombine_Template2018.sh new file mode 100755 index 00000000..a2fde5f7 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/runCombine_Template2018.sh @@ -0,0 +1,17 @@ +combineCards.py eeee=ZZ2018_eeee.txt eemm=ZZ2018_eemm.txt mmee=ZZ2018_mmee.txt mmmm=ZZ2018_mmmm.txt > ZZ2018.txt +text2workspace.py ZZ2018.txt -m 999 -o ZZ2018.root + +if [[ $$1 == "impacts" ]]; then + rm -rf impact + mkdir impact + pushd impact + card="../ZZ2018.root" + combineTool.py -M Impacts -m 125 -d $$card --doInitialFit + combineTool.py -M Impacts -m 125 -d $$card --allPars --doFits --parallel 12 + combineTool.py -M Impacts -m 125 -d $$card --allPars -o impacts.json + plotImpacts.py -i impacts.json -o impacts + popd +else + combine -M MaxLikelihoodFit -d ZZ2018.root $$1 +fi + diff --git a/Templates/config.kelong b/Templates/config.kelong index d3790450..afd857d5 100644 --- a/Templates/config.kelong +++ b/Templates/config.kelong @@ -2,6 +2,7 @@ user = kelong analysis = WZ dataset_manager_path = /afs/cern.ch/user/k/%(user)s/work +dataset_manager_name = AnalysisDatasetManager combine_path = %(dataset_manager_path)s/HiggsCombine/CMSSW_8_1_0/src/HiggsAnalysis/CombinedLimit output_path = /eos/user/k/%(user)s/%(analysis)sAnalysisData fakeRate_output = %(output_path)s/FakeRates diff --git a/Utilities/python/CombineCardTools.py b/Utilities/python/CombineCardTools.py new file mode 100644 index 00000000..14ba5480 --- /dev/null +++ b/Utilities/python/CombineCardTools.py @@ -0,0 +1,205 @@ +import logging +import ConfigureJobs +import HistTools +import OutputTools +from prettytable import PrettyTable +import os +import ROOT + +class CombineCardTools(object): + def __init__(self): + self.fitVariable = "" + self.fitVariableAppend = {} + self.processes = [] + self.yields = {} + self.histData = {} + self.crossSectionMap = {} + self.outputFile = "" + self.templateName = "" + self.channels = [] + self.variations = {} + self.rebin = None + self.isMC = True + self.isUnrolledFit = False + self.lumi = 1 + self.outputFolder = "." + + def setPlotGroups(self, xsecMap): + self.crossSectionMap = xsecMap + + def setRebin(self, rebin): + self.rebin = rebin + + def setCrosSectionMap(self, xsecMap): + self.crossSectionMap = xsecMap + + # Map of plot groups and members (individual processes) + def setProcesses(self, processes): + self.processes = processes + + def setFitVariableAppend(self, process, append): + self.fitVariableAppend[process] = append + + def setFitVariable(self, variable): + self.fitVariable = variable + + def setVariations(self, variations, exclude=[]): + if not self.processes: + raise ValueError("No processes defined, can't set variations") + for process in self.processes.keys(): + if process in exclude: + self.setVariationsByProcess(process, []) + continue + self.setVariationsByProcess(process, variations) + + def getVariations(self): + return self.variations + + def getVariationsForProcess(self, process): + if process not in self.variations.keys(): + raise ValueError("Variations not defined for process %s" % process) + return self.variations[process] + + def setVariationsByProcess(self, process, variations): + if "Up" not in variations and "Down" not in variations: + variations = [x+y for x in variations for y in ["Up", "Down"]] + self.variations[process] = variations + + def weightHistName(self, channel, process): + fitVariable = self.getFitVariable(process) + variable = fitVariable.replace("unrolled", "2D") if self.isUnrolledFit else fitVariable + return "_".join([variable, "lheWeights", channel]) + + def setLumi(self, lumi): + self.lumi = lumi + + def setOutputFolder(self, outputFolder): + self.outputFolder = outputFolder + if not os.path.isdir(outputFolder): + os.makedirs(outputFolder) + + def getRootFile(self, rtfile, mode=None): + if type(rtfile) == str: + if mode: + return ROOT.TFile.Open(rtfile, mode) + else: + return ROOT.TFile.Open(rtfile) + return rtfile + + def setTemplateFileName(self, templateName): + self.templateName = templateName + + def setOutputFile(self, outputFile): + self.outputFile = self.getRootFile("/".join([self.outputFolder, outputFile]), "RECREATE") + + def setInputFile(self, inputFile): + self.inputFile = self.getRootFile(inputFile) + + def setChannels(self, channels): + self.channels = channels + for chan in self.channels + ["all"]: + self.yields[chan] = {} + + def processHists(self, processName): + return self.histData[processName] + + def getFitVariable(self, process): + if process not in self.fitVariableAppend: + return self.fitVariable + return "_".join([self.fitVariable, self.fitVariableAppend[process]]) + + def combineChannels(self, group, central=True): + variations = self.variations[group.GetName()][:] + fitVariable = self.getFitVariable(group.GetName()) + if central: + variations.append("") + for var in variations: + # TODO: Remove these two replace statements, it's WZ/ZZ specific + name = fitVariable if var is "" else "_".join([fitVariable, var]) + hist_name = name + "_" + self.channels[0] + hist = group.FindObject(hist_name) + if not hist: + logging.warning("Failed to find hist %s in group %s. Skipping" % (hist_name, group.GetName())) + continue + hist = hist.Clone(name) + ROOT.SetOwnership(hist, False) + group.Add(hist) + for chan in self.channels[1:]: + chan_hist = group.FindObject(name + "_" + chan) + hist.Add(chan_hist) + + def listOfHistsByProcess(self, processName, addTheory): + if self.fitVariable == "": + raise ValueError("Must declare fit variable before defining plots") + fitVariable = self.getFitVariable(processName) + plots = ["_".join([fitVariable, chan]) for chan in self.channels] + variations = self.getVariationsForProcess(processName) + plots += ["_".join([fitVariable, var, c]) for var in variations for c in self.channels] + if addTheory: + plots += [self.weightHistName(c, processName) for c in self.channels] + return plots + + # processName needs to match a PlotGroup + def loadHistsForProcess(self, processName, addTheory, scaleNorm=1): + plotsToRead = self.listOfHistsByProcess(processName, addTheory) + + group = HistTools.makeCompositeHists(self.inputFile, processName, + {proc : self.crossSectionMap[proc] for proc in self.processes[processName]}, + self.lumi, plotsToRead, rebin=self.rebin) + + fitVariable = self.getFitVariable(processName) + #TODO:Make optional + processedHists = [] + for chan in self.channels: + histName = "_".join([fitVariable, chan]) if chan != "all" else fitVariable + hist = group.FindObject(histName) + #TODO: Make optional + if "data" not in processName.lower(): + HistTools.removeZeros(hist) + HistTools.addOverflow(hist) + processedHists.append(histName) + self.yields[chan].update({processName : round(hist.Integral(), 4) if hist.Integral() > 0 else 0.0001}) + + if chan == self.channels[0]: + self.yields["all"][processName] = self.yields[chan][processName] + else: + self.yields["all"][processName] += self.yields[chan][processName] + + if addTheory: + weightHist = group.FindObject(self.weightHistName(chan, processName)) + if not weightHist: + logging.warning("Failed to find %s. Skipping" % self.weightHistName(chan, processName)) + continue + scaleHists = HistTools.getScaleHists(weightHist, processName, self.rebin) + group.extend(scaleHists) + #TODO: You may want to combine channels before removing zeros + self.combineChannels(group) + #TODO: Make optional + map(HistTools.addOverflow, filter(lambda x: (x.GetName() not in processedHists), group)) + if "data" not in group.GetName(): + map(HistTools.removeZeros, filter(lambda x: (x.GetName() not in processedHists), group)) + self.histData[processName] = group + + # It's best to call this function for process, otherwise you can end up + # storing many large histograms in memory + def writeProcessHistsToOutput(self, processName): + if processName not in self.histData.keys() or not self.histData[processName]: + raise ValueError("Hists for process %s not found" % processName) + processHists = self.histData[processName] + OutputTools.writeOutputListItem(processHists, self.outputFile) + processHists.Delete() + + def writeCards(self, chan, nuisances, year="", extraArgs={}): + chan_dict = self.yields[chan].copy() + chan_dict.update(extraArgs) + chan_dict["nuisances"] = nuisances + chan_dict["fit_variable"] = self.fitVariable + chan_dict["output_file"] = self.outputFile.GetName() + outputCard = self.templateName.split("/")[-1].format(channel=chan, year=year) + outputCard = outputCard.replace("template", "") + #outputCard = outputCard.replace("__", "_") + ConfigureJobs.fillTemplatedFile(self.templateName.format(channel=chan, year=year), + "/".join([self.outputFolder, outputCard]), + chan_dict + ) + diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index e1499579..01e4920e 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -7,6 +7,8 @@ import json import array import string +import socket +import logging #try: import configparser #except: @@ -43,19 +45,37 @@ def getBinning(variable='MTWZ', isVBS=True, isHiggs=False): def getChannels(analysis='WZ'): if analysis == 'WZ': return ["eee", "eem", "emm", "mmm"] -def getManagerPath(): + +def getManagerName(): + config_name = "Templates/config.%s" % os.getlogin() + default_name = "AnalysisDatasetManager" + if not os.path.isfile(config_name): + logging.warning("dataset_manager_name not specified in config file %s" % config_name) + logging.warning("Using default '%s'" % default_name) + return default_name config = configparser.ConfigParser() - try: - config.read_file(open("Templates/config.%s" % os.environ["USER"])) - if "dataset_manager_path" not in config['Setup']: - raise ValueError("dataset_manager_path not specified in config file Template/config.%s" - % os.environ["USER"]) - except ValueError as e: - if os.path.isdir('ZZ4lRun2DatasetManager'): - return '.' - raise e + config.read_file(open(config_name)) + if "dataset_manager_name" not in config['Setup']: + logging.warning("dataset_manager_name not specified in config file %s" % config_name) + logging.warning("Using default '%s'" % default_name) + return default_name + return config['Setup']['dataset_manager_name'] +def getManagerPath(): + config_name = "Templates/config.%s" % os.getlogin() + if not os.path.isfile(config_name): + if os.path.isdir(getManagerName()): + return '.' + else: + raise IOError("Failed to find valid config file. Looking for %s" + % config_name) + config = configparser.ConfigParser() + config.read_file(open(config_name)) + if "dataset_manager_path" not in config['Setup']: + raise ValueError("dataset_manager_path not specified in config file %s" + % config_name) return config['Setup']['dataset_manager_path'] + "/" + def getCombinePath(): config = configparser.ConfigParser() config.read_file(open("Templates/config.%s" % os.environ["USER"])) @@ -63,19 +83,8 @@ def getCombinePath(): raise ValueError("dataset_manager_path not specified in config file Template/config.%s" % os.environ["USER"]) return config['Setup']['combine_path'] + "/" -def getListOfEWKFilenames(analysis): - if "ZZ4l" in analysis: - return [ - "zz4l-powheg", - "ggZZ4e", - "ggZZ4m", - "ggZZ4t", - "ggZZ2e2mu", - "ggZZ2e2tau", - #"ggZZ2mu2tau", - ] - else: - return [ +def getListOfEWKFilenames(): + return [ # "wz3lnu-powheg", # Use jet binned WZ samples for subtraction by default "wz3lnu-mgmlm-0j", @@ -97,7 +106,7 @@ def getListOfEWKFilenames(analysis): "ggZZ4e", "ggZZ4m", "ggZZ2e2mu", - ] + ] def getListOfNonpromptFilenames(): return ["tt-lep", "st-schan", @@ -149,57 +158,26 @@ def getListOfHDFSFiles(file_path): elif "root" in split[1]: files.append(split[1]) return files -def getListOfFiles(filelist, selection, manager_path=""): + +# TODO: Would be good to switch the order of the last two arguments +# completely deprecate manager_path without breaking things +def getListOfFiles(filelist, selection, manager_path="", analysis=""): if manager_path is "": manager_path = getManagerPath() - data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path + data_path = "%s/%s/FileInfo" % (manager_path, getManagerName()) data_info = UserInput.readAllInfo("/".join([data_path, "data/*"])) mc_info = UserInput.readAllInfo("/".join([data_path, "montecarlo/*"])) - valid_names = data_info.keys() + mc_info.keys() + analysis_info = UserInput.readInfo("/".join([data_path, analysis, selection])) \ + if analysis != "" else [] + valid_names = (data_info.keys() + mc_info.keys()) if not analysis_info else analysis_info.keys() names = [] for name in filelist: if ".root" in name: names.append(name) elif "WZxsec2016" in name: dataset_file = manager_path + \ - "ZZ4lRun2DatasetManager/FileInfo/WZxsec2016/%s.json" % selection - allnames = json.load(open(dataset_file)).keys() - if "nodata" in name: - nodata = [x for x in allnames if "data" not in x] - names += nodata - elif "data" in name: - names += [x for x in allnames if "data" in x] - else: - names += allnames - elif "ZZ4l2016" in name: - dataset_file = manager_path + \ - "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2016/%s.json" % selection - allnames = json.load(open(dataset_file)).keys() - print allnames - if "nodata" in name: - nodata = [x for x in allnames if "data" not in x] - names += nodata - elif "data" in name: - names += [x for x in allnames if "data" in x] - else: - names += allnames - elif "ZZ4l2017" in name: - dataset_file = manager_path + \ - "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2017/%s.json" % selection - allnames = json.load(open(dataset_file)).keys() - print allnames - if "nodata" in name: - nodata = [x for x in allnames if "data" not in x] - names += nodata - elif "data" in name: - names += [x for x in allnames if "data" in x] - else: - names += allnames - elif "ZZ4l2018" in name: - dataset_file = manager_path + \ - "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2018/%s.json" % selection + "%s/FileInfo/WZxsec2016/%s.json" % (getManagerPath(), selection) allnames = json.load(open(dataset_file)).keys() - print allnames if "nodata" in name: nodata = [x for x in allnames if "data" not in x] names += nodata @@ -212,16 +190,19 @@ def getListOfFiles(filelist, selection, manager_path=""): else: if name.split("__")[0] not in valid_names: print "%s is not a valid name" % name - print "Valid names are", valid_names + print "Valid names must be defined in AnalysisDatasetManager/FileInfo/(data/montecarlo)*" continue names += [name] return [str(i) for i in names] def getXrdRedirector(): - usbased = ["hep.wisc.edu"] - if any(i in os.environ["HOSTNAME"] for i in usbased): - return 'cmsxrootd.fnal.gov' - return 'cms-xrd-global.cern.ch' + usbased = ["wisc.edu"] + usredir = 'cmsxrootd.fnal.gov' + globalredir = 'cms-xrd-global.cern.ch' + # Cluster machines may not have this env variable + if any(i in socket.gethostname() for i in usbased): + return usredir + return globalredir def fillTemplatedFile(template_file_name, out_file_name, template_dict): with open(template_file_name, "r") as templateFile: @@ -229,21 +210,37 @@ def fillTemplatedFile(template_file_name, out_file_name, template_dict): result = source.substitute(template_dict) with open(out_file_name, "w") as outFile: outFile.write(result) -def getListOfFilesWithXSec(filelist, manager_path=""): + +def getListOfFilesWithXSec(filelist, manager_path="", selection="ntuples"): if manager_path is "": manager_path = getManagerPath() - data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path - files = getListOfFiles(filelist, "ntuples", manager_path) + data_path = "%s/%s/FileInfo" % (manager_path, getManagerName()) + files = getListOfFiles(filelist, selection, manager_path) mc_info = UserInput.readAllInfo("/".join([data_path, "montecarlo/*"])) info = {} for file_name in files: - if "data" in file_name: + if "data" in file_name.lower(): info.update({file_name : 1}) else: file_info = mc_info[file_name.split("__")[0]] kfac = file_info["kfactor"] if "kfactor" in file_info.keys() else 1 info.update({file_name : file_info["cross_section"]*kfac}) return info + +def getListOfFilesWithDASPath(filelist, analysis, selection, manager_path=""): + if manager_path is "": + manager_path = getManagerPath() + data_path = "%s/%s/FileInfo" % (manager_path, getManagerName()) + files = getListOfFiles(filelist, selection, manager_path, analysis) + selection_info = UserInput.readInfo("/".join([data_path, analysis, selection])) + info = {} + for file_name in files: + if "DAS" not in selection_info[file_name].keys(): + print "ERROR: DAS path not defined for file %s in analysis %s/%s" % (file_name, analysis, selection) + continue + info.update({file_name : selection_info[file_name]["DAS"]}) + return info + def getPreviousStep(selection, analysis): selection_map = {} if analysis == "WZxsec2016": @@ -286,7 +283,7 @@ def getConfigFileName(config_file_name): for extension in ["json", "py"]: if os.path.isfile(".".join([config_file_name, extension])): return ".".join([config_file_name, extension]) - raise IOError("Invalid configuration file. Tried to read %s which does not exist" % \ + raise ValueError("Invalid configuration file. Tried to read %s which does not exist" % \ config_file_name) def getInputFilesPath(sample_name, selection, analysis, manager_path=""): @@ -295,7 +292,7 @@ def getInputFilesPath(sample_name, selection, analysis, manager_path=""): if ".root" in sample_name: print "INFO: using simple file %s" % sample_name return sample_name - data_path = "%s/ZZ4lRun2DatasetManager/FileInfo" % manager_path + data_path = "%s/%s/FileInfo" % (manager_path, getManagerName()) input_file_base_name = "/".join([data_path, analysis, selection]) input_file_name = getConfigFileName(input_file_base_name) input_files = UserInput.readInfo(input_file_name) diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index bdcb7978..110f8476 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -126,12 +126,13 @@ def getLHEWeightHists(init2D_hist, entries, name, variation_name, rebin=None): hist_name = init2D_hist.GetName().replace("lheWeights", "%s_%sUp" % (variation_name, name)) return hists, hist_name -def getPDFHists(init2D_hist, entries, name, rebin=None): +def getPDFHists(init2D_hist, entries, name, rebin=None, central=0): hists, hist_name = getLHEWeightHists(init2D_hist, entries, name, "pdf", rebin) #return hists return getVariationHists(hists, name, hist_name, - lambda x: x[0]*(1+getPDFPercentVariation(x)), - lambda x: x[0]*(1-getPDFPercentVariation(x)) + lambda x: x[central]*(1+getPDFPercentVariation(x)), + lambda x: x[central]*(1-getPDFPercentVariation(x)), + central ) def getPDFPercentVariation(values): @@ -140,20 +141,20 @@ def getPDFPercentVariation(values): return 0 return abs(values[84] - values[16])/denom -def getScaleHists(scale_hist2D, name, rebin=None): - entries = [i for i in range(1,10) if i not in [7, 9]] +def getScaleHists(scale_hist2D, name, rebin=None, central=0, exclude=[7,9]): + entries = [i for i in range(1,10) if i not in exclude] hists, hist_name = getLHEWeightHists(scale_hist2D, entries, name, "QCDscale", rebin) - return getVariationHists(hists, name, hist_name, lambda x: x[-1], lambda x: x[1]) + return getVariationHists(hists, name, hist_name, lambda x: x[-1], lambda x: x[1], central) -def getVariationHists(hists, process_name, histUp_name, up_action, down_action): - histUp = hists[0].Clone(histUp_name) +def getVariationHists(hists, process_name, histUp_name, up_action, down_action, central=0): + histUp = hists[central].Clone(histUp_name) histDown = histUp.Clone(histUp_name.replace("Up", "Down")) - histCentral = hists[0] + histCentral = hists.pop(central) # Include overflow - for i in range(0, hists[0].GetNbinsX()+2): + for i in range(0, histCentral.GetNbinsX()+2): vals = [] - for hist in hists[1:]: + for hist in hists: vals.append(hist.GetBinContent(i)) vals.sort() vals.insert(0, histCentral.GetBinContent(i)) @@ -229,6 +230,9 @@ def addControlRegionToFitHist(control_hist, input_hist, base_name="unrolled"): ROOT.SetOwnership(hist, False) return hist +def addOverflow(hist): + addOverflowAndUnderflow(hist, underflow=False, overflow=True) + def addOverflowAndUnderflow(hist, underflow=True, overflow=True): if not "TH1" in hist.ClassName(): return @@ -244,14 +248,14 @@ def addOverflowAndUnderflow(hist, underflow=True, overflow=True): def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False, overflow=True, rebin=None): composite = ROOT.TList() composite.SetName(name) - #print "members for CompositeHists: ",members - #print "hist_file:",hist_file for directory in [str(i) for i in members.keys()]: + #TODO: Remove this, it's very WZ specific + dirname = directory + directory = directory.replace("_", "-") + directory = directory.replace("--", "__") # For aQGC, the different plot groups should already be in their own files if "aqgc" in directory: directory = name - #print "directory:",directory - #print "directory:",type(directory) if not hist_file.Get(directory): print "Skipping invalid filename %s" % directory continue @@ -275,7 +279,7 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False if hist: sumhist = composite.FindObject(hist.GetName()) if sumweights: - hist.Scale(members[directory.split("__")[0]]*1000*lumi/sumweights) + hist.Scale(members[dirname.split("__")[0]]*1000*lumi/sumweights) addOverflowAndUnderflow(hist, underflow, overflow) else: raise RuntimeError("hist %s was not produced for " diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py new file mode 100644 index 00000000..654ae627 --- /dev/null +++ b/Utilities/scripts/setupZZCombine.py @@ -0,0 +1,64 @@ +from python import CombineCardTools +from python import ConfigureJobs +import sys +import ROOT +import logging +import array + +cardtool = CombineCardTools.CombineCardTools() + +manager_path = ConfigureJobs.getManagerPath() +manager_name = ConfigureJobs.getManagerName() +sys.path.append("/".join([manager_path, "AnalysisDatasetManager", + "Utilities/python"])) + +from ConfigHistFactory import ConfigHistFactory +config_factory = ConfigHistFactory( + "%s/%s" % (manager_path, manager_name), + "ZZ4l2016/LooseLeptons", +) + +plot_groups = ["HZZ_signal","qqZZ_powheg","ggZZ", "VVV", "data", "nonprompt",] +plotGroupsMap = {name : config_factory.getPlotGroupMembers(name) for name in plot_groups} + +xsecs = ConfigureJobs.getListOfFilesWithXSec([f for files in plotGroupsMap.values() for f in files]) + +lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.74} +fileMap = { "2017" : "/eos/user/k/kelong/HistFiles/ZZ/Hists13Aug2019-ZZ4l2017Full.root", + "2018" : "/eos/user/k/kelong/HistFiles/ZZ/Hists13Aug2019-ZZ4l2018Full.root", + "2016" : "/eos/user/k/kelong/HistFiles/ZZ/Hists29Aug2019-ZZ4l2016.root", +} +channels = ["eeee", "eemm", "mmee", "mmmm"] +nuissance_map = {"eeee" : 9, "eemm" : 10, "mmee" : 10, "mmmm" : 8, "all" : 6} +#fitvar = "ZZPt" +#rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) +fitvar = "Mass" +rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) +cardtool.setFitVariable(fitvar) +cardtool.setRebin(rebin) +#cardtool.setFitVariableAppend("nonprompt", "Fakes") +cardtool.setProcesses(plotGroupsMap) +cardtool.setChannels(channels) +cardtool.setCrosSectionMap(xsecs) +cardtool.setVariations(["CMS_eff_e", "CMS_RecoEff_e", "CMS_eff_m", ],#"CMS_pileup"], + exclude=["nonprompt", "data"]) +cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) +#cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2017Fit" % fitvar) + +for year in ["2016"]:#fileMap.keys(): + cardtool.setLumi(lumiMap[year]) + cardtool.setInputFile(fileMap[year]) + print fileMap[year], lumiMap[year] + cardtool.setOutputFile("ZZCombineInput_{year}.root".format(year=year)) + #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s%sFit" % (fitvar, year)) + for process in plot_groups: + #Turn this back on when the theory uncertainties are added + addTheory = process not in ["nonprompt"] and False + cardtool.loadHistsForProcess(process, addTheory) + cardtool.writeProcessHistsToOutput(process) + + for chan in channels + ["all"]: + cardtool.setTemplateFileName("Templates/CombineCards/ZZSelection/ZZ_template{year}_{channel}.txt") + logging.info("Writting cards for channel %s" % chan) + cardtool.writeCards(chan, nuissance_map[chan], year=year) + From c387f35b088bec3ebf0371fb9680bed9c8d4108a Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Fri, 30 Aug 2019 05:25:51 -0400 Subject: [PATCH 15/53] Restore ZZ addition for EWK file names --- Utilities/python/ConfigureJobs.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index 01e4920e..9832ff55 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -83,7 +83,18 @@ def getCombinePath(): raise ValueError("dataset_manager_path not specified in config file Template/config.%s" % os.environ["USER"]) return config['Setup']['combine_path'] + "/" -def getListOfEWKFilenames(): +def getListOfEWKFilenames(analysis=""): + if "ZZ4l" in analysis: + return [ + "zz4l-powheg", + "ggZZ4e", + "ggZZ4m", + "ggZZ4t", + "ggZZ2e2mu", + "ggZZ2e2tau", + #"ggZZ2mu2tau", + ] + # TODO: This is obviously WZ specific and should be updated return [ # "wz3lnu-powheg", # Use jet binned WZ samples for subtraction by default From 79cfb96ef671281ddc9e480b7fbcc56211f24bb6 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Fri, 30 Aug 2019 06:11:26 -0400 Subject: [PATCH 16/53] What are these changes --- Utilities/python/SelectorTools.py | 4 ++-- Utilities/scripts/makeHistFile.py | 36 +++++++++++++++---------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index cecfeb8a..170b3020 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -129,8 +129,8 @@ def setDatasets(self, datalist): if "@" in dataset: dataset, file_path = [f.strip() for f in dataset.split("@")] else: - if "Bkg" in self.analysis: - self.analysis=self.analysis[:-3] + #if "Bkg" in self.analysis: + # self.analysis=self.analysis[:-3] try: file_path = ConfigureJobs.getInputFilesPath(dataset, self.input_tier, self.analysis) diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 2f981477..1bc19832 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -148,24 +148,24 @@ def makeHistFile(args): analysis = "/".join([args['analysis'], selection]) hists, hist_inputs = UserInput.getHistInfo(analysis, args['hist_names'], args['noHistConfig']) - if not args['test']: - - bkgselector = SelectorTools.SelectorDriver(args['analysis']+"Bkg", args['selection'], args['input_tier'], args['year']) - bkgselector.setOutputfile(fOut.GetName()) - bkgselector.setInputs(sf_inputs+fr_inputs+hist_inputs) - bkgselector.setSumWeights(False) - bkgselector.setNtupeType("UWVV" if args['uwvv'] else "NanoAOD") - if args['uwvv']: - logging.debug("Processing channels " % args['channels']) - bkgselector.setChannels(args['channels']) - bkgselector.setNumCores(args['numCores']) - - if args['filenames']: - bkgselector.setDatasets(args['filenames']) - else: - bkgselector.setFileList(*args['inputs_from_file']) - - background = bkgselector.applySelector() + #if not args['test']: + + # bkgselector = SelectorTools.SelectorDriver(args['analysis']+"Bkg", args['selection'], args['input_tier'], args['year']) + # bkgselector.setOutputfile(fOut.GetName()) + # bkgselector.setInputs(sf_inputs+fr_inputs+hist_inputs) + # bkgselector.setSumWeights(False) + # bkgselector.setNtupeType("UWVV" if args['uwvv'] else "NanoAOD") + # if args['uwvv']: + # logging.debug("Processing channels " % args['channels']) + # bkgselector.setChannels(args['channels']) + # bkgselector.setNumCores(args['numCores']) + + # if args['filenames']: + # bkgselector.setDatasets(args['filenames']) + # else: + # bkgselector.setFileList(*args['inputs_from_file']) + + # background = bkgselector.applySelector() selector = SelectorTools.SelectorDriver(args['analysis'], args['selection'], args['input_tier'], args['year']) selector.setOutputfile(fOut.GetName()) From 99f745dab132aa17de821516765b7119c8dfd76f Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Fri, 30 Aug 2019 06:38:24 -0400 Subject: [PATCH 17/53] Temporary masks to uncertainties, theory hists added But not currently scaled properly --- Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt | 3 ++- Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt | 5 +++-- Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt | 3 ++- Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt | 5 +++-- Utilities/python/HistTools.py | 4 +++- Utilities/scripts/setupZZCombine.py | 6 ++++-- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt index 187cdee7..05cbd9ed 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt @@ -8,7 +8,8 @@ shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qq shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +#shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL bin eeee diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt index 90267a19..7bb80362 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt @@ -8,7 +8,8 @@ shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qq shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +#shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL bin eemm @@ -32,6 +33,6 @@ trigger_mm_17 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt index 667228dc..e46806d1 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt @@ -8,6 +8,7 @@ shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qq shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +#shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL @@ -32,6 +33,6 @@ trigger_mm_17 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt index 31455a37..ec5791df 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt @@ -8,7 +8,8 @@ shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qq shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +#shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL bin mmmm @@ -30,6 +31,6 @@ bkg_mm_17 lnN - - - trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 - trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index 110f8476..53d12b9c 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -163,6 +163,7 @@ def getVariationHists(hists, process_name, histUp_name, up_action, down_action, # For now, skip this check on aQGC for now, since they're screwed up if "aqgc" in process_name: continue isValidVariation(process_name, histCentral, histUp, histDown) + #print "For process %s: Central, down, up: %s, %s, %s" % (process_name, histCentral.Integral(), histUp.Integral(), histDown.Integral()) return [histUp, histDown] def isValidVariation(process_name, histCentral, histUp, histDown): @@ -266,7 +267,7 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False sumweights_hist = hist_file.Get("/".join([directory.split("__")[0], "sumweights"])) if not sumweights_hist: raise RuntimeError("Failed to find sumWeights for dataset %s" % directory) - sumweights = sumweights_hist.Integral() + sumweights = sumweights_hist.Integral(1, sumweights_hist.GetNbinsX()+2) sumweights_hist.Delete() for histname in hists: if histname == "sumweights": continue @@ -280,6 +281,7 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False sumhist = composite.FindObject(hist.GetName()) if sumweights: hist.Scale(members[dirname.split("__")[0]]*1000*lumi/sumweights) + #print "Scaling by lumi*xsec / sumweights", lumi, members[dirname.split("__")[0]], sumweights addOverflowAndUnderflow(hist, underflow, overflow) else: raise RuntimeError("hist %s was not produced for " diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index 654ae627..f477e483 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -29,7 +29,8 @@ "2016" : "/eos/user/k/kelong/HistFiles/ZZ/Hists29Aug2019-ZZ4l2016.root", } channels = ["eeee", "eemm", "mmee", "mmmm"] -nuissance_map = {"eeee" : 9, "eemm" : 10, "mmee" : 10, "mmmm" : 8, "all" : 6} +#nuissance_map = {"eeee" : 9, "eemm" : 10, "mmee" : 10, "mmmm" : 8, "all" : 6} +nuissance_map = {"eeee" : 8, "eemm" : 9, "mmee" : 9, "mmmm" : 7, "all" : 5} #fitvar = "ZZPt" #rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) fitvar = "Mass" @@ -53,7 +54,8 @@ #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s%sFit" % (fitvar, year)) for process in plot_groups: #Turn this back on when the theory uncertainties are added - addTheory = process not in ["nonprompt"] and False + #addTheory = process not in ["nonprompt"] and False + addTheory = process not in ["nonprompt", "data"] cardtool.loadHistsForProcess(process, addTheory) cardtool.writeProcessHistsToOutput(process) From a28f4ce7afd0a1e520dfc2abf474a3655389514f Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 2 Sep 2019 06:16:17 -0400 Subject: [PATCH 18/53] Kind of working with scale histograms But not sure they're totally correct yet --- .../ZZSelection/ZZ_template2016_all.txt | 6 ++++++ .../ZZSelection/ZZ_template2016_eeee.txt | 9 ++++++-- .../ZZSelection/ZZ_template2016_eemm.txt | 9 ++++++-- .../ZZSelection/ZZ_template2016_mmee.txt | 7 ++++++- .../ZZSelection/ZZ_template2016_mmmm.txt | 9 ++++++-- Utilities/python/CombineCardTools.py | 2 +- Utilities/python/HistTools.py | 21 ++++++++++--------- Utilities/scripts/setupZZCombine.py | 15 ++++++------- 8 files changed, 53 insertions(+), 25 deletions(-) diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt index 72bf515e..a8ded14e 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt @@ -31,3 +31,9 @@ CMS_eff_e shape 1 1 1 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 CMS_pileup shape 1 1 1 1 0 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt index 05cbd9ed..cf86640e 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt @@ -8,8 +8,7 @@ shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qq shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -#shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL bin eeee @@ -35,3 +34,9 @@ CMS_RecoEff_e shape 1 1 1 #CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt index 7bb80362..fd7e92f5 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt @@ -8,8 +8,7 @@ shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qq shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -#shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL bin eemm @@ -36,3 +35,9 @@ CMS_eff_m shape 1 1 1 #CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt index e46806d1..e163bdd3 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt @@ -8,7 +8,6 @@ shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qq shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -#shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL @@ -36,3 +35,9 @@ CMS_eff_m shape 1 1 1 #CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt index ec5791df..eb50e8fc 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt @@ -8,8 +8,7 @@ shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qq shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL -#shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL -shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL bin mmmm @@ -34,3 +33,9 @@ CMS_eff_m shape 1 1 1 #CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Utilities/python/CombineCardTools.py b/Utilities/python/CombineCardTools.py index 14ba5480..4033a6fe 100644 --- a/Utilities/python/CombineCardTools.py +++ b/Utilities/python/CombineCardTools.py @@ -176,7 +176,7 @@ def loadHistsForProcess(self, processName, addTheory, scaleNorm=1): self.combineChannels(group) #TODO: Make optional map(HistTools.addOverflow, filter(lambda x: (x.GetName() not in processedHists), group)) - if "data" not in group.GetName(): + if "data" not in group.GetName().lower(): map(HistTools.removeZeros, filter(lambda x: (x.GetName() not in processedHists), group)) self.histData[processName] = group diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index 53d12b9c..29d31cbe 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -1,5 +1,6 @@ import array import ROOT +import logging def getDifference(fOut, name, dir1, dir2, ratioFunc=None): differences = ROOT.TList() @@ -12,11 +13,11 @@ def getDifference(fOut, name, dir1, dir2, ratioFunc=None): diff = hist1.Clone() diff.Add(hist2, -1) elif not hist1: - print "WARNING: Hist %s was not produced for " \ - "dataset(s) %s" % (histname, dir1) + logging.warning("Hist %s was not produced for " \ + "dataset(s) %s" % (histname, dir1)) elif not hist2: - print "WARNING: Hist %s was not produced for " \ - "dataset(s) %s" % (histname, dir2) + logging.warning("Hist %s was not produced for " \ + "dataset(s) %s" % (histname, dir2)) differences.Add(diff) if ratioFunc: ratios = ratioFunc(differences) @@ -162,13 +163,13 @@ def getVariationHists(hists, process_name, histUp_name, up_action, down_action, histDown.SetBinContent(i, down_action(vals)) # For now, skip this check on aQGC for now, since they're screwed up if "aqgc" in process_name: continue + logging.debug("For process %s: Central, down, up: %s, %s, %s" % (process_name, histCentral.Integral(), histDown.Integral(), histUp.Integral())) isValidVariation(process_name, histCentral, histUp, histDown) - #print "For process %s: Central, down, up: %s, %s, %s" % (process_name, histCentral.Integral(), histUp.Integral(), histDown.Integral()) return [histUp, histDown] def isValidVariation(process_name, histCentral, histUp, histDown): for i in range(0, histCentral.GetNbinsX()+2): - if histDown.GetBinContent(i) >= histCentral.GetBinContent(i) and histCentral.GetBinContent(i) > 0: + if histDown.GetBinContent(i) >= histCentral.GetBinContent(i) and histCentral.GetBinContent(i) > 0.01: raise RuntimeError("Down variation >= central value for %s, hist %s" " This shouldn't be possible.\n" "down_hist: %0.4f\n" @@ -176,11 +177,11 @@ def isValidVariation(process_name, histCentral, histUp, histDown): "bin: %i\n" % (process_name, histDown.GetName(), histDown.GetBinContent(i), histCentral.GetBinContent(i), i) ) - if histUp.GetBinContent(i) <= histCentral.GetBinContent(i) and histCentral.GetBinContent(i) > 0: + if histUp.GetBinContent(i) <= histCentral.GetBinContent(i) and histCentral.GetBinContent(i) > 0.01: raise RuntimeError("Up variation <= central value for %s, hist %s." " This shouldn't be possible.\n" - "up_hist: %0.2f\n" - "central_hist: %0.2f\n" + "up_hist: %0.4f\n" + "central_hist: %0.4f\n" "bin: %i\n" % (process_name, histUp.GetName(), histUp.GetBinContent(i), histCentral.GetBinContent(i), i) ) @@ -258,7 +259,7 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False if "aqgc" in directory: directory = name if not hist_file.Get(directory): - print "Skipping invalid filename %s" % directory + logging.warning("Skipping invalid filename %s" % directory) continue if hists == []: hists = [i.GetName() for i in hist_file.Get(directory).GetListOfKeys()] diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index f477e483..e10d22b6 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -5,6 +5,8 @@ import logging import array +#logging.basicConfig(level=logging.DEBUG) + cardtool = CombineCardTools.CombineCardTools() manager_path = ConfigureJobs.getManagerPath() @@ -24,27 +26,27 @@ xsecs = ConfigureJobs.getListOfFilesWithXSec([f for files in plotGroupsMap.values() for f in files]) lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.74} -fileMap = { "2017" : "/eos/user/k/kelong/HistFiles/ZZ/Hists13Aug2019-ZZ4l2017Full.root", +fileMap = { "2017" : "/eos/user/k/kelong/HistFiles/ZZ/Hists29Aug2019-ZZ4l2017.root", "2018" : "/eos/user/k/kelong/HistFiles/ZZ/Hists13Aug2019-ZZ4l2018Full.root", - "2016" : "/eos/user/k/kelong/HistFiles/ZZ/Hists29Aug2019-ZZ4l2016.root", + "2016" : "/afs/cern.ch/user/u/uhussain/public/ForKenneth/Hists30Aug2019-ZZ4l2016.root", } channels = ["eeee", "eemm", "mmee", "mmmm"] #nuissance_map = {"eeee" : 9, "eemm" : 10, "mmee" : 10, "mmmm" : 8, "all" : 6} -nuissance_map = {"eeee" : 8, "eemm" : 9, "mmee" : 9, "mmmm" : 7, "all" : 5} +nuissance_map = {"eeee" : 12, "eemm" : 13, "mmee" : 13, "mmmm" : 11, "all" : 9} #fitvar = "ZZPt" #rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) fitvar = "Mass" rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) cardtool.setFitVariable(fitvar) cardtool.setRebin(rebin) -#cardtool.setFitVariableAppend("nonprompt", "Fakes") +cardtool.setFitVariableAppend("nonprompt", "Fakes") cardtool.setProcesses(plotGroupsMap) cardtool.setChannels(channels) cardtool.setCrosSectionMap(xsecs) cardtool.setVariations(["CMS_eff_e", "CMS_RecoEff_e", "CMS_eff_m", ],#"CMS_pileup"], exclude=["nonprompt", "data"]) +#cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) -#cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2017Fit" % fitvar) for year in ["2016"]:#fileMap.keys(): cardtool.setLumi(lumiMap[year]) @@ -54,8 +56,7 @@ #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s%sFit" % (fitvar, year)) for process in plot_groups: #Turn this back on when the theory uncertainties are added - #addTheory = process not in ["nonprompt"] and False - addTheory = process not in ["nonprompt", "data"] + addTheory = process not in ["nonprompt", "data"] #and False cardtool.loadHistsForProcess(process, addTheory) cardtool.writeProcessHistsToOutput(process) From afb817daf6f98f3c90d941aa82ff5dc111d8fc46 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 2 Sep 2019 07:43:00 -0400 Subject: [PATCH 19/53] Latest Selector code --- Utilities/python/ConfigureJobs.py | 2 +- Utilities/python/SelectorTools.py | 4 +-- interface/SelectorBase.h | 2 ++ interface/ZZSelector.h | 2 +- runZZ4l2017.sh | 2 +- runZZ4l2018.sh | 2 +- src/SelectorBase.cc | 2 ++ src/ZZBackgroundSelector.cc | 8 ++++- src/ZZSelector.cc | 54 ++++++++++++++++++++++--------- src/ZZSelectorBase.cc | 2 +- 10 files changed, 56 insertions(+), 24 deletions(-) diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index e1499579..a00cc5bc 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -72,7 +72,7 @@ def getListOfEWKFilenames(analysis): "ggZZ4t", "ggZZ2e2mu", "ggZZ2e2tau", - #"ggZZ2mu2tau", + "ggZZ2mu2tau", ] else: return [ diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 5403887b..2e442d98 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -129,8 +129,6 @@ def setDatasets(self, datalist): if "@" in dataset: dataset, file_path = [f.strip() for f in dataset.split("@")] else: - #if "Bkg" in self.analysis: - # self.analysis=self.analysis[:-3] try: file_path = ConfigureJobs.getInputFilesPath(dataset, self.input_tier, self.analysis) @@ -159,7 +157,7 @@ def processDataset(self, dataset, file_path, chan): select.SetInputList(self.inputs) self.addTNamed("name", dataset) # Only add for one channel - addSumweights = self.addSumweights and self.channels.index(chan) == 0 and "data" not in dataset + addSumweights = self.addSumweights and self.channels.index(chan) == 0 and "data" not in dataset and "Background" not in self.selector_name if addSumweights: sumweights_hist = ROOT.gROOT.FindObject("sumweights") # Avoid accidentally combining sumweights across datasets diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index 468ce516..16f88de0 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -95,6 +95,7 @@ class SelectorBase : public TSelector { {"Zselection", Zselection}, {"ZZselection", ZZselection}, {"SignalSync", ZZselection}, + {"AllData", ZZselection}, {"LooseLeptons", ZZselection}, {"Wselection_Full", Wselection_Full}, {"FakeRateSelectionLoose", FakeRateSelectionLoose}, @@ -142,6 +143,7 @@ class SelectorBase : public TSelector { TH1D* sumWeightsHist_; bool doSystematics_; + bool isNonPrompt_; bool addSumweights_; bool applyScaleFactors_; bool applyPrefiringCorr_; diff --git a/interface/ZZSelector.h b/interface/ZZSelector.h index 9e922ad9..ff43f361 100644 --- a/interface/ZZSelector.h +++ b/interface/ZZSelector.h @@ -73,7 +73,7 @@ public : void LoadBranchesUWVV(Long64_t entry, std::pair variation) override; void FillHistograms(Long64_t entry, std::pair variation) override; void ApplyScaleFactors(); - bool PassesZZSelection(); + bool PassesZZSelection(bool nonPrompt); bool PassesZZjjSelection(); bool PassesHZZSelection(); unsigned int GetLheWeightInfo(); diff --git a/runZZ4l2017.sh b/runZZ4l2017.sh index 4b2d187d..f3026a9a 100755 --- a/runZZ4l2017.sh +++ b/runZZ4l2017.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 +./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 --with_background -sf data/scaleFactorsZZ4l2017.root diff --git a/runZZ4l2018.sh b/runZZ4l2018.sh index 25c83250..c1c22889 100755 --- a/runZZ4l2018.sh +++ b/runZZ4l2018.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file zzPowheg2018 --test --uwvv -c eeee,eemm,mmee,mmmm -f zz4l-powheg +./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file test2018 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2018 -j 12 --with_background -sf data/scaleFactorsZZ4l2018.root diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index 4a1d288a..2ca0af3b 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -256,7 +256,9 @@ void SelectorBase::InitializeHistogramFromConfig(std::string name, std::string c } } // Weight hists must be subset of 1D hists! + //std::cout<<"size of weighthistMap1D_: "<(weighthistMap1D_[histName], (name+"_lheWeights_"+channel).c_str(), histData[0].c_str(), nbins, xmin, xmax, 1000, 0, 1000); diff --git a/src/ZZBackgroundSelector.cc b/src/ZZBackgroundSelector.cc index cbc9ddd5..2f8988b4 100644 --- a/src/ZZBackgroundSelector.cc +++ b/src/ZZBackgroundSelector.cc @@ -92,8 +92,14 @@ float ZZBackgroundSelector::getEventWeight(Long64_t entry) { void ZZBackgroundSelector::LoadBranchesUWVV(Long64_t entry, std::pair variation) { ZZSelector::LoadBranchesUWVV(entry, variation); - SetZ1Z2Masses(); + SetZ1Z2Masses(); + if (!ZZSelection()){ + return;} + //std::cout<<"isNonPrompt_ from ZZSelector: "<GetEntry(entry); b_l2IsIso->GetEntry(entry); b_l3IsTight->GetEntry(entry); - b_l3IsIso->GetEntry(entry); + b_l3IsIso->GetEntry(entry); if (channel_ == eeee || channel_ == eemm || channel_ == mmee){ b_l1IsGap->GetEntry(entry); b_l2IsGap->GetEntry(entry); From 1e0e0bf51e576fe97413051fc1743d725c95dc6d Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 2 Sep 2019 07:54:59 -0400 Subject: [PATCH 20/53] Trying to debug scale weights --- Utilities/python/CombineCardTools.py | 2 +- Utilities/python/HistTools.py | 1 - Utilities/scripts/setupZZCombine.py | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Utilities/python/CombineCardTools.py b/Utilities/python/CombineCardTools.py index 4033a6fe..113e010f 100644 --- a/Utilities/python/CombineCardTools.py +++ b/Utilities/python/CombineCardTools.py @@ -145,7 +145,7 @@ def loadHistsForProcess(self, processName, addTheory, scaleNorm=1): group = HistTools.makeCompositeHists(self.inputFile, processName, {proc : self.crossSectionMap[proc] for proc in self.processes[processName]}, - self.lumi, plotsToRead, rebin=self.rebin) + self.lumi, plotsToRead, rebin=self.rebin, overflow=False) fitVariable = self.getFitVariable(processName) #TODO:Make optional diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index 29d31cbe..b529997b 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -282,7 +282,6 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False sumhist = composite.FindObject(hist.GetName()) if sumweights: hist.Scale(members[dirname.split("__")[0]]*1000*lumi/sumweights) - #print "Scaling by lumi*xsec / sumweights", lumi, members[dirname.split("__")[0]], sumweights addOverflowAndUnderflow(hist, underflow, overflow) else: raise RuntimeError("hist %s was not produced for " diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index e10d22b6..5b6e0eac 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -5,7 +5,7 @@ import logging import array -#logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(level=logging.DEBUG) cardtool = CombineCardTools.CombineCardTools() @@ -37,6 +37,7 @@ #rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) fitvar = "Mass" rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) +#fitvar = "yield" cardtool.setFitVariable(fitvar) cardtool.setRebin(rebin) cardtool.setFitVariableAppend("nonprompt", "Fakes") From 2bd1f72fc9c3c17d19ccc39f063bfbc3a329ba3d Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 2 Sep 2019 08:52:57 -0400 Subject: [PATCH 21/53] Set weight_info after isMC_ has already been set Fixes bug in scale histograms --- Utilities/scripts/makeHistFile.py | 2 ++ src/ZZSelector.cc | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 1764eea4..61d14db8 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -11,6 +11,8 @@ import datetime import subprocess +#logging.basicConfig(level=logging.DEBUG) + def getComLineArgs(): parser = UserInput.getDefaultParser() parser.add_argument("--lumi", "-l", type=float, diff --git a/src/ZZSelector.cc b/src/ZZSelector.cc index af78ec7d..7b495265 100644 --- a/src/ZZSelector.cc +++ b/src/ZZSelector.cc @@ -4,10 +4,6 @@ void ZZSelector::Init(TTree *tree) { - weight_info_ = 0; - if (isMC_) { - weight_info_ = GetLheWeightInfo(); - } systematics_ = { {electronRecoEffUp,"CMS_RecoEff_eUp"}, {electronRecoEffDown,"CMS_RecoEff_eDown"}, @@ -63,6 +59,7 @@ void ZZSelector::Init(TTree *tree) void ZZSelector::SetBranchesUWVV() { ZZSelectorBase::SetBranchesUWVV(); if (isMC_) { + weight_info_ = GetLheWeightInfo(); if (weight_info_ > 0) fChain->SetBranchAddress("scaleWeights", &scaleWeights, &b_scaleWeights); if ((weight_info_ == 2 || weight_info_ == 3) && doSystematics_) @@ -658,7 +655,10 @@ void ZZSelector::FillHistograms(Long64_t entry, std::pair Date: Mon, 2 Sep 2019 09:01:45 -0400 Subject: [PATCH 22/53] Latest stuff --- src/SelectorBase.cc | 6 +++--- src/ZZBackgroundSelector.cc | 1 + src/ZZSelector.cc | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index 2ca0af3b..23e4e46a 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -81,7 +81,7 @@ void SelectorBase::Init(TTree *tree) if (name_.find("data") == std::string::npos){ isMC_ = true; } - if (doSystematics_ && isMC_) // isNonpromptEstimate? + if (doSystematics_ && isMC_ && !isNonPrompt_) // isNonpromptEstimate? variations_.insert(systematics_.begin(), systematics_.end()); currentHistDir_ = dynamic_cast(fOutput->FindObject(name_.c_str())); @@ -238,7 +238,7 @@ void SelectorBase::InitializeHistogramFromConfig(std::string name, std::string c //std::cout<<"doSystematics: "<(hists2D_[histName], histName.c_str(), histData[0].c_str(),nbins, xmin, xmax, nbinsy, ymin, ymax); - if (doSystematics_ && std::find(systHists2D_.begin(), systHists2D_.end(), histName) != systHists2D_.end()) { + if (doSystematics_ && !isNonPrompt_ && std::find(systHists2D_.begin(), systHists2D_.end(), histName) != systHists2D_.end()) { for (auto& syst : systematics_) { std::string syst_hist_name = name+"_"+syst.second + "_" + channel; hists2D_[syst_hist_name] = {}; diff --git a/src/ZZBackgroundSelector.cc b/src/ZZBackgroundSelector.cc index 2f8988b4..6030bf80 100644 --- a/src/ZZBackgroundSelector.cc +++ b/src/ZZBackgroundSelector.cc @@ -98,6 +98,7 @@ void ZZBackgroundSelector::LoadBranchesUWVV(Long64_t entry, std::pair 0) fChain->SetBranchAddress("scaleWeights", &scaleWeights, &b_scaleWeights); - if ((weight_info_ == 2 || weight_info_ == 3) && doSystematics_) + if ((weight_info_ == 2 || weight_info_ == 3) && doSystematics_ && !isNonPrompt_) fChain->SetBranchAddress("pdfWeights", &pdfWeights, &b_pdfWeights); } fChain->SetBranchAddress("Mass", &Mass, &b_Mass); @@ -122,7 +122,7 @@ void ZZSelector::LoadBranchesUWVV(Long64_t entry, std::pair 0) { b_scaleWeights->GetEntry(entry); lheWeights = *scaleWeights; From 8b62d49b31a8d6596871848dc6c84d4820dd06cd Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 2 Sep 2019 09:09:05 -0400 Subject: [PATCH 23/53] Adding syst hists to histmap handled elsewhere --- src/SelectorBase.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index 67fa9ec4..2ca0af3b 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -194,9 +194,7 @@ void SelectorBase::InitializeHistogramsFromConfig() { if (histInfo == nullptr ) throw std::domain_error("Can't initialize histograms without passing histogram information to TSelector"); - std::vector allhists1D = hists1D_; - allhists1D.insert(allhists1D.end(), systHists_.begin(), systHists_.end()); - InitializeHistMap(allhists1D, histMap1D_); + InitializeHistMap(hists1D_, histMap1D_); InitializeHistMap(weighthists1D_, weighthistMap1D_); for (auto && entry : *histInfo) { From 0b2133597a29de190afd41cc55c1afb4ae243924 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 2 Sep 2019 16:28:59 -0400 Subject: [PATCH 24/53] ConfigJobs version --- Utilities/python/ConfigureJobs.py | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index ceae0b91..d0106b37 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -196,6 +196,42 @@ def getListOfFiles(filelist, selection, manager_path="", analysis=""): names += [x for x in allnames if "data" in x] else: names += allnames + elif "ZZ4l2016" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2016/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames + elif "ZZ4l2017" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2017/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames + elif "ZZ4l2018" in name: + dataset_file = manager_path + \ + "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2018/%s.json" % selection + allnames = json.load(open(dataset_file)).keys() + print allnames + if "nodata" in name: + nodata = [x for x in allnames if "data" not in x] + names += nodata + elif "data" in name: + names += [x for x in allnames if "data" in x] + else: + names += allnames elif "*" in name: names += fnmatch.filter(valid_names, name) else: From 42c8e7ae4320257e1f3daccaf9f9e7c1ee16940d Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Tue, 3 Sep 2019 10:18:03 -0400 Subject: [PATCH 25/53] Update ZZ cards to work for full Run II --- .../ZZSelection/ZZ_template2017_all.txt | 8 +++++++- .../ZZSelection/ZZ_template2017_eeee.txt | 8 +++++++- .../ZZSelection/ZZ_template2017_eemm.txt | 8 +++++++- .../ZZSelection/ZZ_template2017_mmee.txt | 8 +++++++- .../ZZSelection/ZZ_template2017_mmmm.txt | 8 +++++++- .../ZZSelection/ZZ_template2018_all.txt | 10 ++++++++-- .../ZZSelection/ZZ_template2018_eeee.txt | 8 +++++++- .../ZZSelection/ZZ_template2018_eemm.txt | 8 +++++++- .../ZZSelection/ZZ_template2018_mmee.txt | 8 +++++++- .../ZZSelection/ZZ_template2018_mmmm.txt | 8 +++++++- Utilities/scripts/setupZZCombine.py | 14 +++++++------- 11 files changed, 78 insertions(+), 18 deletions(-) diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt index 72bf515e..269964ba 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt @@ -30,4 +30,10 @@ trigger lnN 1.020 1.020 1.020 CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt index 1d132199..cf86640e 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt @@ -31,6 +31,12 @@ trigger_eeee_17 lnN 1.01 1.01 1.01 trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt index 90267a19..fd7e92f5 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt @@ -32,6 +32,12 @@ trigger_mm_17 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt index 667228dc..e163bdd3 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt @@ -32,6 +32,12 @@ trigger_mm_17 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt index 31455a37..eb50e8fc 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt @@ -30,6 +30,12 @@ bkg_mm_17 lnN - - - trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 - trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt index 607497a4..9f1573a8 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt @@ -12,7 +12,7 @@ shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes nonprompt/${fi shapes data_obs * ${output_file} data/${fit_variable} bin all -observation -1 +observation ${data} ------------ #nonprompt is data-driven Z+X background @@ -30,4 +30,10 @@ trigger lnN 1.020 1.020 1.020 CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt index d2f0d167..630c5014 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt @@ -31,6 +31,12 @@ trigger_eeee_18 lnN 1.01 1.01 1.01 trigger_ee_18 lnN 1.01 1.01 1.01 1.01 - CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt index 9d4dbeeb..6d929c1e 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt @@ -32,6 +32,12 @@ trigger_mm_18 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt index fd821077..d5f2f5b4 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt @@ -32,6 +32,12 @@ trigger_mm_18 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt index 4ce6f909..d47856f0 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt @@ -30,6 +30,12 @@ bkg_mm_18 lnN - - - trigger_mmmm_18 lnN 1.01 1.01 1.01 1.01 - trigger_mm_18 lnN 1.01 1.01 1.01 1.01 - CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index 5b6e0eac..d6b46aca 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -5,7 +5,7 @@ import logging import array -logging.basicConfig(level=logging.DEBUG) +#logging.basicConfig(level=logging.DEBUG) cardtool = CombineCardTools.CombineCardTools() @@ -26,9 +26,9 @@ xsecs = ConfigureJobs.getListOfFilesWithXSec([f for files in plotGroupsMap.values() for f in files]) lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.74} -fileMap = { "2017" : "/eos/user/k/kelong/HistFiles/ZZ/Hists29Aug2019-ZZ4l2017.root", - "2018" : "/eos/user/k/kelong/HistFiles/ZZ/Hists13Aug2019-ZZ4l2018Full.root", - "2016" : "/afs/cern.ch/user/u/uhussain/public/ForKenneth/Hists30Aug2019-ZZ4l2016.root", +fileMap = { "2016" : "/eos/user/k/kelong/HistFiles/ZZ/Hists02Sep2019-ZZ4l2016.root", + "2017" : "/eos/user/k/kelong/HistFiles/ZZ/Hists02Sep2019-ZZ4l2017.root", + "2018" : "/eos/user/k/kelong/HistFiles/ZZ/Hists02Sep2019-ZZ4l2018.root", } channels = ["eeee", "eemm", "mmee", "mmmm"] #nuissance_map = {"eeee" : 9, "eemm" : 10, "mmee" : 10, "mmmm" : 8, "all" : 6} @@ -38,8 +38,8 @@ fitvar = "Mass" rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) #fitvar = "yield" -cardtool.setFitVariable(fitvar) cardtool.setRebin(rebin) +cardtool.setFitVariable(fitvar) cardtool.setFitVariableAppend("nonprompt", "Fakes") cardtool.setProcesses(plotGroupsMap) cardtool.setChannels(channels) @@ -47,9 +47,9 @@ cardtool.setVariations(["CMS_eff_e", "CMS_RecoEff_e", "CMS_eff_m", ],#"CMS_pileup"], exclude=["nonprompt", "data"]) #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) -cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) +cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%sFitFullRunII" % fitvar) -for year in ["2016"]:#fileMap.keys(): +for year in fileMap.keys(): cardtool.setLumi(lumiMap[year]) cardtool.setInputFile(fileMap[year]) print fileMap[year], lumiMap[year] From 4dbb5d50098928752e9b83ffb83de75c16dc73b1 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Thu, 5 Sep 2019 11:16:45 -0400 Subject: [PATCH 26/53] All updates --- ScaleFactors/testScales.py | 64 ++++++++++++++++------------- Templates/config.uhussain | 10 +++++ Utilities/python/HistTools.py | 6 +-- Utilities/scripts/setupZZCombine.py | 15 +++---- createSignal16.sh | 1 + recipe/setup.sh | 2 +- src/ScaleFactor.cc | 9 +++- src/ZZSelector.cc | 4 +- 8 files changed, 65 insertions(+), 46 deletions(-) create mode 100644 Templates/config.uhussain create mode 100755 createSignal16.sh diff --git a/ScaleFactors/testScales.py b/ScaleFactors/testScales.py index 3283b419..d4536106 100755 --- a/ScaleFactors/testScales.py +++ b/ScaleFactors/testScales.py @@ -25,41 +25,47 @@ # Generate with setupScaleFactors.py # Will need appropriate files in ../data/ -fScales = ROOT.TFile('../data/scaleFactors.root') +fScales = ROOT.TFile('../data/scaleFactorsZZ4l2017.root') pu = fScales.Get('pileupSF') -muonIso = fScales.Get('muonIsoSF') -muonId = fScales.Get('muonTightIdSF') -electronTightId = fScales.Get('electronTightIdSF') -electronMediumId = fScales.Get('electronMediumIdSF') +#muonIso = fScales.Get('muonIsoSF') +#muonId = fScales.Get('electronLowRecoSF') +#electronTightId = fScales.Get('electronTightIdSF') +#electronMediumId = fScales.Get('electronMediumIdSF') -#mCBTightFakeRate = fScales.Get("mCBTightFakeRate_Svenja") -#mCBMedFakeRate = fScales.Get("mCBMedFakeRate_Svenja") -#eCBTightFakeRate = fScales.Get("eCBTightFakeRate_Svenja") -#eCBMedFakeRate = fScales.Get("eCBMedFakeRate_Svenja") -mCBTightFakeRate = fScales.Get("mCBTightFakeRate") -eCBTightFakeRate = fScales.Get("eCBTightFakeRate") +mZZTightFakeRate = fScales.Get("mZZTightFakeRate") +eZZTightFakeRate = fScales.Get("eZZTightFakeRate") + +muonMoriondSF= fScales.Get('muonMoriond18SF') +electronLowRecoSF = fScales.Get('electronLowReco18SF') +electronRecoSF = fScales.Get('electronReco18SF') +electronMoriondSF = fScales.Get('electronMoriond18SF') +electronMoriondGapSF = fScales.Get('electronMoriond18GapSF') + + +#mCBTightFakeRate = fScales.Get("mCBTightFakeRate") +#eCBTightFakeRate = fScales.Get("eCBTightFakeRate") del fScales # Make sure we don't rely on file being open pu.RegisterGlobalFunction() print "pileupSF(3) = ", ROOT.pileupSF(3) dummyTree.Scan('10+10*randVal : pileupSF(10+10*randVal)', '', '', 10) -muonIso.RegisterGlobalFunction(2) # 2D function -muonId.RegisterGlobalFunction(2) # 2D function -print "muonIsoSF(1.1, 30) = ", ROOT.muonIsoSF(1.1, 30) -print "muonTightIdSF(1.1, 30) = ", ROOT.muonTightIdSF(1.1, 30) -dummyTree.Scan('abs(randVal*2) : randVal2*5+30 : muonIsoSF(abs(randVal*2), randVal2*5+30)', '', '', 10) -dummyTree.Scan('abs(randVal*2) : randVal2*5+30 : muonTightIdSF(abs(randVal*2), randVal2*5+30)', '', '', 10) - -electronMediumId.RegisterGlobalFunction(2) # 2D function -electronTightId.RegisterGlobalFunction(2) # 2D function -dummyTree.Scan('abs(randVal*2) : randVal2*5+30 : electronMediumIdSF(abs(randVal*2), randVal2*5+30)', '', '', 10) -dummyTree.Scan('abs(randVal*2) : randVal2*5+30 : electronTightIdSF(abs(randVal*2), randVal2*5+30)', '', '', 10) - -mCBTightFakeRate.RegisterGlobalFunction(2) # 2D function -print "mCBTightFakeRate(1.1, 30) = ", ROOT.mCBTightFakeRate(30, 1.1) -dummyTree.Scan('abs(randVal*2) : randVal2*10+30 : mCBTightFakeRate(randVal2*10+30, abs(randVal*2))', '', '', 10) +muonMoriondSF.RegisterGlobalFunction(2) # 2D function +electronLowRecoSF.RegisterGlobalFunction(2) # 2D function +print "muonMoriondSF(1.1, 30) = ", ROOT.muonMoriond18SF(1.1, 30) +print "electronLowRecoSF(1.1, 30) = ", ROOT.electronLowReco18SF(1.1, 30) +dummyTree.Scan('abs(randVal*2) : randVal2*5+30 : muonMoriond18SF(abs(randVal*2), randVal2*5+30)', '', '', 10) +dummyTree.Scan('abs(randVal*2) : randVal2*5+30 : electronLowReco18SF(abs(randVal*2), randVal2*5+30)', '', '', 10) -eCBTightFakeRate.RegisterGlobalFunction(2) # 2D function -print "eCBTightFakeRate(1.1, 30) = ", ROOT.eCBTightFakeRate(30, 1.1) -dummyTree.Scan('abs(randVal*2) : randVal2*10+30 : eCBTightFakeRate(randVal2*10+30, abs(randVal*2))', '', '', 10) +#electronMediumId.RegisterGlobalFunction(2) # 2D function +#electronTightId.RegisterGlobalFunction(2) # 2D function +#dummyTree.Scan('abs(randVal*2) : randVal2*5+30 : electronMediumIdSF(abs(randVal*2), randVal2*5+30)', '', '', 10) +#dummyTree.Scan('abs(randVal*2) : randVal2*5+30 : electronTightIdSF(abs(randVal*2), randVal2*5+30)', '', '', 10) +# +#mCBTightFakeRate.RegisterGlobalFunction(2) # 2D function +#print "mCBTightFakeRate(1.1, 30) = ", ROOT.mCBTightFakeRate(30, 1.1) +#dummyTree.Scan('abs(randVal*2) : randVal2*10+30 : mCBTightFakeRate(randVal2*10+30, abs(randVal*2))', '', '', 10) +# +#eCBTightFakeRate.RegisterGlobalFunction(2) # 2D function +#print "eCBTightFakeRate(1.1, 30) = ", ROOT.eCBTightFakeRate(30, 1.1) +#dummyTree.Scan('abs(randVal*2) : randVal2*10+30 : eCBTightFakeRate(randVal2*10+30, abs(randVal*2))', '', '', 10) diff --git a/Templates/config.uhussain b/Templates/config.uhussain new file mode 100644 index 00000000..1f93133f --- /dev/null +++ b/Templates/config.uhussain @@ -0,0 +1,10 @@ +[Setup] +user = uhussain +analysis = ZZ +dataset_manager_path = /afs/cern.ch/user/u/%(user)s/work +dataset_manager_name = ZZ4lRun2DatasetManager +combine_path = %(dataset_manager_path)s/HiggsCombine/CMSSW_10_2_13/src/HiggsAnalysis/CombinedLimit +output_path = /eos/user/u/%(user)s/%(analysis)sAnalysisData +fakeRate_output = %(output_path)s/FakesRates +hist_output = %(output_path)s/HistFiles +combine_output = %(output_path)s/CombineData diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index b529997b..d61de3e4 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -251,10 +251,6 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False composite = ROOT.TList() composite.SetName(name) for directory in [str(i) for i in members.keys()]: - #TODO: Remove this, it's very WZ specific - dirname = directory - directory = directory.replace("_", "-") - directory = directory.replace("--", "__") # For aQGC, the different plot groups should already be in their own files if "aqgc" in directory: directory = name @@ -281,7 +277,7 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False if hist: sumhist = composite.FindObject(hist.GetName()) if sumweights: - hist.Scale(members[dirname.split("__")[0]]*1000*lumi/sumweights) + hist.Scale(members[directory.split("__")[0]]*1000*lumi/sumweights) addOverflowAndUnderflow(hist, underflow, overflow) else: raise RuntimeError("hist %s was not produced for " diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index 5b6e0eac..0787ce6f 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -10,28 +10,29 @@ cardtool = CombineCardTools.CombineCardTools() manager_path = ConfigureJobs.getManagerPath() -manager_name = ConfigureJobs.getManagerName() -sys.path.append("/".join([manager_path, "AnalysisDatasetManager", +manager_name = ConfigureJobs.getManagerName() +#print "manager_path: ", manager_path +#print "manager_name: ", manager_name +sys.path.append("/".join([manager_path, manager_name, "Utilities/python"])) - +#print sys.path from ConfigHistFactory import ConfigHistFactory config_factory = ConfigHistFactory( "%s/%s" % (manager_path, manager_name), "ZZ4l2016/LooseLeptons", ) -plot_groups = ["HZZ_signal","qqZZ_powheg","ggZZ", "VVV", "data", "nonprompt",] +plot_groups = ["HZZ-signal","qqZZ-powheg","ggZZ", "VVV", "data", "nonprompt",] plotGroupsMap = {name : config_factory.getPlotGroupMembers(name) for name in plot_groups} xsecs = ConfigureJobs.getListOfFilesWithXSec([f for files in plotGroupsMap.values() for f in files]) -lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.74} +lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.67} fileMap = { "2017" : "/eos/user/k/kelong/HistFiles/ZZ/Hists29Aug2019-ZZ4l2017.root", "2018" : "/eos/user/k/kelong/HistFiles/ZZ/Hists13Aug2019-ZZ4l2018Full.root", "2016" : "/afs/cern.ch/user/u/uhussain/public/ForKenneth/Hists30Aug2019-ZZ4l2016.root", } channels = ["eeee", "eemm", "mmee", "mmmm"] -#nuissance_map = {"eeee" : 9, "eemm" : 10, "mmee" : 10, "mmmm" : 8, "all" : 6} nuissance_map = {"eeee" : 12, "eemm" : 13, "mmee" : 13, "mmmm" : 11, "all" : 9} #fitvar = "ZZPt" #rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) @@ -47,7 +48,7 @@ cardtool.setVariations(["CMS_eff_e", "CMS_RecoEff_e", "CMS_eff_m", ],#"CMS_pileup"], exclude=["nonprompt", "data"]) #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) -cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) +cardtool.setOutputFolder("/eos/user/u/uhussain/CombineStudies/ZZ/%s2016Fit" % fitvar) for year in ["2016"]:#fileMap.keys(): cardtool.setLumi(lumiMap[year]) diff --git a/createSignal16.sh b/createSignal16.sh new file mode 100755 index 00000000..2cd96f81 --- /dev/null +++ b/createSignal16.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s SignalSync -l 35.9 -f 2016SignalSync -sf data/scaleFactorsZZ4l2018.root -ls Signal16 --test > eventlistSignal16_Usama_full.txt diff --git a/recipe/setup.sh b/recipe/setup.sh index dbccf094..c934ccce 100644 --- a/recipe/setup.sh +++ b/recipe/setup.sh @@ -1,6 +1,6 @@ #!/bin/bash -dataset_manager=$(./Utilities/scripts/getConfigValue.py dataset_manager_path)/AnalysisDatasetManager +dataset_manager=$(./Utilities/scripts/getConfigValue.py dataset_manager_path)/ZZ4lRun2DatasetManager pushd $CMSSW_BASE/src/Analysis/VVAnalysis/Cuts echo "INFO: Linking alias files" diff --git a/src/ScaleFactor.cc b/src/ScaleFactor.cc index 1542e430..26c5c776 100644 --- a/src/ScaleFactor.cc +++ b/src/ScaleFactor.cc @@ -110,15 +110,20 @@ double ScaleFactor::Evaluate2D(double x, double y, Variation var) const } else if ( var == ShiftUp && histShiftUp2D_ != nullptr ) { auto bin = histShiftUp2D_->FindBin(x, y); - return histShiftUp2D_->GetBinContent(bin); + //Don't forget this is done only to deal with special Muon "ERROR" histogram in 2017,2018 + //If you actually have a ShiftUp histogram then this would be wrong! + return histCentral2D_->GetBinContent(bin) + histShiftUp2D_->GetBinContent(bin); } else if ( var == ShiftUp && histCentral2D_ != nullptr ) { auto bin = histCentral2D_->FindBin(x, y); return histCentral2D_->GetBinContent(bin) + histCentral2D_->GetBinError(bin); } + + //Don't forget this is done only to deal with special Muon "ERROR" histogram in 2017,2018 + //If you actually have a ShiftUp histogram then this would be wrong! else if ( var == ShiftDown && histShiftDown2D_ != nullptr ) { auto bin = histShiftDown2D_->FindBin(x, y); - return histShiftDown2D_->GetBinContent(bin); + return histCentral2D_->GetBinContent(bin) - histShiftDown2D_->GetBinContent(bin); } else if ( var == ShiftDown && histCentral2D_ != nullptr ) { auto bin = histCentral2D_->FindBin(x, y); diff --git a/src/ZZSelector.cc b/src/ZZSelector.cc index abf1bb59..7e39c21b 100644 --- a/src/ZZSelector.cc +++ b/src/ZZSelector.cc @@ -655,10 +655,10 @@ void ZZSelector::FillHistograms(Long64_t entry, std::pair Date: Sun, 8 Sep 2019 09:43:58 -0400 Subject: [PATCH 27/53] Some degree of PDF uncertainties --- Utilities/python/CombineCardTools.py | 9 ++++---- Utilities/python/ConfigureJobs.py | 2 +- Utilities/python/HistTools.py | 33 ++++++++++++++-------------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Utilities/python/CombineCardTools.py b/Utilities/python/CombineCardTools.py index 113e010f..efc0de23 100644 --- a/Utilities/python/CombineCardTools.py +++ b/Utilities/python/CombineCardTools.py @@ -140,7 +140,7 @@ def listOfHistsByProcess(self, processName, addTheory): return plots # processName needs to match a PlotGroup - def loadHistsForProcess(self, processName, addTheory, scaleNorm=1): + def loadHistsForProcess(self, processName, addTheory, central=-1, scaleNorm=1): plotsToRead = self.listOfHistsByProcess(processName, addTheory) group = HistTools.makeCompositeHists(self.inputFile, processName, @@ -170,8 +170,9 @@ def loadHistsForProcess(self, processName, addTheory, scaleNorm=1): if not weightHist: logging.warning("Failed to find %s. Skipping" % self.weightHistName(chan, processName)) continue - scaleHists = HistTools.getScaleHists(weightHist, processName, self.rebin) - group.extend(scaleHists) + scaleHists = HistTools.getScaleHists(weightHist, processName, self.rebin, central=central) + pdfHists = HistTools.getPDFHists(weightHist, range(9,8+100), processName, self.rebin, central=central) + group.extend(scaleHists+pdfHists) #TODO: You may want to combine channels before removing zeros self.combineChannels(group) #TODO: Make optional @@ -197,7 +198,7 @@ def writeCards(self, chan, nuisances, year="", extraArgs={}): chan_dict["output_file"] = self.outputFile.GetName() outputCard = self.templateName.split("/")[-1].format(channel=chan, year=year) outputCard = outputCard.replace("template", "") - #outputCard = outputCard.replace("__", "_") + outputCard = outputCard.replace("__", "_") ConfigureJobs.fillTemplatedFile(self.templateName.format(channel=chan, year=year), "/".join([self.outputFolder, outputCard]), chan_dict diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index ceae0b91..623387c3 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -230,7 +230,7 @@ def getListOfFilesWithXSec(filelist, manager_path="", selection="ntuples"): mc_info = UserInput.readAllInfo("/".join([data_path, "montecarlo/*"])) info = {} for file_name in files: - if "data" in file_name.lower(): + if "data" in file_name.lower() or "nonprompt" in file_name.lower(): info.update({file_name : 1}) else: file_info = mc_info[file_name.split("__")[0]] diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index b529997b..49467804 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -114,6 +114,7 @@ def getStatHists(hist, name, chan, signal): return (stat_hists, variation_names) def getWeightHistProjection(init2D_hist, name, entry, rebin): + print name, entry hist_name = init2D_hist.GetName().replace("lheWeights", name+"_weight%i" % entry) tmphist = init2D_hist.ProjectionX("temp", entry, entry, "e") hist = tmphist.Clone(hist_name) if not rebin else tmphist.Rebin(len(rebin)-1, hist_name, rebin) @@ -130,10 +131,10 @@ def getLHEWeightHists(init2D_hist, entries, name, variation_name, rebin=None): def getPDFHists(init2D_hist, entries, name, rebin=None, central=0): hists, hist_name = getLHEWeightHists(init2D_hist, entries, name, "pdf", rebin) #return hists + upaction = lambda x: x[int(0.84*len(entries))] if central == -1 else x[central]*(1+getPDFPercentVariation(x)) + downaction = lambda x: x[int(0.16*len(entries))] if central == -1 else x[central]*(1+getPDFPercentVariation(x)) return getVariationHists(hists, name, hist_name, - lambda x: x[central]*(1+getPDFPercentVariation(x)), - lambda x: x[central]*(1-getPDFPercentVariation(x)), - central + upaction, downaction, central ) def getPDFPercentVariation(values): @@ -143,7 +144,9 @@ def getPDFPercentVariation(values): return abs(values[84] - values[16])/denom def getScaleHists(scale_hist2D, name, rebin=None, central=0, exclude=[7,9]): - entries = [i for i in range(1,10) if i not in exclude] + if central == -1: + exclude = [6,8] # Hack! For nanoaod + entries = [i for i in range(1,10 if central != -1 else 9) if i not in exclude] hists, hist_name = getLHEWeightHists(scale_hist2D, entries, name, "QCDscale", rebin) return getVariationHists(hists, name, hist_name, lambda x: x[-1], lambda x: x[1], central) @@ -151,20 +154,21 @@ def getVariationHists(hists, process_name, histUp_name, up_action, down_action, histUp = hists[central].Clone(histUp_name) histDown = histUp.Clone(histUp_name.replace("Up", "Down")) - histCentral = hists.pop(central) + histCentral = hists.pop(central) if central != -1 else None # Include overflow - for i in range(0, histCentral.GetNbinsX()+2): + for i in range(0, histUp.GetNbinsX()+2): vals = [] for hist in hists: vals.append(hist.GetBinContent(i)) vals.sort() - vals.insert(0, histCentral.GetBinContent(i)) + vals.insert(0, histCentral.GetBinContent(i) if histCentral else 0) histUp.SetBinContent(i, up_action(vals)) histDown.SetBinContent(i, down_action(vals)) # For now, skip this check on aQGC for now, since they're screwed up if "aqgc" in process_name: continue - logging.debug("For process %s: Central, down, up: %s, %s, %s" % (process_name, histCentral.Integral(), histDown.Integral(), histUp.Integral())) - isValidVariation(process_name, histCentral, histUp, histDown) + logging.debug("For process %s: Central, down, up: %s, %s, %s" % (process_name, histCentral.Integral() if histCentral else 0, histDown.Integral(), histUp.Integral())) + if histCentral: + isValidVariation(process_name, histCentral, histUp, histDown) return [histUp, histDown] def isValidVariation(process_name, histCentral, histUp, histDown): @@ -251,10 +255,6 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False composite = ROOT.TList() composite.SetName(name) for directory in [str(i) for i in members.keys()]: - #TODO: Remove this, it's very WZ specific - dirname = directory - directory = directory.replace("_", "-") - directory = directory.replace("--", "__") # For aQGC, the different plot groups should already be in their own files if "aqgc" in directory: directory = name @@ -264,8 +264,8 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False if hists == []: hists = [i.GetName() for i in hist_file.Get(directory).GetListOfKeys()] sumweights = 0 - if "data" not in directory.lower(): - sumweights_hist = hist_file.Get("/".join([directory.split("__")[0], "sumweights"])) + if "data" not in directory.lower() and "nonprompt" not in directory.lower(): + sumweights_hist = hist_file.Get("/".join([directory, "sumweights"])) if not sumweights_hist: raise RuntimeError("Failed to find sumWeights for dataset %s" % directory) sumweights = sumweights_hist.Integral(1, sumweights_hist.GetNbinsX()+2) @@ -281,7 +281,8 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False if hist: sumhist = composite.FindObject(hist.GetName()) if sumweights: - hist.Scale(members[dirname.split("__")[0]]*1000*lumi/sumweights) + xsec = members[directory if directory in members.keys() else directory.split("__")[0]] + hist.Scale(xsec*1000*lumi/sumweights) addOverflowAndUnderflow(hist, underflow, overflow) else: raise RuntimeError("hist %s was not produced for " From 458aee141ece14090bf728c8e04a1f3180de309e Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 9 Sep 2019 07:59:40 -0400 Subject: [PATCH 28/53] Add ZGen scipts, trying Hessian uncertainty --- .../CombineCards/VGen/ZGen_template_ee.txt | 23 ++++++++ .../CombineCards/VGen/ZGen_template_mm.txt | 24 ++++++++ Utilities/python/CombineCardTools.py | 34 ++++++++--- Utilities/python/HistTools.py | 23 ++++++-- Utilities/scripts/setupZGenCombine.py | 57 +++++++++++++++++++ 5 files changed, 148 insertions(+), 13 deletions(-) create mode 100644 Templates/CombineCards/VGen/ZGen_template_ee.txt create mode 100644 Templates/CombineCards/VGen/ZGen_template_mm.txt create mode 100644 Utilities/scripts/setupZGenCombine.py diff --git a/Templates/CombineCards/VGen/ZGen_template_ee.txt b/Templates/CombineCards/VGen/ZGen_template_ee.txt new file mode 100644 index 00000000..96e4b4c3 --- /dev/null +++ b/Templates/CombineCards/VGen/ZGen_template_ee.txt @@ -0,0 +1,23 @@ +imax 1 number of channels +jmax 1 number of processes - 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes ${dy_sample} * ${output_file} ${dy_sample}/${fit_variable}_$$CHANNEL ${dy_sample}/${fit_variable}_$$CHANNEL_$$SYSTEMATIC +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_$$CHANNEL nonprompt/${fit_variable}_$$CHANNEL_$$SYSTEMATIC +shapes data_obs * ${output_file} ${data_name}/${fit_variable}_$$CHANNEL + +bin ee +observation -1 + +------------ +bin ee ee +process ${dy_sample} nonprompt +process -1 1 +rate ${dy_lo_2018} ${nonprompt} +------------ +lumi2016_13TeV lnN 1.025 1.025 +dummyErr_ee lnN 1.02 - +QCDscale_${dy_sample} shape 1 - + + diff --git a/Templates/CombineCards/VGen/ZGen_template_mm.txt b/Templates/CombineCards/VGen/ZGen_template_mm.txt new file mode 100644 index 00000000..f4571726 --- /dev/null +++ b/Templates/CombineCards/VGen/ZGen_template_mm.txt @@ -0,0 +1,24 @@ +imax 1 number of channels +jmax 1 number of processes - 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes ${dy_sample} * ${output_file} ${dy_sample}/${fit_variable}_$$CHANNEL ${dy_sample}/${fit_variable}_$$CHANNEL_$$SYSTEMATIC +shapes nonprompt * ${output_file} ${nonprompt}/${fit_variable}_$$CHANNEL ${nonprompt}/${fit_variable}_$$CHANNEL_$$SYSTEMATIC +shapes data_obs * ${output_file} ${data_name}/${fit_variable}_$$CHANNEL + +bin mm +observation -1 + +------------ +bin mm mm +process ${dy_sample} nonprompt +process -1 1 +rate ${dy_lo_2018} ${nonprompt} +------------ +lumi2016_13TeV lnN 1.025 1.025 +dummyErr_mm lnN 1.02 - +QCDscale_${dy_sample} shape 1 - + + + diff --git a/Utilities/python/CombineCardTools.py b/Utilities/python/CombineCardTools.py index efc0de23..5de7809a 100644 --- a/Utilities/python/CombineCardTools.py +++ b/Utilities/python/CombineCardTools.py @@ -23,6 +23,7 @@ def __init__(self): self.isUnrolledFit = False self.lumi = 1 self.outputFolder = "." + self.theoryVariations = {} def setPlotGroups(self, xsecMap): self.crossSectionMap = xsecMap @@ -78,6 +79,22 @@ def setOutputFolder(self, outputFolder): if not os.path.isdir(outputFolder): os.makedirs(outputFolder) + def addTheoryVar(self, processName, varName, entries, central=0, exclude=[]): + if "scale" not in varName.lower() and "pdf" not in varName.lower(): + raise ValueError("Invalid theory uncertainty %s. Must be type 'scale' or 'pdf'" % varName) + name = "scale" if "scale" in varName.lower() else "pdf" + + if not processName in self.theoryVariations: + self.theoryVariations[processName] = {} + + self.theoryVariations[processName].update({ name : { + "entries" : entries, + "central" : central, + "exclude" : exclude, + "combine" : "envelope" if name == "scale" else ("mc" if "hessian" not in varName else "mc"), + } + }) + def getRootFile(self, rtfile, mode=None): if type(rtfile) == str: if mode: @@ -128,20 +145,20 @@ def combineChannels(self, group, central=True): chan_hist = group.FindObject(name + "_" + chan) hist.Add(chan_hist) - def listOfHistsByProcess(self, processName, addTheory): + def listOfHistsByProcess(self, processName): if self.fitVariable == "": raise ValueError("Must declare fit variable before defining plots") fitVariable = self.getFitVariable(processName) plots = ["_".join([fitVariable, chan]) for chan in self.channels] variations = self.getVariationsForProcess(processName) plots += ["_".join([fitVariable, var, c]) for var in variations for c in self.channels] - if addTheory: + if processName in self.theoryVariations.keys(): plots += [self.weightHistName(c, processName) for c in self.channels] return plots # processName needs to match a PlotGroup - def loadHistsForProcess(self, processName, addTheory, central=-1, scaleNorm=1): - plotsToRead = self.listOfHistsByProcess(processName, addTheory) + def loadHistsForProcess(self, processName, scaleNorm=1): + plotsToRead = self.listOfHistsByProcess(processName) group = HistTools.makeCompositeHists(self.inputFile, processName, {proc : self.crossSectionMap[proc] for proc in self.processes[processName]}, @@ -165,13 +182,16 @@ def loadHistsForProcess(self, processName, addTheory, central=-1, scaleNorm=1): else: self.yields["all"][processName] += self.yields[chan][processName] - if addTheory: + if processName in self.theoryVariations: weightHist = group.FindObject(self.weightHistName(chan, processName)) if not weightHist: logging.warning("Failed to find %s. Skipping" % self.weightHistName(chan, processName)) continue - scaleHists = HistTools.getScaleHists(weightHist, processName, self.rebin, central=central) - pdfHists = HistTools.getPDFHists(weightHist, range(9,8+100), processName, self.rebin, central=central) + theoryVars = self.theoryVariations[processName] + scaleHists = HistTools.getScaleHists(weightHist, processName, self.rebin, + entries=theoryVars['scale']['entries'], central=theoryVars['scale']['central']) + pdfHists = HistTools.getHessianPDFVariationHists(weightHist, theoryVars['pdf']['entries'], processName, + self.rebin, central=theoryVars['pdf']['central']) group.extend(scaleHists+pdfHists) #TODO: You may want to combine channels before removing zeros self.combineChannels(group) diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index 49467804..3d568e34 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -1,6 +1,7 @@ import array import ROOT import logging +import math def getDifference(fOut, name, dir1, dir2, ratioFunc=None): differences = ROOT.TList() @@ -128,25 +129,35 @@ def getLHEWeightHists(init2D_hist, entries, name, variation_name, rebin=None): hist_name = init2D_hist.GetName().replace("lheWeights", "%s_%sUp" % (variation_name, name)) return hists, hist_name -def getPDFHists(init2D_hist, entries, name, rebin=None, central=0): +def getMCPDFVariationHists(init2D_hist, entries, name, rebin=None, central=0): hists, hist_name = getLHEWeightHists(init2D_hist, entries, name, "pdf", rebin) - #return hists upaction = lambda x: x[int(0.84*len(entries))] if central == -1 else x[central]*(1+getPDFPercentVariation(x)) downaction = lambda x: x[int(0.16*len(entries))] if central == -1 else x[central]*(1+getPDFPercentVariation(x)) return getVariationHists(hists, name, hist_name, upaction, downaction, central ) +def getHessianPDFVariationHists(init2D_hist, entries, name, rebin=None, central=0): + hists, hist_name = getLHEWeightHists(init2D_hist, entries, name, "pdf", rebin) + #centralIndex = central if central != -1 else int(len(entries)/2) + sumsq = lambda x: math.sqrt(sum([0 if y < 0.01 else ((x[central] - y)**2) for y in x])) + upaction = lambda x: x[central] + sumsq(x) + downaction = lambda x: x[central] - sumsq(x) + return getVariationHists(hists, name, hist_name, + upaction, downaction, central, #downaction, central + ) + +def getAllHessianPDFHists(): + hists, hist_name = getLHEWeightHists(init2D_hist, entries, name, "pdf", rebin) + return hists + def getPDFPercentVariation(values): denom = values[84] + values[16] if denom == 0: return 0 return abs(values[84] - values[16])/denom -def getScaleHists(scale_hist2D, name, rebin=None, central=0, exclude=[7,9]): - if central == -1: - exclude = [6,8] # Hack! For nanoaod - entries = [i for i in range(1,10 if central != -1 else 9) if i not in exclude] +def getScaleHists(scale_hist2D, name, rebin=None, entries=[i for i in range(1,10)], central=0, exclude=[7,9]): hists, hist_name = getLHEWeightHists(scale_hist2D, entries, name, "QCDscale", rebin) return getVariationHists(hists, name, hist_name, lambda x: x[-1], lambda x: x[1], central) diff --git a/Utilities/scripts/setupZGenCombine.py b/Utilities/scripts/setupZGenCombine.py new file mode 100644 index 00000000..2871c7dc --- /dev/null +++ b/Utilities/scripts/setupZGenCombine.py @@ -0,0 +1,57 @@ +from python import CombineCardTools +from python import ConfigureJobs +import sys +import ROOT +import logging +import array + +ROOT.gROOT.SetBatch(True) +logging.basicConfig(level=logging.DEBUG) + +cardtool = CombineCardTools.CombineCardTools() + +manager_path = ConfigureJobs.getManagerPath() +sys.path.append("/".join([manager_path, "AnalysisDatasetManager", + "Utilities/python"])) + +from ConfigHistFactory import ConfigHistFactory +config_factory = ConfigHistFactory( + "%s/AnalysisDatasetManager" % manager_path, + "ZGen/NanoAOD", +) + +#plot_groups = ["nonprompt", "dy_lo", "dy_htbinned", "dy_htbinned_cp5", "dy_lo_2018"] +plot_groups = ["nonprompt", "dy_htbinned_cp5", "dy_lo_2018"] +plotGroupsMap = {name : config_factory.getPlotGroupMembers(name) for name in plot_groups} + +xsecs = ConfigureJobs.getListOfFilesWithXSec([f for files in plotGroupsMap.values() for f in files]) + +channels = ["ee", "mm"] +fitvar = "ptZ" +#rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) +cardtool.setFitVariable(fitvar) +#cardtool.setRebin(rebin) +cardtool.setProcesses(plotGroupsMap) +cardtool.setChannels(channels) +cardtool.setCrosSectionMap(xsecs) +cardtool.setVariations([]) +cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZGen/%s" % fitvar) + +cardtool.setLumi(35.9) +cardtool.setInputFile("/eos/user/k/kelong/HistFiles/ZGen/combined_withNonprompt.root") +cardtool.setOutputFile("ZGenCombineInput.root") +for process in plot_groups: + #Turn this back on when the theory uncertainties are added + if process not in ["nonprompt", "data"]: #and False + cardtool.addTheoryVar(process, 'scale', range(0, 8), exclude=[5, 7], central=-1) + cardtool.addTheoryVar(process, 'pdf_hessian', range(9, 109), central=-1) + cardtool.loadHistsForProcess(process) + cardtool.writeProcessHistsToOutput(process) + +nuissance_map = {"ee" : 3, "mm" : 3 } +for chan in channels: #+ ["all"]: + cardtool.setTemplateFileName("Templates/CombineCards/VGen/ZGen_template_{channel}.txt") + logging.info("Writting cards for channel %s" % chan) + cardtool.writeCards(chan, nuissance_map[chan], + #extraArgs={"data_name" : "dy_lo", "dy_sample" : "dy_lo"}) + extraArgs={"data_name" : "dy_lo_2018", "dy_sample" : "dy_lo_2018"}) From 989aec54d7d15402bf6d617e67cc1577308e09c2 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 9 Sep 2019 09:51:21 -0400 Subject: [PATCH 29/53] Add PDF hists to ZZ --- .../ZZSelection/ZZ_template2016_all.txt | 4 ++++ .../ZZSelection/ZZ_template2016_eeee.txt | 4 ++++ .../ZZSelection/ZZ_template2016_eemm.txt | 4 ++++ .../ZZSelection/ZZ_template2016_mmee.txt | 4 ++++ .../ZZSelection/ZZ_template2016_mmmm.txt | 4 ++++ .../ZZSelection/ZZ_template2017_all.txt | 4 ++++ .../ZZSelection/ZZ_template2017_eeee.txt | 4 ++++ .../ZZSelection/ZZ_template2017_eemm.txt | 4 ++++ .../ZZSelection/ZZ_template2017_mmee.txt | 4 ++++ .../ZZSelection/ZZ_template2017_mmmm.txt | 4 ++++ .../ZZSelection/ZZ_template2018_all.txt | 4 ++++ .../ZZSelection/ZZ_template2018_eeee.txt | 4 ++++ .../ZZSelection/ZZ_template2018_eemm.txt | 4 ++++ .../ZZSelection/ZZ_template2018_mmee.txt | 4 ++++ .../ZZSelection/ZZ_template2018_mmmm.txt | 4 ++++ Utilities/python/CombineCardTools.py | 5 +++-- Utilities/python/HistTools.py | 22 ++++++++++++------- Utilities/scripts/setupZZCombine.py | 9 ++++---- 18 files changed, 82 insertions(+), 14 deletions(-) diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt index a8ded14e..aa8f54ad 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt @@ -35,5 +35,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt index cf86640e..db2f16cf 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt @@ -38,5 +38,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt index fd7e92f5..e05ed1f0 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt @@ -39,5 +39,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt index e163bdd3..cc7cbc95 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt @@ -39,5 +39,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt index eb50e8fc..78e6d704 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt @@ -37,5 +37,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt index 269964ba..236dd553 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt @@ -35,5 +35,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt index cf86640e..db2f16cf 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt @@ -38,5 +38,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt index fd7e92f5..e05ed1f0 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt @@ -39,5 +39,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt index e163bdd3..cc7cbc95 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt @@ -39,5 +39,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt index eb50e8fc..78e6d704 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt @@ -37,5 +37,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt index 9f1573a8..50e47e00 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt @@ -35,5 +35,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt index 630c5014..a6305e93 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt @@ -38,5 +38,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt index 6d929c1e..6fac8981 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt @@ -39,5 +39,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt index d5f2f5b4..230c2008 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt @@ -39,5 +39,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt index d47856f0..64c0f719 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt @@ -37,5 +37,9 @@ QCDscale_HZZ_signal shape 1 0 0 QCDscale_qqZZ_powheg shape 0 1 0 0 0 QCDscale_ggZZ lnN 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 1 0 +pdf_HZZ_signal shape 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 1 0 0 0 +pdf_ggZZ lnN 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 1 0 * autoMCStats 1 diff --git a/Utilities/python/CombineCardTools.py b/Utilities/python/CombineCardTools.py index 5de7809a..e4aae60e 100644 --- a/Utilities/python/CombineCardTools.py +++ b/Utilities/python/CombineCardTools.py @@ -91,7 +91,7 @@ def addTheoryVar(self, processName, varName, entries, central=0, exclude=[]): "entries" : entries, "central" : central, "exclude" : exclude, - "combine" : "envelope" if name == "scale" else ("mc" if "hessian" not in varName else "mc"), + "combine" : "envelope" if name == "scale" else ("hessian" if "hessian" in varName else "mc"), } }) @@ -190,7 +190,8 @@ def loadHistsForProcess(self, processName, scaleNorm=1): theoryVars = self.theoryVariations[processName] scaleHists = HistTools.getScaleHists(weightHist, processName, self.rebin, entries=theoryVars['scale']['entries'], central=theoryVars['scale']['central']) - pdfHists = HistTools.getHessianPDFVariationHists(weightHist, theoryVars['pdf']['entries'], processName, + pdfFunction = getattr(HistTools, "get%sPDFVariationHists" % ("Hessian" if "hessian" in theoryVars['pdf']['combine'] else "MC")) + pdfHists = pdfFunction(weightHist, theoryVars['pdf']['entries'], processName, self.rebin, central=theoryVars['pdf']['central']) group.extend(scaleHists+pdfHists) #TODO: You may want to combine channels before removing zeros diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index 3d568e34..4b28e806 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -115,7 +115,6 @@ def getStatHists(hist, name, chan, signal): return (stat_hists, variation_names) def getWeightHistProjection(init2D_hist, name, entry, rebin): - print name, entry hist_name = init2D_hist.GetName().replace("lheWeights", name+"_weight%i" % entry) tmphist = init2D_hist.ProjectionX("temp", entry, entry, "e") hist = tmphist.Clone(hist_name) if not rebin else tmphist.Rebin(len(rebin)-1, hist_name, rebin) @@ -131,8 +130,13 @@ def getLHEWeightHists(init2D_hist, entries, name, variation_name, rebin=None): def getMCPDFVariationHists(init2D_hist, entries, name, rebin=None, central=0): hists, hist_name = getLHEWeightHists(init2D_hist, entries, name, "pdf", rebin) - upaction = lambda x: x[int(0.84*len(entries))] if central == -1 else x[central]*(1+getPDFPercentVariation(x)) - downaction = lambda x: x[int(0.16*len(entries))] if central == -1 else x[central]*(1+getPDFPercentVariation(x)) + if central == -1: + upaction = lambda x: x[int(0.84*len(entries))] + downaction = lambda x: x[int(0.16*len(entries))] + else: + upaction = lambda x : x[central]*(1+getPDFPercentVariation(x)) + downaction = lambda x: x[central]*(1-getPDFPercentVariation(x)) + return getVariationHists(hists, name, hist_name, upaction, downaction, central ) @@ -178,27 +182,29 @@ def getVariationHists(hists, process_name, histUp_name, up_action, down_action, # For now, skip this check on aQGC for now, since they're screwed up if "aqgc" in process_name: continue logging.debug("For process %s: Central, down, up: %s, %s, %s" % (process_name, histCentral.Integral() if histCentral else 0, histDown.Integral(), histUp.Integral())) - if histCentral: + if histCentral and False: # Off for now, it can happen that groups have some hists with no weights which screws this up isValidVariation(process_name, histCentral, histUp, histDown) return [histUp, histDown] def isValidVariation(process_name, histCentral, histUp, histDown): for i in range(0, histCentral.GetNbinsX()+2): - if histDown.GetBinContent(i) >= histCentral.GetBinContent(i) and histCentral.GetBinContent(i) > 0.01: + if histDown.GetBinContent(i) > histCentral.GetBinContent(i) and histCentral.GetBinContent(i) > 0.01: raise RuntimeError("Down variation >= central value for %s, hist %s" " This shouldn't be possible.\n" + "up_hist: %0.4f\n" "down_hist: %0.4f\n" "central_hist: %0.4f\n" "bin: %i\n" - % (process_name, histDown.GetName(), histDown.GetBinContent(i), histCentral.GetBinContent(i), i) + % (process_name, histDown.GetName(), histUp.GetBinContent(i), histDown.GetBinContent(i), histCentral.GetBinContent(i), i) ) - if histUp.GetBinContent(i) <= histCentral.GetBinContent(i) and histCentral.GetBinContent(i) > 0.01: + if histUp.GetBinContent(i) < histCentral.GetBinContent(i) and histCentral.GetBinContent(i) > 0.01: raise RuntimeError("Up variation <= central value for %s, hist %s." " This shouldn't be possible.\n" "up_hist: %0.4f\n" + "down_hist: %0.4f\n" "central_hist: %0.4f\n" "bin: %i\n" - % (process_name, histUp.GetName(), histUp.GetBinContent(i), histCentral.GetBinContent(i), i) + % (process_name, histUp.GetName(), histUp.GetBinContent(i), histDown.GetBinContent(i), histCentral.GetBinContent(i), i) ) def getTransformed3DScaleHists(scale_hist3D, transformation, transform_args, name): diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index d6b46aca..f373e937 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -31,8 +31,7 @@ "2018" : "/eos/user/k/kelong/HistFiles/ZZ/Hists02Sep2019-ZZ4l2018.root", } channels = ["eeee", "eemm", "mmee", "mmmm"] -#nuissance_map = {"eeee" : 9, "eemm" : 10, "mmee" : 10, "mmmm" : 8, "all" : 6} -nuissance_map = {"eeee" : 12, "eemm" : 13, "mmee" : 13, "mmmm" : 11, "all" : 9} +nuissance_map = {"eeee" : 16, "eemm" : 17, "mmee" : 17, "mmmm" : 15, "all" : 13} #fitvar = "ZZPt" #rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) fitvar = "Mass" @@ -57,8 +56,10 @@ #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s%sFit" % (fitvar, year)) for process in plot_groups: #Turn this back on when the theory uncertainties are added - addTheory = process not in ["nonprompt", "data"] #and False - cardtool.loadHistsForProcess(process, addTheory) + if process not in ["nonprompt", "data"]: #and False + cardtool.addTheoryVar(process, 'scale', range(1, 10), exclude=[7, 9], central=0) + cardtool.addTheoryVar(process, 'pdf_hessian' if year != "2016" else 'pdf_mc', [1]+[i for i in range(10, 111)], central=0) + cardtool.loadHistsForProcess(process) cardtool.writeProcessHistsToOutput(process) for chan in channels + ["all"]: From 6e4437807fc109d75dc17dac44d9cced4c035334 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 9 Sep 2019 10:32:34 -0400 Subject: [PATCH 30/53] Added ZZEWK signal to the templates --- .../ZZSelection/ZZ_template2016_all.txt | 33 +++++++-------- .../ZZSelection/ZZ_template2016_eeee.txt | 39 +++++++++--------- .../ZZSelection/ZZ_template2016_eemm.txt | 41 ++++++++++--------- .../ZZSelection/ZZ_template2016_mmee.txt | 41 ++++++++++--------- .../ZZSelection/ZZ_template2016_mmmm.txt | 41 ++++++++++--------- .../ZZSelection/ZZ_template2017_all.txt | 33 +++++++-------- .../ZZSelection/ZZ_template2017_eeee.txt | 39 +++++++++--------- .../ZZSelection/ZZ_template2017_eemm.txt | 41 ++++++++++--------- .../ZZSelection/ZZ_template2017_mmee.txt | 41 ++++++++++--------- .../ZZSelection/ZZ_template2017_mmmm.txt | 37 +++++++++-------- .../ZZSelection/ZZ_template2018_all.txt | 33 +++++++-------- .../ZZSelection/ZZ_template2018_eeee.txt | 39 +++++++++--------- .../ZZSelection/ZZ_template2018_eemm.txt | 41 ++++++++++--------- .../ZZSelection/ZZ_template2018_mmee.txt | 41 ++++++++++--------- .../ZZSelection/ZZ_template2018_mmmm.txt | 37 +++++++++-------- 15 files changed, 296 insertions(+), 281 deletions(-) diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt index a8ded14e..a2e95169 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,20 +21,20 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin all all all all all -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 2 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------------------- -bkgStat lnN - - - - 1.4 -trigger lnN 1.020 1.020 1.020 1.020 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -CMS_pileup shape 1 1 1 1 0 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin all all all all all all +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt index cf86640e..db5a1878 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,23 +21,23 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin eeee eeee eeee eeee eeee -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 2 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ---------------------------------------------------------------------------------------------------------------- -bkg_eeee_17 lnN - - - - 1.2 -bkg_ee_17 lnN - - - - 1.2 -trigger_eeee_17 lnN 1.01 1.01 1.01 1.01 - -trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin eeee eeee eeee eeee eeee eeee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +----------------------------------------------------------------------------------------------------------------------------------- +bkg_eeee_16 lnN - - - - - 1.2 +bkg_ee_16 lnN - - - - - 1.2 +trigger_eeee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt index fd7e92f5..694b4a92 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,24 +21,24 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin eemm eemm eemm eemm eemm -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------------------------- -bkg_mm_17 lnN - - - - 1.1 -bkg_ee_17 lnN - - - - 1.1 -trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin eemm eemm eemm eemm eemm eemm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------ +bkg_mm_16 lnN - - - - - 1.1 +bkg_ee_16 lnN - - - - - 1.1 +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt index e163bdd3..2ad58f15 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,24 +21,24 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin mmee mmee mmee mmee mmee -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} -------------------------------------------------------------------------------- ------------------------------- -bkg_mm_17 lnN - - - - 1.1 -bkg_ee_17 lnN - - - - 1.1 -trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin mmee mmee mmee mmee mmee mmee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------- ------------------------------- +bkg_mm_16 lnN - - - - - 1.1 +bkg_ee_16 lnN - - - - - 1.1 +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt index eb50e8fc..2a7e4ad7 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,22 +21,22 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin mmmm mmmm mmmm mmmm mmmm -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ---------------------------------------------------------------------------------------------------------------- -bkg_mmmm_17 lnN - - - - 1.2 -bkg_mm_17 lnN - - - - 1.2 -trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 - -* autoMCStats 1 +bin mmmm mmmm mmmm mmmm mmmm mmmm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------------------------- +bkg_mmmm_16 lnN - - - - - 1.2 +bkg_mm_16 lnN - - - - - 1.2 +trigger_mmmm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt index 269964ba..0d855cea 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,20 +21,20 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin all all all all all -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 2 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------------------- -bkgStat lnN - - - - 1.4 -trigger lnN 1.020 1.020 1.020 1.020 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin all all all all all all +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +---------------------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt index cf86640e..aa262604 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,23 +21,23 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin eeee eeee eeee eeee eeee -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 2 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ---------------------------------------------------------------------------------------------------------------- -bkg_eeee_17 lnN - - - - 1.2 -bkg_ee_17 lnN - - - - 1.2 -trigger_eeee_17 lnN 1.01 1.01 1.01 1.01 - -trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin eeee eeee eeee eeee eeee eeee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------ +bkg_eeee_17 lnN - - - - - 1.2 +bkg_ee_17 lnN - - - - - 1.2 +trigger_eeee_17 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt index fd7e92f5..fdb721e8 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,24 +21,24 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin eemm eemm eemm eemm eemm -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------------------------- -bkg_mm_17 lnN - - - - 1.1 -bkg_ee_17 lnN - - - - 1.1 -trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin eemm eemm eemm eemm eemm eemm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------- +bkg_mm_17 lnN - - - - - 1.1 +bkg_ee_17 lnN - - - - - 1.1 +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt index e163bdd3..2e14fe32 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,24 +21,24 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin mmee mmee mmee mmee mmee -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} -------------------------------------------------------------------------------- ------------------------------- -bkg_mm_17 lnN - - - - 1.1 -bkg_ee_17 lnN - - - - 1.1 -trigger_ee_17 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin mmee mmee mmee mmee mmee mmee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------ +bkg_mm_17 lnN - - - - - 1.1 +bkg_ee_17 lnN - - - - - 1.1 +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt index eb50e8fc..9fc77c69 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,22 +21,22 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin mmmm mmmm mmmm mmmm mmmm -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ---------------------------------------------------------------------------------------------------------------- -bkg_mmmm_17 lnN - - - - 1.2 -bkg_mm_17 lnN - - - - 1.2 -trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_17 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin mmmm mmmm mmmm mmmm mmmm mmmm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate {zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------ +bkg_mmmm_17 lnN - - - - - 1.2 +bkg_mm_17 lnN - - - - - 1.2 +trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt index 9f1573a8..52aaaead 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable} HZZ_signal/${fit_variable}_$$SYSTEMATIC shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable} qqZZ_powheg/${fit_variable}_$$SYSTEMATIC shapes ggZZ * ${output_file} ggZZ/${fit_variable} ggZZ/${fit_variable}_$$SYSTEMATIC @@ -20,20 +21,20 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin all all all all all -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 2 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------------------- -bkgStat lnN - - - - 1.4 -trigger lnN 1.020 1.020 1.020 1.020 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin all all all all all all +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +---------------------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt index 630c5014..36c7d035 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,23 +21,23 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin eeee eeee eeee eeee eeee -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 2 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ---------------------------------------------------------------------------------------------------------------- -bkg_eeee_18 lnN - - - - 1.2 -bkg_ee_18 lnN - - - - 1.2 -trigger_eeee_18 lnN 1.01 1.01 1.01 1.01 - -trigger_ee_18 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin eeee eeee eeee eeee eeee eeee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------------------------------- +bkg_eeee_18 lnN - - - - - 1.2 +bkg_ee_18 lnN - - - - - 1.2 +trigger_eeee_18 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt index 6d929c1e..38230775 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,24 +21,24 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin eemm eemm eemm eemm eemm -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------------------------- -bkg_mm_18 lnN - - - - 1.1 -bkg_ee_18 lnN - - - - 1.1 -trigger_ee_18 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_18 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin eemm eemm eemm eemm eemm eemm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------- +bkg_mm_18 lnN - - - - - 1.1 +bkg_ee_18 lnN - - - - - 1.1 +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt index d5f2f5b4..c9a25124 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,24 +21,24 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin mmee mmee mmee mmee mmee -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} -------------------------------------------------------------------------------- ------------------------------- -bkg_mm_18 lnN - - - - 1.1 -bkg_ee_18 lnN - - - - 1.1 -trigger_ee_18 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_18 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin mmee mmee mmee mmee mmee mmee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------- ------------------------------- +bkg_mm_18 lnN - - - - - 1.1 +bkg_ee_18 lnN - - - - - 1.1 +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt index d47856f0..eab40f25 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt @@ -1,8 +1,9 @@ imax 1 number of channels -jmax 4 number of backgrounds plus signals minus 1 +jmax 5 number of backgrounds plus signals minus 1 kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) ------------ +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL @@ -20,22 +21,22 @@ observation ${data} # the second 'process' line must have a positive number for backgrounds, and 0 for signal # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin mmmm mmmm mmmm mmmm mmmm -process HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -2 -1 0 1 1 -rate ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ---------------------------------------------------------------------------------------------------------------- -bkg_mmmm_18 lnN - - - - 1.2 -bkg_mm_18 lnN - - - - 1.2 -trigger_mmmm_18 lnN 1.01 1.01 1.01 1.01 - -trigger_mm_18 lnN 1.01 1.01 1.01 1.01 - -CMS_eff_m shape 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 -lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 -QCDscale_HZZ_signal shape 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 1 0 +bin mmmm mmmm mmmm mmmm mmmm mmmm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------------------------------- +bkg_mmmm_18 lnN - - - - - 1.2 +bkg_mm_18 lnN - - - - - 1.2 +trigger_mmmm_18 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 * autoMCStats 1 From 856cde16a0be4ef78328399a592f7c136ba3d7fb Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 9 Sep 2019 10:44:56 -0400 Subject: [PATCH 31/53] local changes to setupZZCombine --- Utilities/scripts/setupZZCombine.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index 8dd61463..5cd035e8 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -22,22 +22,17 @@ "ZZ4l2016/LooseLeptons", ) -plot_groups = ["HZZ-signal","qqZZ-powheg","ggZZ", "VVV", "data", "nonprompt",] +plot_groups = ["HZZ_signal","qqZZ_powheg","zzjj4l_ewk","ggZZ", "VVV", "data", "nonprompt",] plotGroupsMap = {name : config_factory.getPlotGroupMembers(name) for name in plot_groups} xsecs = ConfigureJobs.getListOfFilesWithXSec([f for files in plotGroupsMap.values() for f in files]) -lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.74} -fileMap = { "2016" : "/eos/user/k/kelong/HistFiles/ZZ/Hists02Sep2019-ZZ4l2016.root", - "2017" : "/eos/user/k/kelong/HistFiles/ZZ/Hists02Sep2019-ZZ4l2017.root", - "2018" : "/eos/user/k/kelong/HistFiles/ZZ/Hists02Sep2019-ZZ4l2018.root", -======= lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.67} -fileMap = { "2017" : "/eos/user/k/kelong/HistFiles/ZZ/Hists29Aug2019-ZZ4l2017.root", - "2018" : "/eos/user/k/kelong/HistFiles/ZZ/Hists13Aug2019-ZZ4l2018Full.root", - "2016" : "/afs/cern.ch/user/u/uhussain/public/ForKenneth/Hists30Aug2019-ZZ4l2016.root", -} +fileMap = { "2016" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists02Sep2019-ZZ4l2016.root", + "2017" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists02Sep2019-ZZ4l2017.root", + "2018" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists02Sep2019-ZZ4l2018.root", + channels = ["eeee", "eemm", "mmee", "mmmm"] nuissance_map = {"eeee" : 12, "eemm" : 13, "mmee" : 13, "mmmm" : 11, "all" : 9} #fitvar = "ZZPt" @@ -55,8 +50,7 @@ exclude=["nonprompt", "data"]) #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) -cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%sFitFullRunII" % fitvar) -cardtool.setOutputFolder("/eos/user/u/uhussain/CombineStudies/ZZ/%s2016Fit" % fitvar) +cardtool.setOutputFolder("/eos/user/u/uhussain/CombineStudies/ZZ/%sFitFullRunII" % fitvar) for year in fileMap.keys(): cardtool.setLumi(lumiMap[year]) From ba2d34185e4c44a8b3b07f9a7e09113724dbd4f6 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Thu, 12 Sep 2019 14:39:32 -0400 Subject: [PATCH 32/53] Fake Rate stuff not working --- Utilities/python/SelectorTools.py | 3 + Utilities/scripts/makeFakeRates.py | 97 +++++++++++++++------ interface/FakeRateSelector.h | 53 +++++++++--- interface/SelectorBase.h | 2 + makeFakeRates2016.sh | 1 + src/FakeRateSelector.cc | 132 +++++++++++++++++++++-------- 6 files changed, 211 insertions(+), 77 deletions(-) create mode 100755 makeFakeRates2016.sh diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 2e442d98..5bcef3a7 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -59,6 +59,9 @@ def setChannels(self, channels): def isBackground(self): self.selector_name = self.selector_name.replace("Selector", "BackgroundSelector") + def isFake(self): + self.selector_name = self.selector_name.replace("ZZ", "FakeRate") + def setOutputfile(self, outfile_name): self.outfile_name = outfile_name self.outfile = ROOT.gROOT.FindObject(outfile_name) diff --git a/Utilities/scripts/makeFakeRates.py b/Utilities/scripts/makeFakeRates.py index 54d2b6ee..9b989672 100755 --- a/Utilities/scripts/makeFakeRates.py +++ b/Utilities/scripts/makeFakeRates.py @@ -5,23 +5,42 @@ from python import UserInput,OutputTools from python import ConfigureJobs from python import SelectorTools,HistTools +import logging ROOT.gROOT.SetBatch(True) -channels = ["eee", "eem", "emm", "mmm"] def getComLineArgs(): parser = UserInput.getDefaultParser() - parser.add_argument("--proof", "-p", - action='store_true', help="Don't use proof") parser.add_argument("--lumi", "-l", type=float, - default=35.87, help="luminosity value (in fb-1)") + default=41.5, help="luminosity value (in fb-1)") + parser.add_argument("--uwvv", action='store_true', + help="Use UWVV format ntuples in stead of NanoAOD") + parser.add_argument("--noHistConfig", action='store_true', + help="Don't rely on config file to specify hist info") + parser.add_argument("--input_tier", type=str, + default="", help="Selection stage of input files") + parser.add_argument("--year", type=str, + default="default", help="Year of Analysis") + parser.add_argument("-j", "--numCores", type=int, default=1, + help="Number of cores to use (parallelize by dataset)") + parser.add_argument("--scalefactors_file", "-sf", type=str, + default="", help="ScaleFactors file name") parser.add_argument("--output_file", "-o", type=str, default="", help="Output file name") + parser.add_argument("-c", "--channels", + type=lambda x : [i.strip() for i in x.split(',')], + default=["eee","eem","emm","mmm"], help="List of channels" + "separated by commas. NOTE: set to Inclusive for NanoAOD") + parser.add_argument("-b", "--hist_names", + type=lambda x : [i.strip() for i in x.split(',')], + default=["all"], help="List of histograms, " + "as defined in ZZ4lRun2DatasetManager, separated " + "by commas") return vars(parser.parse_args()) def getHistNames(channels): - base_hists = [x+y for x in ["passingLoose", "passingTight"] \ - for y in "1DEta", "1DPt", "2D"] + base_hists = [x+y for x in ["passingLooseE", "passingTightE","passingLooseMu", "passingTightMu"] \ + for y in "1DEta", "1DPt_barrel","1DPt_endcap", "2D"] if len(channels) == 0: return base_hists return [x+"_"+y for x in base_hists for y in channels] @@ -30,6 +49,8 @@ def getHistNames(channels): def makeCompositeHists(name, members, addRatios=True, overflow=False): composite = ROOT.TList() composite.SetName(name) + if name=="AllEWK": + print "EWK members: ",members for directory in [str(i) for i in members.keys()]: for histname in getHistNames(["eee", "eem", "emm", "mmm"]): hist = fOut.Get("/".join([directory, histname])) @@ -93,35 +114,57 @@ def getRatios(hists): return ratios args = getComLineArgs() -proof = 0 -if args['proof']: - ROOT.TProof.Open("workers=12") - proof = ROOT.gProof + today = datetime.date.today().strftime("%d%b%Y") -fileName = "data/fakeRate%s-%s.root" % (today, args['selection']) if args['output_file'] == "" \ +fileName = "data/fakeRate%s-%s.root" % (today,args['analysis']) if args['output_file'] == "" \ else args['output_file'] fOut = ROOT.TFile(fileName, "recreate") -fScales = ROOT.TFile('data/scaleFactors.root') -muonIsoSF = fScales.Get('muonIsoSF') -muonIdSF = fScales.Get('muonTightIdSF') -electronTightIdSF = fScales.Get('electronTightIdSF') -electronGsfSF = fScales.Get('electronGsfSF') -pileupSF = fScales.Get('pileupSF') -sf_inputs = [electronTightIdSF, electronGsfSF, muonIsoSF, muonIdSF, pileupSF] -SelectorTools.applySelector(args["filenames"], - "FakeRateSelector", args['selection'], fOut, - extra_inputs=sf_inputs, proof=args['proof'], - addSumweights=True) +addScaleFacs = False +if args['analysis'] == "WZxsec2016" or args['analysis'] == 'Zstudy_2016' or args['scalefactors_file']: + addScaleFacs = True +sf_inputs = [ROOT.TParameter(bool)("applyScaleFacs", False)] + +if args['input_tier'] == '': + args['input_tier'] = args['selection'] +selection = args['selection'].split("_")[0] + +if selection == "Inclusive2Jet": + selection = "Wselection" + print "Info: Using Wselection for hist defintions" +analysis = "/".join([args['analysis'], selection]) +hists, hist_inputs = UserInput.getHistInfo(analysis, args['hist_names'], args['noHistConfig']) + +selector = SelectorTools.SelectorDriver(args['analysis'], args['selection'], args['input_tier'], args['year']) +selector.setOutputfile(fOut.GetName()) +selector.setInputs(sf_inputs+hist_inputs) +selector.isFake() + +selector.setNtupeType("UWVV" if args['uwvv'] else "NanoAOD") +if args['uwvv']: + logging.debug("Processing channels " % args['channels']) + selector.setChannels(args['channels']) + +selector.setNumCores(args['numCores']) + +if args['filenames']: + selector.setDatasets(args['filenames']) +else: + selector.setFileList(*args['inputs_from_file']) +mc = selector.applySelector() + -alldata = makeCompositeHists("AllData", ConfigureJobs.getListOfFilesWithXSec(["WZxsec2016data"])) +alldata = makeCompositeHists("AllData", ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"])) OutputTools.writeOutputListItem(alldata, fOut) allewk = makeCompositeHists("AllEWK", ConfigureJobs.getListOfFilesWithXSec( - ConfigureJobs.getListOfEWKFilenames()), False) + ConfigureJobs.getListOfEWKFilenames()), True) OutputTools.writeOutputListItem(allewk, fOut) -allnonprompt = makeCompositeHists("NonpromptMC", ConfigureJobs.getListOfFilesWithXSec( - ConfigureJobs.getListOfNonpromptFilenames())) -OutputTools.writeOutputListItem(allnonprompt, fOut) +allDYJets = makeCompositeHists("DYMC", ConfigureJobs.getListOfFilesWithXSec( + ConfigureJobs.getListOfDYFilenames()),True) +OutputTools.writeOutputListItem(allDYJets, fOut) +#allnonprompt = makeCompositeHists("NonpromptMC", ConfigureJobs.getListOfFilesWithXSec( +# ConfigureJobs.getListOfNonpromptFilenames())) +#OutputTools.writeOutputListItem(allnonprompt, fOut) final = HistTools.getDifference(fOut, "DataEWKCorrected", "AllData", "AllEWK", getRatios) OutputTools.writeOutputListItem(final, fOut) diff --git a/interface/FakeRateSelector.h b/interface/FakeRateSelector.h index d25cadf9..81ade578 100644 --- a/interface/FakeRateSelector.h +++ b/interface/FakeRateSelector.h @@ -10,35 +10,60 @@ #include // Headers needed by this particular selector -#include "Analysis/VVAnalysis/interface/WZSelectorBase.h" +#include "Analysis/VVAnalysis/interface/ZZSelectorBase.h" #include -class FakeRateSelector : public WZSelectorBase { +class FakeRateSelector : public ZZSelectorBase { public : + TH2D* passingTightE2D_; + TH1D* passingTightE1DPt_barrel_; + TH1D* passingTightE1DPt_endcap_; + TH1D* passingTightE1DEta_; + TH2D* passingLooseE2D_; + TH1D* passingLooseE1DPt_barrel_; + TH1D* passingLooseE1DPt_endcap_; + TH1D* passingLooseE1DEta_; + TH2D* ratioE2D_; + TH1D* ratioE1DPt_barrel_; + TH1D* ratioE1DPt_endcap_; + TH1D* ratioE1DEta_; + + TH2D* passingTightMu2D_; + TH1D* passingTightMu1DPt_barrel_; + TH1D* passingTightMu1DPt_endcap_; + TH1D* passingTightMu1DEta_; + TH2D* passingLooseMu2D_; + TH1D* passingLooseMu1DPt_barrel_; + TH1D* passingLooseMu1DPt_endcap_; + TH1D* passingLooseMu1DEta_; + TH2D* ratioMu2D_; + TH1D* ratioMu1DPt_barrel_; + TH1D* ratioMu1DPt_endcap_; + TH1D* ratioMu1DEta_; TH2D* passingTight2D_; - TH1D* passingTight1DPt_; + TH1D* passingTight1DPt_barrel_; + TH1D* passingTight1DPt_endcap_; TH1D* passingTight1DEta_; TH2D* passingLoose2D_; - TH1D* passingLoose1DPt_; + TH1D* passingLoose1DPt_barrel_; + TH1D* passingLoose1DPt_endcap_; TH1D* passingLoose1DEta_; TH2D* ratio2D_; - TH1D* ratio1DPt_; + TH1D* ratio1DPt_barrel_; + TH1D* ratio1DPt_endcap_; TH1D* ratio1DEta_; - Float_t type1_pfMETEt; - UInt_t nCBVIDVetoElec; - UInt_t nWZLooseMuon; - - TBranch* b_type1_pfMETEt; - TBranch* b_nCBVIDVetoElec; - TBranch* b_nWZLooseMuon; - // Readers to access the data (delete the ones you do not need). + FakeRateSelector(TTree * /*tree*/ =0) { } + virtual ~FakeRateSelector() { } + virtual void Init(TTree *tree) override; virtual void SetupNewDirectory() override; - virtual void FillHistograms(Long64_t entry, std::pair variation) override; ClassDefOverride(FakeRateSelector,0); + +protected: + void LoadBranchesUWVV(Long64_t entry, std::pair variation) override; }; #endif diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index 16f88de0..8a1a8cbd 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -97,6 +97,8 @@ class SelectorBase : public TSelector { {"SignalSync", ZZselection}, {"AllData", ZZselection}, {"LooseLeptons", ZZselection}, + {"TightLeptonsWGen", ZZselection}, + {"ZplusLSkim", ZZselection}, {"Wselection_Full", Wselection_Full}, {"FakeRateSelectionLoose", FakeRateSelectionLoose}, {"FakeRateSelectionTight", FakeRateSelectionTight}, diff --git a/makeFakeRates2016.sh b/makeFakeRates2016.sh new file mode 100755 index 00000000..11cc076f --- /dev/null +++ b/makeFakeRates2016.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeFakeRates.py -a ZZ4l2016 -s ZplusLSkim -l 35.9 -f ZZ4l2016 --uwvv --noHistConfig diff --git a/src/FakeRateSelector.cc b/src/FakeRateSelector.cc index 5be36887..3bc4110f 100644 --- a/src/FakeRateSelector.cc +++ b/src/FakeRateSelector.cc @@ -1,53 +1,113 @@ #include "Analysis/VVAnalysis/interface/FakeRateSelector.h" #include -void FakeRateSelector::FillHistograms(Long64_t entry, std::pair variation) { - if (!passesLeptonVeto) - return; - if (l1Pt < 25 || l2Pt < 15) - return; - if (ZMass > 101.1876 || ZMass < 81.1876) - return; - if (type1_pfMETEt > 25) - return; - if (l3MtToMET > 30) - return; - if (!tightZLeptons()) - return; - - if (!IsGenMatched3l()) - return; +void FakeRateSelector::LoadBranchesUWVV(Long64_t entry, std::pair variation) { + ZZSelectorBase::LoadBranchesUWVV(entry, variation); + //In HZZ AN it says: |M_inv(l1,l2)- MZ| < 7 GeV, to reduce the contribution from photon (asymmetric) conversions populating low masses. + if (Z1mass > 98.1876 || Z1mass < 84.1876){ + return;} + if (type1_pfMETEt > 25){ + return;} + if (l3MtToMET > 30){ + return;} + if (!tightZ1Leptons()){ + return;} + float pt_fillval = l3Pt; float eta_fillval = std::abs(l3Eta); float loose_weight = weight; - if (channel_ == eee || channel_ == emm) { - loose_weight /= eIdSF_->Evaluate2D(std::abs(l3Eta), l3Pt); + //if (channel_ == eee || channel_ == emm) { + // loose_weight /= eIdSF_->Evaluate2D(std::abs(l3Eta), l3Pt); + //} + //else if (channel_ == eem || channel_ == mmm) { + // loose_weight /= mIsoSF_->Evaluate2D(std::abs(l3Eta), l3Pt); + //} + //Electron barrel up to |eta| = 1.479 + if((channel_ == eee) || (channel_ == emm)){ + if(eta_fillval < 1.479) + passingLooseE1DPt_barrel_->Fill(pt_fillval, loose_weight); + else + passingLooseE1DPt_endcap_->Fill(pt_fillval, loose_weight); + + passingLooseE2D_->Fill(pt_fillval, eta_fillval, loose_weight); + passingLooseE1DEta_->Fill(eta_fillval, loose_weight); } + //Muon barrel up to |eta| = 1.2 else if (channel_ == eem || channel_ == mmm) { - loose_weight /= mIsoSF_->Evaluate2D(std::abs(l3Eta), l3Pt); + if(eta_fillval < 1.2) + passingLooseMu1DPt_barrel_->Fill(pt_fillval, loose_weight); + else + passingLooseMu1DPt_endcap_->Fill(pt_fillval, loose_weight); + + passingLooseMu2D_->Fill(pt_fillval, eta_fillval, loose_weight); + passingLooseMu1DEta_->Fill(eta_fillval, loose_weight); } - passingLoose2D_->Fill(pt_fillval, eta_fillval, loose_weight); - passingLoose1DPt_->Fill(pt_fillval, loose_weight); - passingLoose1DEta_->Fill(eta_fillval, loose_weight); - if (lepton3IsTight()) { - passingTight2D_->Fill(pt_fillval, eta_fillval, weight); - passingTight1DPt_->Fill(pt_fillval, weight); - passingTight1DEta_->Fill(eta_fillval, weight); + if (lep3IsTight()) { + if((channel_ == eee) || (channel_ == emm)){ + if(eta_fillval < 1.479) + passingTightE1DPt_barrel_->Fill(pt_fillval, loose_weight); + else + passingTightE1DPt_endcap_->Fill(pt_fillval, loose_weight); + + passingTightE2D_->Fill(pt_fillval, eta_fillval, weight); + passingTightE1DEta_->Fill(eta_fillval, weight); + } + //Muon barrel up to |eta| = 1.2 + else if (channel_ == eem || channel_ == mmm) { + if(eta_fillval < 1.2) + passingTightMu1DPt_barrel_->Fill(pt_fillval, loose_weight); + else + passingTightMu1DPt_endcap_->Fill(pt_fillval, loose_weight); + + passingTightMu2D_->Fill(pt_fillval, eta_fillval, weight); + passingTightMu1DEta_->Fill(eta_fillval, weight); + } } } -void FakeRateSelector::SetupNewDirectory() { - WZSelectorBase::SetupNewDirectory(); +void FakeRateSelector::Init(TTree *tree) +{ + ZZSelectorBase::Init(tree); + +} + +void FakeRateSelector::SetupNewDirectory() +{ + SelectorBase::SetupNewDirectory(); + + const int MuPtbins = 6; + double Mu_Pt_bins[MuPtbins+1] = {5,10,20,30,40,50,80}; - const int nvarbins = 3; - double variable_pt_bins[nvarbins+1] = {10, 20, 30, FR_MAX_PT_}; - AddObject(passingTight2D_, ("passingTight2D_"+channelName_).c_str(), "#eta; p_{T} [GeV]", nvarbins, variable_pt_bins, 3, 0, 2.5); - AddObject(passingTight1DPt_, ("passingTight1DPt_"+channelName_).c_str(), "Tight leptons; p_{T} [GeV]", nvarbins, variable_pt_bins); - AddObject(passingTight1DEta_, ("passingTight1DEta_"+channelName_).c_str(), "Tight leptons; #eta", 3, 0, 2.5); + const int ElePtbins = 6; + double Ele_Pt_bins[ElePtbins+1] = {5,10,20,30,40,50,80}; + //For electron fakes + + const int nEleEtabins=4; + double Ele_eta_bins[nEleEtabins+1] = {0.,0.7395,1.479,2.0,2.5}; + + //For muons fakes - AddObject(passingLoose2D_, ("passingLoose2D_"+channelName_).c_str(), "#eta; p_{T} [GeV]", nvarbins, variable_pt_bins, 3, 0, 2.5); - AddObject(passingLoose1DPt_, ("passingLoose1DPt_"+channelName_).c_str(), "Loose leptons; p_{T} [GeV]", nvarbins, variable_pt_bins); - AddObject(passingLoose1DEta_, ("passingLoose1DEta_"+channelName_).c_str(), "Loose leptons; #eta", 3, 0, 2.5); + const int nMuEtabins=2; + double Mu_eta_bins[nMuEtabins+1] = {0.,1.2,2.4}; + + AddObject(passingTightE2D_, ("passingTightE2D_"+channelName_).c_str(), "|#eta|; p_{T} [GeV]", ElePtbins, Ele_Pt_bins, nEleEtabins,Ele_eta_bins); + AddObject(passingTightE1DEta_, ("passingTightE1DEta_"+channelName_).c_str(), "Tight leptons; |#eta|", nEleEtabins,Ele_eta_bins); + AddObject(passingLooseE2D_, ("passingLooseE2D_"+channelName_).c_str(), "|#eta|; p_{T} [GeV]", ElePtbins, Ele_Pt_bins, nEleEtabins,Ele_eta_bins); + AddObject(passingLooseE1DEta_, ("passingLooseE1DEta_"+channelName_).c_str(), "Loose leptons; |#eta|", nEleEtabins,Ele_eta_bins); + AddObject(passingTightE1DPt_barrel_, ("passingTightE1DPt_barrel_"+channelName_).c_str(), "Tight leptons; p_{T} [GeV]", ElePtbins, Ele_Pt_bins); + AddObject(passingTightE1DPt_endcap_, ("passingTightE1DPt_endcap_"+channelName_).c_str(), "Tight leptons; p_{T} [GeV]", ElePtbins, Ele_Pt_bins); + AddObject(passingLooseE1DPt_barrel_, ("passingLooseE1DPt_barrel_"+channelName_).c_str(), "Loose leptons; p_{T} [GeV]", ElePtbins, Ele_Pt_bins); + AddObject(passingLooseE1DPt_endcap_, ("passingLooseE1DPt_endcap_"+channelName_).c_str(), "Loose leptons; p_{T} [GeV]", ElePtbins, Ele_Pt_bins); + + AddObject(passingTightMu2D_, ("passingTightMu2D_"+channelName_).c_str(), "|#eta|; p_{T} [GeV]", MuPtbins, Mu_Pt_bins, nMuEtabins,Mu_eta_bins); + AddObject(passingTightMu1DEta_, ("passingTightMu1DEta_"+channelName_).c_str(), "Tight leptons; |#eta|", nMuEtabins,Mu_eta_bins); + AddObject(passingLooseMu2D_, ("passingLooseMu2D_"+channelName_).c_str(), "|#eta|; p_{T} [GeV]", MuPtbins, Mu_Pt_bins, nMuEtabins,Mu_eta_bins); + AddObject(passingLooseMu1DEta_, ("passingLooseMu1DEta_"+channelName_).c_str(), "Loose leptons; |#eta|", nMuEtabins,Mu_eta_bins); + AddObject(passingTightMu1DPt_barrel_, ("passingTightMu1DPt_barrel_"+channelName_).c_str(), "Tight leptons; p_{T} [GeV]", MuPtbins, Mu_Pt_bins); + AddObject(passingTightMu1DPt_endcap_, ("passingTightMu1DPt_endcap_"+channelName_).c_str(), "Tight leptons; p_{T} [GeV]", MuPtbins, Mu_Pt_bins); + AddObject(passingLooseMu1DPt_barrel_, ("passingLooseMu1DPt_barrel_"+channelName_).c_str(), "Loose leptons; p_{T} [GeV]", MuPtbins, Mu_Pt_bins); + AddObject(passingLooseMu1DPt_endcap_, ("passingLooseMu1DPt_endcap_"+channelName_).c_str(), "Loose leptons; p_{T} [GeV]", MuPtbins, Mu_Pt_bins); + } From 90462d03971494efa88f6da8418ec48bb5e309c0 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Fri, 13 Sep 2019 12:38:55 -0400 Subject: [PATCH 33/53] PU files for 3 years --- PileupWeights16/PU_Central.root | Bin 0 -> 4867 bytes PileupWeights16/PU_minBiasDOWN.root | Bin 0 -> 4887 bytes PileupWeights16/PU_minBiasUP.root | Bin 0 -> 4878 bytes PileupWeights17/PU_Central.root | Bin 0 -> 5247 bytes PileupWeights17/PU_minBiasDOWN.root | Bin 0 -> 5258 bytes PileupWeights17/PU_minBiasUP.root | Bin 0 -> 5250 bytes PileupWeights18/PU_Central.root | Bin 0 -> 5259 bytes PileupWeights18/PU_minBiasDOWN.root | Bin 0 -> 5280 bytes PileupWeights18/PU_minBiasUP.root | Bin 0 -> 5265 bytes 9 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 PileupWeights16/PU_Central.root create mode 100644 PileupWeights16/PU_minBiasDOWN.root create mode 100644 PileupWeights16/PU_minBiasUP.root create mode 100644 PileupWeights17/PU_Central.root create mode 100644 PileupWeights17/PU_minBiasDOWN.root create mode 100644 PileupWeights17/PU_minBiasUP.root create mode 100644 PileupWeights18/PU_Central.root create mode 100644 PileupWeights18/PU_minBiasDOWN.root create mode 100644 PileupWeights18/PU_minBiasUP.root diff --git a/PileupWeights16/PU_Central.root b/PileupWeights16/PU_Central.root new file mode 100644 index 0000000000000000000000000000000000000000..eeaf6bcb6d10c7407bd845c2264efad58ba423c8 GIT binary patch literal 4867 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 literal 0 HcmV?d00001 diff --git a/PileupWeights16/PU_minBiasDOWN.root b/PileupWeights16/PU_minBiasDOWN.root new file mode 100644 index 0000000000000000000000000000000000000000..423d60b4862da631e20db01cfee32ff6eac48697 GIT binary patch literal 4887 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 literal 0 HcmV?d00001 diff --git a/PileupWeights16/PU_minBiasUP.root b/PileupWeights16/PU_minBiasUP.root new file mode 100644 index 0000000000000000000000000000000000000000..c52879cab640084ca5f2f4685acc43e887dcfdff GIT binary patch literal 4878 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 literal 0 HcmV?d00001 diff --git a/PileupWeights17/PU_Central.root b/PileupWeights17/PU_Central.root new file mode 100644 index 0000000000000000000000000000000000000000..68676f9b1a7c1f537dbdd7db45592cd3311e9db1 GIT binary patch literal 5247 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 literal 0 HcmV?d00001 diff --git a/PileupWeights17/PU_minBiasDOWN.root b/PileupWeights17/PU_minBiasDOWN.root new file mode 100644 index 0000000000000000000000000000000000000000..63809570dec6ea37e45158344f030344561353fa GIT binary patch literal 5258 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 literal 0 HcmV?d00001 diff --git a/PileupWeights18/PU_Central.root b/PileupWeights18/PU_Central.root new file mode 100644 index 0000000000000000000000000000000000000000..ffa4517776f470cf75982c2c20f57ce997f5af9b GIT binary patch literal 5259 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 HKMC+(yzR^a literal 0 HcmV?d00001 diff --git a/PileupWeights18/PU_minBiasDOWN.root b/PileupWeights18/PU_minBiasDOWN.root new file mode 100644 index 0000000000000000000000000000000000000000..ae55aaa48746ebd2ff35fc64dae790bb64b3eccd GIT binary patch literal 5280 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 B%JTpK literal 0 HcmV?d00001 From 5e847af8ad0b663d175732160803e7871dedb5a6 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 16 Sep 2019 13:20:25 -0400 Subject: [PATCH 34/53] GenSelector working by itself but not in parallel --- Utilities/python/SelectorTools.py | 12 ++++++-- Utilities/scripts/makeHistFile.py | 28 +++++++++++++++---- interface/ZZGenSelector.h | 2 ++ src/ZZGenSelector.cc | 46 ++++++++----------------------- 4 files changed, 45 insertions(+), 43 deletions(-) diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 5bcef3a7..1fb4503d 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -20,7 +20,6 @@ def __init__(self, analysis, selection, input_tier, year): "Zstudy" : "ZSelector", "Zstudy_2016" : "ZSelector", "Zstudy_2017" : "ZSelector", - "ZZGen" : "ZZGenSelector", "ZZ4l2016" : "ZZSelector", "ZZ4l2017" : "ZZSelector", "ZZ4l2018" : "ZZSelector", @@ -59,6 +58,9 @@ def setChannels(self, channels): def isBackground(self): self.selector_name = self.selector_name.replace("Selector", "BackgroundSelector") + def isGen(self): + self.selector_name = self.selector_name.replace("BackgroundSelector", "GenSelector") + def isFake(self): self.selector_name = self.selector_name.replace("ZZ", "FakeRate") @@ -160,8 +162,9 @@ def processDataset(self, dataset, file_path, chan): select.SetInputList(self.inputs) self.addTNamed("name", dataset) # Only add for one channel - addSumweights = self.addSumweights and self.channels.index(chan) == 0 and "data" not in dataset and "Background" not in self.selector_name + addSumweights = self.addSumweights and self.channels.index(chan) == 0 and "data" not in dataset and "Background" not in self.selector_name and "Gen" not in self.selector_name if addSumweights: + #print "Should only go here once!" sumweights_hist = ROOT.gROOT.FindObject("sumweights") # Avoid accidentally combining sumweights across datasets if sumweights_hist: @@ -255,7 +258,10 @@ def processFile(self, selector, filename, addSumweights, chan, filenum=1): rtfile = ROOT.TFile.Open(filename) if not rtfile or not rtfile.IsOpen() or rtfile.IsZombie(): raise IOError("Failed to open file %s!" % filename) - tree_name = self.getTreeName(chan) + if "Gen" in self.selector_name: + tree_name = self.getTreeName(chan+"Gen") + else: + tree_name = self.getTreeName(chan) tree = rtfile.Get(tree_name) if not tree: raise ValueError(("tree %s not found for file %s. " \ diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 61d14db8..10c08f85 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -25,6 +25,8 @@ def getComLineArgs(): help="Use UWVV format ntuples in stead of NanoAOD") parser.add_argument("--with_background", action='store_true', help="Don't run background selector") + parser.add_argument("--with_Gen", action='store_true', + help="Don't run ZZGen selector") parser.add_argument("--noHistConfig", action='store_true', help="Don't rely on config file to specify hist info") parser.add_argument("-j", "--numCores", type=int, default=1, @@ -164,20 +166,36 @@ def makeHistFile(args): selector.setFileList(*args['inputs_from_file']) mc = selector.applySelector() - if args['test']: - fOut.Close() - sys.exit(0) if args['with_background']: selector.isBackground() selector.setInputs(sf_inputs+hist_inputs+fr_inputs) selector.setOutputfile(tmpFileName.replace(".root", "bkgd.root")) nonprompt = selector.applySelector() - tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd"]] + #tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd"]] + #rval = subprocess.call(["hadd", "-f", tmpFileName] + tempfiles) + #if rval == 0: + # map(os.remove, tempfiles) + + if args['with_Gen']: + selector.isGen() + selector.setInputs(hist_inputs) + selector.setOutputfile(tmpFileName.replace(".root", "gen.root")) + if args['filenames']: + #selector.setDatasets(args['filenames']) + selector.setDatasets(ConfigureJobs.getListOfGenFilenames()) + else: + selector.setFileList(*args['inputs_from_file']) + gen = selector.applySelector() + tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd","gen"]] rval = subprocess.call(["hadd", "-f", tmpFileName] + tempfiles) if rval == 0: map(os.remove, tempfiles) + if args['test']: + fOut.Close() + sys.exit(0) + fOut.Close() fOut = ROOT.TFile.Open(tmpFileName, "update") @@ -196,7 +214,7 @@ def makeHistFile(args): OutputTools.writeOutputListItem(nonpromptmc, fOut) ewkmc = HistTools.makeCompositeHists(fOut,"AllEWK", ConfigureJobs.getListOfFilesWithXSec( - ConfigureJobs.getListOfEWKFilenames(args['analysis']), manager_path), args['lumi'], + ConfigureJobs.getListOfEWK(args['analysis']), manager_path), args['lumi'], underflow=False, overflow=False) OutputTools.writeOutputListItem(ewkmc, fOut) ewkmc.Delete() diff --git a/interface/ZZGenSelector.h b/interface/ZZGenSelector.h index d5d47653..acc6129d 100644 --- a/interface/ZZGenSelector.h +++ b/interface/ZZGenSelector.h @@ -13,6 +13,7 @@ public : Float_t GenPt; Float_t GenEta; Float_t Genweight; + Float_t genWeight; Float_t GenZ1mass; Float_t GenZ2mass; Float_t GenZ1pt; @@ -33,6 +34,7 @@ public : Float_t Genl3Phi; Float_t Genl4Phi; + TBranch* b_genWeight; TBranch* b_GenZ1mass; TBranch* b_GenZ2mass; TBranch* b_GenZ1pt; diff --git a/src/ZZGenSelector.cc b/src/ZZGenSelector.cc index 0bbc3137..ff603f0a 100644 --- a/src/ZZGenSelector.cc +++ b/src/ZZGenSelector.cc @@ -49,6 +49,7 @@ void ZZGenSelector::Init(TTree *tree) void ZZGenSelector::LoadBranchesUWVV(Long64_t entry, std::pair variation) { Genweight = 1; + b_genWeight->GetEntry(entry); b_Genl1Pt->GetEntry(entry); b_Genl2Pt->GetEntry(entry); b_Genl3Pt->GetEntry(entry); @@ -70,6 +71,8 @@ void ZZGenSelector::LoadBranchesUWVV(Long64_t entry, std::pairGetEntry(entry); b_GenZ1pt->GetEntry(entry); b_GenZ1Phi->GetEntry(entry); + //std::cout<<"Genweight before: "<SetBranchAddress("genWeight", &genWeight, &b_genWeight); + } if (channel_ == eeee) { //std::cout<<"enum channel_: "<SetBranchAddress("e1_e2_Mass", &GenZ1mass, &b_GenZ1mass); @@ -257,6 +263,11 @@ void ZZGenSelector::FillHistograms(Long64_t entry, std::pair Date: Mon, 16 Sep 2019 14:31:15 -0400 Subject: [PATCH 35/53] commands to run --- runZZ4l2016.sh | 2 +- runZZ4l2017.sh | 2 +- runZZ4l2018.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index 44c97bbe..c06e4d91 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_background -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root diff --git a/runZZ4l2017.sh b/runZZ4l2017.sh index f3026a9a..1f55fa4e 100755 --- a/runZZ4l2017.sh +++ b/runZZ4l2017.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 --with_background -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root diff --git a/runZZ4l2018.sh b/runZZ4l2018.sh index c1c22889..94d33e00 100755 --- a/runZZ4l2018.sh +++ b/runZZ4l2018.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file test2018 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2018 -j 12 --with_background -sf data/scaleFactorsZZ4l2018.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file test2018 --uwvv -c mmmm -f ZZ4l2018 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2018.root From 8fc115c04b5dbb00310fef15df3b91feed7be7f1 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 16 Sep 2019 14:45:18 -0400 Subject: [PATCH 36/53] Reset datasets to remove unwanted ones, e.g., data for Gen --- Utilities/python/SelectorTools.py | 9 +++++---- Utilities/scripts/makeHistFile.py | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 1fb4503d..3dfde4f6 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -142,6 +142,10 @@ def setDatasets(self, datalist): continue self.datasets[dataset] = [file_path] + def clearDatasets(self): + for dataset in datasets: + dataset[dataset] = [] + def applySelector(self): for chan in self.channels: self.addTNamed("channel", chan) @@ -258,10 +262,7 @@ def processFile(self, selector, filename, addSumweights, chan, filenum=1): rtfile = ROOT.TFile.Open(filename) if not rtfile or not rtfile.IsOpen() or rtfile.IsZombie(): raise IOError("Failed to open file %s!" % filename) - if "Gen" in self.selector_name: - tree_name = self.getTreeName(chan+"Gen") - else: - tree_name = self.getTreeName(chan) + tree_name = self.getTreeName(chan) tree = rtfile.Get(tree_name) if not tree: raise ValueError(("tree %s not found for file %s. " \ diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 10c08f85..ec767952 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -179,6 +179,9 @@ def makeHistFile(args): if args['with_Gen']: selector.isGen() + selector.setChannels([c+"Gen" for c in args['channels']]) + # Make sure to remove data from the dataset lists + selector.clearDatasets() selector.setInputs(hist_inputs) selector.setOutputfile(tmpFileName.replace(".root", "gen.root")) if args['filenames']: @@ -187,6 +190,7 @@ def makeHistFile(args): else: selector.setFileList(*args['inputs_from_file']) gen = selector.applySelector() + selector.setChannels(args['channels']) tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd","gen"]] rval = subprocess.call(["hadd", "-f", tmpFileName] + tempfiles) if rval == 0: From 9d7126ac8e08e4538ed24e00f88f238bfb5fe7cb Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 16 Sep 2019 15:57:15 -0400 Subject: [PATCH 37/53] Fix mistakes in cleardatasets --- Utilities/python/SelectorTools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 3dfde4f6..815ba113 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -143,8 +143,8 @@ def setDatasets(self, datalist): self.datasets[dataset] = [file_path] def clearDatasets(self): - for dataset in datasets: - dataset[dataset] = [] + for dataset in self.datasets: + self.datasets[dataset] = [] def applySelector(self): for chan in self.channels: From 51bd9f1558d0252ea74eb8d0244035a1db0dd4ad Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 16 Sep 2019 16:08:39 -0400 Subject: [PATCH 38/53] All latest changes --- Utilities/python/ConfigureJobs.py | 35 +++++++++++++++++++++++++- Utilities/python/SelectorTools.py | 13 +++++++--- Utilities/scripts/makeHistFile.py | 3 +++ interface/ZZSelector.h | 4 ++- runZZ4l2016.sh | 2 +- src/SelectorBase.cc | 2 ++ src/ZZSelector.cc | 41 ++++++++++++++++++++++++------- 7 files changed, 84 insertions(+), 16 deletions(-) diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index 898b5375..2faf33aa 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -83,7 +83,35 @@ def getCombinePath(): raise ValueError("dataset_manager_path not specified in config file Template/config.%s" % os.environ["USER"]) return config['Setup']['combine_path'] + "/" -def getListOfEWKFilenames(analysis=""): +def getListOfGenFilenames(): + return [ + "zz4l-amcatnlo", + "zz4l-powheg", + "ggZZ4e", + "ggZZ4m", + "ggZZ4t", + "ggZZ2e2mu", + "ggZZ2e2tau", + "ggZZ2mu2tau", + "ggHZZ", + "ttH_HToZZ_4L", + "WminusHToZZ", + "WplusHToZZ", + "ZHToZZ_4L", + "vbfHZZ", + ] +def getListOfEWKFilenames(): + return [ + "wz3lnu-mg5amcnlo", + "zz4l-powheg", + "ggZZ4e", + "ggZZ4m", + "ggZZ4t", + "ggZZ2e2mu", + "ggZZ2e2tau", + "ggZZ2mu2tau", + ] +def getListOfEWK(analysis=""): if "ZZ4l" in analysis: return [ "zz4l-powheg", @@ -118,6 +146,11 @@ def getListOfEWKFilenames(analysis=""): "ggZZ4m", "ggZZ2e2mu", ] +def getListOfDYFilenames(): + return[ + "DYJetsToLL_M10to50", + "DYJetsToLLM-50", + ] def getListOfNonpromptFilenames(): return ["tt-lep", "st-schan", diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 1fb4503d..44a39c27 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -141,6 +141,9 @@ def setDatasets(self, datalist): logging.warning(e) continue self.datasets[dataset] = [file_path] + def clearDatasets(self): + for dataset in self.datasets: + self.datasets[dataset] = [] def applySelector(self): for chan in self.channels: @@ -258,10 +261,12 @@ def processFile(self, selector, filename, addSumweights, chan, filenum=1): rtfile = ROOT.TFile.Open(filename) if not rtfile or not rtfile.IsOpen() or rtfile.IsZombie(): raise IOError("Failed to open file %s!" % filename) - if "Gen" in self.selector_name: - tree_name = self.getTreeName(chan+"Gen") - else: - tree_name = self.getTreeName(chan) + #if "Gen" in self.selector_name: + # tree_name = self.getTreeName(chan+"Gen") + #else: + tree_name = self.getTreeName(chan) + print "selector: ",self.selector_name + print "tree_name: ",tree_name tree = rtfile.Get(tree_name) if not tree: raise ValueError(("tree %s not found for file %s. " \ diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 10c08f85..afd283f7 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -179,6 +179,8 @@ def makeHistFile(args): if args['with_Gen']: selector.isGen() + selector.setChannels([c+"Gen" for c in args['channels']]) + selector.clearDatasets() selector.setInputs(hist_inputs) selector.setOutputfile(tmpFileName.replace(".root", "gen.root")) if args['filenames']: @@ -187,6 +189,7 @@ def makeHistFile(args): else: selector.setFileList(*args['inputs_from_file']) gen = selector.applySelector() + selector.setChannels(args['channels']) tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd","gen"]] rval = subprocess.call(["hadd", "-f", tmpFileName] + tempfiles) if rval == 0: diff --git a/interface/ZZSelector.h b/interface/ZZSelector.h index ff43f361..5bc5f96b 100644 --- a/interface/ZZSelector.h +++ b/interface/ZZSelector.h @@ -52,10 +52,12 @@ public : UInt_t nvtx; Float_t Mass; Float_t Pt; + Float_t Eta; float dPhiZZ; //DeltaPhi between Z1 and Z2 TBranch* b_nvtx; TBranch* b_Mass; TBranch* b_Pt; + TBranch* b_Eta; TBranch* b_jetPt; TBranch* b_jetEta; TBranch* b_mjj; @@ -75,7 +77,7 @@ public : void ApplyScaleFactors(); bool PassesZZSelection(bool nonPrompt); bool PassesZZjjSelection(); - bool PassesHZZSelection(); + bool PassesHZZSelection(bool nonPrompt); unsigned int GetLheWeightInfo(); void SetVariables(Long64_t entry); //bool DuplicatedEvent(); diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index c06e4d91..3ac90647 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee -f ZZ4l2016 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index 23e4e46a..d5d93329 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -134,7 +134,9 @@ void SelectorBase::LoadBranches(Long64_t entry, std::pairSetBranchAddress("Mass", &Mass, &b_Mass); fChain->SetBranchAddress("Pt", &Pt, &b_Pt); + fChain->SetBranchAddress("Eta", &Eta, &b_Eta); fChain->SetBranchAddress("jetPt", &jetPt, &b_jetPt); fChain->SetBranchAddress("jetEta", &jetEta, &b_jetEta); fChain->SetBranchAddress("mjj", &mjj, &b_mjj); @@ -106,6 +115,7 @@ void ZZSelector::LoadBranchesUWVV(Long64_t entry, std::pairGetEntry(entry); b_Mass->GetEntry(entry); b_Pt->GetEntry(entry); + b_Eta->GetEntry(entry); b_jetPt->GetEntry(entry); b_jetEta->GetEntry(entry); b_mjj->GetEntry(entry); @@ -586,11 +596,19 @@ bool ZZSelector::PassesZZSelection(bool nonPrompt){ } } -bool ZZSelector::PassesHZZSelection(){ +bool ZZSelector::PassesHZZSelection(bool nonPrompt){ + if (nonPrompt){ + if (ZSelection()) + return true; + else + return false; + } + else{ if (ZSelection() && TightZZLeptons()) return true; else return false; + } } bool ZZSelector::TightZZLeptons() { if (tightZ1Leptons() && tightZ2Leptons()) @@ -626,7 +644,7 @@ bool ZZSelector::HZZSIPSelection(){ return false; } bool ZZSelector::HZZLowMass() { - if (Mass > 70.0 && Mass < 110.0) + if (Mass > 130.0 && Mass < 170.0) return true; else return false; @@ -674,8 +692,13 @@ void ZZSelector::FillHistograms(Long64_t entry, std::pair Date: Mon, 16 Sep 2019 16:57:44 -0400 Subject: [PATCH 39/53] Clear datasets before setting --- Utilities/python/ConfigureJobs.py | 43 +++++++++++++++---------------- Utilities/python/SelectorTools.py | 8 ++---- Utilities/scripts/makeHistFile.py | 9 +++---- interface/SelectorBase.h | 1 + runZZ4l2016.sh | 3 ++- 5 files changed, 30 insertions(+), 34 deletions(-) diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index 2faf33aa..ed9f1962 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -83,24 +83,26 @@ def getCombinePath(): raise ValueError("dataset_manager_path not specified in config file Template/config.%s" % os.environ["USER"]) return config['Setup']['combine_path'] + "/" -def getListOfGenFilenames(): - return [ - "zz4l-amcatnlo", - "zz4l-powheg", - "ggZZ4e", - "ggZZ4m", - "ggZZ4t", - "ggZZ2e2mu", - "ggZZ2e2tau", - "ggZZ2mu2tau", - "ggHZZ", - "ttH_HToZZ_4L", - "WminusHToZZ", - "WplusHToZZ", - "ZHToZZ_4L", - "vbfHZZ", - ] -def getListOfEWKFilenames(): +def getListOfGenFilenames(analysis='ZZ'): + if 'ZZ' in analysis: + return [ + "zz4l-amcatnlo", + "zz4l-powheg", + "ggZZ4e", + "ggZZ4m", + "ggZZ4t", + "ggZZ2e2mu", + "ggZZ2e2tau", + "ggZZ2mu2tau", + #"ggHZZ", + #"ttH_HToZZ_4L", + #"WminusHToZZ", + #"WplusHToZZ", + #"ZHToZZ_4L", + #"vbfHZZ", + ] + return [] +def getListOfEWKFilenames(analysis=""): return [ "wz3lnu-mg5amcnlo", "zz4l-powheg", @@ -111,10 +113,10 @@ def getListOfEWKFilenames(): "ggZZ2e2tau", "ggZZ2mu2tau", ] -def getListOfEWK(analysis=""): if "ZZ4l" in analysis: return [ "zz4l-powheg", + "zz4ljj-ewk", "ggZZ4e", "ggZZ4m", "ggZZ4t", @@ -233,7 +235,6 @@ def getListOfFiles(filelist, selection, manager_path="", analysis=""): dataset_file = manager_path + \ "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2016/%s.json" % selection allnames = json.load(open(dataset_file)).keys() - print allnames if "nodata" in name: nodata = [x for x in allnames if "data" not in x] names += nodata @@ -245,7 +246,6 @@ def getListOfFiles(filelist, selection, manager_path="", analysis=""): dataset_file = manager_path + \ "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2017/%s.json" % selection allnames = json.load(open(dataset_file)).keys() - print allnames if "nodata" in name: nodata = [x for x in allnames if "data" not in x] names += nodata @@ -257,7 +257,6 @@ def getListOfFiles(filelist, selection, manager_path="", analysis=""): dataset_file = manager_path + \ "ZZ4lRun2DatasetManager/FileInfo/ZZ4l2018/%s.json" % selection allnames = json.load(open(dataset_file)).keys() - print allnames if "nodata" in name: nodata = [x for x in allnames if "data" not in x] names += nodata diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index fe7b5c04..95256eb2 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -129,6 +129,7 @@ def setFileList(self, list_of_files, nPerJob, jobNum): self.datasets[dataset].append(file_path) def setDatasets(self, datalist): + self.clearDatasets() datasets = ConfigureJobs.getListOfFiles(datalist, self.input_tier) for dataset in datasets: if "@" in dataset: @@ -141,13 +142,9 @@ def setDatasets(self, datalist): logging.warning(e) continue self.datasets[dataset] = [file_path] - def clearDatasets(self): - for dataset in self.datasets: - self.datasets[dataset] = [] def clearDatasets(self): - for dataset in self.datasets: - self.datasets[dataset] = [] + self.datasets.clear() def applySelector(self): for chan in self.channels: @@ -164,7 +161,6 @@ def applySelector(self): def processDataset(self, dataset, file_path, chan): logging.info("Processing dataset %s" % dataset) - print "Processing dataset: ", dataset select = getattr(ROOT, self.selector_name)() select.SetInputList(self.inputs) self.addTNamed("name", dataset) diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index ec767952..9e5aed93 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -164,14 +164,14 @@ def makeHistFile(args): selector.setDatasets(args['filenames']) else: selector.setFileList(*args['inputs_from_file']) - mc = selector.applySelector() + #mc = selector.applySelector() if args['with_background']: selector.isBackground() selector.setInputs(sf_inputs+hist_inputs+fr_inputs) selector.setOutputfile(tmpFileName.replace(".root", "bkgd.root")) - nonprompt = selector.applySelector() + #nonprompt = selector.applySelector() #tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd"]] #rval = subprocess.call(["hadd", "-f", tmpFileName] + tempfiles) #if rval == 0: @@ -181,12 +181,11 @@ def makeHistFile(args): selector.isGen() selector.setChannels([c+"Gen" for c in args['channels']]) # Make sure to remove data from the dataset lists - selector.clearDatasets() selector.setInputs(hist_inputs) selector.setOutputfile(tmpFileName.replace(".root", "gen.root")) if args['filenames']: #selector.setDatasets(args['filenames']) - selector.setDatasets(ConfigureJobs.getListOfGenFilenames()) + selector.setDatasets(ConfigureJobs.getListOfGenFilenames(args['analysis'])) else: selector.setFileList(*args['inputs_from_file']) gen = selector.applySelector() @@ -218,7 +217,7 @@ def makeHistFile(args): OutputTools.writeOutputListItem(nonpromptmc, fOut) ewkmc = HistTools.makeCompositeHists(fOut,"AllEWK", ConfigureJobs.getListOfFilesWithXSec( - ConfigureJobs.getListOfEWK(args['analysis']), manager_path), args['lumi'], + ConfigureJobs.getListOfEWKFilenames(args['analysis']), manager_path), args['lumi'], underflow=False, overflow=False) OutputTools.writeOutputListItem(ewkmc, fOut) ewkmc.Delete() diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index 8a1a8cbd..07826648 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -133,6 +133,7 @@ class SelectorBase : public TSelector { {"ee", ee}, {"em", em}, {"mm", mm}, {"eee", eee}, {"eem", eem}, {"emm", emm}, {"mmm", mmm}, {"eeee", eeee}, {"eemm", eemm}, {"mmee", mmee}, {"mmmm", mmmm}, + {"eeeeGen", eeee}, {"eemmGen", eemm},{"mmeeGen", mmee},{"mmmmGen", mmmm}, {"Inclusive", Inclusive}, {"lll", lll}, }; diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index 3ac90647..ed1e44d2 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1 +1,2 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee -f ZZ4l2016 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root +#./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee -f ZZ4l2016 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root From 2703ca6fcfe97fc44c30f6984eada594749f56f0 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 16 Sep 2019 18:25:44 -0400 Subject: [PATCH 40/53] I think it's at least all running and combining --- Utilities/python/ConfigureJobs.py | 12 ++++++------ Utilities/python/SelectorTools.py | 6 ++++++ Utilities/scripts/makeHistFile.py | 28 ++++++++++++++++------------ runZZ4l2016.sh | 4 ++-- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index ed9f1962..140a25ca 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -94,12 +94,12 @@ def getListOfGenFilenames(analysis='ZZ'): "ggZZ2e2mu", "ggZZ2e2tau", "ggZZ2mu2tau", - #"ggHZZ", - #"ttH_HToZZ_4L", - #"WminusHToZZ", - #"WplusHToZZ", - #"ZHToZZ_4L", - #"vbfHZZ", + "ggHZZ", + "ttH_HToZZ_4L", + "WminusHToZZ", + "WplusHToZZ", + "ZHToZZ_4L", + "vbfHZZ", ] return [] def getListOfEWKFilenames(analysis=""): diff --git a/Utilities/python/SelectorTools.py b/Utilities/python/SelectorTools.py index 95256eb2..a672f1d9 100755 --- a/Utilities/python/SelectorTools.py +++ b/Utilities/python/SelectorTools.py @@ -42,6 +42,7 @@ def __init__(self, analysis, selection, input_tier, year): self.numCores = 1 self.channels = ["Inclusive"] self.outfile_name = "temp.root" + self.outfile = 0 self.datasets = {} # Needed to parallelize class member function, see @@ -63,8 +64,13 @@ def isGen(self): def isFake(self): self.selector_name = self.selector_name.replace("ZZ", "FakeRate") + + def outputFile(self): + return self.outfile def setOutputfile(self, outfile_name): + if self.outfile: + self.outfile.Close() self.outfile_name = outfile_name self.outfile = ROOT.gROOT.FindObject(outfile_name) if not self.outfile: diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 9e5aed93..53623de2 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -63,7 +63,9 @@ def makeHistFile(args): else: tmpFileName = "Hists%s-%s.root" % (today, args['output_file']) if args['selection'] == "SignalSync" \ else "Hists%s-%s.root" % (today, args['analysis']) - fOut = ROOT.TFile(tmpFileName if not args['with_background'] else tmpFileName.replace(".root", "sel.root"), "recreate") + toCombine = args['with_background'] or args['with_Gen'] + fOut = ROOT.TFile(tmpFileName if not toCombine else tmpFileName.replace(".root", "sel.root"), "recreate") + combinedNames = [fOut.GetName()] addScaleFacs = False if args['analysis'] == "WZxsec2016" or args['analysis'] == 'Zstudy_2016' or args['scalefactors_file']: @@ -164,25 +166,25 @@ def makeHistFile(args): selector.setDatasets(args['filenames']) else: selector.setFileList(*args['inputs_from_file']) - #mc = selector.applySelector() + mc = selector.applySelector() if args['with_background']: selector.isBackground() selector.setInputs(sf_inputs+hist_inputs+fr_inputs) - selector.setOutputfile(tmpFileName.replace(".root", "bkgd.root")) - #nonprompt = selector.applySelector() - #tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd"]] - #rval = subprocess.call(["hadd", "-f", tmpFileName] + tempfiles) - #if rval == 0: - # map(os.remove, tempfiles) + output_name = tmpFileName.replace(".root", "bkgd.root") + selector.setOutputfile(output_name) + bkgd = selector.applySelector() + combinedNames.append(output_name) if args['with_Gen']: selector.isGen() selector.setChannels([c+"Gen" for c in args['channels']]) # Make sure to remove data from the dataset lists selector.setInputs(hist_inputs) - selector.setOutputfile(tmpFileName.replace(".root", "gen.root")) + output_name = tmpFileName.replace(".root", "gen.root") + selector.setOutputfile(output_name) + combinedNames.append(output_name) if args['filenames']: #selector.setDatasets(args['filenames']) selector.setDatasets(ConfigureJobs.getListOfGenFilenames(args['analysis'])) @@ -190,10 +192,12 @@ def makeHistFile(args): selector.setFileList(*args['inputs_from_file']) gen = selector.applySelector() selector.setChannels(args['channels']) - tempfiles = [tmpFileName.replace(".root", "%s.root" % app) for app in ["sel", "bkgd","gen"]] - rval = subprocess.call(["hadd", "-f", tmpFileName] + tempfiles) + selector.outputFile().Close() + + if len(combinedNames) > 1: + rval = subprocess.call(["hadd", "-f", tmpFileName] + combinedNames) if rval == 0: - map(os.remove, tempfiles) + map(os.remove, combinedNames) if args['test']: fOut.Close() diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index ed1e44d2..7d443085 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1,2 +1,2 @@ -#./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee -f ZZ4l2016 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee -f ZZ4l2016 --with_Gen --with_background --with_Gen -sf data/scaleFactorsZZ4l2017.root +#./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root From 567db537819856cb221b0ee9d5fe733fe473dce2 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Mon, 16 Sep 2019 18:50:31 -0400 Subject: [PATCH 41/53] Don't include WZ in EW files, still not sure what's up with zzjj --- Utilities/python/ConfigureJobs.py | 13 ++----------- Utilities/python/HistTools.py | 4 +++- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index 140a25ca..01d67094 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -88,6 +88,7 @@ def getListOfGenFilenames(analysis='ZZ'): return [ "zz4l-amcatnlo", "zz4l-powheg", + "zzjj4l-ewk", "ggZZ4e", "ggZZ4m", "ggZZ4t", @@ -103,20 +104,10 @@ def getListOfGenFilenames(analysis='ZZ'): ] return [] def getListOfEWKFilenames(analysis=""): - return [ - "wz3lnu-mg5amcnlo", - "zz4l-powheg", - "ggZZ4e", - "ggZZ4m", - "ggZZ4t", - "ggZZ2e2mu", - "ggZZ2e2tau", - "ggZZ2mu2tau", - ] if "ZZ4l" in analysis: return [ "zz4l-powheg", - "zz4ljj-ewk", + "zzjj4l-ewk", "ggZZ4e", "ggZZ4m", "ggZZ4t", diff --git a/Utilities/python/HistTools.py b/Utilities/python/HistTools.py index 4b28e806..ddffabdf 100644 --- a/Utilities/python/HistTools.py +++ b/Utilities/python/HistTools.py @@ -268,7 +268,7 @@ def addOverflowAndUnderflow(hist, underflow=True, overflow=True): add_underflow = hist.GetBinContent(0) + hist.GetBinContent(1) hist.SetBinContent(1, add_underflow) -def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False, overflow=True, rebin=None): +def makeCompositeHists(hist_file, name, members, lumi, hists=[], hist_filter=0, underflow=False, overflow=True, rebin=None): composite = ROOT.TList() composite.SetName(name) for directory in [str(i) for i in members.keys()]: @@ -280,6 +280,8 @@ def makeCompositeHists(hist_file, name, members, lumi, hists=[], underflow=False continue if hists == []: hists = [i.GetName() for i in hist_file.Get(directory).GetListOfKeys()] + if hist_filter: + hists = filter(hist_filter, hists) sumweights = 0 if "data" not in directory.lower() and "nonprompt" not in directory.lower(): sumweights_hist = hist_file.Get("/".join([directory, "sumweights"])) From dcffd76a89dc7c406d29cabfd06264466cbee0f0 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 23 Sep 2019 07:11:19 -0400 Subject: [PATCH 42/53] New SFs and 6 distributions we want to unfold are ZZMass,ZZPt, ZPt, leptonPt, dPhi(Z1,Z2), dR(Z1,Z2) --- Utilities/scripts/makeHistFile.py | 50 ++++++++++++++++++++----------- interface/ZZGenSelector.h | 11 +++++-- interface/ZZSelector.h | 1 + interface/ZZSelectorBase.h | 4 +++ src/ZZGenSelector.cc | 43 +++++++++++--------------- src/ZZSelector.cc | 28 +++++++++++------ src/ZZSelectorBase.cc | 10 +++++++ 7 files changed, 92 insertions(+), 55 deletions(-) diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index 53623de2..d5ee0624 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -83,31 +83,45 @@ def makeHistFile(args): if eZZTightFakeRate: eZZTightFakeRate.SetName("fakeRate_allE") if "2018" in args['scalefactors_file']: - muonMoriondSF= fScales.Get('muonMoriond19SF') - muonMoriondSF.SetName("muonMoriondSF") - electronLowRecoSF = fScales.Get('electronLowReco19SF') - electronLowRecoSF.SetName("electronLowRecoSF") - electronRecoSF = fScales.Get('electronReco19SF') - electronRecoSF.SetName("electronRecoSF") - electronMoriondSF = fScales.Get('electronMoriond19SF') - electronMoriondSF.SetName("electronMoriondSF") - electronMoriondGapSF = fScales.Get('electronMoriond19GapSF') - electronMoriondGapSF.SetName("electronMoriondGapSF") - else: - muonMoriondSF= fScales.Get('muonMoriond18SF') - muonMoriondSF.SetName("muonMoriondSF") + muonRunSF= fScales.Get('muonRun18SF') + muonRunSF.SetName("muonRunSF") electronLowRecoSF = fScales.Get('electronLowReco18SF') electronLowRecoSF.SetName("electronLowRecoSF") electronRecoSF = fScales.Get('electronReco18SF') electronRecoSF.SetName("electronRecoSF") - electronMoriondSF = fScales.Get('electronMoriond18SF') - electronMoriondSF.SetName("electronMoriondSF") - electronMoriondGapSF = fScales.Get('electronMoriond18GapSF') - electronMoriondGapSF.SetName("electronMoriondGapSF") + electronRunSF = fScales.Get('electronRun18SF') + electronRunSF.SetName("electronRunSF") + electronRunGapSF = fScales.Get('electronRun18GapSF') + electronRunGapSF.SetName("electronRunGapSF") + elif "2016" in args['scalefactors_file']: + muonRunSF= fScales.Get('muonRun16SF') + muonRunSF.SetName("muonRunSF") + electronLowRecoSF = fScales.Get('electronLowReco16SF') + electronLowRecoSF.SetName("electronLowRecoSF") + electronRecoSF = fScales.Get('electronReco16SF') + electronRecoSF.SetName("electronRecoSF") + electronRunSF = fScales.Get('electronRun16SF') + electronRunSF.SetName("electronRunSF") + electronRunGapSF = fScales.Get('electronRun16GapSF') + electronRunGapSF.SetName("electronRunGapSF") + elif "2017" in args['scalefactors_file']: + muonRunSF= fScales.Get('muonRun17SF') + muonRunSF.SetName("muonRunSF") + electronLowRecoSF = fScales.Get('electronLowReco17SF') + electronLowRecoSF.SetName("electronLowRecoSF") + electronRecoSF = fScales.Get('electronReco17SF') + electronRecoSF.SetName("electronRecoSF") + electronRunSF = fScales.Get('electronRun17SF') + electronRunSF.SetName("electronRunSF") + electronRunGapSF = fScales.Get('electronRun17GapSF') + electronRunGapSF.SetName("electronRunGapSF") + else: + print "what scale factors you want?" + sys.exit() pileupSF = fScales.Get('pileupSF') fr_inputs = [eZZTightFakeRate, mZZTightFakeRate,] - sf_inputs = [electronLowRecoSF,electronRecoSF,electronMoriondSF, electronMoriondGapSF,muonMoriondSF,pileupSF] + sf_inputs = [electronLowRecoSF,electronRecoSF,electronRunSF, electronRunGapSF,muonRunSF,pileupSF] else: fScales = ROOT.TFile('data/scaleFactors.root') mCBTightFakeRate = fScales.Get("mCBTightFakeRate") diff --git a/interface/ZZGenSelector.h b/interface/ZZGenSelector.h index acc6129d..9f872df9 100644 --- a/interface/ZZGenSelector.h +++ b/interface/ZZGenSelector.h @@ -8,7 +8,8 @@ class ZZGenSelector : public SelectorBase { public : - float GendPhiZZ; //DeltaPhi between Z1 and Z2 + float GendPhiZZ; //DeltaPhi between Z1 and Z2 + float GendRZZ; //DeltaR between Z1 and Z2 Float_t GenMass; Float_t GenPt; Float_t GenEta; @@ -19,8 +20,10 @@ public : Float_t GenZ1pt; Float_t GenZ2pt; Float_t GenZ1Phi; - Float_t GenZ2Phi; - + Float_t GenZ2Phi; + Float_t GenZ1Eta; + Float_t GenZ2Eta; + Float_t Genl1Pt; Float_t Genl2Pt; Float_t Genl3Pt; @@ -39,6 +42,8 @@ public : TBranch* b_GenZ2mass; TBranch* b_GenZ1pt; TBranch* b_GenZ2pt; + TBranch* b_GenZ1Eta; + TBranch* b_GenZ2Eta; TBranch* b_GenZ1Phi; TBranch* b_GenZ2Phi; TBranch* b_GenMass; diff --git a/interface/ZZSelector.h b/interface/ZZSelector.h index 5bc5f96b..e872174b 100644 --- a/interface/ZZSelector.h +++ b/interface/ZZSelector.h @@ -54,6 +54,7 @@ public : Float_t Pt; Float_t Eta; float dPhiZZ; //DeltaPhi between Z1 and Z2 + float dRZZ; //DeltaR between Z1 and Z2 TBranch* b_nvtx; TBranch* b_Mass; TBranch* b_Pt; diff --git a/interface/ZZSelectorBase.h b/interface/ZZSelectorBase.h index 77aad9c1..27140fe1 100644 --- a/interface/ZZSelectorBase.h +++ b/interface/ZZSelectorBase.h @@ -44,6 +44,8 @@ public : Float_t Z2pt; Float_t Z1Phi; Float_t Z2Phi; + Float_t Z1Eta; + Float_t Z2Eta; Float_t type1_pfMETEt; Float_t type1_pfMETPhi; Float_t l1GenPt; @@ -114,6 +116,8 @@ public : TBranch* b_Z2pt; TBranch* b_Z1Phi; TBranch* b_Z2Phi; + TBranch* b_Z1Eta; + TBranch* b_Z2Eta; TBranch* b_nTruePU; TBranch* b_type1_pfMETEt; TBranch* b_type1_pfMETPhi; diff --git a/src/ZZGenSelector.cc b/src/ZZGenSelector.cc index ff603f0a..e6e9612b 100644 --- a/src/ZZGenSelector.cc +++ b/src/ZZGenSelector.cc @@ -6,40 +6,16 @@ void ZZGenSelector::Init(TTree *tree) { allChannels_ = {"ee", "mm", }; hists1D_ = { - "GenZ2lep2_Phi", - "GenZ2lep2_Pt", "GenMass", - "Pt", - "nJets", - "nJetCSVv2T", "Genyield", "GenZMass", - "GenZ1Mass", - "GenZ2Mass", "GenZZPt", "GenZZEta", - "GenZ1Pt", - "GenZ2Pt", "GenZPt", - "GenZ1Phi", - "GenZ2Phi", "GendPhiZ1Z2", + "GendRZ1Z2", "GenLepPt", "GenLepEta", - "GenLep12Pt", - "GenLep12Eta", - "GenLep34Pt", - "GenLep34Eta", - "GenZ1lep1_Eta", - "GenZ1lep1_Phi", - "GenZ1lep1_Pt", - "GenZ1lep2_Eta", - "GenZ1lep2_Phi", - "GenZ1lep2_Pt", - "GenZ2lep1_Eta", - "GenZ2lep1_Phi", - "GenZ2lep1_Pt", - "GenZ2lep2_Eta", }; //hists2D_ = {"GenZ1Mass_GenZ2Mass"}; @@ -67,6 +43,8 @@ void ZZGenSelector::LoadBranchesUWVV(Long64_t entry, std::pairGetEntry(entry); b_GenZ2pt->GetEntry(entry); b_GenZ2Phi->GetEntry(entry); + b_GenZ1Eta->GetEntry(entry); + b_GenZ2Eta->GetEntry(entry); } b_GenZ1mass->GetEntry(entry); b_GenZ1pt->GetEntry(entry); @@ -98,7 +76,13 @@ void ZZGenSelector::LoadBranchesUWVV(Long64_t entry, std::pair variation) { @@ -121,6 +105,8 @@ void ZZGenSelector::SetBranchesUWVV() { fChain->SetBranchAddress("e3_e4_Pt", &GenZ2pt, &b_GenZ2pt); fChain->SetBranchAddress("e1_e2_Phi", &GenZ1Phi, &b_GenZ1Phi); fChain->SetBranchAddress("e3_e4_Phi", &GenZ2Phi, &b_GenZ2Phi); + fChain->SetBranchAddress("e1_e2_Eta", &GenZ1Eta, &b_GenZ1Eta); + fChain->SetBranchAddress("e3_e4_Eta", &GenZ2Eta, &b_GenZ2Eta); fChain->SetBranchAddress("e1Pt", &Genl1Pt, &b_Genl1Pt); fChain->SetBranchAddress("e2Pt", &Genl2Pt, &b_Genl2Pt); fChain->SetBranchAddress("e3Pt", &Genl3Pt, &b_Genl3Pt); @@ -143,6 +129,8 @@ void ZZGenSelector::SetBranchesUWVV() { fChain->SetBranchAddress("m1_m2_Pt", &GenZ2pt, &b_GenZ2pt); fChain->SetBranchAddress("e1_e2_Phi", &GenZ1Phi, &b_GenZ1Phi); fChain->SetBranchAddress("m1_m2_Phi", &GenZ2Phi, &b_GenZ2Phi); + fChain->SetBranchAddress("e1_e2_Eta", &GenZ1Eta, &b_GenZ1Eta); + fChain->SetBranchAddress("m1_m2_Eta", &GenZ2Eta, &b_GenZ2Eta); fChain->SetBranchAddress("e1Pt", &Genl1Pt, &b_Genl1Pt); fChain->SetBranchAddress("e2Pt", &Genl2Pt, &b_Genl2Pt); fChain->SetBranchAddress("m1Pt", &Genl3Pt, &b_Genl3Pt); @@ -163,6 +151,8 @@ void ZZGenSelector::SetBranchesUWVV() { fChain->SetBranchAddress("m1_m2_Pt", &GenZ2pt, &b_GenZ2pt); fChain->SetBranchAddress("e1_e2_Phi", &GenZ1Phi, &b_GenZ1Phi); fChain->SetBranchAddress("m1_m2_Phi", &GenZ2Phi, &b_GenZ2Phi); + fChain->SetBranchAddress("e1_e2_Eta", &GenZ1Eta, &b_GenZ1Eta); + fChain->SetBranchAddress("m1_m2_Eta", &GenZ2Eta, &b_GenZ2Eta); fChain->SetBranchAddress("e1Pt", &Genl1Pt, &b_Genl1Pt); fChain->SetBranchAddress("e2Pt", &Genl2Pt, &b_Genl2Pt); fChain->SetBranchAddress("m1Pt", &Genl3Pt, &b_Genl3Pt); @@ -183,6 +173,8 @@ void ZZGenSelector::SetBranchesUWVV() { fChain->SetBranchAddress("m3_m4_Pt", &GenZ2pt, &b_GenZ2pt); fChain->SetBranchAddress("m1_m2_Phi", &GenZ1Phi, &b_GenZ1Phi); fChain->SetBranchAddress("m3_m4_Phi", &GenZ2Phi, &b_GenZ2Phi); + fChain->SetBranchAddress("m1_m2_Eta", &GenZ1Eta, &b_GenZ1Eta); + fChain->SetBranchAddress("m3_m4_Eta", &GenZ2Eta, &b_GenZ2Eta); fChain->SetBranchAddress("m1Pt", &Genl1Pt, &b_Genl1Pt); fChain->SetBranchAddress("m2Pt", &Genl2Pt, &b_Genl2Pt); fChain->SetBranchAddress("m3Pt", &Genl3Pt, &b_Genl3Pt); @@ -268,6 +260,7 @@ void ZZGenSelector::FillHistograms(Long64_t entry, std::pairSetBranchAddress("e3_e4_Pt", &Z2pt, &b_Z2pt); fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); fChain->SetBranchAddress("e3_e4_Phi", &Z2Phi, &b_Z2Phi); + fChain->SetBranchAddress("e1_e2_Eta", &Z1Eta, &b_Z1Eta); + fChain->SetBranchAddress("e3_e4_Eta", &Z2Eta, &b_Z2Eta); fChain->SetBranchAddress("e1Pt", &l1Pt, &b_l1Pt); fChain->SetBranchAddress("e2Pt", &l2Pt, &b_l2Pt); fChain->SetBranchAddress("e3Pt", &l3Pt, &b_l3Pt); @@ -140,6 +142,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("m1_m2_Pt", &Z2pt, &b_Z2pt); fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); fChain->SetBranchAddress("m1_m2_Phi", &Z2Phi, &b_Z2Phi); + fChain->SetBranchAddress("e1_e2_Eta", &Z1Eta, &b_Z1Eta); + fChain->SetBranchAddress("m1_m2_Eta", &Z2Eta, &b_Z2Eta); fChain->SetBranchAddress("e1Pt", &l1Pt, &b_l1Pt); fChain->SetBranchAddress("e2Pt", &l2Pt, &b_l2Pt); fChain->SetBranchAddress("m1Pt", &l3Pt, &b_l3Pt); @@ -193,6 +197,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("m1_m2_Pt", &Z2pt, &b_Z2pt); fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); fChain->SetBranchAddress("m1_m2_Phi", &Z2Phi, &b_Z2Phi); + fChain->SetBranchAddress("e1_e2_Eta", &Z1Eta, &b_Z1Eta); + fChain->SetBranchAddress("m1_m2_Eta", &Z2Eta, &b_Z2Eta); fChain->SetBranchAddress("e1Pt", &l1Pt, &b_l1Pt); fChain->SetBranchAddress("e2Pt", &l2Pt, &b_l2Pt); fChain->SetBranchAddress("m1Pt", &l3Pt, &b_l3Pt); @@ -244,6 +250,8 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("m3_m4_Pt", &Z2pt, &b_Z2pt); fChain->SetBranchAddress("m1_m2_Phi", &Z1Phi, &b_Z1Phi); fChain->SetBranchAddress("m3_m4_Phi", &Z2Phi, &b_Z2Phi); + fChain->SetBranchAddress("m1_m2_Eta", &Z1Eta, &b_Z1Eta); + fChain->SetBranchAddress("m3_m4_Eta", &Z2Eta, &b_Z2Eta); fChain->SetBranchAddress("m1Pt", &l1Pt, &b_l1Pt); fChain->SetBranchAddress("m2Pt", &l2Pt, &b_l2Pt); fChain->SetBranchAddress("m3Pt", &l3Pt, &b_l3Pt); @@ -450,6 +458,8 @@ void ZZSelectorBase::LoadBranchesUWVV(Long64_t entry, std::pairGetEntry(entry); b_Z2pt->GetEntry(entry); b_Z2Phi->GetEntry(entry); + b_Z1Eta->GetEntry(entry); + b_Z2Eta->GetEntry(entry); } b_Z1mass->GetEntry(entry); b_Z1pt->GetEntry(entry); From 6b755cdd8572edda2eb7116124fdaff78546c184 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Mon, 23 Sep 2019 14:54:14 -0400 Subject: [PATCH 43/53] setting systematics zero for background selector --- src/ZZBackgroundSelector.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ZZBackgroundSelector.cc b/src/ZZBackgroundSelector.cc index 6030bf80..5171b956 100644 --- a/src/ZZBackgroundSelector.cc +++ b/src/ZZBackgroundSelector.cc @@ -12,6 +12,7 @@ void ZZBackgroundSelector::SlaveBegin(TTree * /*tree*/) //}; //isNonpromptEstimate_ = true; //doaQGC_ = false; + ZZSelector::SlaveBegin(0); fakeRate_allE_ = (ScaleFactor *) GetInputList()->FindObject("fakeRate_allE"); if (fakeRate_allE_ == nullptr ) Abort("Must pass electron fake rate to input list!"); @@ -98,7 +99,9 @@ void ZZBackgroundSelector::LoadBranchesUWVV(Long64_t entry, std::pair Date: Mon, 23 Sep 2019 15:10:54 -0400 Subject: [PATCH 44/53] still trying --- src/ZZBackgroundSelector.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ZZBackgroundSelector.cc b/src/ZZBackgroundSelector.cc index 5171b956..91cb3842 100644 --- a/src/ZZBackgroundSelector.cc +++ b/src/ZZBackgroundSelector.cc @@ -19,6 +19,11 @@ void ZZBackgroundSelector::SlaveBegin(TTree * /*tree*/) fakeRate_allMu_ = (ScaleFactor *) GetInputList()->FindObject("fakeRate_allMu"); if (fakeRate_allMu_ == nullptr ) Abort("Must pass muon fake rate to input list!"); } +void ZZBackgroundSelector::Init(TTree *tree) { + ZZSelector::Init(tree); + systematics_ = {}; + doSystematics_ = false; +} void ZZBackgroundSelector::SetupNewDirectory() { @@ -100,8 +105,8 @@ void ZZBackgroundSelector::LoadBranchesUWVV(Long64_t entry, std::pair Date: Mon, 23 Sep 2019 15:20:00 -0400 Subject: [PATCH 45/53] makes sense --- src/ZZBackgroundSelector.cc | 4 ++-- src/ZZSelector.cc | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ZZBackgroundSelector.cc b/src/ZZBackgroundSelector.cc index 91cb3842..719ab23c 100644 --- a/src/ZZBackgroundSelector.cc +++ b/src/ZZBackgroundSelector.cc @@ -20,9 +20,9 @@ void ZZBackgroundSelector::SlaveBegin(TTree * /*tree*/) if (fakeRate_allMu_ == nullptr ) Abort("Must pass muon fake rate to input list!"); } void ZZBackgroundSelector::Init(TTree *tree) { + isNonPrompt_ = true; ZZSelector::Init(tree); systematics_ = {}; - doSystematics_ = false; } void ZZBackgroundSelector::SetupNewDirectory() @@ -102,7 +102,7 @@ void ZZBackgroundSelector::LoadBranchesUWVV(Long64_t entry, std::pair Date: Mon, 23 Sep 2019 15:29:40 -0400 Subject: [PATCH 46/53] no extra histograms --- interface/SelectorBase.h | 2 +- interface/ZZBackgroundSelector.h | 1 + src/SelectorBase.cc | 4 ++-- src/ZZSelector.cc | 14 +++++++------- src/ZZSelectorBase.cc | 12 ++++++------ 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index 07826648..4600bd43 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -146,7 +146,7 @@ class SelectorBase : public TSelector { TH1D* sumWeightsHist_; bool doSystematics_; - bool isNonPrompt_; + bool isNonPrompt_ = false; bool addSumweights_; bool applyScaleFactors_; bool applyPrefiringCorr_; diff --git a/interface/ZZBackgroundSelector.h b/interface/ZZBackgroundSelector.h index c57f5f93..48810cdb 100644 --- a/interface/ZZBackgroundSelector.h +++ b/interface/ZZBackgroundSelector.h @@ -22,6 +22,7 @@ public : TH1D* WeightsHistmmee_; TH1D* WeightsHisteemm_; + virtual void Init(TTree *tree) override; virtual void SetupNewDirectory() override; virtual void SlaveBegin(TTree *tree) override; diff --git a/src/SelectorBase.cc b/src/SelectorBase.cc index d5d93329..16755db8 100644 --- a/src/SelectorBase.cc +++ b/src/SelectorBase.cc @@ -259,7 +259,7 @@ void SelectorBase::InitializeHistogramFromConfig(std::string name, std::string c } // Weight hists must be subset of 1D hists! //std::cout<<"size of weighthistMap1D_: "<(weighthistMap1D_[histName], (name+"_lheWeights_"+channel).c_str(), histData[0].c_str(), @@ -281,7 +281,7 @@ void SelectorBase::InitializeHistogramFromConfig(std::string name, std::string c } } // 3D weight hists must be subset of 2D hists! - if (isMC_ && (weighthistMap2D_.find(histName) != weighthistMap2D_.end())) { + if (isMC_ && !isNonPrompt_ && (weighthistMap2D_.find(histName) != weighthistMap2D_.end())) { AddObject(weighthistMap2D_[histName], (name+"_lheWeights_"+channel).c_str(), histData[0].c_str(), nbins, xmin, xmax, nbinsy, ymin, ymax, 1000, 0, 1000); diff --git a/src/ZZSelector.cc b/src/ZZSelector.cc index fa12a2b9..34f4d51e 100644 --- a/src/ZZSelector.cc +++ b/src/ZZSelector.cc @@ -6,13 +6,13 @@ void ZZSelector::Init(TTree *tree) { systematics_ = { {electronRecoEffUp,"CMS_RecoEff_eUp"}, - //{electronRecoEffDown,"CMS_RecoEff_eDown"}, - //{electronEfficiencyUp, "CMS_eff_eUp"}, - //{electronEfficiencyDown, "CMS_eff_eDown"}, - //{muonEfficiencyUp, "CMS_eff_mUp"}, - //{muonEfficiencyDown, "CMS_eff_mDown"}, - //{pileupUp, "CMS_pileupUp"}, - //{pileupDown, "CMS_pileupDown"}, + {electronRecoEffDown,"CMS_RecoEff_eDown"}, + {electronEfficiencyUp, "CMS_eff_eUp"}, + {electronEfficiencyDown, "CMS_eff_eDown"}, + {muonEfficiencyUp, "CMS_eff_mUp"}, + {muonEfficiencyDown, "CMS_eff_mDown"}, + {pileupUp, "CMS_pileupUp"}, + {pileupDown, "CMS_pileupDown"}, }; doSystematics_ = true; diff --git a/src/ZZSelectorBase.cc b/src/ZZSelectorBase.cc index 8326416e..3fbbdfcf 100644 --- a/src/ZZSelectorBase.cc +++ b/src/ZZSelectorBase.cc @@ -22,15 +22,15 @@ void ZZSelectorBase::SetScaleFactors() eRecoSF_ = (ScaleFactor *) GetInputList()->FindObject("electronRecoSF"); if (eRecoSF_ == nullptr ) std::invalid_argument("Must pass electron Reco SF"); - eIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronMoriondSF"); + eIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronRunSF"); if (eIdSF_ == nullptr ) - std::invalid_argument("Must pass electron Moriond SF"); - eGapIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronMoriondGapSF"); + std::invalid_argument("Must pass electron Run SF"); + eGapIdSF_ = (ScaleFactor *) GetInputList()->FindObject("electronRunGapSF"); if (eGapIdSF_ == nullptr ) - std::invalid_argument("Must pass electronGap Moriond SF"); - mIdSF_ = (ScaleFactor *) GetInputList()->FindObject("muonMoriondSF"); + std::invalid_argument("Must pass electronGap Run SF"); + mIdSF_ = (ScaleFactor *) GetInputList()->FindObject("muonRunSF"); if (mIdSF_ == nullptr ) - std::invalid_argument("Must pass muon Moriond SF"); + std::invalid_argument("Must pass muon Run SF"); //There are L1Prefiring weight and uncertainity in the ZZ UWVV ntuples //prefireEff_ = (TEfficiency*) GetInputList()->FindObject("prefireEfficiencyMap"); From 0120ce983080aa71cee319aeb94c1692b2205869 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Fri, 11 Oct 2019 16:37:10 -0400 Subject: [PATCH 47/53] All the updates in fake rate selectors, scale factors etc --- ScaleFactors/setupScaleFactors.py | 250 +++++++++++++++------------ Utilities/python/CombineCardTools.py | 3 +- Utilities/python/ConfigureJobs.py | 4 +- Utilities/scripts/makeFakeRates.py | 129 ++++++++------ Utilities/scripts/plotFakeRates.py | 218 ++++++++++++++++++----- Utilities/scripts/setupZZCombine.py | 56 ++++-- interface/FakeRateSelector.h | 11 +- interface/SelectorBase.h | 1 + interface/ZZSelectorBase.h | 2 + makeFakeRates2016.sh | 2 +- src/FakeRateSelector.cc | 9 +- src/ZZSelector.cc | 4 +- src/ZZSelectorBase.cc | 10 ++ 13 files changed, 464 insertions(+), 235 deletions(-) diff --git a/ScaleFactors/setupScaleFactors.py b/ScaleFactors/setupScaleFactors.py index 5cb58a5b..61e369d3 100755 --- a/ScaleFactors/setupScaleFactors.py +++ b/ScaleFactors/setupScaleFactors.py @@ -9,6 +9,7 @@ import ROOT import argparse import os +import sys ROOT.gROOT.SetBatch(True) ROOT.PyConfig.IgnoreCommandLineOptions = True @@ -37,118 +38,153 @@ def invert2DHist(hist): return new_hist parser = argparse.ArgumentParser() -parser.add_argument("-t", "--tightfr_file", type=str, - default='data/fakeRate18Apr2017-3LooseLeptons-TightMuons.root') -parser.add_argument("-m", "--medfr_file", type=str, - default='data/fakeRate18Apr2017-3LooseLeptons-MediumMuons.root') -args = parser.parse_args() -output_file = 'data/scaleFactors.root' -fScales = ROOT.TFile(output_file, 'recreate') + +def getComLineArgs(): + parser.add_argument("--year", type=str,default="default", help="Year of Analysis") + parser.add_argument("-t", "--tightfr_file", type=str, + default="") + parser.add_argument("--output_file", "-o", type=str, + default="test.root", help="Output file name") + + return vars(parser.parse_args()) + +args = getComLineArgs() + +year = args["year"] +frfile = args["tightfr_file"] +fScales = ROOT.TFile(args['output_file'], 'recreate') + + # For nTruePU reweighting -pileupSF = ROOT.ScaleFactor("pileupSF", "Run2016B-H 36.8/fb Pileup profile over RunIISpring16 MC Scale Factor, x=NTruePU") -pileupFile = ROOT.TFile.Open('PileupWeights/PU_Central.root') -pileupFileUp = ROOT.TFile.Open('PileupWeights/PU_minBiasUP.root') -pileupFileDown = ROOT.TFile.Open('PileupWeights/PU_minBiasDOWN.root') +if year=="2016": + print "2016 PU reweighting" + pileupSF = ROOT.ScaleFactor("pileupSF", "Run2016B-H 35.9/fb Pileup profile over RunIISummer16 MC Scale Factor, x=NTruePU") + pileupFile = ROOT.TFile.Open('PileupWeights16/PU_Central.root') + pileupFileUp = ROOT.TFile.Open('PileupWeights16/PU_minBiasUP.root') + pileupFileDown = ROOT.TFile.Open('PileupWeights16/PU_minBiasDOWN.root') +elif year=="2017": + pileupSF = ROOT.ScaleFactor("pileupSF", "Run2017B-F 41.5/fb Pileup profile over RunIIFall17 MC Scale Factor, x=NTruePU") + pileupFile = ROOT.TFile.Open('PileupWeights17/PU_Central.root') + pileupFileUp = ROOT.TFile.Open('PileupWeights17/PU_minBiasUP.root') + pileupFileDown = ROOT.TFile.Open('PileupWeights17/PU_minBiasDOWN.root') +elif year=="2018": + pileupSF = ROOT.ScaleFactor("pileupSF", "Run2018A-D 59.95/fb Pileup profile over RunIIFall18 MC Scale Factor, x=NTruePU") + pileupFile = ROOT.TFile.Open('PileupWeights18/PU_Central.root') + pileupFileUp = ROOT.TFile.Open('PileupWeights18/PU_minBiasUP.root') + pileupFileDown = ROOT.TFile.Open('PileupWeights18/PU_minBiasDOWN.root') +else: + print "You forgot to specify the year for which you want scale factors" + sys.exit() pileupSF.Set1DHist(pileupFile.Get('pileup'), pileupFileUp.Get('pileup'), pileupFileDown.Get('pileup')) fScales.cd() pileupSF.Write() -electronTightIdSF = ROOT.ScaleFactor("electronTightIdSF", "Moriond '17 Electron Tight WP ID SF, x=Eta, y=Pt") -eidFile = ROOT.TFile.Open('data/moriond17ElectronTightSF.root') -electronTightIdSF.Set2DHist(float2double(eidFile.Get('EGamma_SF2D'))) -fScales.cd() -electronTightIdSF.Write() -electronGsfSF = ROOT.ScaleFactor("electronGsfSF", "Moriond '17 Electron GSF track reco SF, x=Eta, y=Pt") -eleGsfFile = ROOT.TFile.Open('data/moriond17ElectronRecoSF.root') -electronGsfSF.Set2DHist(float2double(eleGsfFile.Get('EGamma_SF2D'))) -fScales.cd() -electronGsfSF.Write() -muonIdSF = ROOT.ScaleFactor("muonTightIdSF", "Moriond '17 Muon Tight WP ID SF, x=abs(Eta), y=Pt, z=run number") -midFile1 = ROOT.TFile.Open('data/moriond17MuonID_BCDEF.root') -midFile2 = ROOT.TFile.Open('data/moriond17MuonID_GH.root') -muon_ptetaratio1 = midFile1.Get('MC_NUM_TightID_DEN_genTracks_PAR_pt_eta/abseta_pt_ratio') -muon_ptetaratio2 = midFile2.Get('MC_NUM_TightID_DEN_genTracks_PAR_pt_eta/abseta_pt_ratio') -muon_allratio = float2double(muon_ptetaratio1.Clone("muon_allratio")) -for xbin in range(muon_ptetaratio1.GetNbinsX()+2): - for ybin in range(muon_ptetaratio1.GetNbinsY()+2): - runBFmean, runBFerr = muon_ptetaratio1.GetBinContent(xbin, ybin), muon_ptetaratio1.GetBinError(xbin, ybin) - runGHmean, runGHerr = muon_ptetaratio2.GetBinContent(xbin, ybin), muon_ptetaratio2.GetBinError(xbin, ybin) - allmean = (20.5*runBFmean + 16.3*runGHmean) / 36.8 - allerr = (20.5*runBFerr + 16.3*runGHerr) / 36.8 - muon_allratio.SetBinContent(xbin, ybin, allmean) - muon_allratio.SetBinError(xbin, ybin, allerr) -muonIdSF.Set2DHist(muon_allratio) -fScales.cd() -muonIdSF.Write() -muonIsoSF = ROOT.ScaleFactor("muonIsoSF", "Moriond '17 Muon Tight Iso (0.15) WP ID SF, x=abs(Eta), y=Pt, z=run number") -misoFile1 = ROOT.TFile.Open('data/moriond17MuonIso_BCDEF.root') -misoFile2 = ROOT.TFile.Open('data/moriond17MuonIso_GH.root') -muIso_ptetaratio1 = misoFile1.Get('TightISO_TightID_pt_eta/abseta_pt_ratio') -muIso_ptetaratio2 = misoFile2.Get('TightISO_TightID_pt_eta/abseta_pt_ratio') -muIso_allratio = float2double(muon_ptetaratio1.Clone("muIso_allratio")) -for xbin in range(muIso_ptetaratio1.GetNbinsX()+2): - for ybin in range(muIso_ptetaratio1.GetNbinsY()+2): - runBFmean, runBFerr = muIso_ptetaratio1.GetBinContent(xbin, ybin), muIso_ptetaratio1.GetBinError(xbin, ybin) - runGHmean, runGHerr = muIso_ptetaratio2.GetBinContent(xbin, ybin), muIso_ptetaratio2.GetBinError(xbin, ybin) - allmean = (20.5*runBFmean + 16.3*runGHmean) / 36.8 - allerr = (20.5*runBFerr + 16.3*runGHerr) / 36.8 - muIso_allratio.SetBinContent(xbin, ybin, allmean) - muIso_allratio.SetBinError(xbin, ybin, allerr) -muonIsoSF.Set2DHist(muIso_allratio) -fScales.cd() -muonIsoSF.Write() - -# Used for tests on fake rate files from Jakob and Svenja -#efakeRateFile = ROOT.TFile.Open('/eos/user/k/kelong/WZAnalysisData/FakeRates/fromJakob/eFakeRates.root') -#jakob_etight = efakeRateFile.Get('eFakeRates') -#jakob_etight = invert2DHist(jakob_etight) -#mfakeRateFile = ROOT.TFile.Open('/eos/user/k/kelong/WZAnalysisData/FakeRates/fromJakob/muFakeRates.root') -#jakob_mtight = mfakeRateFile.Get('muFakeRates') -#jakob_mtight = invert2DHist(jakob_mtight) -# -#eCBTightFakeRate = ROOT.ScaleFactor("eCBTightFakeRate_Jakob", "Fake rate from dijet control, via Jakob") -#eCBTightFakeRate.Set2DHist(jakob_etight, 0, 0, ROOT.ScaleFactor.AsInHist) -#mCBTightFakeRate = ROOT.ScaleFactor("mCBTightFakeRate_Jakob", "Fake rate from dijet control, via Jakob") -#mCBTightFakeRate.Set2DHist(jakob_mtight, 0, 0, ROOT.ScaleFactor.AsInHist) -#fScales.cd() -#mCBTightFakeRate.Write() -#eCBTightFakeRate.Write() - -#fakeRateFile = ROOT.TFile.Open('/eos/user/k/kelong/WZAnalysisData/FakeRates/CutBasedFakeRate_fromSvenja_final.root') -#eCBMedFakeRate = ROOT.ScaleFactor("eCBMedFakeRate_Svenja", "Fake rate from dijet control, by Svenja") -#eCBMedFakeRate.Set2DHist(float2double(fakeRateFile.Get('e/medium/fakeratePtEta')), 0, 0, ROOT.ScaleFactor.AsInHist) -#eCBTightFakeRate = ROOT.ScaleFactor("eCBTightFakeRate_Svenja", "Fake rate from dijet control, by Svenja") -#eCBTightFakeRate.Set2DHist(float2double(fakeRateFile.Get('e/tight/fakeratePtEta')), 0, 0, ROOT.ScaleFactor.AsInHist) -#mCBMedFakeRate = ROOT.ScaleFactor("mCBMedFakeRate_Svenja", "Fake rate from dijet control, by Svenja") -#mCBMedFakeRate.Set2DHist(float2double(fakeRateFile.Get('m/medium/fakeratePtEta')), 0, 0, ROOT.ScaleFactor.AsInHist) -#mCBTightFakeRate = ROOT.ScaleFactor("mCBTightFakeRate_Svenja", "Fake rate from dijet control, by Svenja") -#mCBTightFakeRate.Set2DHist(float2double(fakeRateFile.Get('m/tight/fakeratePtEta')), 0, 0, ROOT.ScaleFactor.AsInHist) -#fScales.cd() -#mCBMedFakeRate.Write() -#mCBTightFakeRate.Write() -#eCBMedFakeRate.Write() -#eCBTightFakeRate.Write() - -if os.path.isfile(args.medfr_file): - print "INFO: Adding medium fake rates to %s" % output_file - fakeRateFile = ROOT.TFile.Open(args.medfr_file) - eCBMedFakeRateZjets = ROOT.ScaleFactor("eCBMedFakeRate", "Fake rate from Z+jet") - eCBMedFakeRateZjets.Set2DHist(fakeRateFile.Get('DataEWKCorrected/ratio2D_allE'), 0, 0, ROOT.ScaleFactor.AsInHist) - mCBMedFakeRateZjets = ROOT.ScaleFactor("mCBMedFakeRate", "Fake rate from Z+jet") - mCBMedFakeRateZjets.Set2DHist(fakeRateFile.Get('DataEWKCorrected/ratio2D_allMu'), 0, 0, ROOT.ScaleFactor.AsInHist) - fScales.cd() - mCBMedFakeRateZjets.Write() - eCBMedFakeRateZjets.Write() +if year=="2016": + print "Doing 2016 Lepton SF" + electronLowReco16SF = ROOT.ScaleFactor("electronLowReco16SF", "Run '16 Electron Low Reco SF, x=Eta, y=Pt") + eLowRecoFile = ROOT.TFile.Open('data/Ele_Reco_LowEt_2016.root') + electronLowReco16SF.Set2DHist(float2double(eLowRecoFile.Get('EGamma_SF2D'))) + fScales.cd() + electronLowReco16SF.Write() + + #Electron (Pt>20 Reco SF from POG https://twiki.cern.ch/twiki/bin/viewauth/CMS/Egamma2016DataRecommendations + electronReco16SF = ROOT.ScaleFactor("electronReco16SF", "Run '16 Electron Reco SF, x=Eta, y=Pt") + eRecoFile = ROOT.TFile.Open('data/Ele_Reco_2016.root') + electronReco16SF.Set2DHist(float2double(eRecoFile.Get('EGamma_SF2D'))) + fScales.cd() + electronReco16SF.Write() + + electronRun16SF = ROOT.ScaleFactor("electronRun16SF", "Run '16 Electron HZZ ID SF, x=Eta, y=Pt") + eidFile = ROOT.TFile.Open('data/ElectronSF_Legacy_2016_NoGap.root') + electronRun16SF.Set2DHist(float2double(eidFile.Get('EGamma_SF2D'))) + fScales.cd() + electronRun16SF.Write() + + electronRun16GapSF = ROOT.ScaleFactor("electronRun16GapSF", "Run '16 GapElectron HZZ ID SF, x=Eta, y=Pt") + eleGsfFile = ROOT.TFile.Open('data/ElectronSF_Legacy_2016_Gap.root') + electronRun16GapSF.Set2DHist(float2double(eleGsfFile.Get('EGamma_SF2D'))) + fScales.cd() + electronRun16GapSF.Write() + + muonRun16SF = ROOT.ScaleFactor("muonRun16SF", "Muon Run '16 Trk+ID+ISO SF, x=abs(Eta), y=Pt") + mid16File = ROOT.TFile.Open('data/final_HZZ_muon_SF_2016_IsBDT_0610.root') + muonRun16SF.Set2DHist(float2double(mid16File.Get('FINAL')),float2double(mid16File.Get('ERROR')),float2double(mid16File.Get('ERROR'))) + fScales.cd() + muonRun16SF.Write() +elif year=="2017": + electronLowReco17SF = ROOT.ScaleFactor("electronLowReco17SF", "Run '17 Electron Low Reco SF, x=Eta, y=Pt") + eLowRecoFile = ROOT.TFile.Open('data/Ele_Reco_LowEt_2017.root') + electronLowReco17SF.Set2DHist(float2double(eLowRecoFile.Get('EGamma_SF2D'))) + fScales.cd() + electronLowReco17SF.Write() + + #Electron (Pt>20 Reco SF from POG https://twiki.cern.ch/twiki/bin/viewauth/CMS/Egamma2017DataRecommendations + electronReco17SF = ROOT.ScaleFactor("electronReco17SF", "Run '17 Electron Reco SF, x=Eta, y=Pt") + eRecoFile = ROOT.TFile.Open('data/Ele_Reco_2017.root') + electronReco17SF.Set2DHist(float2double(eRecoFile.Get('EGamma_SF2D'))) + fScales.cd() + electronReco17SF.Write() + + electronRun17SF = ROOT.ScaleFactor("electronRun17SF", "Run '17 Electron HZZ ID SF, x=Eta, y=Pt") + eidFile = ROOT.TFile.Open('data/ElectronSF_Legacy_2017_NoGap.root') + electronRun17SF.Set2DHist(float2double(eidFile.Get('EGamma_SF2D'))) + fScales.cd() + electronRun17SF.Write() + + electronRun17GapSF = ROOT.ScaleFactor("electronRun17GapSF", "Run '17 GapElectron HZZ ID SF, x=Eta, y=Pt") + eleGsfFile = ROOT.TFile.Open('data/ElectronSF_Legacy_2017_Gap.root') + electronRun17GapSF.Set2DHist(float2double(eleGsfFile.Get('EGamma_SF2D'))) + fScales.cd() + electronRun17GapSF.Write() + + muonRun17SF = ROOT.ScaleFactor("muonRun17SF", "Muon Run '17 Trk+ID+ISO SF, x=abs(Eta), y=Pt") + midFile = ROOT.TFile.Open('data/final_HZZ_muon_SF_2017_IsBDT_0610.root') + muonRun17SF.Set2DHist(float2double(midFile.Get('FINAL')),float2double(midFile.Get('ERROR')),float2double(midFile.Get('ERROR'))) + fScales.cd() + muonRun17SF.Write() +elif year=="2018": + #Electron (Pt<20 Reco SF from POG https://twiki.cern.ch/twiki/bin/viewauth/CMS/Egamma2018DataRecommendations + electronLowReco18SF = ROOT.ScaleFactor("electronLowReco18SF", "Run '18 Electron Low Reco SF, x=Eta, y=Pt") + eLowRecoFile = ROOT.TFile.Open('data/Ele_Reco_LowEt_2018.root') + electronLowReco18SF.Set2DHist(float2double(eLowRecoFile.Get('EGamma_SF2D'))) + fScales.cd() + electronLowReco18SF.Write() + + #Electron (Pt>20 Reco SF from POG https://twiki.cern.ch/twiki/bin/viewauth/CMS/Egamma2018DataRecommendations + electronReco18SF = ROOT.ScaleFactor("electronReco18SF", "Run '18 Electron Reco SF, x=Eta, y=Pt") + eRecoFile = ROOT.TFile.Open('data/Ele_Reco_2018.root') + electronReco18SF.Set2DHist(float2double(eRecoFile.Get('EGamma_SF2D'))) + fScales.cd() + electronReco18SF.Write() + + electronRun18SF = ROOT.ScaleFactor("electronRun18SF", "Run '18 Electron HZZ ID SF, x=Eta, y=Pt") + eidFile = ROOT.TFile.Open('data/ElectronSF_Legacy_2018_NoGap.root') + electronRun18SF.Set2DHist(float2double(eidFile.Get('EGamma_SF2D'))) + fScales.cd() + electronRun18SF.Write() + + electronRun18GapSF = ROOT.ScaleFactor("electronRun18GapSF", "Run '18 GapElectron HZZ ID SF, x=Eta, y=Pt") + eleGsfFile = ROOT.TFile.Open('data/ElectronSF_Legacy_2018_Gap.root') + electronRun18GapSF.Set2DHist(float2double(eleGsfFile.Get('EGamma_SF2D'))) + fScales.cd() + electronRun18GapSF.Write() + + muonRun18SF = ROOT.ScaleFactor("muonRun18SF", "Muon Run '18 Trk+ID+ISO SF, x=abs(Eta), y=Pt") + mid18File = ROOT.TFile.Open('data/final_HZZ_muon_SF_2018_IsBDT_0610.root') + muonRun18SF.Set2DHist(float2double(mid18File.Get('FINAL')),float2double(mid18File.Get('ERROR')),float2double(mid18File.Get('ERROR'))) + fScales.cd() + muonRun18SF.Write() -if os.path.isfile(args.tightfr_file): - print "INFO: Adding tight fake rates to %s" % output_file - fakeRateFile = ROOT.TFile.Open(args.tightfr_file) - eCBTightFakeRateZjets = ROOT.ScaleFactor("eCBTightFakeRate", "Fake rate from Z+jet") - eCBTightFakeRateZjets.Set2DHist(fakeRateFile.Get('DataEWKCorrected/ratio2D_allE'), 0, 0, ROOT.ScaleFactor.AsInHist) - mCBTightFakeRateZjets = ROOT.ScaleFactor("mCBTightFakeRate", "Fake rate from Z+jet") - mCBTightFakeRateZjets.Set2DHist(fakeRateFile.Get('DataEWKCorrected/ratio2D_allMu'), 0, 0, ROOT.ScaleFactor.AsInHist) - fScales.cd() - mCBTightFakeRateZjets.Write() - eCBTightFakeRateZjets.Write() +#For every year there is a separate fakeRate file +if os.path.isfile(frfile): + print "INFO: Adding tight fake rates to %s" % args["output_file"] + fakeRateFile = ROOT.TFile.Open(frfile) + eZZTightFakeRate = ROOT.ScaleFactor("eZZTightFakeRate", "Fake rate from Z+jet") + eZZTightFakeRate.Set2DHist(fakeRateFile.Get('DataEWKCorrected/ratioE2D_allE'), 0, 0, ROOT.ScaleFactor.AsInHist) + mZZTightFakeRate = ROOT.ScaleFactor("mZZTightFakeRate", "Fake rate from Z+jet") + mZZTightFakeRate.Set2DHist(fakeRateFile.Get('DataEWKCorrected/ratioMu2D_allMu'), 0, 0, ROOT.ScaleFactor.AsInHist) + fScales.cd() + mZZTightFakeRate.Write() + eZZTightFakeRate.Write() diff --git a/Utilities/python/CombineCardTools.py b/Utilities/python/CombineCardTools.py index e4aae60e..cb98fa5f 100644 --- a/Utilities/python/CombineCardTools.py +++ b/Utilities/python/CombineCardTools.py @@ -107,7 +107,8 @@ def setTemplateFileName(self, templateName): self.templateName = templateName def setOutputFile(self, outputFile): - self.outputFile = self.getRootFile("/".join([self.outputFolder, outputFile]), "RECREATE") + #self.outputFile = self.getRootFile("/".join([self.outputFolder, outputFile]), "RECREATE") + self.outputFile = self.getRootFile(outputFile, "RECREATE") def setInputFile(self, inputFile): self.inputFile = self.getRootFile(inputFile) diff --git a/Utilities/python/ConfigureJobs.py b/Utilities/python/ConfigureJobs.py index 01d67094..e89dedf2 100644 --- a/Utilities/python/ConfigureJobs.py +++ b/Utilities/python/ConfigureJobs.py @@ -88,7 +88,7 @@ def getListOfGenFilenames(analysis='ZZ'): return [ "zz4l-amcatnlo", "zz4l-powheg", - "zzjj4l-ewk", + #"zzjj4l-ewk", "ggZZ4e", "ggZZ4m", "ggZZ4t", @@ -107,7 +107,7 @@ def getListOfEWKFilenames(analysis=""): if "ZZ4l" in analysis: return [ "zz4l-powheg", - "zzjj4l-ewk", + #"zzjj4l-ewk", "ggZZ4e", "ggZZ4m", "ggZZ4t", diff --git a/Utilities/scripts/makeFakeRates.py b/Utilities/scripts/makeFakeRates.py index 9b989672..56948204 100755 --- a/Utilities/scripts/makeFakeRates.py +++ b/Utilities/scripts/makeFakeRates.py @@ -6,6 +6,7 @@ from python import ConfigureJobs from python import SelectorTools,HistTools import logging +import sys ROOT.gROOT.SetBatch(True) @@ -13,6 +14,8 @@ def getComLineArgs(): parser = UserInput.getDefaultParser() parser.add_argument("--lumi", "-l", type=float, default=41.5, help="luminosity value (in fb-1)") + parser.add_argument("--test", action='store_true', + help="Run test job (no background estimate)") parser.add_argument("--uwvv", action='store_true', help="Use UWVV format ntuples in stead of NanoAOD") parser.add_argument("--noHistConfig", action='store_true', @@ -46,18 +49,22 @@ def getHistNames(channels): return [x+"_"+y for x in base_hists for y in channels] # Turn off overflow for FR hists (> 50 is pretty much all EWK anyway) -def makeCompositeHists(name, members, addRatios=True, overflow=False): +def makeCompositeHists(hist_file,name, members, addRatios=True, overflow=False): composite = ROOT.TList() composite.SetName(name) if name=="AllEWK": print "EWK members: ",members for directory in [str(i) for i in members.keys()]: for histname in getHistNames(["eee", "eem", "emm", "mmm"]): - hist = fOut.Get("/".join([directory, histname])) + print "histname:", histname + print "hist_file:", hist_file + print "directory:",directory + hist = hist_file.Get("/".join([directory, str(histname)])) + print "hist:", hist if hist: sumhist = composite.FindObject(hist.GetName()) if "data" not in directory and hist.GetEntries() > 0: - sumweights_hist = fOut.Get("/".join([directory, "sumweights"])) + sumweights_hist = hist_file.Get("/".join([directory, "sumweights"])) sumweights = sumweights_hist.Integral() hist.Scale(members[directory]*1000*args['lumi']/sumweights) if overflow and isinstance(hist, ROOT.TH1): @@ -116,55 +123,67 @@ def getRatios(hists): args = getComLineArgs() today = datetime.date.today().strftime("%d%b%Y") -fileName = "data/fakeRate%s-%s.root" % (today,args['analysis']) if args['output_file'] == "" \ - else args['output_file'] -fOut = ROOT.TFile(fileName, "recreate") - - -addScaleFacs = False -if args['analysis'] == "WZxsec2016" or args['analysis'] == 'Zstudy_2016' or args['scalefactors_file']: - addScaleFacs = True -sf_inputs = [ROOT.TParameter(bool)("applyScaleFacs", False)] - -if args['input_tier'] == '': - args['input_tier'] = args['selection'] -selection = args['selection'].split("_")[0] - -if selection == "Inclusive2Jet": - selection = "Wselection" - print "Info: Using Wselection for hist defintions" -analysis = "/".join([args['analysis'], selection]) -hists, hist_inputs = UserInput.getHistInfo(analysis, args['hist_names'], args['noHistConfig']) - -selector = SelectorTools.SelectorDriver(args['analysis'], args['selection'], args['input_tier'], args['year']) -selector.setOutputfile(fOut.GetName()) -selector.setInputs(sf_inputs+hist_inputs) -selector.isFake() - -selector.setNtupeType("UWVV" if args['uwvv'] else "NanoAOD") -if args['uwvv']: - logging.debug("Processing channels " % args['channels']) - selector.setChannels(args['channels']) - -selector.setNumCores(args['numCores']) - -if args['filenames']: - selector.setDatasets(args['filenames']) -else: - selector.setFileList(*args['inputs_from_file']) -mc = selector.applySelector() - - -alldata = makeCompositeHists("AllData", ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"])) -OutputTools.writeOutputListItem(alldata, fOut) -allewk = makeCompositeHists("AllEWK", ConfigureJobs.getListOfFilesWithXSec( - ConfigureJobs.getListOfEWKFilenames()), True) -OutputTools.writeOutputListItem(allewk, fOut) -allDYJets = makeCompositeHists("DYMC", ConfigureJobs.getListOfFilesWithXSec( - ConfigureJobs.getListOfDYFilenames()),True) -OutputTools.writeOutputListItem(allDYJets, fOut) -#allnonprompt = makeCompositeHists("NonpromptMC", ConfigureJobs.getListOfFilesWithXSec( -# ConfigureJobs.getListOfNonpromptFilenames())) -#OutputTools.writeOutputListItem(allnonprompt, fOut) -final = HistTools.getDifference(fOut, "DataEWKCorrected", "AllData", "AllEWK", getRatios) -OutputTools.writeOutputListItem(final, fOut) +#fileName = "data/fakeRate%s-%s.root" % (today,args['analysis']) if args['output_file'] == "" \ +# else args['output_file'] +fileName="data/fakeRate15Sep2019-ZZ4l2016.root" +if not args['test']: + fOut = ROOT.TFile(fileName, "recreate") + + + addScaleFacs = False + if args['analysis'] == "WZxsec2016" or args['analysis'] == 'Zstudy_2016' or args['scalefactors_file']: + addScaleFacs = True + sf_inputs = [ROOT.TParameter(bool)("applyScaleFacs", False)] + + if args['input_tier'] == '': + args['input_tier'] = args['selection'] + selection = args['selection'].split("_")[0] + + if selection == "Inclusive2Jet": + selection = "Wselection" + print "Info: Using Wselection for hist defintions" + analysis = "/".join([args['analysis'], selection]) + hists, hist_inputs = UserInput.getHistInfo(analysis, args['hist_names'], args['noHistConfig']) + print "hists: ",hists + print "hist_inputs: ", hist_inputs + selector = SelectorTools.SelectorDriver(args['analysis'], args['selection'], args['input_tier'], args['year']) + selector.setOutputfile(fOut.GetName()) + selector.setInputs(sf_inputs+hist_inputs) + selector.isFake() + + selector.setNtupeType("UWVV" if args['uwvv'] else "NanoAOD") + if args['uwvv']: + logging.debug("Processing channels " % args['channels']) + selector.setChannels(args['channels']) + + selector.setNumCores(args['numCores']) + + if args['filenames']: + selector.setDatasets(args['filenames']) + else: + selector.setFileList(*args['inputs_from_file']) + mc = selector.applySelector() + + #if args['test']: + # sys.exit(0) + + #fOut.Close() +if args['test']: + fOut = ROOT.TFile.Open(fileName, "update") + alldata = makeCompositeHists(fOut,"AllData", ConfigureJobs.getListOfFilesWithXSec([args['analysis']+"data"])) + OutputTools.writeOutputListItem(alldata, fOut) + alldata.Delete() + allewk = makeCompositeHists(fOut,"AllEWK", ConfigureJobs.getListOfFilesWithXSec( + ConfigureJobs.getListOfEWKFilenames()), True) + OutputTools.writeOutputListItem(allewk, fOut) + allewk.Delete() + allDYJets = makeCompositeHists(fOut,"DYMC", ConfigureJobs.getListOfFilesWithXSec( + ConfigureJobs.getListOfDYFilenames()),True) + OutputTools.writeOutputListItem(allDYJets, fOut) + allDYJets.Delete() + #allnonprompt = makeCompositeHists("NonpromptMC", ConfigureJobs.getListOfFilesWithXSec( + # ConfigureJobs.getListOfNonpromptFilenames())) + #OutputTools.writeOutputListItem(allnonprompt, fOut) + final = HistTools.getDifference(fOut, "DataEWKCorrected", "AllData", "AllEWK", getRatios) + OutputTools.writeOutputListItem(final, fOut) + final.Delete() diff --git a/Utilities/scripts/plotFakeRates.py b/Utilities/scripts/plotFakeRates.py index c67119a0..a4b0d5d0 100755 --- a/Utilities/scripts/plotFakeRates.py +++ b/Utilities/scripts/plotFakeRates.py @@ -9,16 +9,48 @@ canvas = ROOT.TCanvas("canvas", "canvas") def getTGraphAsymmErrors(frfile, folder, param, obj): - tight_hist = frfile.Get("%s/passingTight%s_all%s" % (folder, param, obj)) - loose_hist = frfile.Get("%s/passingLoose%s_all%s" % (folder, param, obj)) + tight_hist = frfile.Get("%s/passingTight%s%s_all%s" % (folder, obj ,param, obj)) + loose_hist = frfile.Get("%s/passingLoose%s%s_all%s" % (folder, obj ,param, obj)) + tight_hist.SetTitle("") + loose_hist.SetTitle("") graph = ROOT.TGraphAsymmErrors(tight_hist, loose_hist) graph.SetMarkerStyle(6) - graph.SetMinimum(0) - graph.SetMaximum(0.8) + if obj=="E": + graph.SetMinimum(0.01) + graph.SetMaximum(0.35) if "Pt" in param else graph.SetMaximum(0.1) + else: + graph.SetMinimum(0.04) + graph.SetMaximum(0.35) if "Pt" in param else graph.SetMaximum(0.3) return graph +def getTGraphAsymmErrorsPt(frfile, folder, param, obj): + tight_hist_barrel = frfile.Get("%s/passingTight%s%s_barrel_all%s" % (folder, obj, param, obj)) + loose_hist_barrel = frfile.Get("%s/passingLoose%s%s_barrel_all%s" % (folder, obj, param, obj)) + tight_hist_barrel.SetTitle("") + loose_hist_barrel.SetTitle("") + barrel = ROOT.TGraphAsymmErrors(tight_hist_barrel, loose_hist_barrel) + barrel.SetMarkerStyle(6) + barrel.SetLineColor(ROOT.kBlue) + tight_hist_endcap = frfile.Get("%s/passingTight%s%s_endcap_all%s" % (folder, obj, param, obj)) + loose_hist_endcap = frfile.Get("%s/passingLoose%s%s_endcap_all%s" % (folder,obj, param, obj)) + tight_hist_endcap.SetTitle("") + loose_hist_endcap.SetTitle("") + endcap = ROOT.TGraphAsymmErrors(tight_hist_endcap, loose_hist_endcap) + endcap.SetMarkerStyle(6) + endcap.SetLineColor(ROOT.kRed) + if obj=="E": + barrel.SetMinimum(0.01) + barrel.SetMaximum(0.35) if "Pt" in param else barrel.SetMaximum(0.1) + endcap.SetMinimum(0.01) + endcap.SetMaximum(0.35) if "Pt" in param else endcap.SetMaximum(0.1) + else: + barrel.SetMinimum(0.04) + barrel.SetMaximum(0.35) if "Pt" in param else barrel.SetMaximum(0.3) + endcap.SetMinimum(0.04) + endcap.SetMaximum(0.35) if "Pt" in param else endcap.SetMaximum(0.3) + return barrel,endcap def getTextBox(obj, extra_text=""): - text_box = ROOT.TPaveText(0.2, 0.92, 0.4+0.02*len(extra_text), 0.86, "blNDC") + text_box = ROOT.TPaveText(0.2, 0.88, 0.4+0.02*len(extra_text), 0.81, "blNDC") text_box.SetFillColor(0) text_box.SetLineColor(ROOT.kBlack) text_box.SetTextFont(42) @@ -27,81 +59,178 @@ def getTextBox(obj, extra_text=""): ROOT.SetOwnership(text_box, False) return text_box -def invert2DHist(hist): - new_hist = ROOT.TH2D(hist.GetName(), hist.GetTitle(), - 3, 0, 2.5, - 3, array.array('d', [10,20,30,50])) - ROOT.SetOwnership(new_hist, False) - for x in range(hist.GetNbinsX()+1): - for y in range(hist.GetNbinsY()+1): - value = hist.GetBinContent(x, y) - new_hist.SetBinContent(y, x, value) - new_hist.GetXaxis().SetTitle(hist.GetXaxis().GetTitle()) - new_hist.GetYaxis().SetTitle(hist.GetYaxis().GetTitle()) +def getLumiTextBox(): + texS = ROOT.TLatex(0.615,0.95,"#sqrt{s} = 13 TeV, 35.9 fb^{-1}") + texS.SetNDC() + texS.SetTextFont(42) + texS.SetTextSize(0.040) + texS.Draw() + texS1 = ROOT.TLatex(0.15,0.95,"#bf{CMS} #it{Preliminary}") + texS1.SetNDC() + texS1.SetTextFont(42) + texS1.SetTextSize(0.040) + texS1.Draw() + return texS,texS1 + +def invert2DHist(hist,obj): + if (obj=="E"): + new_hist = ROOT.TH2D(hist.GetName(), hist.GetTitle(), + 4, array.array('d',[0.,0.7395,1.479,2.0,2.5]), + 6, array.array('d', [5,10,20,30,40,50,80])) + ROOT.SetOwnership(new_hist, False) + for x in range(hist.GetNbinsX()+1): + for y in range(hist.GetNbinsY()+1): + value = hist.GetBinContent(x, y) + new_hist.SetBinContent(y, x, value) + new_hist.GetXaxis().SetTitle(hist.GetXaxis().GetTitle()) + new_hist.GetYaxis().SetTitle(hist.GetYaxis().GetTitle()) + elif (obj=="Mu"): + new_hist = ROOT.TH2D(hist.GetName(), hist.GetTitle(), + 2, array.array('d',[0.,1.2,2.4]), + 6, array.array('d', [5,10,20,30,40,50,80])) + ROOT.SetOwnership(new_hist, False) + for x in range(hist.GetNbinsX()+1): + for y in range(hist.GetNbinsY()+1): + value = hist.GetBinContent(x, y) + new_hist.SetBinContent(y, x, value) + new_hist.GetXaxis().SetTitle(hist.GetXaxis().GetTitle()) + new_hist.GetYaxis().SetTitle(hist.GetYaxis().GetTitle()) return new_hist def makeDataPlots(param, obj, outdir): - data_ewkcorr_graph = frfile.Get("DataEWKCorrected/ratio%s_all%s" % (param, obj)) \ - if "2D" in param else getTGraphAsymmErrors(frfile, "DataEWKCorrected", param, obj) - data_ewkcorr_graph.SetLineColor(ROOT.kRed) + if "Pt" in param: + data_ewkcorr_barrel,data_ewkcorr_endcap = getTGraphAsymmErrorsPt(frfile, "DataEWKCorrected", param, obj) + elif "2D" in param: + data_ewkcorr_graph = frfile.Get("DataEWKCorrected/ratio%s%s_all%s" % (obj,param, obj)) + else: + data_ewkcorr_graph = getTGraphAsymmErrors(frfile, "DataEWKCorrected", param, obj) + data_ewkcorr_graph.SetLineColor(ROOT.kRed) draw_opt = "PA" if "2D" not in param else "colz text" if "2D" in param: - data_ewkcorr_graph = invert2DHist(data_ewkcorr_graph) + data_ewkcorr_graph.SetTitle("") + ROOT.gStyle.SetOptStat(0) + data_ewkcorr_graph = invert2DHist(data_ewkcorr_graph,obj) #data_ewkcorr_graph.GetYaxis().SetTitle("#eta") data_ewkcorr_graph.GetYaxis().SetTitle("p_{T} [GeV]") - data_ewkcorr_graph.GetXaxis().SetTitle("#eta") - else: + data_ewkcorr_graph.GetXaxis().SetTitle("|#eta|") + data_ewkcorr_graph.Draw(draw_opt) + elif "Eta" in param: + data_ewkcorr_graph.SetTitle("") data_ewkcorr_graph.GetYaxis().SetTitle("Passing Tight / Passing Loose") - xlabel = "p_{T} [GeV]" if "Pt" in param else "#eta" + xlabel = "|#eta|" data_ewkcorr_graph.GetXaxis().SetTitle(xlabel) - data_ewkcorr_graph.Draw(draw_opt) + data_ewkcorr_graph.Draw(draw_opt) + else: + data_ewkcorr_barrel.SetTitle("") + data_ewkcorr_barrel.SetLineStyle(2) + data_ewkcorr_barrel.GetYaxis().SetTitle("Passing Tight / Passing Loose") + xlabel = "p_{T} [GeV]" + data_ewkcorr_barrel.GetXaxis().SetTitle(xlabel) + data_ewkcorr_barrel.Draw("PA") + data_ewkcorr_endcap.SetLineStyle(2) + data_ewkcorr_endcap.SetTitle("") + data_ewkcorr_endcap.Draw("P") text_box = getTextBox(obj) text_box.Draw() - - if not "2D" in param: + texS,texS1=getLumiTextBox() + + if (not "2D" in param) and ("Eta" in param): data_uncorr_graph = getTGraphAsymmErrors(frfile, "AllData", param, obj) + data_uncorr_graph.SetTitle("") data_uncorr_graph.Draw("P") - legend = ROOT.TLegend(0.2,.85,.55,.70) + legend = ROOT.TLegend(0.2,.80,.40,.70) legend.AddEntry(data_uncorr_graph, "Data", "l") legend.AddEntry(data_ewkcorr_graph, "Data - EWK", "l") legend.Draw() - + elif ("Pt" in param): + data_uncorr_barrel,data_uncorr_endcap = getTGraphAsymmErrorsPt(frfile, "AllData", param, obj) + data_uncorr_barrel.SetTitle("") + data_uncorr_barrel.Draw("P") + data_uncorr_endcap.SetTitle("") + data_uncorr_endcap.Draw("P") + + legend = ROOT.TLegend(0.2,.80,.40,.70) + legend.AddEntry(data_uncorr_barrel, "barrel uncorrected", "l") + legend.AddEntry(data_ewkcorr_barrel, "barrel corrected", "l") + legend.AddEntry(data_uncorr_endcap, "endcap uncorrected", "l") + legend.AddEntry(data_ewkcorr_endcap, "endcap corrected", "l") + legend.Draw() canvas.Print("%s/ratio%s_all%s.png" % (outdir, param, obj)) canvas.Print("%s/ratio%s_all%s.pdf" % (outdir, param, obj)) def makeMCPlots(param, obj, outdir): - graph = frfile.Get("NonpromptMC/ratio%s_all%s" % (param, obj)) \ - if "2D" in param else getTGraphAsymmErrors(frfile, "NonpromptMC", param, obj) - graph.SetLineColor(ROOT.kRed) + if "Pt" in param: + data_ewkcorr_barrel,data_ewkcorr_endcap = getTGraphAsymmErrorsPt(frfile, "DataEWKCorrected", param, obj) + elif "2D" in param: + data_ewkcorr_graph = frfile.Get("DataEWKCorrected/ratio%s%s_all%s" % (obj,param, obj)) + else: + data_ewkcorr_graph = getTGraphAsymmErrors(frfile, "DataEWKCorrected", param, obj) + data_ewkcorr_graph.SetLineColor(ROOT.kRed) draw_opt = "PA" if "2D" not in param else "colz text" if "2D" in param: - graph.GetYaxis().SetTitle("#eta") + data_ewkcorr_graph.SetTitle("") + ROOT.gStyle.SetOptStat(0) + data_ewkcorr_graph = invert2DHist(data_ewkcorr_graph,obj) + #data_ewkcorr_graph.GetYaxis().SetTitle("#eta") + data_ewkcorr_graph.GetYaxis().SetTitle("p_{T} [GeV]") + data_ewkcorr_graph.GetXaxis().SetTitle("|#eta|") + data_ewkcorr_graph.Draw(draw_opt) + elif "Eta" in param: + data_ewkcorr_graph.SetTitle("") + data_ewkcorr_graph.GetYaxis().SetTitle("Passing Tight / Passing Loose") + xlabel = "|#eta|" + data_ewkcorr_graph.GetXaxis().SetTitle(xlabel) + data_ewkcorr_graph.Draw(draw_opt) else: - graph.GetYaxis().SetTitle("Passing Tight / Passing Loose") - xlabel = "p_{T} [GeV]" if "Pt" in param else "#eta" - graph.GetXaxis().SetTitle(xlabel) - graph.Draw(draw_opt) + data_ewkcorr_barrel.SetTitle("") + data_ewkcorr_barrel.SetLineStyle(2) + data_ewkcorr_barrel.GetYaxis().SetTitle("Passing Tight / Passing Loose") + xlabel = "p_{T} [GeV]" + data_ewkcorr_barrel.GetXaxis().SetTitle(xlabel) + data_ewkcorr_barrel.Draw("PA") + data_ewkcorr_endcap.SetLineStyle(2) + data_ewkcorr_endcap.SetTitle("") + data_ewkcorr_endcap.Draw("P") - text_box = getTextBox(obj, "(MC)") + text_box = getTextBox(obj) text_box.Draw() + texS,texS1=getLumiTextBox() - if not "2D" in param: - legend = ROOT.TLegend(0.2,.85,.55,.70) - legend.AddEntry(graph, "Nonprompt MC", "l") + if (not "2D" in param) and ("Eta" in param): + data_uncorr_graph = getTGraphAsymmErrors(frfile, "DYMC", param, obj) + data_uncorr_graph.SetTitle("") + data_uncorr_graph.Draw("P") + + legend = ROOT.TLegend(0.2,.80,.40,.70) + legend.AddEntry(data_ewkcorr_graph, "Data - EWK", "l") + legend.AddEntry(data_uncorr_graph, "DYJets(MC)", "l") + legend.Draw() + elif ("Pt" in param): + data_uncorr_barrel,data_uncorr_endcap = getTGraphAsymmErrorsPt(frfile, "DYMC", param, obj) + data_uncorr_barrel.SetTitle("") + data_uncorr_barrel.Draw("P SAME") + data_uncorr_endcap.SetTitle("") + data_uncorr_endcap.Draw("P SAME") + + legend = ROOT.TLegend(0.2,.80,.40,.70) + legend.AddEntry(data_ewkcorr_barrel, "barrel Data-EWK", "l") + legend.AddEntry(data_uncorr_barrel, "barrel DYJets MC", "l") + legend.AddEntry(data_ewkcorr_endcap, "endcap Data-EWK", "l") + legend.AddEntry(data_uncorr_endcap, "endcap DYJets MC", "l") legend.Draw() canvas.Print("%s/ratio%s_all%s.png" % (outdir, param, obj)) canvas.Print("%s/ratio%s_all%s.pdf" % (outdir, param, obj)) -frfile = ROOT.TFile("/eos/user/k/kelong/WZAnalysisData/FakeRates/fakeRateMar2018-TightLepsFrom3MediumLeptons.root") +frfile = ROOT.TFile("/data/uhussain/ZZTo4l/FullRun2/VVAnalyzer/CMSSW_10_3_1/src/Analysis/VVAnalysis/data/fakeRate15Sep2019-ZZ4l2016.root") -data_folder_name = datetime.date.today().strftime("%Y%b"+"_ScaleFacs") -data_outdir = "~/www/DibosonAnalysisData/PlottingResults/WZxsec2016/FakeRates/" + data_folder_name + "/plots" -mc_outdir = "~/www/DibosonAnalysisData/PlottingResults/WZxsec2016/FakeRates/" + data_folder_name + "-MC/plots" +data_folder_name = datetime.date.today().strftime("%Y%b%d"+"_ZZ4l") +data_outdir = "~/www/ZZFullRun2/PlottingResults/ZZ4l2016/FakeRatesFromData/" + data_folder_name + "/plots" +mc_outdir = "~/www/ZZFullRun2/PlottingResults/ZZ4l2016/FakeRates/" + data_folder_name + "-MC/plots" for outdir in [data_outdir, mc_outdir]: try: @@ -111,6 +240,7 @@ def makeMCPlots(param, obj, outdir): pass for param in ["1DPt", "1DEta", "2D"]: +#for param in ["1DPt", "1DEta"]: for obj in ["Mu", "E"]: makeDataPlots(param, obj, data_outdir) makeMCPlots(param, obj, mc_outdir) diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index 16eef16f..afcab59b 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -4,11 +4,14 @@ import ROOT import logging import array +import os +import shutil #logging.basicConfig(level=logging.DEBUG) cardtool = CombineCardTools.CombineCardTools() + manager_path = ConfigureJobs.getManagerPath() manager_name = ConfigureJobs.getManagerName() #print "manager_path: ", manager_path @@ -21,26 +24,37 @@ "%s/%s" % (manager_path, manager_name), "ZZ4l2016/LooseLeptons", ) +#manager_path = ConfigureJobs.getManagerPath() +#manager_name = ConfigureJobs.getManagerName() +##print "manager_path: ", manager_path +#if manager_path not in sys.path: +# sys.path.insert(0, "/".join([manager_path,"ZZ4lRun2DatasetManager", "Utilities/python"])) +#dataset_file = "%s/ZZ4lRun2DatasetManager/FileInfo/ZZ4l2016/%s.json" % (manager_path, "LooseLeptons") +#allnames = json.load(open(dataset_file)) +#atgcSamples={} +#for name in allnames.keys(): +# if "atgc" in name or "sherpa" in name: +# atgcSamples[str(name)]= str(allnames[name]['plot_group']) +#print atgcSamples plot_groups = ["HZZ_signal","qqZZ_powheg","zzjj4l_ewk","ggZZ", "VVV", "data", "nonprompt",] plotGroupsMap = {name : config_factory.getPlotGroupMembers(name) for name in plot_groups} - xsecs = ConfigureJobs.getListOfFilesWithXSec([f for files in plotGroupsMap.values() for f in files]) lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.67} -fileMap = { "2016" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists02Sep2019-ZZ4l2016.root", - "2017" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists02Sep2019-ZZ4l2017.root", - "2018" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists02Sep2019-ZZ4l2018.root", - +fileMap = { "2016" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists25Sep2019-ZZ4l2016.root", + "2017" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists25Sep2019-ZZ4l2017.root", + "2018" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists25Sep2019-ZZ4l2018.root", + } channels = ["eeee", "eemm", "mmee", "mmmm"] nuissance_map = {"eeee" : 16, "eemm" : 17, "mmee" : 17, "mmmm" : 15, "all" : 13} #fitvar = "ZZPt" #rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) -fitvar = "Mass" -rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) -#fitvar = "yield" -cardtool.setRebin(rebin) +#fitvar = "Mass" +#rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) +fitvar = "yield" +#cardtool.setRebin(rebin) cardtool.setFitVariable(fitvar) cardtool.setFitVariableAppend("nonprompt", "Fakes") cardtool.setProcesses(plotGroupsMap) @@ -50,9 +64,21 @@ exclude=["nonprompt", "data"]) #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) -cardtool.setOutputFolder("/eos/user/u/uhussain/CombineStudies/ZZ/%sFitFullRunII" % fitvar) +combine_dir = ConfigureJobs.getCombinePath() +folder_name="%sFitFullRunII" % fitvar -for year in fileMap.keys(): +output_dir = '/'.join([combine_dir,"ZZ", folder_name]) + +try: + os.makedirs(output_dir) +except OSError as e: + logging.warning(e) + pass +output_folder = "CombineStudies/ZZ/%sFitFullRunII_Oct4" % fitvar +cardtool.setOutputFolder(output_folder) + +for year in ["2016","2017","2018"]: +#for year in fileMap.keys(): cardtool.setLumi(lumiMap[year]) cardtool.setInputFile(fileMap[year]) print fileMap[year], lumiMap[year] @@ -60,7 +86,7 @@ #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s%sFit" % (fitvar, year)) for process in plot_groups: #Turn this back on when the theory uncertainties are added - if process not in ["nonprompt", "data"]: #and False + if process not in ["qqZZ_sherpa","zzqjj4l_ewk","nonprompt", "data"]: #and False cardtool.addTheoryVar(process, 'scale', range(1, 10), exclude=[7, 9], central=0) cardtool.addTheoryVar(process, 'pdf_hessian' if year != "2016" else 'pdf_mc', [1]+[i for i in range(10, 111)], central=0) cardtool.loadHistsForProcess(process) @@ -71,3 +97,9 @@ logging.info("Writting cards for channel %s" % chan) cardtool.writeCards(chan, nuissance_map[chan], year=year) + +copyFiles=os.listdir(output_folder) +for f in copyFiles: + full_file_name=os.path.join(output_folder,f) + if os.path.isfile(full_file_name): + shutil.copy(full_file_name,output_dir) diff --git a/interface/FakeRateSelector.h b/interface/FakeRateSelector.h index 81ade578..06ab35a4 100644 --- a/interface/FakeRateSelector.h +++ b/interface/FakeRateSelector.h @@ -54,16 +54,15 @@ public : TH1D* ratio1DPt_endcap_; TH1D* ratio1DEta_; - // Readers to access the data (delete the ones you do not need). - FakeRateSelector(TTree * /*tree*/ =0) { } - virtual ~FakeRateSelector() { } virtual void Init(TTree *tree) override; virtual void SetupNewDirectory() override; - + //virtual void FillHistograms(Long64_t entry, std::pair variation) override; ClassDefOverride(FakeRateSelector,0); -protected: - void LoadBranchesUWVV(Long64_t entry, std::pair variation) override; +private: + void LoadBranchesUWVV(Long64_t entry, std::pair variation) override; + + }; #endif diff --git a/interface/SelectorBase.h b/interface/SelectorBase.h index 4600bd43..9d9f04c5 100644 --- a/interface/SelectorBase.h +++ b/interface/SelectorBase.h @@ -77,6 +77,7 @@ class SelectorBase : public TSelector { electronEfficiencyUp, electronEfficiencyDown, electronScaleUp, electronScaleDown, pileupUp, pileupDown, + //L1prefiringWeightUp, L1prefiringWeightDown, }; /****************************/ diff --git a/interface/ZZSelectorBase.h b/interface/ZZSelectorBase.h index 27140fe1..0147e196 100644 --- a/interface/ZZSelectorBase.h +++ b/interface/ZZSelectorBase.h @@ -35,6 +35,7 @@ public : //Int_t duplicated; Float_t weight; Float_t genWeight; + Float_t L1prefiringWeight; Float_t nTruePU; Float_t Z1mass; Float_t Z2mass; @@ -107,6 +108,7 @@ public : TBranch* b_scaleWeights; //TBranch* b_duplicated; TBranch* b_genWeight; + TBranch* b_L1prefiringWeight; TBranch* b_Z1mass; TBranch* b_Z2mass; //Smart cut on 4e/4mu diff --git a/makeFakeRates2016.sh b/makeFakeRates2016.sh index 11cc076f..b6f07bd5 100755 --- a/makeFakeRates2016.sh +++ b/makeFakeRates2016.sh @@ -1 +1 @@ -./Utilities/scripts/makeFakeRates.py -a ZZ4l2016 -s ZplusLSkim -l 35.9 -f ZZ4l2016 --uwvv --noHistConfig +./Utilities/scripts/makeFakeRates.py -a ZZ4l2016 -s ZplusLSkim -l 35.9 -f ZZ4l2016 --uwvv --noHistConfig -c eee,eem,emm,mmm --test diff --git a/src/FakeRateSelector.cc b/src/FakeRateSelector.cc index 3bc4110f..bd39579e 100644 --- a/src/FakeRateSelector.cc +++ b/src/FakeRateSelector.cc @@ -1,8 +1,7 @@ #include "Analysis/VVAnalysis/interface/FakeRateSelector.h" #include -void FakeRateSelector::LoadBranchesUWVV(Long64_t entry, std::pair variation) { - +void FakeRateSelector::LoadBranchesUWVV(Long64_t entry, std::pair variation) { ZZSelectorBase::LoadBranchesUWVV(entry, variation); //In HZZ AN it says: |M_inv(l1,l2)- MZ| < 7 GeV, to reduce the contribution from photon (asymmetric) conversions populating low masses. if (Z1mass > 98.1876 || Z1mass < 84.1876){ @@ -16,7 +15,8 @@ void FakeRateSelector::LoadBranchesUWVV(Long64_t entry, std::pairEvaluate2D(std::abs(l3Eta), l3Pt); @@ -69,13 +69,14 @@ void FakeRateSelector::LoadBranchesUWVV(Long64_t entry, std::pairSetBranchAddress("genWeight", &genWeight, &b_genWeight); fChain->SetBranchAddress("nTruePU", &nTruePU, &b_nTruePU); + if (year_ == yr2016 || year_ == yr2017){ + fChain->SetBranchAddress("L1prefiringWeight", &L1prefiringWeight, &b_L1prefiringWeight); + } } else { //fChain->SetBranchAddress("Flag_duplicateMuonsPass", Flag_duplicateMuonsPass); @@ -485,6 +488,13 @@ void ZZSelectorBase::LoadBranchesUWVV(Long64_t entry, std::pairGetEntry(entry); b_nTruePU->GetEntry(entry); weight = genWeight; + //Prefiring weights for 2016 and 2017 + //std::cout<<"genWeight: "<GetEntry(entry); + weight *= L1prefiringWeight; + //std::cout<<"PrefiredWeight: "< Date: Fri, 11 Oct 2019 16:47:53 -0400 Subject: [PATCH 48/53] Commiting all the bash scripts --- Utilities/scripts/makeAtgcForSenka.py | 113 ++++++++++++++++++++++++++ Utilities/scripts/makeFileForSenka.py | 92 +++++++++++++++++++++ Utilities/scripts/makeSimpleHtml.py | 88 ++++++++++++++++++++ makeFakeRates2017.sh | 1 + makeFakeRates2018.sh | 1 + makeScaleFactors2016.sh | 1 + makeScaleFactors2017.sh | 1 + makeScaleFactors2018.sh | 1 + runAllFiles.sh | 8 ++ runZZ4l2016.sh | 2 +- runZZ4l2016WGen.sh | 1 + runZZ4l2017.sh | 2 +- runZZ4l2018.sh | 2 +- test2016.sh | 1 + 14 files changed, 311 insertions(+), 3 deletions(-) create mode 100644 Utilities/scripts/makeAtgcForSenka.py create mode 100644 Utilities/scripts/makeFileForSenka.py create mode 100755 Utilities/scripts/makeSimpleHtml.py create mode 100755 makeFakeRates2017.sh create mode 100755 makeFakeRates2018.sh create mode 100755 makeScaleFactors2016.sh create mode 100755 makeScaleFactors2017.sh create mode 100755 makeScaleFactors2018.sh create mode 100755 runAllFiles.sh create mode 100755 runZZ4l2016WGen.sh create mode 100755 test2016.sh diff --git a/Utilities/scripts/makeAtgcForSenka.py b/Utilities/scripts/makeAtgcForSenka.py new file mode 100644 index 00000000..9706918d --- /dev/null +++ b/Utilities/scripts/makeAtgcForSenka.py @@ -0,0 +1,113 @@ +import sys +import ROOT +import os +import logging +import json +import array +from python import ConfigureJobs + +def addOverflow(hist): + addOverflowAndUnderflow(hist, underflow=False, overflow=True) + +def addOverflowAndUnderflow(hist, underflow=True, overflow=True): + if not "TH1" in hist.ClassName(): + return + if overflow: + # Returns num bins + overflow + underflow + num_bins = hist.GetNbinsX() + add_overflow = hist.GetBinContent(num_bins) + hist.GetBinContent(num_bins + 1) + hist.SetBinContent(num_bins, add_overflow) + if underflow: + add_underflow = hist.GetBinContent(0) + hist.GetBinContent(1) + hist.SetBinContent(1, add_underflow) + +manager_path = ConfigureJobs.getManagerPath() +manager_name = ConfigureJobs.getManagerName() +#print "manager_path: ", manager_path +if manager_path not in sys.path: + sys.path.insert(0, "/".join([manager_path,"ZZ4lRun2DatasetManager", "Utilities/python"])) + +dataset_file = "%s/ZZ4lRun2DatasetManager/FileInfo/ZZ4l2016/%s.json" % (manager_path, "LooseLeptons") +allnames = json.load(open(dataset_file)) +atgcSamples={} +for name in allnames.keys(): + if "atgc" in name or "sherpa" in name: + atgcSamples[str(name)]= str(allnames[name]['plot_group']) +print atgcSamples +fileMap = { "2016" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists02Sep2019-ZZ4l2016.root", + "2017" : "", + "2018" : "", + } +channels = ["eeee", "eemm", "mmmm"] +#channels = ["eemm"] +eVariations = ["CMS_eff_eUp", "CMS_eff_eDown","CMS_RecoEff_eUp", "CMS_RecoEff_eDown"] +mVariations = ["CMS_eff_mUp","CMS_eff_mDown"] +#systVariations=[] +fitvar = "Mass" +rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) +outputFolder = "ForSenka/%sFullRunII" % fitvar +if not os.path.isdir(outputFolder): + os.makedirs(outputFolder) + +#for year in fileMap.keys(): +for year in ["2016"]: + fileName=fileMap[year] + if type(fileName) == str: hist_file = ROOT.TFile.Open(fileName) + for chan in channels: + savehists=[] + outputFile = "ZZatgcInput_%s_%s.root" % (chan,year) + for process in [str(i) for i in atgcSamples.keys()]: + histNames=[] + if process=="nonprompt": + histNames.append("Mass_Fakes_{channel}".format(channel=chan)) + else: + histNames.append("Mass_{channel}".format(channel=chan)) + if not hist_file.Get(process): + logging.warning("Skipping invalid filename %s" % process) + continue + if process not in ["data","nonprompt"]: + if chan=="eeee": + for var in eVariations: + histNames.append("Mass_%s_%s" % (var,chan)) + elif chan=="mmmm": + for var in mVariations: + histNames.append("Mass_%s_%s" % (var,chan)) + elif chan=="eemm": + for var in eVariations+mVariations: + histNames.append("Mass_%s_%s" % (var,chan)) + print "plot_group: ",process + print "histNames: ",histNames + for name in histNames: + tmphist = hist_file.Get("/".join([process, name])) + if not tmphist: + raise RuntimeError("Failed to produce histogram %s" % "/".join([process, name])) + if "eemm" in name: + ##combine eemm and mmee channels + secname = name.replace("eemm","mmee") + tmphist2 = hist_file.Get("/".join([process, secname])) + #print tmphist.GetName(),": ",tmphist.Integral() + #print tmphist2.GetName(),": ",tmphist2.Integral() + tmphist.Add(tmphist2) + hist = tmphist.Clone() + #print "total: ",hist.Integral() + histnew = hist.Rebin(len(rebin)-1,"histnew",rebin) + addOverflow(histnew) + tmphist.Delete() + if process=="qqZZ_sherpa": + histnew.Scale(0.455985*1000*35.9*1.239/histnew.Integral()) + newName = name.replace("Mass",str(atgcSamples[process])) + newName = newName.replace("_"+chan,"") + hist.Delete() + histnew.SetName(newName) + savehists.append(histnew) + + fOut = ROOT.TFile.Open("/".join([outputFolder, outputFile]), "RECREATE") + fOut.cd() + for newhists in savehists: + newhists.Write() + fOut.Close() + hist_file.Close() + + + + diff --git a/Utilities/scripts/makeFileForSenka.py b/Utilities/scripts/makeFileForSenka.py new file mode 100644 index 00000000..30c52f89 --- /dev/null +++ b/Utilities/scripts/makeFileForSenka.py @@ -0,0 +1,92 @@ +import sys +import ROOT +import os +import logging + +plot_groups = ["HZZ_signal","qqZZ_powheg","qqZZ_sherpa","zzjj4l_ewk","ggZZ", "VVV", "data", "nonprompt",] +#plot_groups = ["HZZ_signal"] +fileMap = { "2016" : "CombineStudies/ZZ/MassFitFullRunII/ZZCombineInput_2016.root", + "2017" : "/eos/user/u/uhussain/CombineStudies/ZZ/MassFitFullRunII/ZZCombineInput_2017.root", + "2018" : "/eos/user/u/uhussain/CombineStudies/ZZ/MassFitFullRunII/ZZCombineInput_2018.root", + } +channels = ["eeee", "eemm", "mmmm"] +#channels = ["eemm"] +eVariations = ["CMS_eff_eUp", "CMS_eff_eDown","CMS_RecoEff_eUp", "CMS_RecoEff_eDown"] +mVariations = ["CMS_eff_mUp","CMS_eff_mDown"] +#systVariations=[] +#"CMS_pileup"], +#theorVariations=[] +theorVariations = ["pdf","QCDscale"] +fitvar = "Mass" + +outputFolder = "ForSenka/%sFullRunII" % fitvar +if not os.path.isdir(outputFolder): + os.makedirs(outputFolder) + +#for year in fileMap.keys(): +for year in ["2016"]: + fileName=fileMap[year] + if type(fileName) == str: hist_file = ROOT.TFile.Open(fileName) + for chan in channels: + savehists=[] + outputFile = "ZZSMInput_%s_%s.root" % (chan,year) + for process in plot_groups: + histNames=[] + if process=="nonprompt": + histNames.append("Mass_Fakes_{channel}".format(channel=chan)) + else: + histNames.append("Mass_{channel}".format(channel=chan)) + if not hist_file.Get(process): + logging.warning("Skipping invalid filename %s" % process) + continue + if process not in ["data","nonprompt"]: + if chan=="eeee": + for var in eVariations: + histNames.append("Mass_%s_%s" % (var,chan)) + elif chan=="mmmm": + for var in mVariations: + histNames.append("Mass_%s_%s" % (var,chan)) + elif chan=="eemm": + for var in eVariations+mVariations: + histNames.append("Mass_%s_%s" % (var,chan)) + if process in ["qqZZ_powheg","HZZ_signal","ggZZ","VVV"]: + for var in theorVariations: + histNames.append("Mass_%s_%sUp_%s" % (var,process,chan)) + histNames.append("Mass_%s_%sDown_%s" % (var,process,chan)) + print "plot_group: ",process + print "histNames: ",histNames + for name in histNames: + tmphist = hist_file.Get("/".join([process, name])) + if not tmphist: + raise RuntimeError("Failed to produce histogram %s" % "/".join([process, name])) + if "eemm" in name: + ##combine eemm and mmee channels + secname = name.replace("eemm","mmee") + tmphist2 = hist_file.Get("/".join([process, secname])) + #print tmphist.GetName(),": ",tmphist.Integral() + #print tmphist2.GetName(),": ",tmphist2.Integral() + tmphist.Add(tmphist2) + hist = tmphist.Clone() + #print "total: ",hist.Integral() + tmphist.Delete() + newName = name.replace("Mass",process) + newName = newName.replace("_"+chan,"") + if "pdf" or "QCD" in newName: + newName = newName.replace("_"+process,"") + if "Fakes" in newName: + newName = newName.replace("_Fakes","") + if "data" in newName: + newName = newName.replace("data","data_obs") + hist.SetName(newName) + savehists.append(hist) + + fOut = ROOT.TFile.Open("/".join([outputFolder, outputFile]), "RECREATE") + fOut.cd() + for newhists in savehists: + newhists.Write() + fOut.Close() + hist_file.Close() + + + + diff --git a/Utilities/scripts/makeSimpleHtml.py b/Utilities/scripts/makeSimpleHtml.py new file mode 100755 index 00000000..9d9316eb --- /dev/null +++ b/Utilities/scripts/makeSimpleHtml.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python +""" + Modified from T. Ruggles and D. Taylor, U. Wisconsin + Changes by K.Long, https://github.com/kdlong/WZConfigPlotting/commit/14d492fe266f87991395aaf188cb25c9116e9cf1 +""" +import glob +import imghdr +import argparse + +def writeHTML(path, name): + image_files = [x for x in glob.glob(path + "/plots/*.*") if imghdr.what(x)] + with open('%s/index.html' % path, 'w') as index: + index = open('%s/index.html' % path, 'w') + index.write('\n' + '\n' + ' {title}\n' + ' \n' + '\n' + '\n'.format(title=name) + ) + index.write('
{title}
\n' + ' \n'.format(title=name) + ) + if "Nonprompt" in path: + relative_path = path.split("/")[-1].replace("Nonprompt", "MC") + index.write('
Monte Carlo based plots: \n' + ' [MC plots]' % relative_path + + '
\n' + '
\n' + ) + elif "MC" in path: + relative_path = path.split("/")[-1].replace("MC", "Nonprompt") + index.write('
Plots with data driven background: \n' + ' [Nonprompt plots]' % relative_path + + '
\n' + '
\n' + ) + if path.split("/")[-1] not in ["eeee", "eemm","mmee","mmmm"]: + index.write('
Plots by channel: \n' + ' [eeee] - ' + ' [eemm] - ' + ' [mmee] - ' + ' [mmmm]' + '
\n' + '
\n' + ) + else: + index.write('
Plots by channel: \n' + ' [eeee] - ' + ' [eemm] - ' + ' [mmee] - ' + ' [mmmm]' + '
\n' + '
\n' + ) + for i, image_file in enumerate(image_files): + file_name = image_file.strip().split('/')[-1].strip() + if i % 3 == 0: + index.write(' \n') + index.write(getTableRow(image_file.split("/")[-1])) + if (i+1) % 3 == 0: + index.write(' \n') + index.write( '\n' + '' ) +def getTableRow(image_file): + return ''' \n'''.format(image=image_file, name=image_file.split(".")[-2]) + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('-p', '--path_to_files', type=str, required=True) + parser.add_argument('-n', '--name', type=str, required=True) + args = parser.parse_args() + + writeHTML(args.path_to_files.rstrip("/*"), args.name) + +if __name__ == "__main__": + main() diff --git a/makeFakeRates2017.sh b/makeFakeRates2017.sh new file mode 100755 index 00000000..6b545392 --- /dev/null +++ b/makeFakeRates2017.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeFakeRates.py -a ZZ4l2017 -s ZplusLSkim -l 41.5 -f ZZ4l2017 --uwvv --noHistConfig -c eee,eem,emm,mmm --test diff --git a/makeFakeRates2018.sh b/makeFakeRates2018.sh new file mode 100755 index 00000000..6302c257 --- /dev/null +++ b/makeFakeRates2018.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeFakeRates.py -a ZZ4l2018 -s ZplusLSkim -l 59.7 -f ZZ4l2018 --uwvv --noHistConfig -c eee,eem,emm,mmm --test diff --git a/makeScaleFactors2016.sh b/makeScaleFactors2016.sh new file mode 100755 index 00000000..e0438029 --- /dev/null +++ b/makeScaleFactors2016.sh @@ -0,0 +1 @@ +python ScaleFactors/setupScaleFactors.py --year 2016 -t data/fakeRate15Sep2019-ZZ4l2016.root --output_file data/scaleFactorsZZ4l2016.root diff --git a/makeScaleFactors2017.sh b/makeScaleFactors2017.sh new file mode 100755 index 00000000..3bc601f3 --- /dev/null +++ b/makeScaleFactors2017.sh @@ -0,0 +1 @@ +python ScaleFactors/setupScaleFactors.py --year 2017 -t data/fakeRate14Sep2019-ZZ4l2017.root --output_file data/scaleFactorsZZ4l2017.root diff --git a/makeScaleFactors2018.sh b/makeScaleFactors2018.sh new file mode 100755 index 00000000..b3582b19 --- /dev/null +++ b/makeScaleFactors2018.sh @@ -0,0 +1 @@ +python ScaleFactors/setupScaleFactors.py --year 2018 -t data/fakeRate15Sep2019-ZZ4l2018.root --output_file data/scaleFactorsZZ4l2018.root diff --git a/runAllFiles.sh b/runAllFiles.sh new file mode 100755 index 00000000..84f87124 --- /dev/null +++ b/runAllFiles.sh @@ -0,0 +1,8 @@ +echo "creating 2016 hist file" +./runZZ4l2016.sh + +echo "creating 2017 hist file" +./runZZ4l2017.sh + +#echo "creating 2018 hist file" +#./runZZ4l2018.sh diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index 7d443085..36c2effb 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1,2 +1,2 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee -f ZZ4l2016 --with_Gen --with_background --with_Gen -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file NoSyst2016 --year 2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_background --with_Gen -sf data/scaleFactorsZZ4l2016.root #./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root diff --git a/runZZ4l2016WGen.sh b/runZZ4l2016WGen.sh new file mode 100755 index 00000000..448de919 --- /dev/null +++ b/runZZ4l2016WGen.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file zzGen2016 --year 2016 --uwvv -c eeee,eemm,mmee,mmmm --test -f zz4l-powheg -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2016.root diff --git a/runZZ4l2017.sh b/runZZ4l2017.sh index 1f55fa4e..9e282a90 100755 --- a/runZZ4l2017.sh +++ b/runZZ4l2017.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --year 2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root diff --git a/runZZ4l2018.sh b/runZZ4l2018.sh index 94d33e00..9ea6dbe4 100755 --- a/runZZ4l2018.sh +++ b/runZZ4l2018.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file test2018 --uwvv -c mmmm -f ZZ4l2018 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2018.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file test2018 --year 2018 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2018 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2018.root diff --git a/test2016.sh b/test2016.sh new file mode 100755 index 00000000..709e6cbf --- /dev/null +++ b/test2016.sh @@ -0,0 +1 @@ +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s SignalSync --output_file zzTest2016 --uwvv -c eeee,eemm,mmee,mmmm --test -f 2016SignalSync From 2a2acf80938c3f68cbb6c8de940218bb3a3ab6b0 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Wed, 30 Oct 2019 16:46:36 -0400 Subject: [PATCH 49/53] updating config files etc --- .gitmodules | 3 --- PileupWeights | 1 - ScaleFactors/setupScaleFactors.py | 4 ++-- Templates/config.uhussain | 2 +- Utilities/scripts/makeAtgcForSenka.py | 31 ++++++++++++++++----------- Utilities/scripts/makeFileForSenka.py | 15 +++++++------ Utilities/scripts/makeHistFile.py | 4 +++- Utilities/scripts/setupZZCombine.py | 24 +++++++++++---------- runZZ4l2016.sh | 2 +- runZZ4l2017.sh | 2 +- runZZ4l2018.sh | 2 +- 11 files changed, 48 insertions(+), 42 deletions(-) delete mode 160000 PileupWeights diff --git a/.gitmodules b/.gitmodules index 9ef7cf8c..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "PileupWeights"] - path = PileupWeights - url = ssh://git@gitlab.cern.ch:7999/ncsmith/PileupWeights.git diff --git a/PileupWeights b/PileupWeights deleted file mode 160000 index 5edbb498..00000000 --- a/PileupWeights +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5edbb49861ac655e5b9401fa5856b3f751aecb36 diff --git a/ScaleFactors/setupScaleFactors.py b/ScaleFactors/setupScaleFactors.py index 61e369d3..752d8518 100755 --- a/ScaleFactors/setupScaleFactors.py +++ b/ScaleFactors/setupScaleFactors.py @@ -109,7 +109,7 @@ def getComLineArgs(): electronRun16GapSF.Write() muonRun16SF = ROOT.ScaleFactor("muonRun16SF", "Muon Run '16 Trk+ID+ISO SF, x=abs(Eta), y=Pt") - mid16File = ROOT.TFile.Open('data/final_HZZ_muon_SF_2016_IsBDT_0610.root') + mid16File = ROOT.TFile.Open('data/MoriondSFs/final_HZZ_SF_2016_legacy_mupogsysts_newLoose_noTracking_1610.root') muonRun16SF.Set2DHist(float2double(mid16File.Get('FINAL')),float2double(mid16File.Get('ERROR')),float2double(mid16File.Get('ERROR'))) fScales.cd() muonRun16SF.Write() @@ -140,7 +140,7 @@ def getComLineArgs(): electronRun17GapSF.Write() muonRun17SF = ROOT.ScaleFactor("muonRun17SF", "Muon Run '17 Trk+ID+ISO SF, x=abs(Eta), y=Pt") - midFile = ROOT.TFile.Open('data/final_HZZ_muon_SF_2017_IsBDT_0610.root') + midFile = ROOT.TFile.Open('data/MoriondSFs/ScaleFactors_mu_Moriond2018_final.root') muonRun17SF.Set2DHist(float2double(midFile.Get('FINAL')),float2double(midFile.Get('ERROR')),float2double(midFile.Get('ERROR'))) fScales.cd() muonRun17SF.Write() diff --git a/Templates/config.uhussain b/Templates/config.uhussain index 1f93133f..915b46f1 100644 --- a/Templates/config.uhussain +++ b/Templates/config.uhussain @@ -3,7 +3,7 @@ user = uhussain analysis = ZZ dataset_manager_path = /afs/cern.ch/user/u/%(user)s/work dataset_manager_name = ZZ4lRun2DatasetManager -combine_path = %(dataset_manager_path)s/HiggsCombine/CMSSW_10_2_13/src/HiggsAnalysis/CombinedLimit +combine_path = %(dataset_manager_path)s/%(dataset_manager_name)s/HiggsCombine/CMSSW_10_2_3/src/HiggsAnalysis/CombinedLimit output_path = /eos/user/u/%(user)s/%(analysis)sAnalysisData fakeRate_output = %(output_path)s/FakesRates hist_output = %(output_path)s/HistFiles diff --git a/Utilities/scripts/makeAtgcForSenka.py b/Utilities/scripts/makeAtgcForSenka.py index 9706918d..226239b7 100644 --- a/Utilities/scripts/makeAtgcForSenka.py +++ b/Utilities/scripts/makeAtgcForSenka.py @@ -27,16 +27,9 @@ def addOverflowAndUnderflow(hist, underflow=True, overflow=True): if manager_path not in sys.path: sys.path.insert(0, "/".join([manager_path,"ZZ4lRun2DatasetManager", "Utilities/python"])) -dataset_file = "%s/ZZ4lRun2DatasetManager/FileInfo/ZZ4l2016/%s.json" % (manager_path, "LooseLeptons") -allnames = json.load(open(dataset_file)) -atgcSamples={} -for name in allnames.keys(): - if "atgc" in name or "sherpa" in name: - atgcSamples[str(name)]= str(allnames[name]['plot_group']) -print atgcSamples -fileMap = { "2016" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists02Sep2019-ZZ4l2016.root", +fileMap = { "2016" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists17Oct2019-ZZ4l2016_Moriond.root", "2017" : "", - "2018" : "", + "2018" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists29Oct2019-ZZ4l2018_MVA.root", } channels = ["eeee", "eemm", "mmmm"] #channels = ["eemm"] @@ -50,8 +43,16 @@ def addOverflowAndUnderflow(hist, underflow=True, overflow=True): os.makedirs(outputFolder) #for year in fileMap.keys(): -for year in ["2016"]: +for year in ["2018"]: + dataset_file = "%s/ZZ4lRun2DatasetManager/FileInfo/ZZ4l%s/%s.json" % (manager_path,year, "LooseLeptons") + allnames = json.load(open(dataset_file)) + atgcSamples={} + for name in allnames.keys(): + if "atgc" in name or "sherpa" in name: + atgcSamples[str(name)]= str(allnames[name]['plot_group']) + print atgcSamples fileName=fileMap[year] + print "fileName: ",fileName if type(fileName) == str: hist_file = ROOT.TFile.Open(fileName) for chan in channels: savehists=[] @@ -75,8 +76,8 @@ def addOverflowAndUnderflow(hist, underflow=True, overflow=True): elif chan=="eemm": for var in eVariations+mVariations: histNames.append("Mass_%s_%s" % (var,chan)) - print "plot_group: ",process - print "histNames: ",histNames + #print "plot_group: ",process + #print "histNames: ",histNames for name in histNames: tmphist = hist_file.Get("/".join([process, name])) if not tmphist: @@ -93,8 +94,12 @@ def addOverflowAndUnderflow(hist, underflow=True, overflow=True): histnew = hist.Rebin(len(rebin)-1,"histnew",rebin) addOverflow(histnew) tmphist.Delete() - if process=="qqZZ_sherpa": + if process=="zz4l-sherpa": + print "this process happens in 2016" histnew.Scale(0.455985*1000*35.9*1.239/histnew.Integral()) + if process=="zz4l-atgc_1" and year=="2018": + print "this process happens in 2018" + histnew.Scale(0.455985*1000*41.5*1.239/histnew.Integral()) newName = name.replace("Mass",str(atgcSamples[process])) newName = newName.replace("_"+chan,"") hist.Delete() diff --git a/Utilities/scripts/makeFileForSenka.py b/Utilities/scripts/makeFileForSenka.py index 30c52f89..bac2316a 100644 --- a/Utilities/scripts/makeFileForSenka.py +++ b/Utilities/scripts/makeFileForSenka.py @@ -2,12 +2,13 @@ import ROOT import os import logging - -plot_groups = ["HZZ_signal","qqZZ_powheg","qqZZ_sherpa","zzjj4l_ewk","ggZZ", "VVV", "data", "nonprompt",] +#Putting qqZZ_sherpa in the atgc files +#plot_groups = ["HZZ_signal","qqZZ_powheg","qqZZ_sherpa","zzjj4l_ewk","ggZZ", "VVV", "data", "nonprompt",] +plot_groups = ["HZZ_signal","qqZZ_powheg","zzjj4l_ewk","ggZZ", "VVV", "data", "nonprompt",] #plot_groups = ["HZZ_signal"] -fileMap = { "2016" : "CombineStudies/ZZ/MassFitFullRunII/ZZCombineInput_2016.root", - "2017" : "/eos/user/u/uhussain/CombineStudies/ZZ/MassFitFullRunII/ZZCombineInput_2017.root", - "2018" : "/eos/user/u/uhussain/CombineStudies/ZZ/MassFitFullRunII/ZZCombineInput_2018.root", +fileMap = { "2016" : "/data/uhussain/ZZTo4l/FullRun2/VVAnalyzer/CMSSW_10_3_1/src/Analysis/VVAnalysis/ZZCombineInput_2016.root", + "2017" : "/data/uhussain/ZZTo4l/FullRun2/VVAnalyzer/CMSSW_10_3_1/src/Analysis/VVAnalysis/ZZCombineInput_2017.root", + "2018" : "/data/uhussain/ZZTo4l/FullRun2/VVAnalyzer/CMSSW_10_3_1/src/Analysis/VVAnalysis/ZZCombineInput_2018.root", } channels = ["eeee", "eemm", "mmmm"] #channels = ["eemm"] @@ -23,8 +24,8 @@ if not os.path.isdir(outputFolder): os.makedirs(outputFolder) -#for year in fileMap.keys(): -for year in ["2016"]: +for year in fileMap.keys(): +#for year in ["2016"]: fileName=fileMap[year] if type(fileName) == str: hist_file = ROOT.TFile.Open(fileName) for chan in channels: diff --git a/Utilities/scripts/makeHistFile.py b/Utilities/scripts/makeHistFile.py index d5ee0624..09d6e008 100755 --- a/Utilities/scripts/makeHistFile.py +++ b/Utilities/scripts/makeHistFile.py @@ -19,6 +19,8 @@ def getComLineArgs(): default=35.87, help="luminosity value (in fb-1)") parser.add_argument("--output_file", "-o", type=str, default="test.root", help="Output file name") + parser.add_argument("--muIDType", type=str, + default="", help="Moriond Muon ID or MVA ID") parser.add_argument("--test", action='store_true', help="Run test job (no background estimate)") parser.add_argument("--uwvv", action='store_true', @@ -62,7 +64,7 @@ def makeHistFile(args): tmpFileName = "Hists%s-%s.root" % (today, args['output_file']) else: tmpFileName = "Hists%s-%s.root" % (today, args['output_file']) if args['selection'] == "SignalSync" \ - else "Hists%s-%s.root" % (today, args['analysis']) + else "Hists%s-%s_%s.root" % (today, args['analysis'],args['muIDType']) toCombine = args['with_background'] or args['with_Gen'] fOut = ROOT.TFile(tmpFileName if not toCombine else tmpFileName.replace(".root", "sel.root"), "recreate") combinedNames = [fOut.GetName()] diff --git a/Utilities/scripts/setupZZCombine.py b/Utilities/scripts/setupZZCombine.py index afcab59b..b59d5c98 100644 --- a/Utilities/scripts/setupZZCombine.py +++ b/Utilities/scripts/setupZZCombine.py @@ -42,25 +42,26 @@ xsecs = ConfigureJobs.getListOfFilesWithXSec([f for files in plotGroupsMap.values() for f in files]) -lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.67} -fileMap = { "2016" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists25Sep2019-ZZ4l2016.root", - "2017" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists25Sep2019-ZZ4l2017.root", - "2018" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists25Sep2019-ZZ4l2018.root", +lumiMap = {"2016" : 35.9, "2017" : 41.5, "2018" : 59.67,"FullRun2":137.1} +fileMap = { "2016" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists17Oct2019-ZZ4l2016_Moriond.root", + "2017" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists14Oct2019-ZZ4l2017_Moriond.root", + "2018" : "/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists15Oct2019-ZZ4l2018_MVA.root", + "FullRun2":"/afs/cern.ch/user/u/uhussain/ZZ4lRun2HistFiles/Hists17Oct2019-ZZFullRun2.root", } channels = ["eeee", "eemm", "mmee", "mmmm"] nuissance_map = {"eeee" : 16, "eemm" : 17, "mmee" : 17, "mmmm" : 15, "all" : 13} #fitvar = "ZZPt" #rebin = array.array('d', [0.0,50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0]) -#fitvar = "Mass" -#rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) -fitvar = "yield" +fitvar = "Mass" +rebin = array.array('d', [100.0,200.0,250.0,300.0,350.0,400.0,500.0,600.0,800.0,1000.0,1200.0]) +#fitvar = "yield" #cardtool.setRebin(rebin) cardtool.setFitVariable(fitvar) cardtool.setFitVariableAppend("nonprompt", "Fakes") cardtool.setProcesses(plotGroupsMap) cardtool.setChannels(channels) cardtool.setCrosSectionMap(xsecs) -cardtool.setVariations(["CMS_eff_e", "CMS_RecoEff_e", "CMS_eff_m", ],#"CMS_pileup"], +cardtool.setVariations(["CMS_eff_e", "CMS_RecoEff_e", "CMS_eff_m","CMS_pileup"], exclude=["nonprompt", "data"]) #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s2016Fit" % fitvar) @@ -74,11 +75,12 @@ except OSError as e: logging.warning(e) pass -output_folder = "CombineStudies/ZZ/%sFitFullRunII_Oct4" % fitvar +output_folder = "CombineStudies/ZZ/%sFitFullRunII_Oct29" % fitvar cardtool.setOutputFolder(output_folder) for year in ["2016","2017","2018"]: -#for year in fileMap.keys(): +#One has to make templates for full Run 2 which i haven't done yet. +#for year in ["FullRun2"]: cardtool.setLumi(lumiMap[year]) cardtool.setInputFile(fileMap[year]) print fileMap[year], lumiMap[year] @@ -86,7 +88,7 @@ #cardtool.setOutputFolder("/eos/user/k/kelong/CombineStudies/ZZ/%s%sFit" % (fitvar, year)) for process in plot_groups: #Turn this back on when the theory uncertainties are added - if process not in ["qqZZ_sherpa","zzqjj4l_ewk","nonprompt", "data"]: #and False + if process not in ["zzjj4l_ewk","qqZZ_sherpa","zzqjj4l_ewk","nonprompt", "data"]: #and False cardtool.addTheoryVar(process, 'scale', range(1, 10), exclude=[7, 9], central=0) cardtool.addTheoryVar(process, 'pdf_hessian' if year != "2016" else 'pdf_mc', [1]+[i for i in range(10, 111)], central=0) cardtool.loadHistsForProcess(process) diff --git a/runZZ4l2016.sh b/runZZ4l2016.sh index 36c2effb..5eba05fb 100755 --- a/runZZ4l2016.sh +++ b/runZZ4l2016.sh @@ -1,2 +1,2 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file NoSyst2016 --year 2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_background --with_Gen -sf data/scaleFactorsZZ4l2016.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file NoSyst2016 --muIDType Moriond --year 2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_background --with_Gen -sf data/MoriondSFs/scaleFactorsZZ4l2016.root #./Utilities/scripts/makeHistFile.py -a ZZ4l2016 -s LooseLeptons --output_file test2016 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2016 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root diff --git a/runZZ4l2017.sh b/runZZ4l2017.sh index 9e282a90..7334d787 100755 --- a/runZZ4l2017.sh +++ b/runZZ4l2017.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --year 2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2017.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file test2017 --muIDType Moriond --year 2017 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2017 -j 12 --with_Gen --with_background -sf data/MoriondSFs/scaleFactorsZZ4l2017.root diff --git a/runZZ4l2018.sh b/runZZ4l2018.sh index 9ea6dbe4..baa035a5 100755 --- a/runZZ4l2018.sh +++ b/runZZ4l2018.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file test2018 --year 2018 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2018 -j 12 --with_Gen --with_background -sf data/scaleFactorsZZ4l2018.root +./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s LooseLeptons --output_file test2018 --muIDType MVA --year 2018 --uwvv -c eeee,eemm,mmee,mmmm -f ZZ4l2018 -j 12 --with_Gen --with_background -sf data/latestSFs/scaleFactorsZZ4l2018.root From 53476b83c226fd7e5edd8a8e8a023b136fd9a64e Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Fri, 1 Nov 2019 14:11:57 -0400 Subject: [PATCH 50/53] selector changes --- interface/ZZSelectorBase.h | 12 ++- src/ZZSelector.cc | 41 ++++++--- src/ZZSelectorBase.cc | 181 +++++++++++++++++++++++++++---------- 3 files changed, 170 insertions(+), 64 deletions(-) diff --git a/interface/ZZSelectorBase.h b/interface/ZZSelectorBase.h index 0147e196..34da4759 100644 --- a/interface/ZZSelectorBase.h +++ b/interface/ZZSelectorBase.h @@ -58,10 +58,10 @@ public : Bool_t l2IsTight; Bool_t l3IsTight; Bool_t l4IsTight; - Bool_t l1IsIso; - Bool_t l2IsIso; - Bool_t l3IsIso; - Bool_t l4IsIso; + Float_t l1IsIso; + Float_t l2IsIso; + Float_t l3IsIso; + Float_t l4IsIso; Bool_t l1IsGap; Bool_t l2IsGap; @@ -203,6 +203,10 @@ public : bool lep2IsTight(); bool lep3IsTight(); bool lep4IsTight(); + bool lep1IsIso(); + bool lep2IsIso(); + bool lep3IsIso(); + bool lep4IsIso(); bool Z1PF(); bool Z1FP(); bool Z1FF(); diff --git a/src/ZZSelector.cc b/src/ZZSelector.cc index 269368dc..f63481ff 100644 --- a/src/ZZSelector.cc +++ b/src/ZZSelector.cc @@ -14,7 +14,7 @@ void ZZSelector::Init(TTree *tree) {pileupUp, "CMS_pileupUp"}, {pileupDown, "CMS_pileupDown"}, }; - doSystematics_ = false; + doSystematics_ = true; //This would be set true inside ZZBackground Selector //isNonPrompt_ = false; @@ -355,10 +355,10 @@ void ZZSelector::SetVariables(Long64_t entry) { bool templ2IsTight = l2IsTight; l2IsTight = l4IsTight; l4IsTight = templ2IsTight; - bool templ1IsIso = l1IsIso; + float templ1IsIso = l1IsIso; l1IsIso = l3IsIso; l3IsIso = templ1IsIso; - bool templ2IsIso = l2IsIso; + float templ2IsIso = l2IsIso; l2IsIso = l4IsIso; l4IsIso = templ2IsIso; bool templ1IsGap = l1IsGap; @@ -583,17 +583,34 @@ bool ZZSelector::PassesZZSelection(bool nonPrompt){ //This nonPrompt boolean is for ZZBackgroundSelector //When running ZZBackgroundSelector, FillHistograms should run just with ZZSelection, we cannot require TightZZLeptons by definition if (nonPrompt){ - if (ZZSelection()) - return true; - else - return false; - } - else{ - //std::cout<<"nonPrompt inside function: "<SetBranchAddress("duplicated", &duplicated, &b_duplicated); //fChain->SetBranchAddress("e1IsFall17isoV2wpHZZ", &l1IsTight, &b_l1IsTight); fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); - fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("e1ZZIso", &l1IsIso, &b_l1IsIso); //fChain->SetBranchAddress("e2IsFall17isoV2wpHZZ", &l2IsTight, &b_l2IsTight); fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); - fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("e2ZZIso", &l2IsIso, &b_l2IsIso); //fChain->SetBranchAddress("e3IsFall17isoV2wpHZZ", &l3IsTight, &b_l3IsTight); fChain->SetBranchAddress("e3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); - fChain->SetBranchAddress("e3ZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("e3ZZIso", &l3IsIso, &b_l3IsIso); //fChain->SetBranchAddress("e4IsFall17isoV2wpHZZ", &l4IsTight, &b_l4IsTight); fChain->SetBranchAddress("e4ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); - fChain->SetBranchAddress("e4ZZIsoPass", &l4IsIso, &b_l4IsIso); + fChain->SetBranchAddress("e4ZZIso", &l4IsIso, &b_l4IsIso); fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); fChain->SetBranchAddress("e3_e4_Mass", &Z2mass, &b_Z2mass); //fChain->SetBranchAddress("e1_e3_Mass", &Zamass, &b_Zamass); @@ -131,14 +131,19 @@ void ZZSelectorBase::SetBranchesUWVV() { //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); //fChain->SetBranchAddress("e1IsFall17isoV2wpHZZ", &l1IsTight, &b_l1IsTight); fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); - fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("e1ZZIso", &l1IsIso, &b_l1IsIso); //fChain->SetBranchAddress("e2IsFall17isoV2wpHZZ", &l2IsTight, &b_l2IsTight); fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); - fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); - fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); - fChain->SetBranchAddress("m1ZZIsoPass", &l3IsIso, &b_l3IsIso); - fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); - fChain->SetBranchAddress("m2ZZIsoPass", &l4IsIso, &b_l4IsIso); + fChain->SetBranchAddress("e2ZZIso", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m1ZZIso", &l3IsIso, &b_l3IsIso); + if (year_ == yr2016 || year_ == yr2017){ + fChain->SetBranchAddress("m1PASTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m2PASTightIDNoVtx", &l4IsTight, &b_l4IsTight);} + else{ + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); + } + fChain->SetBranchAddress("m2ZZIso", &l4IsIso, &b_l4IsIso); fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); fChain->SetBranchAddress("m1_m2_Mass", &Z2mass, &b_Z2mass); fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); @@ -186,14 +191,19 @@ void ZZSelectorBase::SetBranchesUWVV() { //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); //fChain->SetBranchAddress("e1IsFall17isoV2wpHZZ", &l1IsTight, &b_l1IsTight); fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); - fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("e1ZZIso", &l1IsIso, &b_l1IsIso); //fChain->SetBranchAddress("e2IsFall17isoV2wpHZZ", &l2IsTight, &b_l2IsTight); fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); - fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); - fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); - fChain->SetBranchAddress("m1ZZIsoPass", &l3IsIso, &b_l3IsIso); - fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); - fChain->SetBranchAddress("m2ZZIsoPass", &l4IsIso, &b_l4IsIso); + fChain->SetBranchAddress("e2ZZIso", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m1ZZIso", &l3IsIso, &b_l3IsIso); + if (year_ == yr2016 || year_ == yr2017){ + fChain->SetBranchAddress("m1PASTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m2PASTightIDNoVtx", &l4IsTight, &b_l4IsTight);} + else{ + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); + } + fChain->SetBranchAddress("m2ZZIso", &l4IsIso, &b_l4IsIso); fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); fChain->SetBranchAddress("m1_m2_Mass", &Z2mass, &b_Z2mass); fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); @@ -236,15 +246,22 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); fChain->SetBranchAddress("evt", &evt, &b_evt); - //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); - fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); - fChain->SetBranchAddress("m1ZZIsoPass", &l1IsIso, &b_l1IsIso); - fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); - fChain->SetBranchAddress("m2ZZIsoPass", &l2IsIso, &b_l2IsIso); - fChain->SetBranchAddress("m3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); - fChain->SetBranchAddress("m3ZZIsoPass", &l3IsIso, &b_l3IsIso); - fChain->SetBranchAddress("m4ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); - fChain->SetBranchAddress("m4ZZIsoPass", &l4IsIso, &b_l4IsIso); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + if (year_ == yr2016 || year_ == yr2017){ + fChain->SetBranchAddress("m1PASTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m2PASTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("m3PASTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m4PASTightIDNoVtx", &l4IsTight, &b_l4IsTight);} + else{ + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("m3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + fChain->SetBranchAddress("m4ZZTightIDNoVtx", &l4IsTight, &b_l4IsTight); + } + fChain->SetBranchAddress("m1ZZIso", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("m2ZZIso", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m3ZZIso", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("m4ZZIso", &l4IsIso, &b_l4IsIso); fChain->SetBranchAddress("m1_m2_Mass", &Z1mass, &b_Z1mass); fChain->SetBranchAddress("m3_m4_Mass", &Z2mass, &b_Z2mass); //fChain->SetBranchAddress("m1_m3_Mass", &Zamass, &b_Zamass); @@ -287,11 +304,11 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("evt", &evt, &b_evt); //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); - fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("e1ZZIso", &l1IsIso, &b_l1IsIso); fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); - fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("e2ZZIso", &l2IsIso, &b_l2IsIso); fChain->SetBranchAddress("e3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); - fChain->SetBranchAddress("e3ZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("e3ZZIso", &l3IsIso, &b_l3IsIso); fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); @@ -319,11 +336,15 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("evt", &evt, &b_evt); //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); fChain->SetBranchAddress("e1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); - fChain->SetBranchAddress("e1ZZIsoPass", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("e1ZZIso", &l1IsIso, &b_l1IsIso); fChain->SetBranchAddress("e2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); - fChain->SetBranchAddress("e2ZZIsoPass", &l2IsIso, &b_l2IsIso); - fChain->SetBranchAddress("mZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); - fChain->SetBranchAddress("mZZIsoPass", &l3IsIso, &b_l3IsIso); + fChain->SetBranchAddress("e2ZZIso", &l2IsIso, &b_l2IsIso); + if (year_ == yr2016 || year_ == yr2017){ + fChain->SetBranchAddress("mPASTightIDNoVtx", &l3IsTight, &b_l3IsTight);} + else{ + fChain->SetBranchAddress("mZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + } + fChain->SetBranchAddress("mZZIso", &l3IsIso, &b_l3IsIso); fChain->SetBranchAddress("e1_e2_Mass", &Z1mass, &b_Z1mass); fChain->SetBranchAddress("e1_e2_Pt", &Z1pt, &b_Z1pt); fChain->SetBranchAddress("e1_e2_Phi", &Z1Phi, &b_Z1Phi); @@ -352,11 +373,16 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("evt", &evt, &b_evt); //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); fChain->SetBranchAddress("eZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); - fChain->SetBranchAddress("eZZIsoPass", &l3IsIso, &b_l3IsIso); - fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); - fChain->SetBranchAddress("m1ZZIsoPass", &l1IsIso, &b_l1IsIso); - fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); - fChain->SetBranchAddress("m2ZZIsoPass", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("eZZIso", &l3IsIso, &b_l3IsIso); + if (year_ == yr2016 || year_ == yr2017){ + fChain->SetBranchAddress("m1PASTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m2PASTightIDNoVtx", &l2IsTight, &b_l2IsTight);} + else{ + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + } + fChain->SetBranchAddress("m1ZZIso", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("m2ZZIso", &l2IsIso, &b_l2IsIso); fChain->SetBranchAddress("m1_m2_Mass", &Z1mass, &b_Z1mass); fChain->SetBranchAddress("m1_m2_Pt", &Z1pt, &b_Z1pt); fChain->SetBranchAddress("m1_m2_Phi", &Z1Phi, &b_Z1Phi); @@ -382,13 +408,19 @@ void ZZSelectorBase::SetBranchesUWVV() { fChain->SetBranchAddress("run", &run, &b_run); fChain->SetBranchAddress("lumi", &lumi, &b_lumi); fChain->SetBranchAddress("evt", &evt, &b_evt); - //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); - fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); - fChain->SetBranchAddress("m1ZZIsoPass", &l1IsIso, &b_l1IsIso); - fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); - fChain->SetBranchAddress("m2ZZIsoPass", &l2IsIso, &b_l2IsIso); - fChain->SetBranchAddress("m3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); - fChain->SetBranchAddress("m3ZZIsoPass", &l3IsIso, &b_l3IsIso); + //fChain->SetBranchAddress("duplicated", &duplicated, &b_duplicated); + if (year_ == yr2016 || year_ == yr2017){ + fChain->SetBranchAddress("m1PASTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m2PASTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("m3PASTightIDNoVtx", &l3IsTight, &b_l3IsTight);} + else{ + fChain->SetBranchAddress("m1ZZTightIDNoVtx", &l1IsTight, &b_l1IsTight); + fChain->SetBranchAddress("m2ZZTightIDNoVtx", &l2IsTight, &b_l2IsTight); + fChain->SetBranchAddress("m3ZZTightIDNoVtx", &l3IsTight, &b_l3IsTight); + } + fChain->SetBranchAddress("m1ZZIso", &l1IsIso, &b_l1IsIso); + fChain->SetBranchAddress("m2ZZIso", &l2IsIso, &b_l2IsIso); + fChain->SetBranchAddress("m3ZZIso", &l3IsIso, &b_l3IsIso); fChain->SetBranchAddress("m1_m2_Mass", &Z1mass, &b_Z1mass); fChain->SetBranchAddress("m1_m2_Pt", &Z1pt, &b_Z1pt); fChain->SetBranchAddress("m1_m2_Phi", &Z1Phi, &b_Z1Phi); @@ -530,14 +562,61 @@ bool ZZSelectorBase::e1e2IsZ1(Long64_t entry){ else return false; } +//Check Isolation for muons +bool ZZSelectorBase::lep1IsIso(){ + if(abs(l1PdgId)==13){ + if(l1IsIso < 0.35) + return true; + else + return false; + } + else + return true; +} +bool ZZSelectorBase::lep2IsIso(){ + if(abs(l2PdgId)==13){ + if(l2IsIso < 0.35) + return true; + else + return false; + } + else + return true; +} +bool ZZSelectorBase::lep3IsIso(){ + if(abs(l3PdgId)==13){ + if(l3IsIso < 0.35) + return true; + else + return false; + } + else + return true; +} +bool ZZSelectorBase::lep4IsIso(){ + if(abs(l4PdgId)==13){ + if(l4IsIso < 0.35) + return true; + else + return false; + } + else + return true; +} // Meant to be a wrapper for the tight ID just in case it changes // To be a function of multiple variables bool ZZSelectorBase::lep1IsTight() { - return (l1IsTight && l1IsIso); + if (year_ == yr2016 || year_ == yr2017){ + return (l1IsTight && lep1IsIso());} + else + return (l1IsTight); } bool ZZSelectorBase::lep2IsTight() { - return (l2IsTight && l2IsIso); + if (year_ == yr2016 || year_ == yr2017){ + return (l2IsTight && lep2IsIso());} + else + return (l2IsTight); } bool ZZSelectorBase::tightSIP() { if ((l1SIP3D < 4.0 && l2SIP3D < 4.0 && l3SIP3D < 4.0)) @@ -549,10 +628,16 @@ bool ZZSelectorBase::tightZ1Leptons() { return lep1IsTight() && lep2IsTight(); } bool ZZSelectorBase::lep3IsTight() { - return (l3IsTight && l3IsIso); + if (year_ == yr2016 || year_ == yr2017){ + return (l3IsTight && lep3IsIso());} + else + return (l3IsTight); } bool ZZSelectorBase::lep4IsTight() { - return (l4IsTight && l4IsIso); + if (year_ == yr2016 || year_ == yr2017){ + return (l4IsTight && lep4IsIso());} + else + return (l4IsTight); } bool ZZSelectorBase::tightZ2Leptons() { return lep3IsTight() && lep4IsTight(); From b4e3c39230b1eabe5f2b246e9b0fb6ed8702a722 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Fri, 1 Nov 2019 14:25:02 -0400 Subject: [PATCH 51/53] what changes in combine templates --- .../ZZSelection/ZZ_template2016_eeee.txt | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt index b85fd170..a85bed1c 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eeee.txt @@ -23,27 +23,23 @@ observation ${data} # on each process and bin bin eeee eeee eeee eeee eeee eeee -process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 -rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ------------------------------------------------------------------------------------------------------------------------------------ -bkg_eeee_16 lnN - - - - - 1.2 -bkg_ee_16 lnN - - - - - 1.2 -trigger_eeee_16 lnN 1.01 1.01 1.01 1.01 1.01 - -trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 -lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 -QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 0 1 0 -pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 -pdf_VVV shape 0 0 0 0 1 0 - +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process 4 3 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +---------------------------------------------------------------------------------------------------------------------------------- +bkg_eeee_16 lnN - - - - - 1.2 +bkg_ee_16 lnN - - - - - 1.2 +trigger_eeee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 From f70f973a02719bc34d6ec197268e56a3da8423f4 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Fri, 1 Nov 2019 14:27:57 -0400 Subject: [PATCH 52/53] All the template changes --- .../ZZSelection/ZZ_template2016_all.txt | 12 ++--- .../ZZSelection/ZZ_template2016_eemm.txt | 22 ++++---- .../ZZSelection/ZZ_template2016_mmee.txt | 44 ++++++++-------- .../ZZSelection/ZZ_template2016_mmmm.txt | 26 ++++------ .../ZZSelection/ZZ_template2017_all.txt | 10 ++-- .../ZZSelection/ZZ_template2017_eeee.txt | 9 ++-- .../ZZSelection/ZZ_template2017_eemm.txt | 10 ++-- .../ZZSelection/ZZ_template2017_mmee.txt | 9 ++-- .../ZZSelection/ZZ_template2017_mmmm.txt | 11 ++-- .../ZZSelection/ZZ_template2018_all.txt | 10 ++-- .../ZZSelection/ZZ_template2018_eeee.txt | 9 ++-- .../ZZSelection/ZZ_template2018_eemm.txt | 10 ++-- .../ZZSelection/ZZ_template2018_mmee.txt | 9 ++-- .../ZZSelection/ZZ_template2018_mmmm.txt | 9 ++-- .../templateWSherpa/ZZ_template2016_all.txt | 47 +++++++++++++++++ .../templateWSherpa/ZZ_template2016_eeee.txt | 50 ++++++++++++++++++ .../templateWSherpa/ZZ_template2016_eemm.txt | 51 +++++++++++++++++++ .../templateWSherpa/ZZ_template2016_mmee.txt | 51 +++++++++++++++++++ .../templateWSherpa/ZZ_template2016_mmmm.txt | 49 ++++++++++++++++++ .../ZZ_template2016_all.txt | 46 +++++++++++++++++ .../ZZ_template2016_eeee.txt | 49 ++++++++++++++++++ .../ZZ_template2016_eemm.txt | 50 ++++++++++++++++++ .../ZZ_template2016_mmee.txt | 50 ++++++++++++++++++ .../ZZ_template2016_mmmm.txt | 48 +++++++++++++++++ .../ZZ_template2017_all.txt | 46 +++++++++++++++++ .../ZZ_template2017_eeee.txt | 48 +++++++++++++++++ .../ZZ_template2017_eemm.txt | 50 ++++++++++++++++++ .../ZZ_template2017_mmee.txt | 49 ++++++++++++++++++ .../ZZ_template2017_mmmm.txt | 47 +++++++++++++++++ .../ZZ_template2018_all.txt | 46 +++++++++++++++++ .../ZZ_template2018_eeee.txt | 48 +++++++++++++++++ .../ZZ_template2018_eemm.txt | 50 ++++++++++++++++++ .../ZZ_template2018_mmee.txt | 49 ++++++++++++++++++ .../ZZ_template2018_mmmm.txt | 47 +++++++++++++++++ 34 files changed, 1046 insertions(+), 125 deletions(-) create mode 100644 Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_all.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_eeee.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_eemm.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_mmee.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_mmmm.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_all.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_eeee.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_eemm.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_mmee.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_mmmm.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_all.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_eeee.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_eemm.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_mmee.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_mmmm.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_all.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_eeee.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_eemm.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_mmee.txt create mode 100644 Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_mmmm.txt diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt index 8a597899..f1d8d737 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_all.txt @@ -23,9 +23,9 @@ observation ${data} # on each process and bin bin all all all all all all -process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 -rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process 4 3 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------------------------------------- bkgStat lnN - - - - - 1.4 trigger lnN 1.020 1.020 1.020 1.020 1.020 - @@ -34,13 +34,9 @@ CMS_RecoEff_e shape 1 1 1 CMS_eff_m shape 1 1 1 1 1 0 CMS_pileup shape 1 1 1 1 1 0 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 - +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt index 56a78ada..c048a41d 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_eemm.txt @@ -24,7 +24,7 @@ observation ${data} bin eemm eemm eemm eemm eemm eemm process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ------------------------------------------------------------------------------------------------------------------------------ bkg_mm_16 lnN - - - - - 1.1 @@ -34,17 +34,13 @@ trigger_mm_16 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 -lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 -QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 0 1 0 -pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 -pdf_VVV shape 0 0 0 0 1 0 - +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt index c61e6f0b..979100b1 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmee.txt @@ -22,29 +22,25 @@ observation ${data} # then we list the independent sources of uncertainties, and give their effect (syst. error) # on each process and bin -bin mmee mmee mmee mmee mmee mmee -process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 -rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} -------------------------------------------------------------------------------------------- ------------------------------- -bkg_mm_16 lnN - - - - - 1.1 -bkg_ee_16 lnN - - - - - 1.1 -trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - -trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - -CMS_eff_e shape 1 1 1 1 1 0 -CMS_RecoEff_e shape 1 1 1 1 1 0 -CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 -lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 -QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 0 1 0 -pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 -pdf_VVV shape 0 0 0 0 1 0 - +bin mmee mmee mmee mmee mmee mmee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process 4 3 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------- ------------------------------- +bkg_mm_16 lnN - - - - - 1.1 +bkg_ee_16 lnN - - - - - 1.1 +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt index bb65d8dd..8d6b9f08 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2016_mmmm.txt @@ -24,7 +24,7 @@ observation ${data} bin mmmm mmmm mmmm mmmm mmmm mmmm process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------------------------------------------- bkg_mmmm_16 lnN - - - - - 1.2 @@ -32,17 +32,13 @@ bkg_mm_16 lnN - - - trigger_mmmm_16 lnN 1.01 1.01 1.01 1.01 1.01 - trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 -CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 -lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 -QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 -QCDscale_VVV shape 0 0 0 0 1 0 -pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 -pdf_VVV shape 0 0 0 0 1 0 - - -* autoMCStats 1 +CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt index b27a5fb6..f4affd74 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_all.txt @@ -24,7 +24,7 @@ observation ${data} bin all all all all all all process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ---------------------------------------------------------------------------------------------------------------------- bkgStat lnN - - - - - 1.4 @@ -32,15 +32,11 @@ trigger lnN 1.020 1.020 1.020 CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 - +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt index 41287956..a1be4cf1 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eeee.txt @@ -24,7 +24,7 @@ observation ${data} bin eeee eeee eeee eeee eeee eeee process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ------------------------------------------------------------------------------------------------------------------------------ bkg_eeee_17 lnN - - - - - 1.2 @@ -33,16 +33,13 @@ trigger_eeee_17 lnN 1.01 1.01 1.01 trigger_ee_17 lnN 1.01 1.01 1.01 1.01 1.01 - CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt index 9019f1db..14ddbb4e 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_eemm.txt @@ -24,7 +24,7 @@ observation ${data} bin eemm eemm eemm eemm eemm eemm process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ------------------------------------------------------------------------------------------------------------------------------- bkg_mm_17 lnN - - - - - 1.1 @@ -34,17 +34,13 @@ trigger_mm_17 lnN 1.01 1.01 1.0 CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 - +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt index aed705d5..6abe06f0 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmee.txt @@ -24,7 +24,7 @@ observation ${data} bin mmee mmee mmee mmee mmee mmee process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ------------------------------------------------------------------------------------------------------------------------------ bkg_mm_17 lnN - - - - - 1.1 @@ -34,16 +34,13 @@ trigger_mm_17 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt index a18e504e..c318db14 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2017_mmmm.txt @@ -24,24 +24,21 @@ observation ${data} bin mmmm mmmm mmmm mmmm mmmm mmmm process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 -rate {zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +process 4 3 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ------------------------------------------------------------------------------------------------------------------------------ bkg_mmmm_17 lnN - - - - - 1.2 bkg_mm_17 lnN - - - - - 1.2 trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 1.01 - trigger_mm_17 lnN 1.01 1.01 1.01 1.01 1.01 - CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt index 056b8827..753e9d54 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_all.txt @@ -24,7 +24,7 @@ observation ${data} bin all all all all all all process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ---------------------------------------------------------------------------------------------------------------------- bkgStat lnN - - - - - 1.4 @@ -32,15 +32,11 @@ trigger lnN 1.020 1.020 1.020 CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 - +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt index 7860cc85..13f96af8 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eeee.txt @@ -24,7 +24,7 @@ observation ${data} bin eeee eeee eeee eeee eeee eeee process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} -------------------------------------------------------------------------------------------------------------------------------- bkg_eeee_18 lnN - - - - - 1.2 @@ -33,16 +33,13 @@ trigger_eeee_18 lnN 1.01 1.01 1.01 trigger_ee_18 lnN 1.01 1.01 1.01 1.01 1.01 - CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt index 965fe6a2..0837d7f8 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_eemm.txt @@ -24,7 +24,7 @@ observation ${data} bin eemm eemm eemm eemm eemm eemm process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} ------------------------------------------------------------------------------------------------------------------------------- bkg_mm_18 lnN - - - - - 1.1 @@ -34,17 +34,13 @@ trigger_mm_18 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 - +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt index 6de75044..e8bddb0f 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmee.txt @@ -24,7 +24,7 @@ observation ${data} bin mmee mmee mmee mmee mmee mmee process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} --------------------------------------------------------------------------------------------- ------------------------------- bkg_mm_18 lnN - - - - - 1.1 @@ -34,16 +34,13 @@ trigger_mm_18 lnN 1.01 1.01 1.01 CMS_eff_e shape 1 1 1 1 1 0 CMS_RecoEff_e shape 1 1 1 1 1 0 CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt index 70ab5401..e5aadc57 100644 --- a/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt +++ b/Templates/CombineCards/ZZSelection/ZZ_template2018_mmmm.txt @@ -24,7 +24,7 @@ observation ${data} bin mmmm mmmm mmmm mmmm mmmm mmmm process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt -process -3 -2 -1 0 1 2 +process 4 3 -1 0 1 2 rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} -------------------------------------------------------------------------------------------------------------------------------- bkg_mmmm_18 lnN - - - - - 1.2 @@ -32,16 +32,13 @@ bkg_mm_18 lnN - - - trigger_mmmm_18 lnN 1.01 1.01 1.01 1.01 1.01 - trigger_mm_18 lnN 1.01 1.01 1.01 1.01 1.01 - CMS_eff_m shape 1 1 1 1 1 0 -#CMS_pileup shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 QCDscale_HZZ_signal shape 0 1 0 0 0 0 -QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 -QCDscale_ggZZ lnN 0 0 0 1.2 0 0 QCDscale_VVV shape 0 0 0 0 1 0 pdf_HZZ_signal shape 0 1 0 0 0 0 -pdf_qqZZ_powheg shape 0 0 1 0 0 0 -pdf_ggZZ lnN 0 0 0 1.05 0 0 pdf_VVV shape 0 0 0 0 1 0 +theoAcc lnN - - 1.02 1.02 - - * autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_all.txt b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_all.txt new file mode 100644 index 00000000..28067e04 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_all.txt @@ -0,0 +1,47 @@ +imax 1 number of channels +jmax 6 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes qqZZ_sherpa * ${output_file} qqZZ_sherpa/${fit_variable}_$$CHANNEL qqZZ_sherpa/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin all +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin all all all all all all all +process qqZZ_sherpa zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process 3 -3 -2 -1 0 1 2 +rate ${qqZZ_sherpa} ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +----------------------------------------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 1 0 +QCDscale_HZZ_signal shape 0 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_eeee.txt b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_eeee.txt new file mode 100644 index 00000000..6c11b75b --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_eeee.txt @@ -0,0 +1,50 @@ +imax 1 number of channels +jmax 6 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes qqZZ_sherpa * ${output_file} qqZZ_sherpa/${fit_variable}_$$CHANNEL qqZZ_sherpa/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eeee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin eeee eeee eeee eeee eeee eeee eeee +process qqZZ_sherpa zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process 3 -3 -2 -1 0 1 2 +rate ${qqZZ_sherpa} ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------------------------- +bkg_eeee_16 lnN - - - - - - 1.2 +bkg_ee_16 lnN - - - - - - 1.2 +trigger_eeee_16 lnN 1.01 1.01 1.01 1.01 1.01 1.01 - +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_eemm.txt b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_eemm.txt new file mode 100644 index 00000000..632bbbc1 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_eemm.txt @@ -0,0 +1,51 @@ +imax 1 number of channels +jmax 6 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes qqZZ_sherpa * ${output_file} qqZZ_sherpa/${fit_variable}_$$CHANNEL qqZZ_sherpa/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eemm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin eemm eemm eemm eemm eemm eemm eemm +process qqZZ_sherpa zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process 3 -3 -2 -1 0 1 2 +rate ${qqZZ_sherpa} ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------------------------------------- +bkg_mm_16 lnN - - - - - - 1.1 +bkg_ee_16 lnN - - - - - - 1.1 +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_mmee.txt b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_mmee.txt new file mode 100644 index 00000000..8e6101e3 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_mmee.txt @@ -0,0 +1,51 @@ +imax 1 number of channels +jmax 6 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes qqZZ_sherpa * ${output_file} qqZZ_sherpa/${fit_variable}_$$CHANNEL qqZZ_sherpa/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin mmee mmee mmee mmee mmee mmee mmee +process qqZZ_sherpa zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process 3 -3 -2 -1 0 1 2 +rate ${qqZZ_sherpa} ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +----------------------------------------------------------------------------------------------------------- ------------------------------- +bkg_mm_16 lnN - - - - - - 1.1 +bkg_ee_16 lnN - - - - - - 1.1 +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_mmmm.txt b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_mmmm.txt new file mode 100644 index 00000000..a5546dc8 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWSherpa/ZZ_template2016_mmmm.txt @@ -0,0 +1,49 @@ +imax 1 number of channels +jmax 6 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes qqZZ_sherpa * ${output_file} qqZZ_sherpa/${fit_variable}_$$CHANNEL qqZZ_sherpa/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmmm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin mmmm mmmm mmmm mmmm mmmm mmmm mmmm +process qqZZ_sherpa zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process 3 -3 -2 -1 0 1 2 +rate ${qqZZ_sherpa} ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------------------------- +bkg_mmmm_16 lnN - - - - - - 1.2 +bkg_mm_16 lnN - - - - - - 1.2 +trigger_mmmm_16 lnN 1.01 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_all.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_all.txt new file mode 100644 index 00000000..3467b98c --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_all.txt @@ -0,0 +1,46 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin all +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin all all all all all all +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +CMS_pileup shape 1 1 1 1 1 0 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_eeee.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_eeee.txt new file mode 100644 index 00000000..d9de9a03 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_eeee.txt @@ -0,0 +1,49 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eeee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin eeee eeee eeee eeee eeee eeee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +---------------------------------------------------------------------------------------------------------------------------------- +bkg_eeee_16 lnN - - - - - 1.2 +bkg_ee_16 lnN - - - - - 1.2 +trigger_eeee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_eemm.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_eemm.txt new file mode 100644 index 00000000..31dfd8ba --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_eemm.txt @@ -0,0 +1,50 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eemm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin eemm eemm eemm eemm eemm eemm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------ +bkg_mm_16 lnN - - - - - 1.1 +bkg_ee_16 lnN - - - - - 1.1 +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_mmee.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_mmee.txt new file mode 100644 index 00000000..50bc537f --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_mmee.txt @@ -0,0 +1,50 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin mmee mmee mmee mmee mmee mmee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------- ------------------------------- +bkg_mm_16 lnN - - - - - 1.1 +bkg_ee_16 lnN - - - - - 1.1 +trigger_ee_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_mmmm.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_mmmm.txt new file mode 100644 index 00000000..e6bbf877 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2016_mmmm.txt @@ -0,0 +1,48 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmmm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin mmmm mmmm mmmm mmmm mmmm mmmm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------------------------------------------- +bkg_mmmm_16 lnN - - - - - 1.2 +bkg_mm_16 lnN - - - - - 1.2 +trigger_mmmm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_16 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_16 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_all.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_all.txt new file mode 100644 index 00000000..b27a5fb6 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_all.txt @@ -0,0 +1,46 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin all +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin all all all all all all +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +---------------------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_eeee.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_eeee.txt new file mode 100644 index 00000000..41287956 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_eeee.txt @@ -0,0 +1,48 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eeee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin eeee eeee eeee eeee eeee eeee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------ +bkg_eeee_17 lnN - - - - - 1.2 +bkg_ee_17 lnN - - - - - 1.2 +trigger_eeee_17 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_eemm.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_eemm.txt new file mode 100644 index 00000000..9019f1db --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_eemm.txt @@ -0,0 +1,50 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eemm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin eemm eemm eemm eemm eemm eemm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------- +bkg_mm_17 lnN - - - - - 1.1 +bkg_ee_17 lnN - - - - - 1.1 +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_mmee.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_mmee.txt new file mode 100644 index 00000000..aed705d5 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_mmee.txt @@ -0,0 +1,49 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin mmee mmee mmee mmee mmee mmee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------ +bkg_mm_17 lnN - - - - - 1.1 +bkg_ee_17 lnN - - - - - 1.1 +trigger_ee_17 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_mmmm.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_mmmm.txt new file mode 100644 index 00000000..e2ae7125 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2017_mmmm.txt @@ -0,0 +1,47 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmmm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin mmmm mmmm mmmm mmmm mmmm mmmm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------ +bkg_mmmm_17 lnN - - - - - 1.2 +bkg_mm_17 lnN - - - - - 1.2 +trigger_mmmm_17 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_17 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_17 lnN 1.021 1.021 1.021 1.021 1.021 1.021 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_all.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_all.txt new file mode 100644 index 00000000..056b8827 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_all.txt @@ -0,0 +1,46 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable} HZZ_signal/${fit_variable}_$$SYSTEMATIC +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable} qqZZ_powheg/${fit_variable}_$$SYSTEMATIC +shapes ggZZ * ${output_file} ggZZ/${fit_variable} ggZZ/${fit_variable}_$$SYSTEMATIC +shapes VVV * ${output_file} VVV/${fit_variable} VVV/${fit_variable}_$$SYSTEMATIC + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC +shapes data_obs * ${output_file} data/${fit_variable} + +bin all +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin all all all all all all +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +---------------------------------------------------------------------------------------------------------------------- +bkgStat lnN - - - - - 1.4 +trigger lnN 1.020 1.020 1.020 1.020 1.020 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_eeee.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_eeee.txt new file mode 100644 index 00000000..7860cc85 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_eeee.txt @@ -0,0 +1,48 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eeee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin eeee eeee eeee eeee eeee eeee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------------------------------- +bkg_eeee_18 lnN - - - - - 1.2 +bkg_ee_18 lnN - - - - - 1.2 +trigger_eeee_18 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_eemm.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_eemm.txt new file mode 100644 index 00000000..965fe6a2 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_eemm.txt @@ -0,0 +1,50 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin eemm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin eemm eemm eemm eemm eemm eemm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +------------------------------------------------------------------------------------------------------------------------------- +bkg_mm_18 lnN - - - - - 1.1 +bkg_ee_18 lnN - - - - - 1.1 +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_mmee.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_mmee.txt new file mode 100644 index 00000000..6de75044 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_mmee.txt @@ -0,0 +1,49 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmee +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin mmee mmee mmee mmee mmee mmee +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +--------------------------------------------------------------------------------------------- ------------------------------- +bkg_mm_18 lnN - - - - - 1.1 +bkg_ee_18 lnN - - - - - 1.1 +trigger_ee_18 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_e shape 1 1 1 1 1 0 +CMS_RecoEff_e shape 1 1 1 1 1 0 +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + +* autoMCStats 1 diff --git a/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_mmmm.txt b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_mmmm.txt new file mode 100644 index 00000000..70ab5401 --- /dev/null +++ b/Templates/CombineCards/ZZSelection/templateWithTheory/ZZ_template2018_mmmm.txt @@ -0,0 +1,47 @@ +imax 1 number of channels +jmax 5 number of backgrounds plus signals minus 1 +kmax ${nuisances} number of nuisance parameters (sources of systematical uncertainties) +------------ + +shapes zzjj4l_ewk * ${output_file} zzjj4l_ewk/${fit_variable}_$$CHANNEL zzjj4l_ewk/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes HZZ_signal * ${output_file} HZZ_signal/${fit_variable}_$$CHANNEL HZZ_signal/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes qqZZ_powheg * ${output_file} qqZZ_powheg/${fit_variable}_$$CHANNEL qqZZ_powheg/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes ggZZ * ${output_file} ggZZ/${fit_variable}_$$CHANNEL ggZZ/${fit_variable}_$$SYSTEMATIC_$$CHANNEL +shapes VVV * ${output_file} VVV/${fit_variable}_$$CHANNEL VVV/${fit_variable}_$$SYSTEMATIC_$$CHANNEL + +shapes nonprompt * ${output_file} nonprompt/${fit_variable}_Fakes_$$CHANNEL nonprompt/${fit_variable}_Fakes_$$SYSTEMATIC_$$CHANNEL +shapes data_obs * ${output_file} data/${fit_variable}_$$CHANNEL + +bin mmmm +observation ${data} + +------------ +#nonprompt is data-driven Z+X background +# now we list the expected events for signal and all backgrounds in that bin +# the second 'process' line must have a positive number for backgrounds, and 0 for signal +# then we list the independent sources of uncertainties, and give their effect (syst. error) +# on each process and bin + +bin mmmm mmmm mmmm mmmm mmmm mmmm +process zzjj4l_ewk HZZ_signal qqZZ_powheg ggZZ VVV nonprompt +process -3 -2 -1 0 1 2 +rate ${zzjj4l_ewk} ${HZZ_signal} ${qqZZ_powheg} ${ggZZ} ${VVV} ${nonprompt} +-------------------------------------------------------------------------------------------------------------------------------- +bkg_mmmm_18 lnN - - - - - 1.2 +bkg_mm_18 lnN - - - - - 1.2 +trigger_mmmm_18 lnN 1.01 1.01 1.01 1.01 1.01 - +trigger_mm_18 lnN 1.01 1.01 1.01 1.01 1.01 - +CMS_eff_m shape 1 1 1 1 1 0 +#CMS_pileup shape 1 1 1 1 1 0 +CMS_lumi lnN 1.01 1.01 1.01 1.01 1.01 1.01 +lumi_18 lnN 1.023 1.023 1.023 1.023 1.023 1.023 +QCDscale_HZZ_signal shape 0 1 0 0 0 0 +QCDscale_qqZZ_powheg shape 0 0 1 0 0 0 +QCDscale_ggZZ lnN 0 0 0 1.2 0 0 +QCDscale_VVV shape 0 0 0 0 1 0 +pdf_HZZ_signal shape 0 1 0 0 0 0 +pdf_qqZZ_powheg shape 0 0 1 0 0 0 +pdf_ggZZ lnN 0 0 0 1.05 0 0 +pdf_VVV shape 0 0 0 0 1 0 + +* autoMCStats 1 From 014ae9e1eb9fe08d8dc0b54db31256da7571e7f1 Mon Sep 17 00:00:00 2001 From: Usama Hussain Date: Fri, 1 Nov 2019 14:35:15 -0400 Subject: [PATCH 53/53] Making temp branch which is most up-to-date selector branch as master --- runTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runTest.sh b/runTest.sh index 5f264810..42ae12d4 100755 --- a/runTest.sh +++ b/runTest.sh @@ -1 +1 @@ -./Utilities/scripts/makeHistFile.py -a ZZ4l2018 -s SignalSync --output_file testSignal2018.root --test --uwvv -c eeee,eemm,mmee,mmmm -f 2018SignalSync +./Utilities/scripts/makeHistFile.py -a ZZ4l2017 -s LooseLeptons --output_file testSignal2017 --test --uwvv -c eeee,eemm,mmee,mmmm -f zz4l-powheg --with_Gen -sf data/scaleFactorsZZ4l2017.root
+
+ [log] - + [verbose log] - + [pdf] +