From 3e7ffd8054040f58def9c1f53791f93e1ddf1c9c Mon Sep 17 00:00:00 2001 From: yuji Date: Fri, 2 Feb 2024 20:11:06 +0100 Subject: [PATCH 01/32] Run3 style --- ExampleInputFileList.txt | 2 +- H4LCppModule.py | 177 ++++++++++++++++-- interface/GenAnalysis.h | 113 ++++++++++++ interface/H4LTools.h | 45 +++-- keep_and_drop.txt | 4 + post_proc.py | 14 +- src/GenAnalysis.cc | 376 +++++++++++++++++++++++++++++++++++++++ src/H4LTools.cc | 164 +++++++++++++++-- 8 files changed, 847 insertions(+), 48 deletions(-) create mode 100644 interface/GenAnalysis.h create mode 100644 src/GenAnalysis.cc diff --git a/ExampleInputFileList.txt b/ExampleInputFileList.txt index 2620325..76b806e 100644 --- a/ExampleInputFileList.txt +++ b/ExampleInputFileList.txt @@ -1 +1 @@ -/store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/a2a64a49-3404-49db-bf42-cb0ceb5218e2.root \ No newline at end of file diff --git a/H4LCppModule.py b/H4LCppModule.py index b8f3a58..8337fa3 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -14,8 +14,19 @@ def __init__(self,year,cfgFile,isMC,isFSR): ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libjhugenmela.so" % base) ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libmcfm_707.so" % base) ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libcollier.so" % base) + if "/GenAnalysis_cc.so" not in ROOT.gSystem.GetLibraries(): + print("Load GenAnalysis C++ module") + base = "$CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim" + if base: + ROOT.gROOT.ProcessLine( + ".L %s/src/GenAnalysis.cc+O" % base) + else: + base = "$CMSSW_BASE//src/PhysicsTools/NanoAODTools" + ROOT.gSystem.Load("libPhysicsToolsNanoAODTools.so") + ROOT.gROOT.ProcessLine( + ".L %s/interface/GenAnalysis.h" % base) if "/H4LTools_cc.so" not in ROOT.gSystem.GetLibraries(): - print("Load C++ module") + print("Load H4LTools C++ module") base = "$CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim" if base: ROOT.gROOT.ProcessLine( @@ -26,9 +37,11 @@ def __init__(self,year,cfgFile,isMC,isFSR): ROOT.gROOT.ProcessLine( ".L %s/interface/H4LTools.h" % base) self.year = year + self.isMC = isMC + self.genworker = ROOT.GenAnalysis() with open(cfgFile, 'r') as ymlfile: cfg = yaml.load(ymlfile) - self.worker = ROOT.H4LTools(self.year) + self.worker = ROOT.H4LTools(self.year,self.isMC) self.worker.InitializeElecut(cfg['Electron']['pTcut'],cfg['Electron']['Etacut'],cfg['Electron']['Sip3dcut'],cfg['Electron']['Loosedxycut'],cfg['Electron']['Loosedzcut'], cfg['Electron']['Isocut'],cfg['Electron']['BDTWP']['LowEta']['LowPT'],cfg['Electron']['BDTWP']['MedEta']['LowPT'],cfg['Electron']['BDTWP']['HighEta']['LowPT'], cfg['Electron']['BDTWP']['LowEta']['HighPT'],cfg['Electron']['BDTWP']['MedEta']['HighPT'],cfg['Electron']['BDTWP']['HighEta']['HighPT']) @@ -41,7 +54,6 @@ def __init__(self,year,cfgFile,isMC,isFSR): self.passtrigEvts = 0 self.passZZEvts = 0 self.cfgFile = cfgFile - self.isMC = isMC self.worker.isFSR = isFSR pass def beginJob(self): @@ -74,7 +86,16 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): self.initReaders(inputTree) # initReaders must be called in beginFile self.out = wrappedOutputTree self.out.branch("mass4l", "F") + self.out.branch("GENmass4l", "F") + self.out.branch("mass4e", "F") + self.out.branch("mass4mu", "F") + self.out.branch("mass2e2mu", "F") self.out.branch("pT4l", "F") + self.out.branch("GENpT4l", "F") + self.out.branch("rapidity4l", "F") + self.out.branch("njets_pt30_eta4p7", "I") + self.out.branch("GENnjets_pt30_eta4p7", "I") + self.out.branch("GENrapidity4l", "F") self.out.branch("eta4l", "F") self.out.branch("phi4l", "F") self.out.branch("massZ1", "F") @@ -112,12 +133,30 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): self.out.branch("pTj1", "F") self.out.branch("etaj1", "F") self.out.branch("phij1", "F") - self.out.branch("mj2", "F") self.out.branch("pTj2", "F") self.out.branch("etaj2", "F") self.out.branch("phij2", "F") - - + self.out.branch("mj2", "F") + self.out.branch("pileupWeight", "F") + self.out.branch("dataMCWeight_new", "F") + self.out.branch("prefiringWeight", "F") + self.out.branch("passedTrig", "O") + self.out.branch("passedFullSelection", "O") + self.out.branch("passedZ4lSelection", "O") + self.out.branch("passedZ4lZ1LSelection", "O") + self.out.branch("passedZ4lZXCRSelection", "O") + self.out.branch("passedZXCRSelection", "O") + self.out.branch("passedFiducialSelection", "O") + GENHlepNum = 4 + GENZNum = 2 + self.out.branch("GENlep_MomId", "I", lenVar = "nGENLeptons") + self.out.branch("GENlep_MomMomId", "I", lenVar = "nGENLeptons") + self.out.branch("GENZ_MomId", "I", lenVar = "nVECZ") + self.out.branch("GENZ_DaughtersId", "I", lenVar = "GENZNum") + self.out.branch("GENlep_Hindex", "I", lenVar = "GENHlepNum") + self.out.branch("lep_Hindex", "I", lenVar = "GENHlepNum") + self.out.branch("GENlep_id", "I", lenVar = "nGENLeptons") + self.out.branch("lep_genindex", "I", lenVar = "Lepointer") self.out.branch("Electron_Fsr_pt", "F", lenVar = "nElectron_Fsr") self.out.branch("Electron_Fsr_eta", "F", lenVar = "nElectron_Fsr") self.out.branch("Electron_Fsr_phi", "F", lenVar = "nElectron_Fsr") @@ -152,6 +191,8 @@ def analyze(self, event): self.worker.SetObjectNum(event.nElectron,event.nMuon,event.nJet,event.nFsrPhoton) if isMC: self.worker.SetObjectNumGen(event.nGenPart) + self.genworker.Initialize() + self.genworker.SetObjectNumGen(event.nGenPart, event.nGenJet) keepIt = False passedTrig=False @@ -164,6 +205,18 @@ def analyze(self, event): passedZXCRSelection=False passedFiducialSelection=False nZXCRFailedLeptons=0 + prefiringWeight = 1 + dataMCWeight_new = 1 + pileupWeight = 1 + mass4e=0 + mass2e2mu=0 + mass4mu=0 + GENmass4l = -99 + GENpT4l = -99 + nVECZ = 2 + GENrapidity4l = -99 + GENnjets_pt30_eta4p7 = -1 + nGENLeptons = 0 passedTrig = PassTrig(event, self.cfgFile) if (passedTrig==True): self.passtrigEvts += 1 @@ -175,26 +228,41 @@ def analyze(self, event): jets = Collection(event, "Jet") if isMC: genparts = Collection(event, "GenPart") + genjets = Collection(event, "GenJet") + for xj in genjets: + self.genworker.SetGenJets(xj.pt,xj.eta,xj.phi,xj.mass) for xg in genparts: self.worker.SetGenParts(xg.pt) + self.genworker.SetGenParts(xg.pt,xg.eta,xg.phi,xg.mass,xg.pdgId,xg.status,xg.statusFlags,xg.genPartIdxMother) for xm in muons: self.worker.SetMuonsGen(xm.genPartIdx) + for xe in electrons: + self.worker.SetElectronsGen(xe.genPartIdx) for xe in electrons: self.worker.SetElectrons(xe.pt, xe.eta, xe.phi, xe.mass, xe.dxy, - xe.dz, xe.sip3d, xe.mvaFall17V2Iso, xe.pdgId, xe.pfRelIso03_all) + xe.dz, xe.sip3d, xe.mvaHZZIso, xe.pdgId, xe.pfRelIso03_all) for xm in muons: self.worker.SetMuons(xm.corrected_pt, xm.eta, xm.phi, xm.mass, xm.isGlobal, xm.isTracker, xm.dxy, xm.dz, xm.sip3d, xm.ptErr, xm.nTrackerLayers, xm.isPFcand, xm.pdgId, xm.charge, xm.pfRelIso03_all) for xf in fsrPhotons: - self.worker.SetFsrPhotons(xf.dROverEt2,xf.eta,xf.phi,xf.pt,xf.relIso03) + self.worker.SetFsrPhotons(xf.dROverEt2,xf.eta,xf.phi,xf.pt,xf.relIso03,xf.electronIdx,xf.muonIdx) for xj in jets: - self.worker.SetJets(xj.pt,xj.eta,xj.phi,xj.mass,xj.jetId, xj.btagCSVV2, xj.puId) - + self.worker.SetJets(xj.pt,xj.eta,xj.phi,xj.mass,xj.jetId, 0.8, 7) + self.worker.BatchFsrRecovery_Run3() + self.worker.LeptonSelection() if ((self.worker.nTightEle<2)&(self.worker.nTightMu<2)): pass - + if isMC: + self.genworker.SetGenVariables() + GENmass4l = self.genworker.GENmass4l + GENpT4l = self.genworker.GENpT4l + GENrapidity4l = self.genworker.GENrapidity4l + GENnjets_pt30_eta4p7 = self.genworker.GENnjets_pt30_eta4p7 + nGENLeptons = self.genworker.nGENLeptons + + passedFiducialSelection = self.genworker.passedFiducialSelection Electron_Fsr_pt_vec = self.worker.ElectronFsrPt() Electron_Fsr_eta_vec = self.worker.ElectronFsrEta() @@ -202,14 +270,14 @@ def analyze(self, event): Muon_Fsr_pt_vec = self.worker.MuonFsrPt() Muon_Fsr_eta_vec = self.worker.MuonFsrEta() Muon_Fsr_phi_vec = self.worker.MuonFsrPhi() - - + Electron_Fsr_pt = [] Electron_Fsr_eta = [] Electron_Fsr_phi = [] Muon_Fsr_pt = [] Muon_Fsr_eta = [] Muon_Fsr_phi = [] + if len(Electron_Fsr_pt_vec)>0: for i in range(len(Electron_Fsr_pt_vec)): Electron_Fsr_pt.append(Electron_Fsr_pt_vec[i]) @@ -220,9 +288,53 @@ def analyze(self, event): Muon_Fsr_pt.append(Muon_Fsr_pt_vec[i]) Muon_Fsr_eta.append(Muon_Fsr_eta_vec[i]) Muon_Fsr_phi.append(Muon_Fsr_phi_vec[i]) - + GENlep_id = [] + GENlep_Hindex = [] + GENZ_DaughtersId = [] + GENZ_MomId = [] + GENlep_MomId = [] + GENlep_MomMomId = [] + if isMC: + GENlep_id_vec = self.genworker.GENlep_id + if len(GENlep_id_vec)>0: + for i in range(len(GENlep_id_vec)): + GENlep_id.append(GENlep_id_vec[i]) + GENlep_Hindex_vec = self.genworker.GENlep_Hindex + if len(GENlep_Hindex_vec)>0: + for i in range(len(GENlep_Hindex_vec)): + GENlep_Hindex.append(GENlep_Hindex_vec[i]) + GENZ_DaughtersId_vec = self.genworker.GENZ_DaughtersId + if len(GENZ_DaughtersId_vec)>0: + for i in range(len(GENZ_DaughtersId_vec)): + GENZ_DaughtersId.append(GENZ_DaughtersId_vec[i]) + nVECZ = self.genworker.nVECZ + GENZ_MomId_vec = self.genworker.GENZ_MomId + if len(GENZ_MomId_vec)>0: + for i in range(len(GENZ_MomId_vec)): + GENZ_MomId.append(GENZ_MomId_vec[i]) + GENlep_MomId_vec = self.genworker.GENlep_MomId + if len(GENlep_MomId_vec)>0: + for i in range(len(GENlep_MomId_vec)): + GENlep_MomId.append(GENlep_MomId_vec[i]) + GENlep_MomMomId_vec = self.genworker.GENlep_MomMomId + if len(GENlep_MomMomId_vec)>0: + for i in range(len(GENlep_MomMomId_vec)): + GENlep_MomMomId.append(GENlep_MomMomId_vec[i]) + + foundZZCandidate = self.worker.ZZSelection() - + Lepointer = self.worker.Lepointer + lep_Hindex = [] + lep_Hindex_vec = self.worker.lep_Hindex + if len(lep_Hindex_vec)>0: + for i in range(len(lep_Hindex_vec)): + lep_Hindex.append(lep_Hindex_vec[i]) + lep_genindex = [] + if isMC: + lep_genindex_vec = self.worker.lep_genindex + if len(lep_genindex_vec)>0: + for i in range(len(lep_genindex_vec)): + lep_genindex.append(lep_genindex_vec[i]) if (foundZZCandidate): keepIt = True self.passZZEvts += 1 @@ -282,13 +394,30 @@ def analyze(self, event): eta4l = self.worker.ZZsystem.Eta() phi4l = self.worker.ZZsystem.Phi() mass4l = self.worker.ZZsystem.M() + rapidity4l = self.worker.ZZsystem.Rapidity() + njets_pt30_eta4p7 = self.worker.njets_pt30_eta4p7 + if self.worker.flag4e: + mass4e = mass4l + if self.worker.flag2e2mu: + mass4e = mass4l + if self.worker.flag4mu: + mass4mu = mass4l if self.worker.isFSR==False: pT4l = self.worker.ZZsystemnofsr.Pt() eta4l = self.worker.ZZsystemnofsr.Eta() phi4l = self.worker.ZZsystemnofsr.Phi() mass4l = self.worker.ZZsystemnofsr.M() self.out.fillBranch("mass4l",mass4l) + self.out.fillBranch("GENmass4l",GENmass4l) + self.out.fillBranch("mass4e",mass4e) + self.out.fillBranch("mass2e2mu",mass2e2mu) + self.out.fillBranch("mass4mu",mass4mu) self.out.fillBranch("pT4l",pT4l) + self.out.fillBranch("GENpT4l",GENpT4l) + self.out.fillBranch("rapidity4l",rapidity4l) + self.out.fillBranch("GENrapidity4l",GENrapidity4l) + self.out.fillBranch("njets_pt30_eta4p7",njets_pt30_eta4p7) + self.out.fillBranch("GENnjets_pt30_eta4p7",GENnjets_pt30_eta4p7) self.out.fillBranch("eta4l",eta4l) self.out.fillBranch("phi4l",phi4l) self.out.fillBranch("massZ1",massZ1) @@ -305,6 +434,13 @@ def analyze(self, event): self.out.fillBranch("D_int",D_int) self.out.fillBranch("D_L1",D_L1) self.out.fillBranch("D_L1Zg",D_L1Zg) + self.out.fillBranch("passedTrig", passedTrig) + self.out.fillBranch("passedFullSelection", passedFullSelection) + self.out.fillBranch("passedZ4lSelection", passedZ4lSelection) + self.out.fillBranch("passedZ4lZ1LSelection", passedZ4lZ1LSelection) + self.out.fillBranch("passedZ4lZXCRSelection", passedZ4lZXCRSelection) + self.out.fillBranch("passedZXCRSelection", passedZXCRSelection) + self.out.fillBranch("passedFiducialSelection", passedFiducialSelection) self.out.fillBranch("massL1",massL1) self.out.fillBranch("pTL1",pTL1) @@ -331,10 +467,19 @@ def analyze(self, event): self.out.fillBranch("pTj2",pTj2) self.out.fillBranch("etaj2",etaj2) self.out.fillBranch("phij2",phij2) + self.out.fillBranch("pileupWeight",pileupWeight) + self.out.fillBranch("dataMCWeight_new",dataMCWeight_new) + self.out.fillBranch("prefiringWeight",prefiringWeight) # self.out.fillBranch("nElectron_Fsr", len(electrons)) # self.out.fillBranch("nMuon_Fsr", len(muons)) - + + self.out.fillBranch("GENlep_id",GENlep_id) + self.out.fillBranch("GENlep_Hindex",GENlep_Hindex) + self.out.fillBranch("GENZ_DaughtersId",GENZ_DaughtersId) + self.out.fillBranch("GENZ_MomId",GENZ_MomId) + self.out.fillBranch("GENlep_MomId",GENlep_MomId) + self.out.fillBranch("GENlep_MomMomId",GENlep_MomMomId) self.out.fillBranch("Electron_Fsr_pt",Electron_Fsr_pt) self.out.fillBranch("Electron_Fsr_eta",Electron_Fsr_eta) self.out.fillBranch("Electron_Fsr_phi",Electron_Fsr_phi) diff --git a/interface/GenAnalysis.h b/interface/GenAnalysis.h new file mode 100644 index 0000000..2573810 --- /dev/null +++ b/interface/GenAnalysis.h @@ -0,0 +1,113 @@ +#ifndef GenAnalysis_h +#define GenAnalysis_h + +#include +#include +#include +#include +#include +#include +#include "yaml-cpp/yaml.h" +#include "../JHUGenMELA/MELA/interface/Mela.h" + +class GenAnalysis{ + public: + GenAnalysis(); //Importing Ficducial Space cuts + std::vector GENlep_pt; + std::vector GENlep_eta; + std::vector GENlep_phi; + std::vector GENlep_mass; + std::vector GENZ_pt; + std::vector GENZ_eta; + std::vector GENZ_phi; + std::vector GENZ_mass; + std::vector GENZ_MomId; + std::vector GENH_pt; + std::vector GENH_eta; + std::vector GENH_phi; + std::vector GENH_mass; + std::vector GENjet_pt; + std::vector GENjet_eta; + std::vector GENjet_phi; + std::vector GENjet_mass; + std::vector GENlep_RelIso; + std::vector GENlep_id; + std::vector GENlep_status; + std::vector GENlep_MomId; + std::vector GENlep_MomMomId; + float GENMH, GENmassZZ, GENpTZZ; + float Zmass=91.1876; + double genIsoConeSizeEl, genIsoConeSizeMu; + float genIsoCutEl, genIsoCutMu; + float GENmass4l,GENmass4e,GENmass4mu, GENmass2e2mu; + float GENmassZ1,GENmassZ2,GENpT4l,GENeta4l,GENrapidity4l,GENphi4l; + float GENpt_leadingjet_pt30_eta4p7,GENpt_leadingjet_pt30_eta2p5; + float GENpT4lj, GENpT4ljj, GENmass4lj, GENmass4ljj; + float leadingPtCut,subleadingPtCut; + bool passedFiducialSelection; + int GENnjets_pt30_eta4p7,GENnjets_pt30_eta2p5,nGENLeptons; + int GENZ_DaughtersId[2]; + int nVECZ; + unsigned int GENlep_Hindex[4]; + void SetGenParts(float GenPart_pt_, float GenPart_eta_,float GenPart_phi_,float GenPart_mass_,int GenPart_pdgId_,int GenPart_status_,int GenPart_statusFlags_,int GenPart_genPartIdxMother_){ + GenPart_pt.push_back(GenPart_pt_); + GenPart_eta.push_back(GenPart_eta_); + GenPart_phi.push_back(GenPart_phi_); + GenPart_mass.push_back(GenPart_mass_); + GenPart_pdgId.push_back(GenPart_pdgId_); + GenPart_statusFlags.push_back(GenPart_statusFlags_); + GenPart_status.push_back(GenPart_status_); + GenPart_genPartIdxMother.push_back(GenPart_genPartIdxMother_); + } + + void SetGenJets(float GenJet_pt_, float GenJet_eta_,float GenJet_phi_,float GenJet_mass_){ + GenJet_pt.push_back(GenJet_pt_); + GenJet_eta.push_back(GenJet_eta_); + GenJet_phi.push_back(GenJet_phi_); + GenJet_mass.push_back(GenJet_mass_); + } + void SetObjectNumGen(unsigned nGenPart_, unsigned nGenJet_){ + nGenPart = nGenPart_; + nGenJet = nGenJet_; + } + void Initialize(){ + passedFiducialSelection=false; + nGenPart = 0; nGENLeptons=0;nGenJet = 0; GENMH = 0; GENmassZZ= 0; GENpTZZ= 0; GENnjets_pt30_eta4p7=0;GENnjets_pt30_eta2p5=0; + GENpt_leadingjet_pt30_eta4p7=0; GENpt_leadingjet_pt30_eta2p5=0;nVECZ=0; + GENZ_DaughtersId[0]=0;GENZ_DaughtersId[1]=0; + GenPart_pt.clear(); GenPart_eta.clear(); GenPart_phi.clear(); GenPart_mass.clear(); GenPart_pdgId.clear();GenPart_status.clear();GenPart_statusFlags.clear(); GenPart_genPartIdxMother.clear(); + GenJet_pt.clear(); GenJet_eta.clear(); GenJet_phi.clear(); GenJet_mass.clear(); + GENZ_phi.clear(); GENZ_pt.clear(); GENZ_eta.clear(); GENZ_mass.clear();GENZ_MomId.clear(); + GENH_phi.clear(); GENH_pt.clear(); GENH_eta.clear(); GENH_mass.clear(); + GENjet_pt.clear();GENjet_eta.clear();GENjet_phi.clear();GENjet_mass.clear(); + GENlep_eta.clear();GENlep_pt.clear();GENlep_phi.clear();GENlep_mass.clear();GENlep_id.clear();GENlep_status.clear();GENlep_MomMomId.clear();GENlep_MomId.clear();GENlep_RelIso.clear(); + } + int motherID(int Genidx); + int mothermotherID(int Genidx); + void SetGenVariables(); + bool mZ1_mZ2(unsigned int& L1, unsigned int& L2, unsigned int& L3, unsigned int& L4, bool makeCuts); + + + private: + std::vector GenPart_pt; + std::vector GenPart_eta; + std::vector GenPart_phi; + std::vector GenPart_mass; + std::vector GenPart_pdgId; + std::vector GenPart_status; + std::vector GenPart_statusFlags; + std::vector GenPart_genPartIdxMother; + + std::vector GenJet_pt; + std::vector GenJet_eta; + std::vector GenJet_phi; + std::vector GenJet_mass; + + unsigned nGenPart, nGenJet; +}; +GenAnalysis::GenAnalysis(){ + genIsoConeSizeEl=0.3; genIsoConeSizeMu=0.3; + genIsoCutEl=0.35; genIsoCutMu=0.35; + leadingPtCut=20;subleadingPtCut=10; +} +#endif \ No newline at end of file diff --git a/interface/H4LTools.h b/interface/H4LTools.h index 7336cc3..96bd34e 100644 --- a/interface/H4LTools.h +++ b/interface/H4LTools.h @@ -12,7 +12,7 @@ class H4LTools { public: - H4LTools(int year); + H4LTools(int year, bool isMC_); float elePtcut, MuPtcut, eleEtacut, MuEtacut, elesip3dCut, Musip3dCut,Zmass,MZ1cut,MZcutup,MZcutdown,MZZcut,HiggscutUp,HiggscutDown; float eleLoosedxycut,eleLoosedzcut,MuLoosedxycut,MuLoosedzcut,MuTightdxycut,MuTightdzcut,MuTightTrackerLayercut,MuTightpTErrorcut,MuHighPtBound,eleIsocut,MuIsocut; float fsrphotonPtcut,fsrphotonEtacut,fsrphotonIsocut,fsrphotondRlcut,fsrphotondRlOverPtcut, JetPtcut,JetEtacut; @@ -114,6 +114,9 @@ class H4LTools { void SetMuonsGen(int Muon_genPartIdx_){ Muon_genPartIdx.push_back(Muon_genPartIdx_); } + void SetElectronsGen(int Electron_genPartIdx_){ + Electron_genPartIdx.push_back(Electron_genPartIdx_); + } /*void SetMuons(TTreeReaderArray *Muon_pt_, TTreeReaderArray *Muon_eta_, TTreeReaderArray *Muon_phi_, TTreeReaderArray *Muon_mass_, TTreeReaderArray *Muon_isGlobal_, TTreeReaderArray *Muon_isTracker_, TTreeReaderArray *Muon_dxy_, TTreeReaderArray *Muon_dz_,TTreeReaderArray *Muon_sip3d_, TTreeReaderArray *Muon_ptErr_, @@ -137,12 +140,14 @@ class H4LTools { Muon_genPartIdx = Muon_genPartIdx_; }*/ void SetFsrPhotons(float FsrPhoton_dROverEt2_, float FsrPhoton_eta_, - float FsrPhoton_phi_, float FsrPhoton_pt_, float FsrPhoton_relIso03_){ + float FsrPhoton_phi_, float FsrPhoton_pt_, float FsrPhoton_relIso03_, int FsrPhoton_electronIdx_, int FsrPhoton_muonIdx_){ FsrPhoton_dROverEt2.push_back(FsrPhoton_dROverEt2_); FsrPhoton_phi.push_back(FsrPhoton_phi_); FsrPhoton_eta.push_back(FsrPhoton_eta_); FsrPhoton_pt.push_back(FsrPhoton_pt_); FsrPhoton_relIso03.push_back(FsrPhoton_relIso03_); + FsrPhoton_electronIdx.push_back(FsrPhoton_electronIdx_); + FsrPhoton_muonIdx.push_back(FsrPhoton_muonIdx_); } /*void SetFsrPhotons(TTreeReaderArray *FsrPhoton_dROverEt2_, TTreeReaderArray *FsrPhoton_eta_, TTreeReaderArray *FsrPhoton_phi_, TTreeReaderArray *FsrPhoton_pt_, @@ -169,7 +174,7 @@ class H4LTools { void SetObjectNumGen(unsigned nGenPart_){ nGenPart = nGenPart_; } - + bool isMC; std::vector goodLooseElectrons2012(); std::vector goodLooseMuons2012(); std::vector goodMuons2015_noIso_noPf(std::vector Muonindex); @@ -178,7 +183,9 @@ class H4LTools { std::vector passTight_Id(); std::vector goodFsrPhotons(); unsigned doFsrRecovery(TLorentzVector Lep); + unsigned doFsrRecovery_Run3(std::vector goodfsridx, unsigned lepidx, int lepflavor);//lepflavor 11 or 13 std::vector BatchFsrRecovery(std::vector LepList); + void BatchFsrRecovery_Run3(); std::vector ElectronFsr(); std::vector MuonFsr(); std::vector ElectronFsrPt(); @@ -188,12 +195,15 @@ class H4LTools { std::vector MuonFsrEta(); std::vector MuonFsrPhi(); std::vector SelectedJets(std::vector ele, std::vector mu); - + std::vector Electrondressed_Run3; + std::vector Muondressed_Run3; std::vector Zlist; std::vector Zlistnofsr; std::vector Zflavor; //mu->13, e->11 std::vector Zlep1index; std::vector Zlep2index; + std::vector Zlep1lepindex; + std::vector Zlep2lepindex; std::vector Zlep1pt; std::vector Zlep1eta; std::vector Zlep1phi; @@ -213,11 +223,12 @@ class H4LTools { std::vector Zlep2phiNoFsr; std::vector Zlep2massNoFsr; std::vector jetidx; - int nTightEle; int nTightMu; int nTightEleChgSum; int nTightMuChgSum; + int njets_pt30_eta4p7; + int Lepointer; bool flag4e; bool flag4mu; @@ -238,22 +249,28 @@ class H4LTools { std::vector Muiso,Eiso; std::vector Eid; std::vector muid; + std::vector lep_genindex; + std::vector TightElelep_index; + std::vector TightMulep_index; + int lep_Hindex[4]; std::vector TightEleindex; std::vector TightMuindex; void Initialize(){ Electron_pt.clear();Electron_phi.clear();Electron_eta.clear();Electron_mass.clear();Electron_dxy.clear();Electron_dz.clear();Electron_sip3d.clear(); - Electron_mvaFall17V2Iso.clear();Electron_pdgId.clear();Electron_pfRelIso03_all.clear(); + Electron_mvaFall17V2Iso.clear();Electron_pdgId.clear();Electron_genPartIdx.clear();Electron_pfRelIso03_all.clear(); Muon_pt.clear();Muon_phi.clear();Muon_eta.clear();Muon_mass.clear();Muon_dxy.clear();Muon_dz.clear();Muon_sip3d.clear();Muon_ptErr.clear();Muon_pfRelIso03_all.clear(); Muon_nTrackerLayers.clear();Muon_genPartIdx.clear();Muon_pdgId.clear();Muon_charge.clear(); Muon_isTracker.clear();Muon_isGlobal.clear();Muon_isPFcand.clear(); Jet_pt.clear();Jet_phi.clear();Jet_eta.clear();Jet_mass.clear();Jet_btagDeepC.clear(); - Jet_jetId.clear();Jet_puId.clear(); - FsrPhoton_dROverEt2.clear();FsrPhoton_phi.clear();FsrPhoton_eta.clear();FsrPhoton_pt.clear();FsrPhoton_relIso03.clear(); + Jet_jetId.clear();Jet_puId.clear(); + FsrPhoton_dROverEt2.clear();FsrPhoton_phi.clear();FsrPhoton_eta.clear();FsrPhoton_pt.clear();FsrPhoton_relIso03.clear(); FsrPhoton_electronIdx.clear(); FsrPhoton_muonIdx.clear(); GenPart_pt.clear(); Zlist.clear(); Zlistnofsr.clear(); Zflavor.clear(); + Electrondressed_Run3.clear(); + Muondressed_Run3.clear(); Zlep1index.clear(); Zlep2index.clear(); Zlep1pt.clear(); Zlep1eta.clear(); Zlep1phi.clear(); Zlep1mass.clear(); @@ -261,12 +278,14 @@ class H4LTools { Zlep1chg.clear(); Zlep2chg.clear(); Zlep1ptNoFsr.clear(); Zlep1etaNoFsr.clear(); Zlep1phiNoFsr.clear(); Zlep1massNoFsr.clear(); Zlep2ptNoFsr.clear(); Zlep2etaNoFsr.clear(); Zlep2phiNoFsr.clear(); Zlep2massNoFsr.clear(); - jetidx.clear(); + jetidx.clear(); lep_genindex.clear(); TightElelep_index.clear();TightMulep_index.clear(); looseEle.clear(); looseMu.clear(); bestEle.clear(); bestMu.clear(); tighteleforjetidx.clear(); tightmuforjetidx.clear(); Electronindex.clear(); Muonindex.clear(); AllEid.clear(); AllMuid.clear(); Elelist.clear(); Mulist.clear(); ElelistFsr.clear(); Mulist.clear(); Elechg.clear(); Muchg.clear(); Muiso.clear();Eiso.clear(); Eid.clear(); muid.clear(); TightEleindex.clear(); TightMuindex.clear(); + nElectron = 0; nMuon = 0; nJet = 0; nFsrPhoton = 0; nGenPart = 0; nTightEle = 0; nTightMu = 0; nTightEleChgSum = 0; nTightMuChgSum = 0; + Lepointer = 0; pTL1 = -999; etaL1 = -999; phiL1 = -999; massL1 = -999; pTL2 = -999; etaL2 = -999; phiL2 = -999; massL2 = -999; @@ -275,6 +294,7 @@ class H4LTools { pTj1 = -99; etaj1 = -99; phij1 = -99; mj1 = -99; pTj2 = -99; etaj2 = -99; phij2 = -99; mj2 = -99; + njets_pt30_eta4p7 = -1; flag4e=false; flag4mu=false; flag2e2mu=false; } @@ -313,7 +333,7 @@ class H4LTools { private: std::vector Electron_pt,Electron_phi,Electron_eta,Electron_mass,Electron_dxy,Electron_dz,Electron_sip3d; std::vector Electron_mvaFall17V2Iso,Electron_pfRelIso03_all; - std::vector Electron_pdgId; + std::vector Electron_pdgId,Electron_genPartIdx; std::vector Jet_pt,Jet_phi,Jet_eta,Jet_mass,Jet_btagDeepC; std::vector Jet_jetId,Jet_puId; @@ -322,7 +342,7 @@ class H4LTools { std::vector Muon_nTrackerLayers,Muon_genPartIdx,Muon_pdgId,Muon_charge; std::vector Muon_isTracker,Muon_isGlobal,Muon_isPFcand; - std::vector FsrPhoton_dROverEt2,FsrPhoton_phi,FsrPhoton_pt,FsrPhoton_relIso03,FsrPhoton_eta; + std::vector FsrPhoton_dROverEt2,FsrPhoton_phi,FsrPhoton_pt,FsrPhoton_relIso03,FsrPhoton_eta,FsrPhoton_muonIdx,FsrPhoton_electronIdx; std::vector GenPart_pt; @@ -333,7 +353,8 @@ class H4LTools { }; -H4LTools::H4LTools(int year){ +H4LTools::H4LTools(int year, bool isMC_){ + isMC = isMC_; std::cout<<"year"<<" "<setCandidateDecayMode(TVar::CandidateDecay_ZZ); diff --git a/keep_and_drop.txt b/keep_and_drop.txt index 6e6d10a..a130d81 100644 --- a/keep_and_drop.txt +++ b/keep_and_drop.txt @@ -23,6 +23,9 @@ keep *L3 keep *L4 keep *j1 keep *j2 +keep pass* +keep GEN* +keep njet* keep D_* # keep nPhoton # keep Photon* @@ -84,5 +87,6 @@ keep SV* keep Electron_gen* keep FatJet_* keep Gen* +keep genWeight keep Jet_* keep Muon* diff --git a/post_proc.py b/post_proc.py index c708eb0..61bca69 100755 --- a/post_proc.py +++ b/post_proc.py @@ -18,7 +18,7 @@ def parse_arguments(): """Parse command line arguments.""" parser = argparse.ArgumentParser() parser.add_argument("-i", "--inputFile", default="", type=str, help="Input file name") - parser.add_argument("-n", "--entriesToRun", default=100, type=int, help="Set to 0 if need to run over all entries else put number of entries to run") + parser.add_argument("-n", "--entriesToRun", default=200, type=int, help="Set to 0 if need to run over all entries else put number of entries to run") parser.add_argument("-d", "--DownloadFileToLocalThenRun", default=True, type=bool, help="Download file to local then run") return parser.parse_args() @@ -61,7 +61,15 @@ def main(): # Determine the year and type (MC or Data) first_file = testfilelist[0] isMC = "/data/" not in first_file - + + if "22" in first_file or "postEE" in first_file: + """UL2018 for identification of 2018 UL data and UL18 for identification of 2018 UL MC + """ + year = 2018 + cfgFile = "Input_2018.yml" + jsonFileName = "golden_Json/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt" + sfFileName = "DeepCSV_102XSF_V2.csv" + modulesToRun.extend([muonScaleRes2018()]) if "UL18" in first_file or "UL2018" in first_file: """UL2018 for identification of 2018 UL data and UL18 for identification of 2018 UL MC """ @@ -95,7 +103,7 @@ def main(): # btagSF = lambda: btagSFProducer("UL"+str(year), algo="deepjet",selectedWPs=['L','M','T','shape_corr'], sfFileName=sfFileName) btagSF = lambda: btagSFProducer(era = "UL"+str(year), algo = "deepcsv") puidSF = lambda: JetSFMaker("%s" % year) - modulesToRun.extend([jetmetCorrector(), fatJetCorrector(), puidSF()]) + modulesToRun.extend([jetmetCorrector(), fatJetCorrector()])#, puidSF() # # modulesToRun.extend([jetmetCorrector(), fatJetCorrector(), btagSF(), puidSF()]) if year == 2018: modulesToRun.extend([puAutoWeight_2018()]) diff --git a/src/GenAnalysis.cc b/src/GenAnalysis.cc new file mode 100644 index 0000000..00fde19 --- /dev/null +++ b/src/GenAnalysis.cc @@ -0,0 +1,376 @@ +#include "../interface/GenAnalysis.h" +#include +#include +#include +int GenAnalysis::motherID(int Genidx){ + int ID=0; + while(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]!=2212 || abs(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]])!=21 || abs(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]])>6){ + if(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]!=GenPart_pdgId[Genidx]){ + ID=GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]; return ID; + } + else{ + Genidx=GenPart_genPartIdxMother[Genidx]; + } + } + return 2212; +} +int GenAnalysis::mothermotherID(int Genidx){ + int ID=0; + while(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]!=2212 || abs(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]])!=21 || abs(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]])>6){ + if(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]!=GenPart_pdgId[Genidx] && GenPart_pdgId[GenPart_genPartIdxMother[GenPart_genPartIdxMother[Genidx]]]!=GenPart_pdgId[Genidx] && GenPart_pdgId[GenPart_genPartIdxMother[GenPart_genPartIdxMother[Genidx]]]!=GenPart_pdgId[GenPart_genPartIdxMother[Genidx]] ){ + ID=GenPart_pdgId[GenPart_genPartIdxMother[GenPart_genPartIdxMother[Genidx]]]; return ID; + } + else{ + Genidx=GenPart_genPartIdxMother[Genidx]; + } + } + return 2212; +} +void GenAnalysis::SetGenVariables(){ + TLorentzVector GENmom1, GENmom2; + TLorentzVector LS3_Z1_1, LS3_Z1_2, LS3_Z2_1, LS3_Z2_2, GEN_HVec; + int GENmom1_id=-999, GENmom2_id=-999; + int counter_initParticle=0; + for(unsigned int genpidx=0; genpidx gen_fsrset; + for(size_t k=0; k=20 && GenPart_status[genpidx]<30) ){ + GENZ_pt.push_back(GenPart_pt[genpidx]); + GENZ_eta.push_back(GenPart_eta[genpidx]); + GENZ_phi.push_back(GenPart_phi[genpidx]); + GENZ_mass.push_back(GenPart_mass[genpidx]); + GENZ_MomId.push_back(motherID(genpidx)); + nVECZ++; + } + } + if (GENlep_pt.size()>=4) { + + unsigned int L1_nocuts=99; unsigned int L2_nocuts=99; unsigned int L3_nocuts=99; unsigned int L4_nocuts=99; + bool passedFiducialSelectionNoCuts = mZ1_mZ2(L1_nocuts, L2_nocuts, L3_nocuts, L4_nocuts, false); + if (passedFiducialSelectionNoCuts) { + TLorentzVector Z1_1, Z1_2, Z2_1, Z2_2; + Z1_1.SetPtEtaPhiM(GENlep_pt[L1_nocuts],GENlep_eta[L1_nocuts],GENlep_phi[L1_nocuts],GENlep_mass[L1_nocuts]); + Z1_2.SetPtEtaPhiM(GENlep_pt[L2_nocuts],GENlep_eta[L2_nocuts],GENlep_phi[L2_nocuts],GENlep_mass[L2_nocuts]); + Z2_1.SetPtEtaPhiM(GENlep_pt[L3_nocuts],GENlep_eta[L3_nocuts],GENlep_phi[L3_nocuts],GENlep_mass[L3_nocuts]); + Z2_2.SetPtEtaPhiM(GENlep_pt[L4_nocuts],GENlep_eta[L4_nocuts],GENlep_phi[L4_nocuts],GENlep_mass[L4_nocuts]); + GENmassZZ = (Z1_1+Z1_2+Z2_1+Z2_2).M(); + GENpTZZ = (Z1_1+Z1_2+Z2_1+Z2_2).Pt(); + int genfs; + if (abs(GENlep_id[L1_nocuts])==abs(GENlep_id[L3_nocuts])) genfs=1; + else genfs=2; + } + + } + /////// DO THE FIDUCIAL VOLUME CALCULATION ////////////// + passedFiducialSelection=false; + int nFiducialLeptons = 0; + int nFiducialPtLead=0; + int nFiducialPtSublead=0; + + for (unsigned int i=0; i 5.0 && abs(thisLep.Eta()) < 2.4) + || (abs(GENlep_id[i]) == 11 && thisLep.Pt() > 7.0 && abs(thisLep.Eta()) < 2.5) ) + && GENlep_RelIso[i]<((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu) ) { + nFiducialLeptons++; + if (thisLep.Pt()>leadingPtCut) nFiducialPtLead++; + if (thisLep.Pt()>subleadingPtCut) nFiducialPtSublead++; + } + } + if (nFiducialLeptons>=4 && nFiducialPtLead>=1 && nFiducialPtSublead>=2 ){ + // START FIDUCIAL EVENT TOPOLOGY CUTS + unsigned int L1=99; unsigned int L2=99; unsigned int L3=99; unsigned int L4=99; + GENmass4l = -1.0; GENmass4e = -1.0; GENmass4mu = -1.0; GENmass2e2mu = -1.0; + GENmassZ1 = -1.0; GENmassZ2 = -1.0; GENpT4l = -1.0; GENeta4l = 999.; GENrapidity4l = 999.; GENphi4l = 999.; + GENpT4lj = -1.0; GENpT4ljj=-1.0; GENmass4lj = -1.0; GENmass4ljj=-1.0; + + passedFiducialSelection = mZ1_mZ2(L1, L2, L3, L4, true); + + GENlep_Hindex[0] = L1; GENlep_Hindex[1] = L2; GENlep_Hindex[2] = L3; GENlep_Hindex[3] = L4; + if (passedFiducialSelection) { + + // TLorentzVector LS3_Z1_1, LS3_Z1_2, LS3_Z2_1, LS3_Z2_2; + LS3_Z1_1.SetPtEtaPhiM(GENlep_pt[L1],GENlep_eta[L1],GENlep_phi[L1],GENlep_mass[L1]); + LS3_Z1_2.SetPtEtaPhiM(GENlep_pt[L2],GENlep_eta[L2],GENlep_phi[L2],GENlep_mass[L2]); + LS3_Z2_1.SetPtEtaPhiM(GENlep_pt[L3],GENlep_eta[L3],GENlep_phi[L3],GENlep_mass[L3]); + LS3_Z2_2.SetPtEtaPhiM(GENlep_pt[L4],GENlep_eta[L4],GENlep_phi[L4],GENlep_mass[L4]); + GEN_HVec = LS3_Z1_1 + LS3_Z1_2 + LS3_Z2_1 + LS3_Z2_2; + + GENmass4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).M(); + + if (abs(GENlep_id[L1])==11 && abs(GENlep_id[L3])==11) {GENmass4e = GENmass4l;}; + if (abs(GENlep_id[L1])==13 && abs(GENlep_id[L3])==13) {GENmass4mu = GENmass4l;}; + if ( (abs(GENlep_id[L1])==11 || abs(GENlep_id[L1])==13) && + (abs(GENlep_id[L3])==11 || abs(GENlep_id[L3])==13) && + (abs(GENlep_id[L1])!=abs(GENlep_id[L3]) ) ) {GENmass2e2mu = GENmass4l;}; + GENpT4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Pt(); + GENeta4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Eta(); + GENphi4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Phi(); + GENrapidity4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Rapidity(); + GENmassZ1 = (LS3_Z1_1+LS3_Z1_2).M(); + GENmassZ2 = (LS3_Z2_1+LS3_Z2_2).M(); + + int tmpIdL1,tmpIdL2,tmpIdL3,tmpIdL4; + TLorentzVector GENL11P4, GENL12P4, GENL21P4, GENL22P4; + if(GENlep_id[L1] < 0){ GENL11P4.SetPxPyPzE(LS3_Z1_1.Px(),LS3_Z1_1.Py(),LS3_Z1_1.Pz(),LS3_Z1_1.E()); tmpIdL1 = GENlep_id[L1];} + else{ GENL11P4.SetPxPyPzE(LS3_Z1_2.Px(),LS3_Z1_2.Py(),LS3_Z1_2.Pz(),LS3_Z1_2.E()); tmpIdL1 = GENlep_id[L2];} + if(GENlep_id[L2] > 0){ GENL12P4.SetPxPyPzE(LS3_Z1_2.Px(),LS3_Z1_2.Py(),LS3_Z1_2.Pz(),LS3_Z1_2.E()); tmpIdL2 = GENlep_id[L2];} + else{ GENL12P4.SetPxPyPzE(LS3_Z1_1.Px(),LS3_Z1_1.Py(),LS3_Z1_1.Pz(),LS3_Z1_1.E()); tmpIdL2 = GENlep_id[L1];} + if(GENlep_id[L3] < 0){ GENL21P4.SetPxPyPzE(LS3_Z2_1.Px(),LS3_Z2_1.Py(),LS3_Z2_1.Pz(),LS3_Z2_1.E()); tmpIdL3 = GENlep_id[L3];} + else{ GENL21P4.SetPxPyPzE(LS3_Z2_2.Px(),LS3_Z2_2.Py(),LS3_Z2_2.Pz(),LS3_Z2_2.E()); tmpIdL3 = GENlep_id[L4];} + if(GENlep_id[L4] > 0) { GENL22P4.SetPxPyPzE(LS3_Z2_2.Px(),LS3_Z2_2.Py(),LS3_Z2_2.Pz(),LS3_Z2_2.E()); tmpIdL4 = GENlep_id[L4];} + else{ GENL22P4.SetPxPyPzE(LS3_Z2_1.Px(),LS3_Z2_1.Py(),LS3_Z2_1.Pz(),LS3_Z2_1.E()); tmpIdL4 = GENlep_id[L3];} + + } + bool passedMassOS = true; bool passedElMuDeltaR = true; bool passedDeltaR = true; + unsigned int N=GENlep_pt.size(); + for(unsigned int i = 0; i GEN_goodJetsidx; + + for(unsigned genjetidx=0; genjetidx4.7) continue; + + bool inDR_pt30_eta4p7 = false; + unsigned int N=GENlep_pt.size(); + TLorentzVector thisJ; + thisJ.SetPtEtaPhiM(GenJet_pt[genjetidx],GenJet_eta[genjetidx],GenJet_phi[genjetidx],GenJet_mass[genjetidx]); + for(unsigned int i = 0; iGENpt_leadingjet_pt30_eta4p7) { + GENpt_leadingjet_pt30_eta4p7=pt; + } + if (abs(thisJ.Eta())<2.5) { + GENnjets_pt30_eta2p5++; + if (pt>GENpt_leadingjet_pt30_eta2p5) { + GENpt_leadingjet_pt30_eta2p5=pt; + } + } + } + }// loop over gen jets + + } + + } + return; +} +bool GenAnalysis::mZ1_mZ2(unsigned int& L1, unsigned int& L2, unsigned int& L3, unsigned int& L4, bool makeCuts) +{ + + double offshell = 999.0; bool findZ1 = false; bool passZ1 = false; + + L1 = 0; L2 = 0; + + unsigned int N = GENlep_pt.size(); + + for(unsigned int i=0; i 2.4)) continue; + if ( abs(GENlep_id[i]) == 11 && (li.Pt() < 7.0 || abs(li.Eta()) > 2.5)) continue; + if ( GENlep_RelIso[i]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue; + + if ( abs(GENlep_id[j]) == 13 && (lj.Pt() < 5.0 || abs(lj.Eta()) > 2.4)) continue; + if ( abs(GENlep_id[j]) == 11 && (lj.Pt() < 7.0 || abs(lj.Eta()) > 2.5)) continue; + if ( GENlep_RelIso[j]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue; + } + + TLorentzVector mll = li+lj; + + if(abs(mll.M()-Zmass)40 && ml1l2.M()<120 && findZ1) passZ1 = true; + if (!makeCuts) passZ1 = true; + + double pTL34 = 0.0; bool findZ2 = false; + //bool m4lwindow=false; double window_lo=70.0; double window_hi=140.0; + + //cout<<"findZ2"< 2.4)) continue; + if ( abs(GENlep_id[i]) == 11 && (li.Pt() < 7.0 || abs(li.Eta()) > 2.5)) continue; + if ( GENlep_RelIso[i]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue; + + if ( abs(GENlep_id[j]) == 13 && (lj.Pt() < 5.0 || abs(lj.Eta()) > 2.4)) continue; + if ( abs(GENlep_id[j]) == 11 && (lj.Pt() < 7.0 || abs(lj.Eta()) > 2.5)) continue; + if ( GENlep_RelIso[j]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue; + } + + if ( (li.Pt()+lj.Pt())>=pTL34 ) { + double mZ2 = Z2.M(); + if( (mZ2>12 && mZ2<120) || (!makeCuts) ) { + L3 = i; L4 = j; findZ2 = true; + pTL34 = li.Pt()+lj.Pt(); + //if (m4l>window_lo && m4l H4LTools::SelectedJets(std::vector ele, } } } - + njets_pt30_eta4p7 = goodJets.size(); return goodJets; } @@ -163,6 +163,59 @@ unsigned H4LTools::doFsrRecovery(TLorentzVector Lep){ } +unsigned H4LTools::doFsrRecovery_Run3(std::vector goodfsridx, unsigned lepidx, int lepflavor){//lepflavor 11 or 13 + + unsigned matchedfsridx = 999; + if(lepflavor == 11){ + for(unsigned fsridx=0; fsridx fsrlist; + fsrlist = goodFsrPhotons(); + for(unsigned int i=0; i H4LTools::BatchFsrRecovery(std::vector LepList){ std::vector LepFsrList; @@ -207,7 +260,55 @@ std::vector H4LTools::MuonFsr(){ leplistfsr = BatchFsrRecovery(leplist); return leplistfsr; } + std::vector H4LTools::ElectronFsrPt(){ + std::vector lepPt; + for (unsigned int i=0;i H4LTools::ElectronFsrEta(){ + std::vector lepEta; + for (unsigned int i=0;i H4LTools::ElectronFsrPhi(){ + std::vector lepPhi; + for (unsigned int i=0;i H4LTools::MuonFsrPt(){ + std::vector lepPt; + for (unsigned int i=0;i H4LTools::MuonFsrEta(){ + std::vector lepEta; + for (unsigned int i=0;i H4LTools::MuonFsrPhi(){ + std::vector lepPhi; + for (unsigned int i=0;i H4LTools::ElectronFsrPt(){ std::vector lepPt; std::vector leplistfsr; leplistfsr = ElectronFsr(); @@ -265,7 +366,7 @@ std::vector H4LTools::MuonFsrPhi(){ lepPhi.push_back(leplistfsr[i].Phi()); } return lepPhi; -} +}*/ void H4LTools::LeptonSelection(){ @@ -295,6 +396,7 @@ void H4LTools::LeptonSelection(){ TLorentzVector Ele; Ele.SetPtEtaPhiM(Electron_pt[Electronindex[ie]],Electron_eta[Electronindex[ie]],Electron_phi[Electronindex[ie]],Electron_mass[Electronindex[ie]]); Elelist.push_back(Ele); + ElelistFsr.push_back(Electrondressed_Run3[Electronindex[ie]]); Eiso.push_back(Electron_pfRelIso03_all[Electronindex[ie]]); Eid.push_back(AllEid[Electronindex[ie]]); } @@ -309,32 +411,44 @@ void H4LTools::LeptonSelection(){ TLorentzVector Mu; Mu.SetPtEtaPhiM(Muon_pt[Muonindex[imu]],Muon_eta[Muonindex[imu]],Muon_phi[Muonindex[imu]],Muon_mass[Muonindex[imu]]); Mulist.push_back(Mu); + MulistFsr.push_back(Muondressed_Run3[Muonindex[imu]]); muid.push_back(AllMuid[Muonindex[imu]]); Muiso.push_back(Muon_pfRelIso03_all[Muonindex[imu]]); } - ElelistFsr = BatchFsrRecovery(Elelist); - MulistFsr = BatchFsrRecovery(Mulist); + //ElelistFsr = BatchFsrRecovery(Elelist); + //MulistFsr = BatchFsrRecovery(Mulist); for(unsigned int ae=0; ae0.01){ + RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); + } + //FsrEleidx = doFsrRecovery(Elelist[ae]); + /*if(FsrEleidx<900){ TLorentzVector fsrele; fsrele.SetPtEtaPhiM(FsrPhoton_pt[FsrEleidx],FsrPhoton_eta[FsrEleidx],FsrPhoton_phi[FsrEleidx],0); std::cout<<"Ele correction: "<< std::endl; if(Elelist[ae].DeltaR(fsrele)>0.01){ RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); } - } + }*/ } if((Eid[ae]==true)&&(RelEleIsoNoFsr<0.35)){ nTightEle++; TightEleindex.push_back(ae); nTightEleChgSum += Elechg[ae]; + TightElelep_index.push_back(Lepointer); + Lepointer++; + if (isMC) lep_genindex.push_back(Electron_genPartIdx[Electronindex[ae]]); + else lep_genindex.push_back(-1); } } @@ -342,22 +456,33 @@ void H4LTools::LeptonSelection(){ for(unsigned int amu=0; amu0.01){ + RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); + } + /*if(FsrMuonidx<900){ TLorentzVector fsrmuon; fsrmuon.SetPtEtaPhiM(FsrPhoton_pt[FsrMuonidx],FsrPhoton_eta[FsrMuonidx],FsrPhoton_phi[FsrMuonidx],0); std::cout<<"muon FSR recovered"<0.01){ RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); } - } + }*/ } if((muid[amu]==true)&&(RelIsoNoFsr<0.35)){ nTightMu++; TightMuindex.push_back(amu); nTightMuChgSum += Muchg[amu]; + TightMulep_index.push_back(Lepointer); + Lepointer++; + if (isMC) lep_genindex.push_back(Muon_genPartIdx[Muonindex[amu]]); + else lep_genindex.push_back(-1); } } @@ -391,6 +516,8 @@ bool H4LTools::findZCandidate(){ Zlist.push_back(Zcan); Zlep1index.push_back(TightEleindex[ke]); Zlep2index.push_back(TightEleindex[je]); + Zlep1lepindex.push_back(TightElelep_index[ke]); + Zlep2lepindex.push_back(TightElelep_index[je]); Zflavor.push_back(11); Zlep1pt.push_back(ElelistFsr[TightEleindex[ke]].Pt()); Zlep2pt.push_back(ElelistFsr[TightEleindex[je]].Pt()); @@ -426,6 +553,8 @@ bool H4LTools::findZCandidate(){ Zlist.push_back(Zcan); Zlep1index.push_back(TightMuindex[kmu]); Zlep2index.push_back(TightMuindex[jmu]); + Zlep1lepindex.push_back(TightMulep_index[kmu]); + Zlep2lepindex.push_back(TightMulep_index[jmu]); Zflavor.push_back(13); Zlep1pt.push_back(MulistFsr[TightMuindex[kmu]].Pt()); Zlep2pt.push_back(MulistFsr[TightMuindex[jmu]].Pt()); @@ -730,7 +859,10 @@ bool H4LTools::ZZSelection(){ Lep3.SetPtEtaPhiM(Zlep1pt[Z2index],Zlep1eta[Z2index],Zlep1phi[Z2index],Zlep1mass[Z2index]); Lep4.SetPtEtaPhiM(Zlep2pt[Z2index],Zlep2eta[Z2index],Zlep2phi[Z2index],Zlep2mass[Z2index]); - + lep_Hindex[0] = Zlep1lepindex[Z1index]; + lep_Hindex[1] = Zlep2lepindex[Z1index]; + lep_Hindex[2] = Zlep1lepindex[Z2index]; + lep_Hindex[3] = Zlep2lepindex[Z2index]; pTL1 = Lep1.Pt(); etaL1 = Lep1.Eta(); phiL1 = Lep1.Phi(); From 5e38595259a90e7a8c07590377e9af637f182828 Mon Sep 17 00:00:00 2001 From: yuji Date: Fri, 2 Feb 2024 22:25:22 +0100 Subject: [PATCH 02/32] 2022 datafile & NanoAOD changes --- ExampleInputFileList.txt | 25 ++++++++++++++++++++++++- post_proc.py | 4 ++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ExampleInputFileList.txt b/ExampleInputFileList.txt index 76b806e..0af2451 100644 --- a/ExampleInputFileList.txt +++ b/ExampleInputFileList.txt @@ -1 +1,24 @@ -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/a2a64a49-3404-49db-bf42-cb0ceb5218e2.root \ No newline at end of file +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2520000/dcae7632-2ea5-4832-80f0-de7d45837a7f.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/25212339-d2db-48c4-936d-fc47e9de45e9.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/7a86daa3-36d3-42a4-8962-dc831b8608e0.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/c7c62ee7-13a9-4de1-962d-64503a6fef05.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/a2a64a49-3404-49db-bf42-cb0ceb5218e2.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/b46903af-5d85-479e-b776-0803db6c3e2c.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/1070b936-55a7-42ac-9cf5-99931410460a.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/1070b936-55a7-42ac-9cf5-99931410460a.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/397c450f-3316-48d4-9f1c-4617cea565b4.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/542e888a-24b0-4e51-a494-d2690f894c0d.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/60bdd368-5104-4ce9-b051-81c7b86f161c.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/b528cb33-8f3e-4406-8fcb-cb09865bb438.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/3791f2b2-e3a9-443c-8aeb-c8e31d8961c4.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/4f8a3f0f-e843-4777-90e2-f6f8daabe7f0.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/539d25c5-1e49-4991-a6fc-a9acce27df63.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/64c9d27f-8aa1-4260-b70e-448251583317.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/7c111788-925a-4f59-8ae4-a908f8cff51c.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/926ba3f0-d716-46c5-b472-a675d3c35850.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/2aa4541c-32d0-494b-838d-cd0dc572e928.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/4c9b46c1-37db-4203-9cab-371d3b76a705.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/76c31428-6d72-4d4f-921c-2b2dcb852483.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/81b10398-217c-495e-ae94-282d5e0727aa.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/9dc8891a-1b74-4744-9e55-8f2af210d9d5.root +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/b47f5d8f-a86c-4a45-b95e-d74bf0da9008.root \ No newline at end of file diff --git a/post_proc.py b/post_proc.py index 61bca69..a14e55c 100755 --- a/post_proc.py +++ b/post_proc.py @@ -18,7 +18,7 @@ def parse_arguments(): """Parse command line arguments.""" parser = argparse.ArgumentParser() parser.add_argument("-i", "--inputFile", default="", type=str, help="Input file name") - parser.add_argument("-n", "--entriesToRun", default=200, type=int, help="Set to 0 if need to run over all entries else put number of entries to run") + parser.add_argument("-n", "--entriesToRun", default=0, type=int, help="Set to 0 if need to run over all entries else put number of entries to run") parser.add_argument("-d", "--DownloadFileToLocalThenRun", default=True, type=bool, help="Download file to local then run") return parser.parse_args() @@ -116,7 +116,7 @@ def main(): fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") modulesToRun.extend([jetmetCorrector(), fatJetCorrector()]) - p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=False,haddFileName="skimmed_nano_data.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") + p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=False,haddFileName="skimmed_nano_data_2022_ggH.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") p.run() From 0f5f69931099082cc7b00c42ccc60aa8f1644aac Mon Sep 17 00:00:00 2001 From: yuji Date: Fri, 2 Feb 2024 22:26:55 +0100 Subject: [PATCH 03/32] 2022 datafile added --- input_data_Files/sample_list_v12_2022.dat | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 input_data_Files/sample_list_v12_2022.dat diff --git a/input_data_Files/sample_list_v12_2022.dat b/input_data_Files/sample_list_v12_2022.dat new file mode 100644 index 0000000..dabf1c8 --- /dev/null +++ b/input_data_Files/sample_list_v12_2022.dat @@ -0,0 +1,32 @@ +# Data +/SingleMuon/Run2022C-16Dec2023-v1/NANOAOD +/DoubleMuon/Run2022C-16Dec2023-v1/NANOAOD +/Muon/Run2022C-16Dec2023-v1/NANOAOD +/Muon/Run2022D-16Dec2023-v1/NANOAOD +/Muon/Run2022E-16Dec2023-v1/NANOAOD +/Muon/Run2022F-16Dec2023-v1/NANOAOD +/Muon/Run2022G-19Dec2023-v2/NANOAOD +/MuonEG/Run2022C-22Sep2023-v1/NANOAOD +/MuonEG/Run2022D-22Sep2023-v1/NANOAOD +/MuonEG/Run2022E-22Sep2023-v1/NANOAOD +/MuonEG/Run2022F-22Sep2023-v1/NANOAOD +/MuonEG/Run2022G-22Sep2023-v1/NANOAOD +/EGamma/Run2022C-16Dec2023-v1/NANOAOD +/EGamma/Run2022D-16Dec2023-v1/NANOAOD +/EGamma/Run2022E-16Dec2023-v1/NANOAOD +/EGamma/Run2022F-16Dec2023-v1/NANOAOD +/EGamma/Run2022G-16Dec2023-v1/NANOAOD +# +# MC +/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +/VBFHto2Zto4L_M125_TuneCP5_13p6TeV_powheg-jhugenv752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +/VBFHto2Zto4L_M125_TuneCP5_13p6TeV_powheg-jhugenv752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +/WminusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +/WminusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +/WplusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +/WplusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +/ZHto2Zto4L_M125_TuneCP5_13p6TeV_powheg2-minlo-HZJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +/ZHto2Zto4L_M125_TuneCP5_13p6TeV_powheg2-minlo-HZJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +/TTH_Hto2Z_M-125_4LFilter_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +/TTH_Hto2Z_M-125_4LFilter_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM From 156d6a0a8628b029a7a2f6edb434740ea1fa4ca9 Mon Sep 17 00:00:00 2001 From: yuji Date: Fri, 2 Feb 2024 22:28:59 +0100 Subject: [PATCH 04/32] nano_changes.patch added --- nano_changes.patch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nano_changes.patch diff --git a/nano_changes.patch b/nano_changes.patch new file mode 100644 index 0000000..bbd85f0 --- /dev/null +++ b/nano_changes.patch @@ -0,0 +1,26 @@ +diff --git a/python/postprocessing/modules/jme/fatJetUncertainties.py b/python/postprocessing/modules/jme/fatJetUncertainties.py +index d0b5b89..2ada36f 100644 +--- a/python/postprocessing/modules/jme/fatJetUncertainties.py ++++ b/python/postprocessing/modules/jme/fatJetUncertainties.py +@@ -112,7 +112,7 @@ class fatJetUncertaintiesProducer(Module): + self.doGroomed = False + else: + raise ValueError("ERROR: Invalid jet type = '%s'!" % jetType) +- self.rhoBranchName = "fixedGridRhoFastjetAll" ++ self.rhoBranchName = "Rho_fixedGridRhoFastjetAll" + self.lenVar = "n" + self.jetBranchName + + # jet mass scale +diff --git a/python/postprocessing/modules/jme/jetmetUncertainties.py b/python/postprocessing/modules/jme/jetmetUncertainties.py +index cb31351..71e840a 100644 +--- a/python/postprocessing/modules/jme/jetmetUncertainties.py ++++ b/python/postprocessing/modules/jme/jetmetUncertainties.py +@@ -46,7 +46,7 @@ class jetmetUncertaintiesProducer(Module): + else: + self.splitJERIDs = [""] # "empty" ID for the overall JER + self.metBranchName = metBranchName +- self.rhoBranchName = "fixedGridRhoFastjetAll" ++ self.rhoBranchName = "Rho_fixedGridRhoFastjetAll" + # -------------------------------------------------------------------- + # CV: globalTag and jetType not yet used in the jet smearer, as there + # is no consistent set of txt files for JES uncertainties and JER scale From cfddb9bfd364d91cfbd850391bca66f48ed1e4ae Mon Sep 17 00:00:00 2001 From: yuji Date: Sat, 3 Feb 2024 00:09:56 +0100 Subject: [PATCH 05/32] lep*info added --- keep_and_drop.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/keep_and_drop.txt b/keep_and_drop.txt index a130d81..d63602a 100644 --- a/keep_and_drop.txt +++ b/keep_and_drop.txt @@ -27,6 +27,7 @@ keep pass* keep GEN* keep njet* keep D_* +keep lep* # keep nPhoton # keep Photon* keep nElectron From 2976f96975d1684c054d7f5c6afa51cad875e9b7 Mon Sep 17 00:00:00 2001 From: yuji Date: Sun, 4 Feb 2024 15:35:21 +0100 Subject: [PATCH 06/32] keep passtrig evts --- ExampleInputFileList.txt | 20 +-- H4LCppModule.py | 300 +++++++++++++++++++++------------------ keep_and_drop.txt | 2 + post_proc.py | 4 +- 4 files changed, 163 insertions(+), 163 deletions(-) diff --git a/ExampleInputFileList.txt b/ExampleInputFileList.txt index 0af2451..910059d 100644 --- a/ExampleInputFileList.txt +++ b/ExampleInputFileList.txt @@ -3,22 +3,4 @@ /store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/7a86daa3-36d3-42a4-8962-dc831b8608e0.root /store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/c7c62ee7-13a9-4de1-962d-64503a6fef05.root /store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/a2a64a49-3404-49db-bf42-cb0ceb5218e2.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/b46903af-5d85-479e-b776-0803db6c3e2c.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/1070b936-55a7-42ac-9cf5-99931410460a.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/1070b936-55a7-42ac-9cf5-99931410460a.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/397c450f-3316-48d4-9f1c-4617cea565b4.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/542e888a-24b0-4e51-a494-d2690f894c0d.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/60bdd368-5104-4ce9-b051-81c7b86f161c.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/30000/b528cb33-8f3e-4406-8fcb-cb09865bb438.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/3791f2b2-e3a9-443c-8aeb-c8e31d8961c4.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/4f8a3f0f-e843-4777-90e2-f6f8daabe7f0.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/539d25c5-1e49-4991-a6fc-a9acce27df63.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/64c9d27f-8aa1-4260-b70e-448251583317.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/7c111788-925a-4f59-8ae4-a908f8cff51c.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/40000/926ba3f0-d716-46c5-b472-a675d3c35850.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/2aa4541c-32d0-494b-838d-cd0dc572e928.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/4c9b46c1-37db-4203-9cab-371d3b76a705.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/76c31428-6d72-4d4f-921c-2b2dcb852483.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/81b10398-217c-495e-ae94-282d5e0727aa.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/9dc8891a-1b74-4744-9e55-8f2af210d9d5.root -/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/50000/b47f5d8f-a86c-4a45-b95e-d74bf0da9008.root \ No newline at end of file +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/b46903af-5d85-479e-b776-0803db6c3e2c.root \ No newline at end of file diff --git a/H4LCppModule.py b/H4LCppModule.py index 8337fa3..2f574fe 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -217,6 +217,19 @@ def analyze(self, event): GENrapidity4l = -99 GENnjets_pt30_eta4p7 = -1 nGENLeptons = 0 + pTZ1 = -99 + etaZ1 = -99 + phiZ1 = -99 + massZ1 = 0 + pTZ2 = -99 + etaZ2 = -99 + phiZ2 = -99 + massZ2 = -99 + pT4l = -99 + eta4l = -99 + phi4l = -99 + mass4l = 0 + rapidity4l = -99 passedTrig = PassTrig(event, self.cfgFile) if (passedTrig==True): self.passtrigEvts += 1 @@ -323,6 +336,7 @@ def analyze(self, event): foundZZCandidate = self.worker.ZZSelection() + passedFullSelection=foundZZCandidate Lepointer = self.worker.Lepointer lep_Hindex = [] lep_Hindex_vec = self.worker.lep_Hindex @@ -336,157 +350,159 @@ def analyze(self, event): for i in range(len(lep_genindex_vec)): lep_genindex.append(lep_genindex_vec[i]) if (foundZZCandidate): - keepIt = True self.passZZEvts += 1 - pTZ1 = self.worker.Z1.Pt() - etaZ1 = self.worker.Z1.Eta() - phiZ1 = self.worker.Z1.Phi() - massZ1 = self.worker.Z1.M() - pTZ2 = self.worker.Z2.Pt() - etaZ2 = self.worker.Z2.Eta() - phiZ2 = self.worker.Z2.Phi() - massZ2 = self.worker.Z2.M() - D_CP = self.worker.D_CP - D_0m = self.worker.D_0m - D_0hp = self.worker.D_0hp - D_int = self.worker.D_int - D_L1 = self.worker.D_L1 - D_L1Zg = self.worker.D_L1Zg + keepIt = True + + pTZ1 = self.worker.Z1.Pt() + etaZ1 = self.worker.Z1.Eta() + phiZ1 = self.worker.Z1.Phi() + massZ1 = self.worker.Z1.M() + pTZ2 = self.worker.Z2.Pt() + etaZ2 = self.worker.Z2.Eta() + phiZ2 = self.worker.Z2.Phi() + massZ2 = self.worker.Z2.M() + D_CP = self.worker.D_CP + D_0m = self.worker.D_0m + D_0hp = self.worker.D_0hp + D_int = self.worker.D_int + D_L1 = self.worker.D_L1 + D_L1Zg = self.worker.D_L1Zg - pTL1 = self.worker.pTL1 - etaL1 = self.worker.etaL1 - phiL1 = self.worker.phiL1 - massL1 = self.worker.massL1 - pTL2 = self.worker.pTL2 - etaL2 = self.worker.etaL2 - phiL2 = self.worker.phiL2 - massL2 = self.worker.massL2 - pTL3 = self.worker.pTL3 - etaL3 = self.worker.etaL3 - phiL3 = self.worker.phiL3 - massL3 = self.worker.massL3 - pTL4 = self.worker.pTL4 - etaL4 = self.worker.etaL4 - phiL4 = self.worker.phiL4 - massL4 = self.worker.massL4 - pTj1 = self.worker.pTj1 - etaj1 = self.worker.etaj1 - phij1 = self.worker.phij1 - mj1 = self.worker.mj1 - pTj2 = self.worker.pTj2 - etaj2 = self.worker.etaj2 - phij2 = self.worker.phij2 - mj2 = self.worker.mj2 + pTL1 = self.worker.pTL1 + etaL1 = self.worker.etaL1 + phiL1 = self.worker.phiL1 + massL1 = self.worker.massL1 + pTL2 = self.worker.pTL2 + etaL2 = self.worker.etaL2 + phiL2 = self.worker.phiL2 + massL2 = self.worker.massL2 + pTL3 = self.worker.pTL3 + etaL3 = self.worker.etaL3 + phiL3 = self.worker.phiL3 + massL3 = self.worker.massL3 + pTL4 = self.worker.pTL4 + etaL4 = self.worker.etaL4 + phiL4 = self.worker.phiL4 + massL4 = self.worker.massL4 + pTj1 = self.worker.pTj1 + etaj1 = self.worker.etaj1 + phij1 = self.worker.phij1 + mj1 = self.worker.mj1 + pTj2 = self.worker.pTj2 + etaj2 = self.worker.etaj2 + phij2 = self.worker.phij2 + mj2 = self.worker.mj2 - if pTL2>pTL1: - pTL1, pTl2 = pTL2, pTL1 - etaL1, etaL2 = etaL2, etaL1 - phiL1, phiL2 = phiL2, phiL1 - massL1,massL2 = massL2, massL1 - if pTL4>pTL3: - pTL3, pTL4 = pTL4, pTL3 - etaL3, etaL4 = etaL4, etaL3 - phiL3, phiL4 = phiL4, phiL3 - massL3, massL4 = massL4, massL3 + if pTL2>pTL1: + pTL1, pTl2 = pTL2, pTL1 + etaL1, etaL2 = etaL2, etaL1 + phiL1, phiL2 = phiL2, phiL1 + massL1,massL2 = massL2, massL1 + if pTL4>pTL3: + pTL3, pTL4 = pTL4, pTL3 + etaL3, etaL4 = etaL4, etaL3 + phiL3, phiL4 = phiL4, phiL3 + massL3, massL4 = massL4, massL3 - pT4l = self.worker.ZZsystem.Pt() - eta4l = self.worker.ZZsystem.Eta() - phi4l = self.worker.ZZsystem.Phi() - mass4l = self.worker.ZZsystem.M() - rapidity4l = self.worker.ZZsystem.Rapidity() - njets_pt30_eta4p7 = self.worker.njets_pt30_eta4p7 - if self.worker.flag4e: - mass4e = mass4l - if self.worker.flag2e2mu: - mass4e = mass4l - if self.worker.flag4mu: - mass4mu = mass4l - if self.worker.isFSR==False: - pT4l = self.worker.ZZsystemnofsr.Pt() - eta4l = self.worker.ZZsystemnofsr.Eta() - phi4l = self.worker.ZZsystemnofsr.Phi() - mass4l = self.worker.ZZsystemnofsr.M() - self.out.fillBranch("mass4l",mass4l) - self.out.fillBranch("GENmass4l",GENmass4l) - self.out.fillBranch("mass4e",mass4e) - self.out.fillBranch("mass2e2mu",mass2e2mu) - self.out.fillBranch("mass4mu",mass4mu) - self.out.fillBranch("pT4l",pT4l) - self.out.fillBranch("GENpT4l",GENpT4l) - self.out.fillBranch("rapidity4l",rapidity4l) - self.out.fillBranch("GENrapidity4l",GENrapidity4l) - self.out.fillBranch("njets_pt30_eta4p7",njets_pt30_eta4p7) - self.out.fillBranch("GENnjets_pt30_eta4p7",GENnjets_pt30_eta4p7) - self.out.fillBranch("eta4l",eta4l) - self.out.fillBranch("phi4l",phi4l) - self.out.fillBranch("massZ1",massZ1) - self.out.fillBranch("pTZ1",pTZ1) - self.out.fillBranch("etaZ1",etaZ1) - self.out.fillBranch("phiZ1",phiZ1) - self.out.fillBranch("massZ2",massZ2) - self.out.fillBranch("pTZ2",pTZ2) - self.out.fillBranch("etaZ2",etaZ2) - self.out.fillBranch("phiZ2",phiZ2) - self.out.fillBranch("D_CP",D_CP) - self.out.fillBranch("D_0m",D_0m) - self.out.fillBranch("D_0hp",D_0hp) - self.out.fillBranch("D_int",D_int) - self.out.fillBranch("D_L1",D_L1) - self.out.fillBranch("D_L1Zg",D_L1Zg) - self.out.fillBranch("passedTrig", passedTrig) - self.out.fillBranch("passedFullSelection", passedFullSelection) - self.out.fillBranch("passedZ4lSelection", passedZ4lSelection) - self.out.fillBranch("passedZ4lZ1LSelection", passedZ4lZ1LSelection) - self.out.fillBranch("passedZ4lZXCRSelection", passedZ4lZXCRSelection) - self.out.fillBranch("passedZXCRSelection", passedZXCRSelection) - self.out.fillBranch("passedFiducialSelection", passedFiducialSelection) + pT4l = self.worker.ZZsystem.Pt() + eta4l = self.worker.ZZsystem.Eta() + phi4l = self.worker.ZZsystem.Phi() + mass4l = self.worker.ZZsystem.M() + rapidity4l = self.worker.ZZsystem.Rapidity() + njets_pt30_eta4p7 = self.worker.njets_pt30_eta4p7 + if self.worker.flag4e: + mass4e = mass4l + if self.worker.flag2e2mu: + mass4e = mass4l + if self.worker.flag4mu: + mass4mu = mass4l + if self.worker.isFSR==False: + pT4l = self.worker.ZZsystemnofsr.Pt() + eta4l = self.worker.ZZsystemnofsr.Eta() + phi4l = self.worker.ZZsystemnofsr.Phi() + mass4l = self.worker.ZZsystemnofsr.M() + rapidity4l = self.worker.ZZsystemnofsr.Rapidity() + self.out.fillBranch("mass4l",mass4l) + self.out.fillBranch("GENmass4l",GENmass4l) + self.out.fillBranch("mass4e",mass4e) + self.out.fillBranch("mass2e2mu",mass2e2mu) + self.out.fillBranch("mass4mu",mass4mu) + self.out.fillBranch("pT4l",pT4l) + self.out.fillBranch("GENpT4l",GENpT4l) + self.out.fillBranch("rapidity4l",rapidity4l) + self.out.fillBranch("GENrapidity4l",GENrapidity4l) + self.out.fillBranch("njets_pt30_eta4p7",njets_pt30_eta4p7) + self.out.fillBranch("GENnjets_pt30_eta4p7",GENnjets_pt30_eta4p7) + self.out.fillBranch("eta4l",eta4l) + self.out.fillBranch("phi4l",phi4l) + self.out.fillBranch("massZ1",massZ1) + self.out.fillBranch("pTZ1",pTZ1) + self.out.fillBranch("etaZ1",etaZ1) + self.out.fillBranch("phiZ1",phiZ1) + self.out.fillBranch("massZ2",massZ2) + self.out.fillBranch("pTZ2",pTZ2) + self.out.fillBranch("etaZ2",etaZ2) + self.out.fillBranch("phiZ2",phiZ2) + self.out.fillBranch("D_CP",D_CP) + self.out.fillBranch("D_0m",D_0m) + self.out.fillBranch("D_0hp",D_0hp) + self.out.fillBranch("D_int",D_int) + self.out.fillBranch("D_L1",D_L1) + self.out.fillBranch("D_L1Zg",D_L1Zg) + self.out.fillBranch("passedTrig", passedTrig) + self.out.fillBranch("passedFullSelection", passedFullSelection) + self.out.fillBranch("passedZ4lSelection", passedZ4lSelection) + self.out.fillBranch("passedZ4lZ1LSelection", passedZ4lZ1LSelection) + self.out.fillBranch("passedZ4lZXCRSelection", passedZ4lZXCRSelection) + self.out.fillBranch("passedZXCRSelection", passedZXCRSelection) + self.out.fillBranch("passedFiducialSelection", passedFiducialSelection) - self.out.fillBranch("massL1",massL1) - self.out.fillBranch("pTL1",pTL1) - self.out.fillBranch("etaL1",etaL1) - self.out.fillBranch("phiL1",phiL1) - self.out.fillBranch("massL2",massL2) - self.out.fillBranch("pTL2",pTL2) - self.out.fillBranch("etaL2",etaL2) - self.out.fillBranch("phiL2",phiL2) - self.out.fillBranch("massL3",massL3) - self.out.fillBranch("pTL3",pTL3) - self.out.fillBranch("etaL3",etaL3) - self.out.fillBranch("phiL3",phiL3) - self.out.fillBranch("massL4",massL4) - self.out.fillBranch("pTL4",pTL4) - self.out.fillBranch("etaL4",etaL4) - self.out.fillBranch("phiL4",phiL4) + self.out.fillBranch("massL1",massL1) + self.out.fillBranch("pTL1",pTL1) + self.out.fillBranch("etaL1",etaL1) + self.out.fillBranch("phiL1",phiL1) + self.out.fillBranch("massL2",massL2) + self.out.fillBranch("pTL2",pTL2) + self.out.fillBranch("etaL2",etaL2) + self.out.fillBranch("phiL2",phiL2) + self.out.fillBranch("massL3",massL3) + self.out.fillBranch("pTL3",pTL3) + self.out.fillBranch("etaL3",etaL3) + self.out.fillBranch("phiL3",phiL3) + self.out.fillBranch("massL4",massL4) + self.out.fillBranch("pTL4",pTL4) + self.out.fillBranch("etaL4",etaL4) + self.out.fillBranch("phiL4",phiL4) - self.out.fillBranch("mj1",mj1) - self.out.fillBranch("pTj1",pTj1) - self.out.fillBranch("etaj1",etaj1) - self.out.fillBranch("phij1",phij1) - self.out.fillBranch("mj2",mj2) - self.out.fillBranch("pTj2",pTj2) - self.out.fillBranch("etaj2",etaj2) - self.out.fillBranch("phij2",phij2) - self.out.fillBranch("pileupWeight",pileupWeight) - self.out.fillBranch("dataMCWeight_new",dataMCWeight_new) - self.out.fillBranch("prefiringWeight",prefiringWeight) + self.out.fillBranch("mj1",mj1) + self.out.fillBranch("pTj1",pTj1) + self.out.fillBranch("etaj1",etaj1) + self.out.fillBranch("phij1",phij1) + self.out.fillBranch("mj2",mj2) + self.out.fillBranch("pTj2",pTj2) + self.out.fillBranch("etaj2",etaj2) + self.out.fillBranch("phij2",phij2) + self.out.fillBranch("pileupWeight",pileupWeight) + self.out.fillBranch("dataMCWeight_new",dataMCWeight_new) + self.out.fillBranch("prefiringWeight",prefiringWeight) - # self.out.fillBranch("nElectron_Fsr", len(electrons)) - # self.out.fillBranch("nMuon_Fsr", len(muons)) - - self.out.fillBranch("GENlep_id",GENlep_id) - self.out.fillBranch("GENlep_Hindex",GENlep_Hindex) - self.out.fillBranch("GENZ_DaughtersId",GENZ_DaughtersId) - self.out.fillBranch("GENZ_MomId",GENZ_MomId) - self.out.fillBranch("GENlep_MomId",GENlep_MomId) - self.out.fillBranch("GENlep_MomMomId",GENlep_MomMomId) - self.out.fillBranch("Electron_Fsr_pt",Electron_Fsr_pt) - self.out.fillBranch("Electron_Fsr_eta",Electron_Fsr_eta) - self.out.fillBranch("Electron_Fsr_phi",Electron_Fsr_phi) + # self.out.fillBranch("nElectron_Fsr", len(electrons)) + # self.out.fillBranch("nMuon_Fsr", len(muons)) + + self.out.fillBranch("GENlep_id",GENlep_id) + self.out.fillBranch("GENlep_Hindex",GENlep_Hindex) + self.out.fillBranch("GENZ_DaughtersId",GENZ_DaughtersId) + self.out.fillBranch("GENZ_MomId",GENZ_MomId) + self.out.fillBranch("GENlep_MomId",GENlep_MomId) + self.out.fillBranch("GENlep_MomMomId",GENlep_MomMomId) + self.out.fillBranch("Electron_Fsr_pt",Electron_Fsr_pt) + self.out.fillBranch("Electron_Fsr_eta",Electron_Fsr_eta) + self.out.fillBranch("Electron_Fsr_phi",Electron_Fsr_phi) - self.out.fillBranch("Muon_Fsr_pt",Muon_Fsr_pt) - self.out.fillBranch("Muon_Fsr_eta",Muon_Fsr_eta) - self.out.fillBranch("Muon_Fsr_phi",Muon_Fsr_phi) + self.out.fillBranch("Muon_Fsr_pt",Muon_Fsr_pt) + self.out.fillBranch("Muon_Fsr_eta",Muon_Fsr_eta) + self.out.fillBranch("Muon_Fsr_phi",Muon_Fsr_phi) """with open("SyncLepton2018GGH.txt", 'a') as f: if(foundZZCandidate): diff --git a/keep_and_drop.txt b/keep_and_drop.txt index d63602a..e8ba07b 100644 --- a/keep_and_drop.txt +++ b/keep_and_drop.txt @@ -28,6 +28,8 @@ keep GEN* keep njet* keep D_* keep lep* +keep *Weight +keep *Weight* # keep nPhoton # keep Photon* keep nElectron diff --git a/post_proc.py b/post_proc.py index a14e55c..6b98bc9 100755 --- a/post_proc.py +++ b/post_proc.py @@ -52,7 +52,7 @@ def main(): testfilelist.append(args.inputFile) else: print("INFO: No input file specified. Using default file list.") - testfilelist = getListFromFile("ExampleInputFileList.txt") + testfilelist = getListFromFile("ExampleInputFileListD.txt") print("DEBUG: Input file list: {}".format(testfilelist)) if len(testfilelist) == 0: print("ERROR: No input files found. Exiting.") @@ -110,7 +110,7 @@ def main(): if year == 2017: modulesToRun.extend([puAutoWeight_2017()]) if year == 2016: modulesToRun.extend([puAutoWeight_2016()]) - p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=False,haddFileName="skimmed_nano_mc.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") + p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=False,haddFileName="skimmed_nano_mc_2022_ggH_D.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") else: jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") From 941d0e8c33b89ae8ab919df4b73f79157dd3b51f Mon Sep 17 00:00:00 2001 From: YujiLee301 <99654114+YujiLee301@users.noreply.github.com> Date: Sun, 4 Feb 2024 18:26:58 +0100 Subject: [PATCH 07/32] Update post_proc.py --- post_proc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/post_proc.py b/post_proc.py index 6b98bc9..bc9dccf 100755 --- a/post_proc.py +++ b/post_proc.py @@ -52,7 +52,7 @@ def main(): testfilelist.append(args.inputFile) else: print("INFO: No input file specified. Using default file list.") - testfilelist = getListFromFile("ExampleInputFileListD.txt") + testfilelist = getListFromFile("ExampleInputFileList.txt") print("DEBUG: Input file list: {}".format(testfilelist)) if len(testfilelist) == 0: print("ERROR: No input files found. Exiting.") @@ -110,13 +110,13 @@ def main(): if year == 2017: modulesToRun.extend([puAutoWeight_2017()]) if year == 2016: modulesToRun.extend([puAutoWeight_2016()]) - p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=False,haddFileName="skimmed_nano_mc_2022_ggH_D.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") + p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=False,haddFileName="skimmed_nano_mc.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") else: jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") modulesToRun.extend([jetmetCorrector(), fatJetCorrector()]) - p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=False,haddFileName="skimmed_nano_data_2022_ggH.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") + p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=False,haddFileName="skimmed_nano_data.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") p.run() From ad9011c753cacd02d26e890275dc3008c613d807 Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Mon, 5 Feb 2024 17:20:16 +0100 Subject: [PATCH 08/32] - Added file "Input_2022.yml" and linked with post-proc.py - Updated "Keep_and_drop.txt" file - Added "--NOsyst" option in post-proc.py - Updated golden json file for 2022 - GenAnalysis.cc: Replaced "<" with "<=" in line "for(unsigned int j=i+1; j GenPart_pt; std::vector GenPart_eta; @@ -102,12 +102,13 @@ class GenAnalysis{ std::vector GenJet_eta; std::vector GenJet_phi; std::vector GenJet_mass; - + unsigned nGenPart, nGenJet; }; GenAnalysis::GenAnalysis(){ + // FIXME: Add the values to the yaml file genIsoConeSizeEl=0.3; genIsoConeSizeMu=0.3; genIsoCutEl=0.35; genIsoCutMu=0.35; leadingPtCut=20;subleadingPtCut=10; } -#endif \ No newline at end of file +#endif diff --git a/keep_and_drop.txt b/keep_and_drop.txt index e8ba07b..e82174f 100644 --- a/keep_and_drop.txt +++ b/keep_and_drop.txt @@ -5,6 +5,18 @@ drop * # start with all keep run keep event keep lumi* +keep BeamSpot* +# +# +# GEN +keep GenFilter* +# +# Others +keep LowPtElectron* +keep nLowPtElectron* +keep OtherPV* +keep nOtherPV* +keep PV* # # # Trigger @@ -30,14 +42,14 @@ keep D_* keep lep* keep *Weight keep *Weight* -# keep nPhoton -# keep Photon* +keep nPhoton +keep Photon* keep nElectron keep Electron* keep nMuon keep Muon* -# keep nTau -# keep Tau* +keep nTau +keep Tau* keep HTXS* keep btag* keep CaloMET* @@ -60,13 +72,13 @@ keep GenV* keep gen* keep LHE* keep nLHE* -keep nPSWeight -keep PSWeight* +keep nPS* +keep PS* keep nIsoTrack keep IsoTrack* keep nJet keep Jet* -keep L1PreFiring* +keep L1* keep nLowPtElectron keep LowPtElectron* keep GenMET* @@ -76,6 +88,7 @@ keep PuppiMET* keep RawMET* keep RawPuppiMET* keep fixedGridRho* +keep Rho_* keep nGenDressedLepton keep GenDressedLepton* keep nSubJet diff --git a/post_proc.py b/post_proc.py index bc9dccf..7bf280b 100755 --- a/post_proc.py +++ b/post_proc.py @@ -20,6 +20,7 @@ def parse_arguments(): parser.add_argument("-i", "--inputFile", default="", type=str, help="Input file name") parser.add_argument("-n", "--entriesToRun", default=0, type=int, help="Set to 0 if need to run over all entries else put number of entries to run") parser.add_argument("-d", "--DownloadFileToLocalThenRun", default=True, type=bool, help="Download file to local then run") + parser.add_argument("--NOsyst", default=False, action="store_true", help="Do not run systematics") return parser.parse_args() @@ -58,18 +59,21 @@ def main(): print("ERROR: No input files found. Exiting.") exit(1) - # Determine the year and type (MC or Data) + """Determine the year and type (MC or Data) of input ROOT file: + For data the string "/data/" is always there. So, we take this + as handle to decide if the root file is MC or data. + """ first_file = testfilelist[0] isMC = "/data/" not in first_file - - if "22" in first_file or "postEE" in first_file: - """UL2018 for identification of 2018 UL data and UL18 for identification of 2018 UL MC + + if "Summer22" in first_file or "Run2022" in first_file: + """Summer22 and Run2022 for identification of 2022 MC and data respectiverly """ - year = 2018 - cfgFile = "Input_2018.yml" - jsonFileName = "golden_Json/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt" - sfFileName = "DeepCSV_102XSF_V2.csv" - modulesToRun.extend([muonScaleRes2018()]) + year = 2022 + cfgFile = "Input_2022.yml" + jsonFileName = "golden_Json/Cert_Collisions2022_355100_362760_Golden.json" + sfFileName = "DeepCSV_102XSF_V2.csv" # FIXME: Update for year 2022 + modulesToRun.extend([muonScaleRes2018()]) # FIXME: Update for year 2022 if "UL18" in first_file or "UL2018" in first_file: """UL2018 for identification of 2018 UL data and UL18 for identification of 2018 UL MC """ @@ -89,6 +93,7 @@ def main(): jsonFileName = "golden_Json/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt" sfFileName = "DeepCSV_102XSF_V2.csv" modulesToRun.extend([muonScaleRes2016()]) + H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile, isMC, isFSR) modulesToRun.extend([H4LCppModule()]) @@ -98,23 +103,28 @@ def main(): print("isFSR: {}".format(isFSR)) if isMC: - jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") - fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") - # btagSF = lambda: btagSFProducer("UL"+str(year), algo="deepjet",selectedWPs=['L','M','T','shape_corr'], sfFileName=sfFileName) - btagSF = lambda: btagSFProducer(era = "UL"+str(year), algo = "deepcsv") - puidSF = lambda: JetSFMaker("%s" % year) - modulesToRun.extend([jetmetCorrector(), fatJetCorrector()])#, puidSF() - # # modulesToRun.extend([jetmetCorrector(), fatJetCorrector(), btagSF(), puidSF()]) - + if (not args.NOsyst): + # FIXME: JES not used properly + jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") + fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") + # btagSF = lambda: btagSFProducer("UL"+str(year), algo="deepjet",selectedWPs=['L','M','T','shape_corr'], sfFileName=sfFileName) + btagSF = lambda: btagSFProducer(era = "UL"+str(year), algo = "deepcsv") + puidSF = lambda: JetSFMaker("%s" % year) + modulesToRun.extend([jetmetCorrector(), fatJetCorrector()])#, puidSF() + # # modulesToRun.extend([jetmetCorrector(), fatJetCorrector(), btagSF(), puidSF()]) + + # FIXME: No PU weight for 2022 if year == 2018: modulesToRun.extend([puAutoWeight_2018()]) if year == 2017: modulesToRun.extend([puAutoWeight_2017()]) if year == 2016: modulesToRun.extend([puAutoWeight_2016()]) p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=False,haddFileName="skimmed_nano_mc.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") else: - jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") - fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") - modulesToRun.extend([jetmetCorrector(), fatJetCorrector()]) + if (not args.NOsyst): + # FIXME: JES not used properly + jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") + fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") + modulesToRun.extend([jetmetCorrector(), fatJetCorrector()]) p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=False,haddFileName="skimmed_nano_data.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") diff --git a/src/GenAnalysis.cc b/src/GenAnalysis.cc index 00fde19..66b4198 100644 --- a/src/GenAnalysis.cc +++ b/src/GenAnalysis.cc @@ -47,7 +47,7 @@ void GenAnalysis::SetGenVariables(){ if (abs(GenPart_pdgId[genpidx])==11 || abs(GenPart_pdgId[genpidx])==13 || abs(GenPart_pdgId[genpidx])==15){ if(!(GenPart_status[genpidx]==1 || abs(GenPart_pdgId[genpidx])==15)) continue; if (!(abs(motherID(genpidx))==23 || abs(motherID(genpidx))==443 || abs(motherID(genpidx))==553 || abs(motherID(genpidx))==24) ) continue; - + nGENLeptons++; // Collect FSR photons TLorentzVector lep_dressed; @@ -57,7 +57,7 @@ void GenAnalysis::SetGenVariables(){ if( GenPart_status[k] != 1) continue; // stable particles only if( GenPart_pdgId[k] != 22) continue; // only photons TLorentzVector thisphoton; - thisphoton.SetPtEtaPhiM(GenPart_pt[k],GenPart_eta[k],GenPart_phi[k],GenPart_mass[k]); + thisphoton.SetPtEtaPhiM(GenPart_pt[k],GenPart_eta[k],GenPart_phi[k],GenPart_mass[k]); double this_dR_lgamma = thisphoton.DeltaR(lep_dressed); bool idmatch=false; if(GenPart_pdgId[GenPart_genPartIdxMother[k]]==GenPart_pdgId[genpidx]) idmatch=true; @@ -77,7 +77,7 @@ void GenAnalysis::SetGenVariables(){ GENlep_mass.push_back( lep_dressed.M() ); GENlep_MomId.push_back(motherID(genpidx)); GENlep_MomMomId.push_back(mothermotherID(genpidx)); - + TLorentzVector thisLep; thisLep.SetPtEtaPhiM(lep_dressed.Pt(),lep_dressed.Eta(),lep_dressed.Phi(),lep_dressed.M()); // GEN iso calculation @@ -98,7 +98,7 @@ void GenAnalysis::SetGenVariables(){ GENlep_RelIso.push_back(this_GENiso); // END GEN iso calculation }//leptons - + if (GenPart_pdgId[genpidx]==25) { GENMH=GenPart_mass[genpidx]; GENH_pt.push_back(GenPart_pt[genpidx]); @@ -117,7 +117,7 @@ void GenAnalysis::SetGenVariables(){ } } if (GENlep_pt.size()>=4) { - + unsigned int L1_nocuts=99; unsigned int L2_nocuts=99; unsigned int L3_nocuts=99; unsigned int L4_nocuts=99; bool passedFiducialSelectionNoCuts = mZ1_mZ2(L1_nocuts, L2_nocuts, L3_nocuts, L4_nocuts, false); if (passedFiducialSelectionNoCuts) { @@ -139,11 +139,11 @@ void GenAnalysis::SetGenVariables(){ int nFiducialLeptons = 0; int nFiducialPtLead=0; int nFiducialPtSublead=0; - + for (unsigned int i=0; i 5.0 && abs(thisLep.Eta()) < 2.4) || (abs(GENlep_id[i]) == 11 && thisLep.Pt() > 7.0 && abs(thisLep.Eta()) < 2.5) ) && GENlep_RelIso[i]<((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu) ) { @@ -160,10 +160,10 @@ void GenAnalysis::SetGenVariables(){ GENpT4lj = -1.0; GENpT4ljj=-1.0; GENmass4lj = -1.0; GENmass4ljj=-1.0; passedFiducialSelection = mZ1_mZ2(L1, L2, L3, L4, true); - + GENlep_Hindex[0] = L1; GENlep_Hindex[1] = L2; GENlep_Hindex[2] = L3; GENlep_Hindex[3] = L4; if (passedFiducialSelection) { - + // TLorentzVector LS3_Z1_1, LS3_Z1_2, LS3_Z2_1, LS3_Z2_2; LS3_Z1_1.SetPtEtaPhiM(GENlep_pt[L1],GENlep_eta[L1],GENlep_phi[L1],GENlep_mass[L1]); LS3_Z1_2.SetPtEtaPhiM(GENlep_pt[L2],GENlep_eta[L2],GENlep_phi[L2],GENlep_mass[L2]); @@ -172,7 +172,7 @@ void GenAnalysis::SetGenVariables(){ GEN_HVec = LS3_Z1_1 + LS3_Z1_2 + LS3_Z2_1 + LS3_Z2_2; GENmass4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).M(); - + if (abs(GENlep_id[L1])==11 && abs(GENlep_id[L3])==11) {GENmass4e = GENmass4l;}; if (abs(GENlep_id[L1])==13 && abs(GENlep_id[L3])==13) {GENmass4mu = GENmass4l;}; if ( (abs(GENlep_id[L1])==11 || abs(GENlep_id[L1])==13) && @@ -184,7 +184,7 @@ void GenAnalysis::SetGenVariables(){ GENrapidity4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Rapidity(); GENmassZ1 = (LS3_Z1_1+LS3_Z1_2).M(); GENmassZ2 = (LS3_Z2_1+LS3_Z2_2).M(); - + int tmpIdL1,tmpIdL2,tmpIdL3,tmpIdL4; TLorentzVector GENL11P4, GENL12P4, GENL21P4, GENL22P4; if(GENlep_id[L1] < 0){ GENL11P4.SetPxPyPzE(LS3_Z1_1.Px(),LS3_Z1_1.Py(),LS3_Z1_1.Pz(),LS3_Z1_1.E()); tmpIdL1 = GENlep_id[L1];} @@ -195,27 +195,27 @@ void GenAnalysis::SetGenVariables(){ else{ GENL21P4.SetPxPyPzE(LS3_Z2_2.Px(),LS3_Z2_2.Py(),LS3_Z2_2.Pz(),LS3_Z2_2.E()); tmpIdL3 = GENlep_id[L4];} if(GENlep_id[L4] > 0) { GENL22P4.SetPxPyPzE(LS3_Z2_2.Px(),LS3_Z2_2.Py(),LS3_Z2_2.Pz(),LS3_Z2_2.E()); tmpIdL4 = GENlep_id[L4];} else{ GENL22P4.SetPxPyPzE(LS3_Z2_1.Px(),LS3_Z2_1.Py(),LS3_Z2_1.Pz(),LS3_Z2_1.E()); tmpIdL4 = GENlep_id[L3];} - + } bool passedMassOS = true; bool passedElMuDeltaR = true; bool passedDeltaR = true; unsigned int N=GENlep_pt.size(); for(unsigned int i = 0; i GEN_goodJetsidx; @@ -238,7 +238,7 @@ void GenAnalysis::SetGenVariables(){ double pt = GenJet_pt[genjetidx]; double eta = GenJet_eta[genjetidx]; if (pt<30.0 || abs(eta)>4.7) continue; - + bool inDR_pt30_eta4p7 = false; unsigned int N=GENlep_pt.size(); TLorentzVector thisJ; @@ -252,7 +252,7 @@ void GenAnalysis::SetGenVariables(){ inDR_pt30_eta4p7=true; } } - + // count number of gen jets which no gen leptons are inside its cone if (!inDR_pt30_eta4p7) { GEN_goodJetsidx.push_back(genjetidx); @@ -272,84 +272,86 @@ void GenAnalysis::SetGenVariables(){ } } }// loop over gen jets - + } - + } return; } + bool GenAnalysis::mZ1_mZ2(unsigned int& L1, unsigned int& L2, unsigned int& L3, unsigned int& L4, bool makeCuts) { - + // Reference: https://github.com/qyguo/UFHZZAnalysisRun2/blob/e51073652729067c8be7c1334f749aae76931a7b/UFHZZ4LAna/src/UFHZZ4LAna.cc#L9009 + double offshell = 999.0; bool findZ1 = false; bool passZ1 = false; - + L1 = 0; L2 = 0; - + unsigned int N = GENlep_pt.size(); - + for(unsigned int i=0; i 2.4)) continue; if ( abs(GENlep_id[i]) == 11 && (li.Pt() < 7.0 || abs(li.Eta()) > 2.5)) continue; if ( GENlep_RelIso[i]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue; - + if ( abs(GENlep_id[j]) == 13 && (lj.Pt() < 5.0 || abs(lj.Eta()) > 2.4)) continue; if ( abs(GENlep_id[j]) == 11 && (lj.Pt() < 7.0 || abs(lj.Eta()) > 2.5)) continue; if ( GENlep_RelIso[j]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue; } - + TLorentzVector mll = li+lj; - + if(abs(mll.M()-Zmass)40 && ml1l2.M()<120 && findZ1) passZ1 = true; if (!makeCuts) passZ1 = true; - + double pTL34 = 0.0; bool findZ2 = false; //bool m4lwindow=false; double window_lo=70.0; double window_hi=140.0; - + //cout<<"findZ2"< 2.4)) continue; if ( abs(GENlep_id[i]) == 11 && (li.Pt() < 7.0 || abs(li.Eta()) > 2.5)) continue; if ( GENlep_RelIso[i]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue; - + if ( abs(GENlep_id[j]) == 13 && (lj.Pt() < 5.0 || abs(lj.Eta()) > 2.4)) continue; if ( abs(GENlep_id[j]) == 11 && (lj.Pt() < 7.0 || abs(lj.Eta()) > 2.5)) continue; if ( GENlep_RelIso[j]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue; } - + if ( (li.Pt()+lj.Pt())>=pTL34 ) { double mZ2 = Z2.M(); if( (mZ2>12 && mZ2<120) || (!makeCuts) ) { @@ -362,15 +364,15 @@ bool GenAnalysis::mZ1_mZ2(unsigned int& L1, unsigned int& L2, unsigned int& L3, //cout<<"is not new GEN cand"< Date: Mon, 5 Feb 2024 21:57:16 +0100 Subject: [PATCH 09/32] Indentation update in "H4LTools.cc" --- src/H4LTools.cc | 148 ++++++++++++++++++++++++------------------------ 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/src/H4LTools.cc b/src/H4LTools.cc index d2dd930..0dd5883 100644 --- a/src/H4LTools.cc +++ b/src/H4LTools.cc @@ -35,7 +35,7 @@ std::vector H4LTools::goodMuons2015_noIso_noPf(std::vector H4LTools::goodElectrons2015_noIso_noBdt(std::vector Electronindex){ @@ -77,11 +77,11 @@ std::vector H4LTools::passTight_BDT_Id(){ else{ tightid.push_back(false); } - + } - + return tightid; - + } std::vector H4LTools::passTight_Id(){ std::vector tightid; @@ -132,7 +132,7 @@ std::vector H4LTools::SelectedJets(std::vector ele, if(overlaptag==0) goodJets.push_back(i); } } - } + } njets_pt30_eta4p7 = goodJets.size(); return goodJets; } @@ -160,11 +160,11 @@ unsigned H4LTools::doFsrRecovery(TLorentzVector Lep){ } return FsrIdx; - + } unsigned H4LTools::doFsrRecovery_Run3(std::vector goodfsridx, unsigned lepidx, int lepflavor){//lepflavor 11 or 13 - + unsigned matchedfsridx = 999; if(lepflavor == 11){ for(unsigned fsridx=0; fsridx H4LTools::BatchFsrRecovery(std::vector LepList){ - + std::vector LepFsrList; - + for(unsigned int i=0;i H4LTools::MuonFsrPhi(){ }*/ void H4LTools::LeptonSelection(){ - + looseEle = goodLooseElectrons2012(); looseMu = goodLooseMuons2012(); bestEle = goodElectrons2015_noIso_noBdt(looseEle); @@ -385,7 +385,7 @@ void H4LTools::LeptonSelection(){ if(AllMuid[looseMu[juj]]) tightmuforjetidx.push_back(looseMu[juj]); } jetidx = SelectedJets(tighteleforjetidx,tightmuforjetidx); - + for(unsigned int ie=0; ie0){ Elechg.push_back(-1); @@ -415,10 +415,10 @@ void H4LTools::LeptonSelection(){ muid.push_back(AllMuid[Muonindex[imu]]); Muiso.push_back(Muon_pfRelIso03_all[Muonindex[imu]]); } - - //ElelistFsr = BatchFsrRecovery(Elelist); + + //ElelistFsr = BatchFsrRecovery(Elelist); //MulistFsr = BatchFsrRecovery(Mulist); - + for(unsigned int ae=0; ae0.01){ - RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); + RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); } //FsrEleidx = doFsrRecovery(Elelist[ae]); /*if(FsrEleidx<900){ @@ -437,7 +437,7 @@ void H4LTools::LeptonSelection(){ fsrele.SetPtEtaPhiM(FsrPhoton_pt[FsrEleidx],FsrPhoton_eta[FsrEleidx],FsrPhoton_phi[FsrEleidx],0); std::cout<<"Ele correction: "<< std::endl; if(Elelist[ae].DeltaR(fsrele)>0.01){ - RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); + RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); } }*/ } @@ -450,7 +450,7 @@ void H4LTools::LeptonSelection(){ if (isMC) lep_genindex.push_back(Electron_genPartIdx[Electronindex[ae]]); else lep_genindex.push_back(-1); } - + } for(unsigned int amu=0; amu0.01){ - RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); - } + RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); + } /*if(FsrMuonidx<900){ TLorentzVector fsrmuon; fsrmuon.SetPtEtaPhiM(FsrPhoton_pt[FsrMuonidx],FsrPhoton_eta[FsrMuonidx],FsrPhoton_phi[FsrMuonidx],0); std::cout<<"muon FSR recovered"<0.01){ - RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); + RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); } }*/ } @@ -485,13 +485,13 @@ void H4LTools::LeptonSelection(){ else lep_genindex.push_back(-1); } } - - + + } bool H4LTools::findZCandidate(){ - + TLorentzVector z1,z2; - + if (nTightEle>=4) { cut4e++; flag4e = true; @@ -499,13 +499,13 @@ bool H4LTools::findZCandidate(){ else if (nTightMu>=4){ cut4mu++; flag4mu = true; - } + } else if ((nTightMu>=2)&&(nTightEle>=2)){ cut2e2mu++; flag2e2mu = true; - } - - + } + + if(TightEleindex.size()>1){ for(unsigned int ke=0; ke<(TightEleindex.size()-1);ke++){ for(unsigned int je=ke+1;je0){ return true; } @@ -601,22 +601,22 @@ bool H4LTools::findZCandidate(){ bool H4LTools::ZZSelection(){ - + bool foundZZCandidate = false; if(!findZCandidate()){ return foundZZCandidate; } if((nTightMu+nTightEle)<4){ return foundZZCandidate; - } - + } + if((abs(nTightEleChgSum)+abs(nTightMuChgSum))>(nTightMu+nTightEle-4)){ return foundZZCandidate; } if(Zsize<2){ return foundZZCandidate; } - + //Find ZZ candidate std::vector Z1CanIndex; std::vector Z2CanIndex; @@ -633,10 +633,10 @@ bool H4LTools::ZZSelection(){ int nPassPt10; nPassPt20 = (Zlep1pt[m]>20) || (Zlep2pt[m]>20) || (Zlep1pt[n]>20) || (Zlep2pt[n]>20); nPassPt10 = 0; - if (Zlep1pt[m]>10) nPassPt10 += 1; - if (Zlep2pt[m]>10) nPassPt10 += 1; - if (Zlep1pt[n]>10) nPassPt10 += 1; - if (Zlep2pt[n]>10) nPassPt10 += 1; + if (Zlep1pt[m]>10) nPassPt10 += 1; + if (Zlep2pt[m]>10) nPassPt10 += 1; + if (Zlep1pt[n]>10) nPassPt10 += 1; + if (Zlep2pt[n]>10) nPassPt10 += 1; if (nPassPt10 < 2) continue; if (nPassPt20 == false) continue; //lep Pt requirements lepPtTag++; @@ -679,8 +679,8 @@ bool H4LTools::ZZSelection(){ else{ zZ1 = Zlist[n]; zZ2 = Zlist[m]; - } - + } + bool passSmartCut = true; if (Zflavor[m]==Zflavor[n]){ TLorentzVector Za,Zb,lepM1,lepM2,lepN1,lepN2; @@ -697,15 +697,15 @@ bool H4LTools::ZZSelection(){ Za = lepM1 + lepN2; Zb = lepN1 + lepM2; } - + else{ Za = lepM1 + lepN1; Zb = lepN2 + lepM2; } if (fabs(Za.M()-Zmass)setInputEvent(&daughters, &associated, 0, 0); mela->setCurrentCandidateFromIndex(0); mela->setProcess(TVar::HSMHiggs, TVar::JHUGen, TVar::ZZGG); mela->computeP(me_0plus_JHU, true); - + mela->setProcess(TVar::H0minus, TVar::JHUGen, TVar::ZZGG); mela->computeP(p0minus_VAJHU, true); // additional probabilities GG_SIG_ghg2_1_ghz2_1_JHUGen mela->setProcess(TVar::H0hplus, TVar::JHUGen, TVar::ZZGG); - mela->computeP(p0plus_VAJHU, true); - + mela->computeP(p0plus_VAJHU, true); + // p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen, Couplings:ghg2=1,0;ghz1=1,0;ghz2=1,0 Options:SubtractP=GG_SIG_ghg2_1_ghz1_1_JHUGen,GG_SIG_ghg2_1_ghz2_1_JHUGen mela->setProcess(TVar::SelfDefine_spin0, TVar::JHUGen, TVar::ZZGG); (mela->selfDHggcoupl)[0][gHIGGS_GG_2][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_VV_1][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_VV_2][0]=1.; - mela->computeP(p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen, true); //FIXME + mela->computeP(p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen, true); //FIXME - p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen -= p0plus_VAJHU+me_0plus_JHU; + p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen -= p0plus_VAJHU+me_0plus_JHU; // p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen @@ -925,10 +925,10 @@ bool H4LTools::ZZSelection(){ (mela->selfDHggcoupl)[0][gHIGGS_GG_2][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_VV_1][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_VV_1_PRIME2][0]=10000.; - mela->computeP(p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen, true); //FIXME + mela->computeP(p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen, true); //FIXME p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen -= p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen+me_0plus_JHU; - // p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen, ghg2=1,0;ghzgs1_prime2=10000,0 + // p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen, ghg2=1,0;ghzgs1_prime2=10000,0 mela->setProcess(TVar::SelfDefine_spin0, TVar::JHUGen, TVar::ZZGG); (mela->selfDHggcoupl)[0][gHIGGS_GG_2][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_ZA_1_PRIME2][0]=10000.; @@ -955,12 +955,12 @@ bool H4LTools::ZZSelection(){ mela->setProcess(TVar::bkgZZ, TVar::MCFM, TVar::ZZQQB); mela->computeP(me_qqZZ_MCFM, true); - + mela->computeD_gg(TVar::MCFM, TVar::D_gg10, Dgg10_VAMCFM); - + mela->setProcess(TVar::HSMHiggs, TVar::JHUGen, TVar::ZZGG); mela->computePM4l(TVar::SMSyst_None, p0plus_m4l); - + mela->setProcess(TVar::bkgZZ, TVar::JHUGen, TVar::ZZGG); mela->computePM4l(TVar::SMSyst_None, bkg_m4l); D_0m = me_0plus_JHU / (me_0plus_JHU + (p0minus_VAJHU * pow(getDg4Constant(massZZ),2))); @@ -971,7 +971,7 @@ bool H4LTools::ZZSelection(){ D_L1Zg = me_0plus_JHU / (me_0plus_JHU + ((p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen/1e8) * pow(getDL1ZgsConstant(massZZ),2))); mela->resetInputEvent(); return foundZZCandidate; - + } @@ -989,4 +989,4 @@ float H4LTools::getDL1Constant(float ZZMass){ float H4LTools::getDL1ZgsConstant(float ZZMass){ return spline_L1Zgs->Eval(ZZMass); -} \ No newline at end of file +} From 369a0be7b4ab8c71c28b13e1e8ffe322edea638c Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Mon, 5 Feb 2024 23:22:33 +0100 Subject: [PATCH 10/32] Added keep and drop for data --- keep_and_drop_data.txt | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 keep_and_drop_data.txt diff --git a/keep_and_drop_data.txt b/keep_and_drop_data.txt new file mode 100644 index 0000000..1f9c165 --- /dev/null +++ b/keep_and_drop_data.txt @@ -0,0 +1,79 @@ +# this is a comment +drop * # start with all +# +# +keep run +keep event +keep lumi* +keep BeamSpot* +# Others +keep LowPtElectron* +keep nLowPtElectron* +keep OtherPV* +keep nOtherPV* +keep PV* +# +# +# Trigger +# +keep HLT* +# +keep Flag* +# +# +keep *4l +keep *Z1 +keep *Z2 +keep *L1 +keep *L2 +keep *L3 +keep *L4 +keep *j1 +keep *j2 +keep D_* +keep lep* +keep *Weight +keep *Weight* +keep nPhoton +keep Photon* +keep nElectron +keep Electron* +keep nMuon +keep Muon* +keep nTau +keep Tau* +keep HTXS* +keep btag* +keep CaloMET* +keep ChsMET* +keep nCorrT1METJet +keep CorrT1METJet* +keep DeepMET* +keep nFatJet +keep FatJet* +keep nIsoTrack +keep IsoTrack* +keep nJet +keep Jet* +keep L1* +keep nLowPtElectron +keep LowPtElectron* +keep MET* +# keep Pileup* +keep PuppiMET* +keep RawMET* +keep RawPuppiMET* +keep fixedGridRho* +keep Rho_* +keep nSubJet +keep SubJet* +keep TkMET* +keep nOtherPV +keep OtherPV* +keep PV* +keep nSV +keep SV* +keep FatJet_* +keep Jet_* +keep Muon* +keep pass* From da714e3d9196dd5e80c6d2726d97bbe8ee504dcf Mon Sep 17 00:00:00 2001 From: yuji Date: Tue, 6 Feb 2024 12:18:34 +0100 Subject: [PATCH 11/32] mass4l initalization fixed --- H4LCppModule.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index 2f574fe..f534859 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -403,13 +403,12 @@ def analyze(self, event): etaL3, etaL4 = etaL4, etaL3 phiL3, phiL4 = phiL4, phiL3 massL3, massL4 = massL4, massL3 - - - pT4l = self.worker.ZZsystem.Pt() - eta4l = self.worker.ZZsystem.Eta() - phi4l = self.worker.ZZsystem.Phi() - mass4l = self.worker.ZZsystem.M() - rapidity4l = self.worker.ZZsystem.Rapidity() + if passedFullSelection: + pT4l = self.worker.ZZsystem.Pt() + eta4l = self.worker.ZZsystem.Eta() + phi4l = self.worker.ZZsystem.Phi() + mass4l = self.worker.ZZsystem.M() + rapidity4l = self.worker.ZZsystem.Rapidity() njets_pt30_eta4p7 = self.worker.njets_pt30_eta4p7 if self.worker.flag4e: mass4e = mass4l @@ -417,7 +416,7 @@ def analyze(self, event): mass4e = mass4l if self.worker.flag4mu: mass4mu = mass4l - if self.worker.isFSR==False: + if (self.worker.isFSR==False & passedFullSelection): pT4l = self.worker.ZZsystemnofsr.Pt() eta4l = self.worker.ZZsystemnofsr.Eta() phi4l = self.worker.ZZsystemnofsr.Phi() From 6d1f889c481a9b22a63b2048ad35833f7e3ae0dd Mon Sep 17 00:00:00 2001 From: yuji Date: Wed, 7 Feb 2024 21:50:00 +0100 Subject: [PATCH 12/32] add gen cutflow --- H4LCppModule.py | 10 +++ interface/GenAnalysis.h | 10 ++- interface/H4LTools.h | 33 +++++++-- src/GenAnalysis.cc | 41 +++++++++-- src/H4LTools.cc | 149 ++++++++++++++++++++-------------------- 5 files changed, 153 insertions(+), 90 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index f534859..7badd2e 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -80,6 +80,16 @@ def endJob(self): print("PassmZ1mZ2Cut_2e2mu: "+str(self.worker.cutZZ2e2mu)+" Events") print("Passm4l_105_160_Cut_2e2mu: "+str(self.worker.cutm4l2e2mu)+" Events") print("PassZZSelection: "+str(self.passZZEvts)+" Events") + if self.isMC: + print("PassGEN4eCut: "+str(self.genworker.nGEN4e)+" Events") + print("PassGEN4eZ1Cut: "+str(self.genworker.nGEN4epassZ1)+" Events") + print("PassGEN4efidCut: "+str(self.genworker.nGEN4epassFid)+" Events") + print("PassGEN2e2muCut: "+str(self.genworker.nGEN2e2mu)+" Events") + print("PassGEN2e2muZ1Cut: "+str(self.genworker.nGEN2e2mupassZ1)+" Events") + print("PassGEN2e2mufidCut: "+str(self.genworker.nGEN2e2mupassFid)+" Events") + print("PassGEN4muCut: "+str(self.genworker.nGEN4mu)+" Events") + print("PassGEN4muZ1Cut: "+str(self.genworker.nGEN4mupassZ1)+" Events") + print("PassGEN4mufidCut: "+str(self.genworker.nGEN4mupassFid)+" Events") pass def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): diff --git a/interface/GenAnalysis.h b/interface/GenAnalysis.h index b54565c..3072bcf 100644 --- a/interface/GenAnalysis.h +++ b/interface/GenAnalysis.h @@ -49,6 +49,8 @@ class GenAnalysis{ int GENZ_DaughtersId[2]; int nVECZ; unsigned int GENlep_Hindex[4]; + int flag4e, flag4mu, flag2e2mu,flagpassZ1,flagpassFid; + int nGEN4e, nGEN4mu, nGEN2e2mu,nGEN4epassZ1,nGEN4epassFid,nGEN4mupassZ1,nGEN4mupassFid, nGEN2e2mupTEtaisocuts,nGEN2e2mupassZ1,nGEN2e2mupassFid; void SetGenParts(float GenPart_pt_, float GenPart_eta_,float GenPart_phi_,float GenPart_mass_,int GenPart_pdgId_,int GenPart_status_,int GenPart_statusFlags_,int GenPart_genPartIdxMother_){ GenPart_pt.push_back(GenPart_pt_); GenPart_eta.push_back(GenPart_eta_); @@ -73,7 +75,8 @@ class GenAnalysis{ void Initialize(){ passedFiducialSelection=false; nGenPart = 0; nGENLeptons=0;nGenJet = 0; GENMH = 0; GENmassZZ= 0; GENpTZZ= 0; GENnjets_pt30_eta4p7=0;GENnjets_pt30_eta2p5=0; - GENpt_leadingjet_pt30_eta4p7=0; GENpt_leadingjet_pt30_eta2p5=0;nVECZ=0; + GENpt_leadingjet_pt30_eta4p7=0; GENpt_leadingjet_pt30_eta2p5=0;nVECZ=0;GENmass4l=-99;GENmass4e=-99;GENmass4mu=-99; GENmass2e2mu=-99; + GENmassZ1=0;GENmassZ2=0;GENpT4l=0;GENeta4l=-99;GENrapidity4l=-99;GENphi4l=-99; GENZ_DaughtersId[0]=0;GENZ_DaughtersId[1]=0; GenPart_pt.clear(); GenPart_eta.clear(); GenPart_phi.clear(); GenPart_mass.clear(); GenPart_pdgId.clear();GenPart_status.clear();GenPart_statusFlags.clear(); GenPart_genPartIdxMother.clear(); GenJet_pt.clear(); GenJet_eta.clear(); GenJet_phi.clear(); GenJet_mass.clear(); @@ -81,6 +84,8 @@ class GenAnalysis{ GENH_phi.clear(); GENH_pt.clear(); GENH_eta.clear(); GENH_mass.clear(); GENjet_pt.clear();GENjet_eta.clear();GENjet_phi.clear();GENjet_mass.clear(); GENlep_eta.clear();GENlep_pt.clear();GENlep_phi.clear();GENlep_mass.clear();GENlep_id.clear();GENlep_status.clear();GENlep_MomMomId.clear();GENlep_MomId.clear();GENlep_RelIso.clear(); + flag4e=0; flag4mu=0; flag2e2mu=0;flagpassZ1=0;flagpassFid=0; + } int motherID(int Genidx); int mothermotherID(int Genidx); @@ -110,5 +115,6 @@ GenAnalysis::GenAnalysis(){ genIsoConeSizeEl=0.3; genIsoConeSizeMu=0.3; genIsoCutEl=0.35; genIsoCutMu=0.35; leadingPtCut=20;subleadingPtCut=10; -} + nGEN4e=0; nGEN4mu=0; nGEN2e2mu=0;nGEN4epassZ1=0;nGEN4epassFid=0;nGEN4mupassZ1=0;nGEN4mupassFid=0;nGEN2e2mupTEtaisocuts=0;nGEN2e2mupassZ1=0;nGEN2e2mupassFid=0; +} #endif diff --git a/interface/H4LTools.h b/interface/H4LTools.h index 96bd34e..54a1b86 100644 --- a/interface/H4LTools.h +++ b/interface/H4LTools.h @@ -253,10 +253,30 @@ class H4LTools { std::vector TightElelep_index; std::vector TightMulep_index; int lep_Hindex[4]; + TLorentzVector Z1; + TLorentzVector Z1nofsr; + TLorentzVector Z2; + TLorentzVector Z2nofsr; + TLorentzVector ZZsystem; + TLorentzVector ZZsystemnofsr; std::vector TightEleindex; std::vector TightMuindex; void Initialize(){ + looseEle.clear(); + looseMu.clear(); + bestEle.clear(); + bestMu.clear(); + tighteleforjetidx.clear(); + tightmuforjetidx.clear(); + Electronindex.clear(); + Muonindex.clear(); + AllEid.clear(); + AllMuid.clear(); + Elelist.clear(); + Mulist.clear(); + ElelistFsr.clear(); + MulistFsr.clear(); Electron_pt.clear();Electron_phi.clear();Electron_eta.clear();Electron_mass.clear();Electron_dxy.clear();Electron_dz.clear();Electron_sip3d.clear(); Electron_mvaFall17V2Iso.clear();Electron_pdgId.clear();Electron_genPartIdx.clear();Electron_pfRelIso03_all.clear(); Muon_pt.clear();Muon_phi.clear();Muon_eta.clear();Muon_mass.clear();Muon_dxy.clear();Muon_dz.clear();Muon_sip3d.clear();Muon_ptErr.clear();Muon_pfRelIso03_all.clear(); @@ -282,7 +302,12 @@ class H4LTools { looseEle.clear(); looseMu.clear(); bestEle.clear(); bestMu.clear(); tighteleforjetidx.clear(); tightmuforjetidx.clear(); Electronindex.clear(); Muonindex.clear(); AllEid.clear(); AllMuid.clear(); Elelist.clear(); Mulist.clear(); ElelistFsr.clear(); Mulist.clear(); Elechg.clear(); Muchg.clear(); Muiso.clear();Eiso.clear(); Eid.clear(); muid.clear(); TightEleindex.clear(); TightMuindex.clear(); - + Z1.SetPtEtaPhiM(0,0,0,0); + Z1nofsr.SetPtEtaPhiM(0,0,0,0); + Z2.SetPtEtaPhiM(0,0,0,0); + Z2nofsr.SetPtEtaPhiM(0,0,0,0); + ZZsystem.SetPtEtaPhiM(0,0,0,0); + ZZsystemnofsr.SetPtEtaPhiM(0,0,0,0); nElectron = 0; nMuon = 0; nJet = 0; nFsrPhoton = 0; nGenPart = 0; nTightEle = 0; nTightMu = 0; nTightEleChgSum = 0; nTightMuChgSum = 0; Lepointer = 0; @@ -306,12 +331,6 @@ class H4LTools { TSpline *spline_L1Zgs; bool findZCandidate(); bool ZZSelection(); - TLorentzVector Z1; - TLorentzVector Z1nofsr; - TLorentzVector Z2; - TLorentzVector Z2nofsr; - TLorentzVector ZZsystem; - TLorentzVector ZZsystemnofsr; Mela* mela; float me_0plus_JHU, me_qqZZ_MCFM, p0plus_m4l, bkg_m4l; diff --git a/src/GenAnalysis.cc b/src/GenAnalysis.cc index 66b4198..6af840f 100644 --- a/src/GenAnalysis.cc +++ b/src/GenAnalysis.cc @@ -140,6 +140,8 @@ void GenAnalysis::SetGenVariables(){ int nFiducialPtLead=0; int nFiducialPtSublead=0; + int nGENe, nGENmu; + nGENe=0; nGENmu=0; for (unsigned int i=0; ileadingPtCut) nFiducialPtLead++; if (thisLep.Pt()>subleadingPtCut) nFiducialPtSublead++; } + if (abs(GENlep_id[i]) == 13) nGENmu++; + if (abs(GENlep_id[i]) == 11) nGENe++; } + if(nGENmu>3) {flag4mu++;nGEN4mu++;} + if(nGENe>3) {flag4e++;nGEN4e++;} + if((nGENe>1)&&(nGENmu>1)) {flag2e2mu++;nGEN2e2mu++;} if (nFiducialLeptons>=4 && nFiducialPtLead>=1 && nFiducialPtSublead>=2 ){ // START FIDUCIAL EVENT TOPOLOGY CUTS unsigned int L1=99; unsigned int L2=99; unsigned int L3=99; unsigned int L4=99; @@ -160,7 +167,30 @@ void GenAnalysis::SetGenVariables(){ GENpT4lj = -1.0; GENpT4ljj=-1.0; GENmass4lj = -1.0; GENmass4ljj=-1.0; passedFiducialSelection = mZ1_mZ2(L1, L2, L3, L4, true); - + if(flag2e2mu){ + if(flagpassZ1){ + nGEN2e2mupassZ1++; + if(flagpassFid){ + nGEN2e2mupassFid++; + } + } + } + if(flag4e){ + if(flagpassZ1){ + nGEN4epassZ1++; + if(flagpassFid){ + nGEN4epassFid++; + } + } + } + if(flag4mu){ + if(flagpassZ1){ + nGEN4mupassZ1++; + if(flagpassFid){ + nGEN4mupassFid++; + } + } + } GENlep_Hindex[0] = L1; GENlep_Hindex[1] = L2; GENlep_Hindex[2] = L3; GENlep_Hindex[3] = L4; if (passedFiducialSelection) { @@ -173,11 +203,11 @@ void GenAnalysis::SetGenVariables(){ GENmass4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).M(); - if (abs(GENlep_id[L1])==11 && abs(GENlep_id[L3])==11) {GENmass4e = GENmass4l;}; - if (abs(GENlep_id[L1])==13 && abs(GENlep_id[L3])==13) {GENmass4mu = GENmass4l;}; + if (abs(GENlep_id[L1])==11 && abs(GENlep_id[L3])==11) {GENmass4e = GENmass4l;} + if (abs(GENlep_id[L1])==13 && abs(GENlep_id[L3])==13) {GENmass4mu = GENmass4l;} if ( (abs(GENlep_id[L1])==11 || abs(GENlep_id[L1])==13) && (abs(GENlep_id[L3])==11 || abs(GENlep_id[L3])==13) && - (abs(GENlep_id[L1])!=abs(GENlep_id[L3]) ) ) {GENmass2e2mu = GENmass4l;}; + (abs(GENlep_id[L1])!=abs(GENlep_id[L3]) ) ) {GENmass2e2mu = GENmass4l;} GENpT4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Pt(); GENeta4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Eta(); GENphi4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Phi(); @@ -326,6 +356,7 @@ bool GenAnalysis::mZ1_mZ2(unsigned int& L1, unsigned int& L2, unsigned int& L3, if(ml1l2.M()>40 && ml1l2.M()<120 && findZ1) passZ1 = true; if (!makeCuts) passZ1 = true; + if (makeCuts && passZ1) flagpassZ1++; double pTL34 = 0.0; bool findZ2 = false; //bool m4lwindow=false; double window_lo=70.0; double window_hi=140.0; @@ -371,7 +402,7 @@ bool GenAnalysis::mZ1_mZ2(unsigned int& L1, unsigned int& L2, unsigned int& L3, unsigned int tmp_; if(GENlep_pt[L1] H4LTools::goodMuons2015_noIso_noPf(std::vector H4LTools::goodElectrons2015_noIso_noBdt(std::vector Electronindex){ @@ -77,11 +77,11 @@ std::vector H4LTools::passTight_BDT_Id(){ else{ tightid.push_back(false); } - + } - + return tightid; - + } std::vector H4LTools::passTight_Id(){ std::vector tightid; @@ -132,7 +132,7 @@ std::vector H4LTools::SelectedJets(std::vector ele, if(overlaptag==0) goodJets.push_back(i); } } - } + } njets_pt30_eta4p7 = goodJets.size(); return goodJets; } @@ -160,11 +160,11 @@ unsigned H4LTools::doFsrRecovery(TLorentzVector Lep){ } return FsrIdx; - + } unsigned H4LTools::doFsrRecovery_Run3(std::vector goodfsridx, unsigned lepidx, int lepflavor){//lepflavor 11 or 13 - + unsigned matchedfsridx = 999; if(lepflavor == 11){ for(unsigned fsridx=0; fsridx H4LTools::BatchFsrRecovery(std::vector LepList){ - + std::vector LepFsrList; - + for(unsigned int i=0;i H4LTools::MuonFsrPhi(){ }*/ void H4LTools::LeptonSelection(){ - + looseEle = goodLooseElectrons2012(); looseMu = goodLooseMuons2012(); bestEle = goodElectrons2015_noIso_noBdt(looseEle); @@ -385,7 +385,7 @@ void H4LTools::LeptonSelection(){ if(AllMuid[looseMu[juj]]) tightmuforjetidx.push_back(looseMu[juj]); } jetidx = SelectedJets(tighteleforjetidx,tightmuforjetidx); - + for(unsigned int ie=0; ie0){ Elechg.push_back(-1); @@ -415,21 +415,20 @@ void H4LTools::LeptonSelection(){ muid.push_back(AllMuid[Muonindex[imu]]); Muiso.push_back(Muon_pfRelIso03_all[Muonindex[imu]]); } - - //ElelistFsr = BatchFsrRecovery(Elelist); + + //ElelistFsr = BatchFsrRecovery(Elelist); //MulistFsr = BatchFsrRecovery(Mulist); - + for(unsigned int ae=0; ae0.01){ - RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); + RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); } //FsrEleidx = doFsrRecovery(Elelist[ae]); /*if(FsrEleidx<900){ @@ -437,7 +436,7 @@ void H4LTools::LeptonSelection(){ fsrele.SetPtEtaPhiM(FsrPhoton_pt[FsrEleidx],FsrPhoton_eta[FsrEleidx],FsrPhoton_phi[FsrEleidx],0); std::cout<<"Ele correction: "<< std::endl; if(Elelist[ae].DeltaR(fsrele)>0.01){ - RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); + RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); } }*/ } @@ -450,7 +449,7 @@ void H4LTools::LeptonSelection(){ if (isMC) lep_genindex.push_back(Electron_genPartIdx[Electronindex[ae]]); else lep_genindex.push_back(-1); } - + } for(unsigned int amu=0; amu0.01){ - RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); - } + RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); + } /*if(FsrMuonidx<900){ TLorentzVector fsrmuon; fsrmuon.SetPtEtaPhiM(FsrPhoton_pt[FsrMuonidx],FsrPhoton_eta[FsrMuonidx],FsrPhoton_phi[FsrMuonidx],0); std::cout<<"muon FSR recovered"<0.01){ - RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); + RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); } }*/ } @@ -485,13 +482,13 @@ void H4LTools::LeptonSelection(){ else lep_genindex.push_back(-1); } } - - + + } bool H4LTools::findZCandidate(){ - + TLorentzVector z1,z2; - + if (nTightEle>=4) { cut4e++; flag4e = true; @@ -499,13 +496,13 @@ bool H4LTools::findZCandidate(){ else if (nTightMu>=4){ cut4mu++; flag4mu = true; - } + } else if ((nTightMu>=2)&&(nTightEle>=2)){ cut2e2mu++; flag2e2mu = true; - } - - + } + + if(TightEleindex.size()>1){ for(unsigned int ke=0; ke<(TightEleindex.size()-1);ke++){ for(unsigned int je=ke+1;je0){ return true; } @@ -601,22 +598,22 @@ bool H4LTools::findZCandidate(){ bool H4LTools::ZZSelection(){ - + bool foundZZCandidate = false; if(!findZCandidate()){ return foundZZCandidate; } if((nTightMu+nTightEle)<4){ return foundZZCandidate; - } - + } + if((abs(nTightEleChgSum)+abs(nTightMuChgSum))>(nTightMu+nTightEle-4)){ return foundZZCandidate; } if(Zsize<2){ return foundZZCandidate; } - + //Find ZZ candidate std::vector Z1CanIndex; std::vector Z2CanIndex; @@ -633,10 +630,10 @@ bool H4LTools::ZZSelection(){ int nPassPt10; nPassPt20 = (Zlep1pt[m]>20) || (Zlep2pt[m]>20) || (Zlep1pt[n]>20) || (Zlep2pt[n]>20); nPassPt10 = 0; - if (Zlep1pt[m]>10) nPassPt10 += 1; - if (Zlep2pt[m]>10) nPassPt10 += 1; - if (Zlep1pt[n]>10) nPassPt10 += 1; - if (Zlep2pt[n]>10) nPassPt10 += 1; + if (Zlep1pt[m]>10) nPassPt10 += 1; + if (Zlep2pt[m]>10) nPassPt10 += 1; + if (Zlep1pt[n]>10) nPassPt10 += 1; + if (Zlep2pt[n]>10) nPassPt10 += 1; if (nPassPt10 < 2) continue; if (nPassPt20 == false) continue; //lep Pt requirements lepPtTag++; @@ -679,8 +676,8 @@ bool H4LTools::ZZSelection(){ else{ zZ1 = Zlist[n]; zZ2 = Zlist[m]; - } - + } + bool passSmartCut = true; if (Zflavor[m]==Zflavor[n]){ TLorentzVector Za,Zb,lepM1,lepM2,lepN1,lepN2; @@ -697,15 +694,15 @@ bool H4LTools::ZZSelection(){ Za = lepM1 + lepN2; Zb = lepN1 + lepM2; } - + else{ Za = lepM1 + lepN1; Zb = lepN2 + lepM2; } if (fabs(Za.M()-Zmass)setInputEvent(&daughters, &associated, 0, 0); mela->setCurrentCandidateFromIndex(0); mela->setProcess(TVar::HSMHiggs, TVar::JHUGen, TVar::ZZGG); mela->computeP(me_0plus_JHU, true); - + mela->setProcess(TVar::H0minus, TVar::JHUGen, TVar::ZZGG); mela->computeP(p0minus_VAJHU, true); // additional probabilities GG_SIG_ghg2_1_ghz2_1_JHUGen mela->setProcess(TVar::H0hplus, TVar::JHUGen, TVar::ZZGG); - mela->computeP(p0plus_VAJHU, true); - + mela->computeP(p0plus_VAJHU, true); + // p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen, Couplings:ghg2=1,0;ghz1=1,0;ghz2=1,0 Options:SubtractP=GG_SIG_ghg2_1_ghz1_1_JHUGen,GG_SIG_ghg2_1_ghz2_1_JHUGen mela->setProcess(TVar::SelfDefine_spin0, TVar::JHUGen, TVar::ZZGG); (mela->selfDHggcoupl)[0][gHIGGS_GG_2][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_VV_1][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_VV_2][0]=1.; - mela->computeP(p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen, true); //FIXME + mela->computeP(p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen, true); //FIXME - p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen -= p0plus_VAJHU+me_0plus_JHU; + p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen -= p0plus_VAJHU+me_0plus_JHU; // p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen @@ -925,10 +922,10 @@ bool H4LTools::ZZSelection(){ (mela->selfDHggcoupl)[0][gHIGGS_GG_2][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_VV_1][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_VV_1_PRIME2][0]=10000.; - mela->computeP(p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen, true); //FIXME + mela->computeP(p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen, true); //FIXME p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen -= p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen+me_0plus_JHU; - // p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen, ghg2=1,0;ghzgs1_prime2=10000,0 + // p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen, ghg2=1,0;ghzgs1_prime2=10000,0 mela->setProcess(TVar::SelfDefine_spin0, TVar::JHUGen, TVar::ZZGG); (mela->selfDHggcoupl)[0][gHIGGS_GG_2][0]=1.; (mela->selfDHzzcoupl)[0][gHIGGS_ZA_1_PRIME2][0]=10000.; @@ -955,12 +952,12 @@ bool H4LTools::ZZSelection(){ mela->setProcess(TVar::bkgZZ, TVar::MCFM, TVar::ZZQQB); mela->computeP(me_qqZZ_MCFM, true); - + mela->computeD_gg(TVar::MCFM, TVar::D_gg10, Dgg10_VAMCFM); - + mela->setProcess(TVar::HSMHiggs, TVar::JHUGen, TVar::ZZGG); mela->computePM4l(TVar::SMSyst_None, p0plus_m4l); - + mela->setProcess(TVar::bkgZZ, TVar::JHUGen, TVar::ZZGG); mela->computePM4l(TVar::SMSyst_None, bkg_m4l); D_0m = me_0plus_JHU / (me_0plus_JHU + (p0minus_VAJHU * pow(getDg4Constant(massZZ),2))); @@ -971,7 +968,7 @@ bool H4LTools::ZZSelection(){ D_L1Zg = me_0plus_JHU / (me_0plus_JHU + ((p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen/1e8) * pow(getDL1ZgsConstant(massZZ),2))); mela->resetInputEvent(); return foundZZCandidate; - + } @@ -989,4 +986,4 @@ float H4LTools::getDL1Constant(float ZZMass){ float H4LTools::getDL1ZgsConstant(float ZZMass){ return spline_L1Zgs->Eval(ZZMass); -} +} \ No newline at end of file From 30a82a8249972a82036e013358fa24c9cde79ea7 Mon Sep 17 00:00:00 2001 From: YujiLee301 <99654114+YujiLee301@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:38:42 +0100 Subject: [PATCH 13/32] Update GenAnalysis.cc --- src/GenAnalysis.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GenAnalysis.cc b/src/GenAnalysis.cc index 6af840f..8bef780 100644 --- a/src/GenAnalysis.cc +++ b/src/GenAnalysis.cc @@ -230,7 +230,7 @@ void GenAnalysis::SetGenVariables(){ bool passedMassOS = true; bool passedElMuDeltaR = true; bool passedDeltaR = true; unsigned int N=GENlep_pt.size(); for(unsigned int i = 0; i Date: Fri, 16 Feb 2024 14:24:33 +0100 Subject: [PATCH 14/32] fix njet initializing --- interface/H4LTools.h | 2 +- post_proc.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/H4LTools.h b/interface/H4LTools.h index 54a1b86..ed34161 100644 --- a/interface/H4LTools.h +++ b/interface/H4LTools.h @@ -319,7 +319,7 @@ class H4LTools { pTj1 = -99; etaj1 = -99; phij1 = -99; mj1 = -99; pTj2 = -99; etaj2 = -99; phij2 = -99; mj2 = -99; - njets_pt30_eta4p7 = -1; + njets_pt30_eta4p7 = 0; flag4e=false; flag4mu=false; flag2e2mu=false; } diff --git a/post_proc.py b/post_proc.py index 7bf280b..b1032e6 100755 --- a/post_proc.py +++ b/post_proc.py @@ -105,12 +105,12 @@ def main(): if isMC: if (not args.NOsyst): # FIXME: JES not used properly - jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") - fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") + #jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") + #fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") # btagSF = lambda: btagSFProducer("UL"+str(year), algo="deepjet",selectedWPs=['L','M','T','shape_corr'], sfFileName=sfFileName) btagSF = lambda: btagSFProducer(era = "UL"+str(year), algo = "deepcsv") puidSF = lambda: JetSFMaker("%s" % year) - modulesToRun.extend([jetmetCorrector(), fatJetCorrector()])#, puidSF() + #modulesToRun.extend([jetmetCorrector(), fatJetCorrector()])#, puidSF() # # modulesToRun.extend([jetmetCorrector(), fatJetCorrector(), btagSF(), puidSF()]) # FIXME: No PU weight for 2022 @@ -120,11 +120,11 @@ def main(): p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=False,haddFileName="skimmed_nano_mc.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") else: - if (not args.NOsyst): + #if (not args.NOsyst): # FIXME: JES not used properly - jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") - fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") - modulesToRun.extend([jetmetCorrector(), fatJetCorrector()]) + #jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs") + #fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") + #modulesToRun.extend([jetmetCorrector(), fatJetCorrector()]) p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=False,haddFileName="skimmed_nano_data.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") From cdcb835836c73e41a6b53e350c4112a98c99e544 Mon Sep 17 00:00:00 2001 From: yuji Date: Fri, 16 Feb 2024 16:10:34 +0100 Subject: [PATCH 15/32] PU weight implemented --- H4LCppModule.py | 11 ++++- Input_2022.yml | 17 +++++++ PileupWeightHistoMaker.py | 42 ++++++++++++++++ data/Run3_2022_LHC_Simulation_10h_2h_cfi.py | 46 ++++++++++++++++++ data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc | Bin 0 -> 2263 bytes data/__init__.py | 0 data/__init__.pyc | Bin 0 -> 103 bytes ...760_GoldenJson-13p6TeV-66000ub-99bins.root | Bin 0 -> 4892 bytes ...760_GoldenJson-13p6TeV-69200ub-99bins.root | Bin 0 -> 4890 bytes ...760_GoldenJson-13p6TeV-72400ub-99bins.root | Bin 0 -> 4892 bytes data/pileupHistogram_2022.root | Bin 0 -> 4479 bytes data/pileupHistogram_2022down.root | Bin 0 -> 4499 bytes data/pileupHistogram_2022up.root | Bin 0 -> 4488 bytes post_proc.py | 2 +- 14 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 PileupWeightHistoMaker.py create mode 100644 data/Run3_2022_LHC_Simulation_10h_2h_cfi.py create mode 100644 data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc create mode 100644 data/__init__.py create mode 100644 data/__init__.pyc create mode 100755 data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-66000ub-99bins.root create mode 100755 data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-69200ub-99bins.root create mode 100755 data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-72400ub-99bins.root create mode 100644 data/pileupHistogram_2022.root create mode 100644 data/pileupHistogram_2022down.root create mode 100644 data/pileupHistogram_2022up.root diff --git a/H4LCppModule.py b/H4LCppModule.py index 7badd2e..ac4d654 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -50,7 +50,14 @@ def __init__(self,year,cfgFile,isMC,isFSR): self.worker.InitializeFsrPhotonCut(cfg['FsrPhoton']['pTcut'],cfg['FsrPhoton']['Etacut'],cfg['FsrPhoton']['Isocut'],cfg['FsrPhoton']['dRlcut'],cfg['FsrPhoton']['dRlOverPtcut']) self.worker.InitializeJetcut(cfg['Jet']['pTcut'],cfg['Jet']['Etacut']) self.worker.InitializeEvtCut(cfg['MZ1cut'],cfg['MZZcut'],cfg['Higgscut']['down'],cfg['Higgscut']['up'],cfg['Zmass'],cfg['MZcut']['down'],cfg['MZcut']['up']) - + self.PUweightfile = cfg["outputdataNPV"] + self.PUweighthisto = cfg["PUweightHistoName"] + PUinput_file = ROOT.TFile.Open(self.PUweightfile) + PUinput_hist = PUinput_file.Get(self.PUweighthisto) + self.PUweight_list = [] + for i in range(1, PUinput_hist.GetNbinsX() + 1): + self.PUweight_list.append(PUinput_hist.GetBinContent(i)) + PUinput_file.Close() self.passtrigEvts = 0 self.passZZEvts = 0 self.cfgFile = cfgFile @@ -245,6 +252,8 @@ def analyze(self, event): self.passtrigEvts += 1 else: return keepIt + if(isMC): + pileupWeight = self.PUweight_list[event.Pileup_nPU] electrons = Collection(event, "Electron") muons = Collection(event, "Muon") fsrPhotons = Collection(event, "FsrPhoton") diff --git a/Input_2022.yml b/Input_2022.yml index 470953d..e406e7f 100644 --- a/Input_2022.yml +++ b/Input_2022.yml @@ -99,3 +99,20 @@ Jet: 30 Etacut: 4.7 + +inputdataNPV: + "data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-69200ub-99bins.root" +inputdataNPVup: + "data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-72400ub-99bins.root" +inputdataNPVdown: + "data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-66000ub-99bins.root" + +outputdataNPV: + "data/pileupHistogram_2022.root" +outputdataNPVup: + "data/pileupHistogram_2022up.root" +outputdataNPVdown: + "data/pileupHistogram_2022down.root" + +PUweightHistoName: + "pileupWeight" \ No newline at end of file diff --git a/PileupWeightHistoMaker.py b/PileupWeightHistoMaker.py new file mode 100644 index 0000000..94a1e77 --- /dev/null +++ b/PileupWeightHistoMaker.py @@ -0,0 +1,42 @@ +import ROOT +import yaml +from data.Run3_2022_LHC_Simulation_10h_2h_cfi import * + +def getPUweight(pileupdatafile, inputhistoname, outputhistoname, outdir): + + input_file = ROOT.TFile.Open(pileupdatafile) + input_hist = input_file.Get(inputhistoname) + output_hist = ROOT.TH1D(outputhistoname, outputhistoname, input_hist.GetNbinsX(), input_hist.GetXaxis().GetXmin(), input_hist.GetXaxis().GetXmax()) + sum_data_entries = 0 + sum_MC_entries = 0 + for j in range(1, input_hist.GetNbinsX() + 1): + sum_data_entries += input_hist.GetBinContent(j) + sum_MC_entries += probValue[j-1] + for i in range(1, input_hist.GetNbinsX() + 1): + bin_content = input_hist.GetBinContent(i)/(probValue[i-1]*sum_data_entries/sum_MC_entries) + output_hist.SetBinContent(i, bin_content) + output_file = ROOT.TFile.Open(outdir, "RECREATE") + output_hist.Write() + input_file.Close() + output_file.Close() + +def MakeHisto(year): + + if year == 2022: + cfgFile = "Input_2022.yml" + with open(cfgFile, 'r') as ymlfile: + cfg = yaml.load(ymlfile) + inputdataNPV = cfg['inputdataNPV'] + inputdataNPVup = cfg['inputdataNPVup'] + inputdataNPVdown = cfg['inputdataNPVdown'] + outputdataNPV = cfg['outputdataNPV'] + outputdataNPVup = cfg['outputdataNPVup'] + outputdataNPVdown = cfg['outputdataNPVdown'] + outputhistoname = cfg['PUweightHistoName'] + + getPUweight(inputdataNPV, "pileup", outputhistoname, outputdataNPV) + getPUweight(inputdataNPVup, "pileup", outputhistoname, outputdataNPVup) + getPUweight(inputdataNPVdown, "pileup", outputhistoname, outputdataNPVdown) + +MakeHisto(2022) + diff --git a/data/Run3_2022_LHC_Simulation_10h_2h_cfi.py b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.py new file mode 100644 index 0000000..00fd2dc --- /dev/null +++ b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.py @@ -0,0 +1,46 @@ +probFunctionVariable = [ + 0, 1, 2, 3, + 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, + 99] + + +probValue = [ + 7.075550618391933e-8, 1.8432226484975646e-7, 4.6156514471969593e-7, 0.0000011111611991838491, + 0.0000025719752161798103, 0.000005724865812608344, 0.000012255841383374045, 0.000025239403069596116, 0.00005001054998201597, + 0.00009536530158990567, 0.00017505633393457624, 0.00030942214916825035, 0.0005268123536229287, 0.0008642843968521786, + 0.0013669182280399903, 0.0020851167548246985, 0.0030695148409245446, 0.004363635945105083, 0.005995143197404548, + 0.007967247822222358, 0.010252302872826594, 0.01278957659177177, 0.015488544412469806, 0.01823784978331645, + 0.020918669702105028, 0.023420019399650906, 0.025652949149203495, 0.027560835627835043, 0.02912397347687914, + 0.030358091266301533, 0.03130778480604892, 0.03203676872496023, 0.0326170853351521, 0.03311902652393314, + 0.033602777248239, 0.0341120235754556, 0.03466927947785801, 0.03527261707506484, 0.035893786618889145, + 0.03647817900850185, 0.036947435730750315, 0.03720550450678737, 0.037148460727673235, 0.03667753703450604, + 0.03571377296329832, 0.034211859754226276, 0.032170439241889726, 0.029636506070368274, 0.02670262519076345, + 0.023497154911314072, 0.020169158697337236, 0.016870783471647905, 0.013740289679427057, 0.010888563843704815, + 0.008390977574442656, 0.006285186751143873, 0.004574246293656772, 0.003233538335807419, 0.002219622271900557, + 0.0014792038980537092, 0.0009568560481315006, 0.0006007171037926386, 0.00036596934105178995, 0.0002163349104153549, + 0.00012407362512604619, 0.0000690356949524181, 0.000037263645547231494, 0.00001951170588910065, 0.000009910336118978026, + 0.0000048826244075428666, 0.0000023333596885075797, 0.0000010816029570543702, 4.863048449289416e-7, 2.1208148308081624e-7, + 8.97121135679932e-8, 3.6809172420519874e-8, 1.4649459937201982e-8, 5.655267024863598e-9, 2.117664468591336e-9, + 7.692038404370259e-10, 2.7102837405697987e-10, 9.263749466613295e-11, 3.071624552355945e-11, 9.880298997379985e-12, + 3.0832214331312204e-12, 9.33436314183754e-13, 2.7417209623761203e-13, 7.813293248960901e-14, 2.1603865264197903e-14, + 5.796018523167997e-15, 1.5088422256459697e-15, 3.811436255838504e-16, 9.342850737730402e-17, 2.2224464483477953e-17, + 5.130498608124184e-18, 1.1494216669980747e-18, 2.499227229379666e-19, 5.2741621866055994e-20, 1.080281961755894e-20, + 2.1476863811171814e-21] diff --git a/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7154e7fee74baf52341b3a4cee89441d14bdb73e GIT binary patch literal 2263 zcma*ndvr}#9tZF*K_X~KNJ6EN5aQ89Lh6!x@1}`7h*zQ>AtK2)ey&J_ z9dGeUF``UqRn()D%96o!&8(qjRmEd8YcQp=1{uux&6>65-=4G1=X}rEd+oi}KKuMU zp0@H1a$U{M!T%0g_kq?`G_^5cJ+Kkj81w*}fK9<>peN`BHV3`I7GO)T75E0|1GWa+ zfWDv~*cNOD`hx*rAlM%40KN%!1cSi0z+kWw7y^cZoxv_(7}yo;28M&(!5&~wuow6? z7y(9ty}>9j8teo11!KT>z<a5VTHI0hUGjswSo>EHx#BA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ra7eZy-hK`uVNh1&wcOi zozy^wto-MR6X_jZ*roP_-@@S$H|=8U{`B_E*(dFC)+>MOm4{pGayh`qXGukgU2fHT z`ZPN*)-J8b-e38$PmEo{&lH6`DD<_<5U+Iy{X-we%8l!xlm51(CRR!t#m}!v+8aAO zT+3~-R>s0vGqMxh1v$m883kjqX1TJmr{@-HrPYQpS<~IQTHEk{inO>ft2iq%)m_jh zGrD(lbY@CYTxOap-#tA`hsliUJvB3WYG%$9S43e+v6t1~oA6mwwn$4$%SJxG L>TKTR*Y^AmFl(P> literal 0 HcmV?d00001 diff --git a/data/__init__.py b/data/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/data/__init__.pyc b/data/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bce9277c926a17108fac5f0be927e63017c96393 GIT binary patch literal 103 zcmZSn%*)l5c|J9n0SXv_v;zGP)_xI0O%T0BkKRRh^j_j9L3GCnIR!`WHF|F$P7p$f=)FfLNA+TN5L$ROR&d%P_-g$7n`kyqMB;e0M)1D^SYM|xM$$$O^ z0Qe>vE-*;8Fa(Jbc7&sZQJzQ-h%nRx>E$Nuh=jv!VP0?-1QO-q=_l-Vz0=Fh7H01W zL3s*`iHL~_tEj4}YiRy^Ma$(H4fU{x3#vjqJZ)8xFqjL<1&KiY*=j2;DJd!7&%Rx{^#=!-F67u-N%RlyF0RA5)|FQ`H z+kgD@zl;I^1@ixM(+$}_-oOX_#S8xR^YI`24HGR8QQ6~I3j+! zB=ukpu%jOcfGLxN*4F0M`%s)sSrD+1Za&hjv;;BZ;qT&vw($`HoR|{sK%UOQ!@kz1 zt_@A3=9gwD#MHrw1;>ixv&PCVA+lF1Pl5W<9eri+(pY=Sv{3{@Fd0!O#pABIV@skZ zE=C8`FD0S%kZE+YB{Ej7rwaqMWl)d)e5;X|$^v8XK%d-8pQBAIP+g)jS+OeFI;Z&{ zJUGzM-q?=z!qCU9wGMXlUNrtCt8;>=v~S%8vcsCrA>#nbdMCkteEp2_StniRpv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&$v$}|z)!=p_F{nU5$4E|IcT$cp`99*ARRMXoi(tg%EF-}%hw>s77z5Afn zuS$5pL_fH>8zHP)-~B5#hFznvyZU*@c$=L$>@WI{;U#+_1yyZuXd^Wy8|s?O3<6;K zE_T0iwx0Ig2nCwF?=$y>p|F zd`j-on%cl}wq&Al5aWQ{eId}#cR4SA?Z-(GJA-;Zk5rFM2zjmum08x+?8=K;7IO5= zR~G)TM`(}CVk3WguiV2VsUkGH&N zfy}C8QXn&=)=@;`OSDcA^V0;b)lFo# zF%Ak#YlYV<6kD!dt!)|-Z)i_(8EbJgZ@XMq9^CW|Rcs)zDHG3wSr0Wg|MYS&gZ)I{DL ziHY#0yfz`*NX$|^J2b7+QWhIQz`KN;rVsq@+Z|?3C^XHf$IotYJ&wzjEqV`~{FFHJ z=xkCt%DR<;TH>Pu?fF}#-({(l5qIP|?r9*&-uQEl1$+|Sx7xwV4>;nDbDtK!;by{V z;rrKq{ZJhVQlZBd4em~gha}HQsT8o5tRX!1GE+lrmt2P>ww0~p?Xng)Zbg|_-r(tc z&KsLLzh6WAm`xBn_&y_22aes_{M&EOCgnx+>4z=@HLM%g8P7|bA5Ntc*+GTN)ow1h zcKO?Kkvm_)h2kT3&I9MJo6E8-RJ>T{2%HNAqA^TT6^hb6bwB)Gr()$iQoR1k>G5m7 zyvRTZw0Hl&fqrWTzC>4~x`MWW6}2#xPP@hCgfqXV055W|Ku_0^B|MAmN$VS%e~R@B zB1HC23jK!&A(iWYQt1C^B82osQnvs9;0;IuU4JMa+W*n?53xil7XGs}CF#k+8KRg2 F{0l2-qU!(v literal 0 HcmV?d00001 diff --git a/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-72400ub-99bins.root b/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-72400ub-99bins.root new file mode 100755 index 0000000000000000000000000000000000000000..d858c17da8f9f5e24c53d60de1885f4732bc5b92 GIT binary patch literal 4892 zcmd5=cQl+|w|)nslO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1ow~^Ai7Gk)Kmv2@il|0RI6#lO>M; literal 0 HcmV?d00001 diff --git a/data/pileupHistogram_2022down.root b/data/pileupHistogram_2022down.root new file mode 100644 index 0000000000000000000000000000000000000000..31e02521e45b727a3f1521584f0cf7ec8fc767f2 GIT binary patch literal 4499 zcmbVQXEfa1*ZnD@M}inc@6k&bq6AS#4>Hjiy^kRY872}nN)SDIjT(s{ zdXGK``HTODcfFt9XT5i=v+lX;-gD0WwAa4d3xPla!0rM70CoUCg}MsWt6cXg@UFs% z@V^Pj5&*~@0KDwW*2IAss-1j#UjO*G=H08?f3?uS-$vHRg5S1)%5~?fX#fB+Qge2* z=dgn#;Ub<_nUAN2vo{jq=mmGT5*HO0w?p`O2z&j7_;20-puhdEX8=I>RePtaxSj(5 zw>tkX@Px3x7(v?C_4of`#3T7zPiUkerb6*wbWiM^9i5Q>>tL!)a+?s)1_AzfNvKf$ zF(3MFRtOP=3MCb#kw!=?zVMe=t1tP(ejIEp{`3^#ago|-`mtEf4SENI(WgXYX}`e| zx1k9=Mz`%5I7q z_jbGJOpWh8cPMY2%7=PQx0@O=^F1Tr01a;FRefzxASe$sm=R{i4 z&RIysIm-+6$w{IzvN>~A!A;KTqBtd++dt68=0ys_&ajp$91WT+sSd(>>n_X;bIvGK^hxHvFO5AxP46C2qATl61a z`w+83`s&xkvw)H{K(`r&%soG2c=bw)!uEZA(gqV>qg*w^gu4N(r?*Z&cqgZLRG8Q( zcNLR%5W0Z=6!A6CD0Xol*u-rvmS}o0oZ;ROF}dHx4RpLpimwus!^CzM-Z^hJd~k%* ze_>hmeiUSXgE_g&fbzJXb_zBlVO!o;o;-Mv*60+t~T_ys^dmY_mh1 zSAwpC=2L^++4&YxFZHrjcm-m|c7(Wy@EKp8=|jYH{JfdB1$kkalLERda!Olo$`Xjb zDx^N~IoT0HV%hW0V5;{Hlk5(Vy3S71UewfsdT#fFbG9y@yR>k6aY7N&6Hk9~aoN^| zc-aG}B^KEC-au;Qp(yST-6rKcM?z_%6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q}zVC1BXXT5;#08*cB9)N``)G?|4IaEq0sm{l!A7+O^rHsj5>NRxhbp=+M}db`)F zYT;zVwX4%tk;Y(M1da{PpOySsGGF7DlR6_tfE5-jEJ{JzX^hy)WJ{Xy6O_cR|38A_?gh0w{m++gWBFI;{D-8vxNpJnPr6*ON9 zOlfLVs8`{$X*gC)saCo9%SMTzZ!YZan;`Fsg= zqZRj{pvh8(v$W%!m67f~?CUIb93Zg9tYI()6KIzy0 zBjIJQrq!I7J~(>NM0sh&(3dU|qY^8aP~tLEe{eMQoM{{x8s7=Hi& literal 0 HcmV?d00001 diff --git a/post_proc.py b/post_proc.py index b1032e6..f4b24c9 100755 --- a/post_proc.py +++ b/post_proc.py @@ -18,7 +18,7 @@ def parse_arguments(): """Parse command line arguments.""" parser = argparse.ArgumentParser() parser.add_argument("-i", "--inputFile", default="", type=str, help="Input file name") - parser.add_argument("-n", "--entriesToRun", default=0, type=int, help="Set to 0 if need to run over all entries else put number of entries to run") + parser.add_argument("-n", "--entriesToRun", default=100, type=int, help="Set to 0 if need to run over all entries else put number of entries to run") parser.add_argument("-d", "--DownloadFileToLocalThenRun", default=True, type=bool, help="Download file to local then run") parser.add_argument("--NOsyst", default=False, action="store_true", help="Do not run systematics") return parser.parse_args() From b9410e67fa160d43120173d2118d9c689564c057 Mon Sep 17 00:00:00 2001 From: yuji Date: Mon, 26 Feb 2024 13:39:28 +0100 Subject: [PATCH 16/32] Update README --- README.md | 6 +-- input_data_Files/sample_list_v12_2022.dat | 61 ++++++++++++----------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index b360f67..d7734f3 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. cd $CMSSW_BASE/src git clone git@github.com:ram1123/nanoAOD_skim.git PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim cd PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim - git checkout HZZ_Analysis + git checkout HZZ_Analysis_Run3 cd - cmsenv # patch PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/nanoAOD_tools.patch @@ -64,7 +64,7 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. ```bash cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim # Use the arguments that you need. - python condor_setup_lxplus.py --input-file sample_list_v9.dat + python condor_setup_lxplus.py --input-file sample_list_v12_2022.dat # Set proxy before submitting the condor jobs. voms-proxy-init -voms cms --valid 200:00 condor_submit .jdl @@ -83,7 +83,7 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. 1. [condor_setup_lxplus.py](condor_setup_lxplus.py): This script can be used to setup the condor jobs. It takes the input text file (present inside directory [input_data_Files](input_data_Files)) from which you need to take input NanoAOD DAS names. Also, updated the output EOS path. Then do the following: ```bash - python condor_setup_lxplus.py --input-file sample_list_v9.dat + python condor_setup_lxplus.py --input-file sample_list_v12_2022.dat ``` This will create the condor job files and the condor log files. diff --git a/input_data_Files/sample_list_v12_2022.dat b/input_data_Files/sample_list_v12_2022.dat index dabf1c8..50f55ea 100644 --- a/input_data_Files/sample_list_v12_2022.dat +++ b/input_data_Files/sample_list_v12_2022.dat @@ -1,32 +1,35 @@ # Data -/SingleMuon/Run2022C-16Dec2023-v1/NANOAOD -/DoubleMuon/Run2022C-16Dec2023-v1/NANOAOD -/Muon/Run2022C-16Dec2023-v1/NANOAOD -/Muon/Run2022D-16Dec2023-v1/NANOAOD -/Muon/Run2022E-16Dec2023-v1/NANOAOD -/Muon/Run2022F-16Dec2023-v1/NANOAOD -/Muon/Run2022G-19Dec2023-v2/NANOAOD -/MuonEG/Run2022C-22Sep2023-v1/NANOAOD -/MuonEG/Run2022D-22Sep2023-v1/NANOAOD -/MuonEG/Run2022E-22Sep2023-v1/NANOAOD -/MuonEG/Run2022F-22Sep2023-v1/NANOAOD -/MuonEG/Run2022G-22Sep2023-v1/NANOAOD -/EGamma/Run2022C-16Dec2023-v1/NANOAOD -/EGamma/Run2022D-16Dec2023-v1/NANOAOD -/EGamma/Run2022E-16Dec2023-v1/NANOAOD -/EGamma/Run2022F-16Dec2023-v1/NANOAOD -/EGamma/Run2022G-16Dec2023-v1/NANOAOD +#/SingleMuon/Run2022C-16Dec2023-v1/NANOAOD +#/DoubleMuon/Run2022C-16Dec2023-v1/NANOAOD +#/Muon/Run2022C-16Dec2023-v1/NANOAOD +#/Muon/Run2022D-16Dec2023-v1/NANOAOD +#/Muon/Run2022E-16Dec2023-v1/NANOAOD +#/Muon/Run2022F-16Dec2023-v1/NANOAOD +#/Muon/Run2022G-19Dec2023-v2/NANOAOD +#/MuonEG/Run2022C-22Sep2023-v1/NANOAOD +#/MuonEG/Run2022D-22Sep2023-v1/NANOAOD +#/MuonEG/Run2022E-22Sep2023-v1/NANOAOD +#/MuonEG/Run2022F-22Sep2023-v1/NANOAOD +#/MuonEG/Run2022G-22Sep2023-v1/NANOAOD +#/EGamma/Run2022C-16Dec2023-v1/NANOAOD +#/EGamma/Run2022D-16Dec2023-v1/NANOAOD +#/EGamma/Run2022E-16Dec2023-v1/NANOAOD +#/EGamma/Run2022F-16Dec2023-v1/NANOAOD +#/EGamma/Run2022G-16Dec2023-v1/NANOAOD # # MC -/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM -/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM -/VBFHto2Zto4L_M125_TuneCP5_13p6TeV_powheg-jhugenv752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM -/VBFHto2Zto4L_M125_TuneCP5_13p6TeV_powheg-jhugenv752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM -/WminusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM -/WminusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM -/WplusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM -/WplusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM -/ZHto2Zto4L_M125_TuneCP5_13p6TeV_powheg2-minlo-HZJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM -/ZHto2Zto4L_M125_TuneCP5_13p6TeV_powheg2-minlo-HZJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM -/TTH_Hto2Z_M-125_4LFilter_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM -/TTH_Hto2Z_M-125_4LFilter_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +#/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +#/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +#/VBFHto2Zto4L_M125_TuneCP5_13p6TeV_powheg-jhugenv752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +#/VBFHto2Zto4L_M125_TuneCP5_13p6TeV_powheg-jhugenv752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +#/WminusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +#/WminusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +#/WplusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +#/WplusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +#/ZHto2Zto4L_M125_TuneCP5_13p6TeV_powheg2-minlo-HZJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +#/ZHto2Zto4L_M125_TuneCP5_13p6TeV_powheg2-minlo-HZJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +#/TTH_Hto2Z_M-125_4LFilter_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM +#/TTH_Hto2Z_M-125_4LFilter_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM +# +#bkg MC +/ZZto4L_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5_ext1-v2/NANOAODSIM From e20f2d1388d4a08a06389ec05bae26704eabe156 Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Fri, 1 Mar 2024 10:07:25 +0100 Subject: [PATCH 17/32] Fix conflict --- keep_and_drop.txt | 120 ++++++++++++++++++++--------------------- keep_and_drop_data.txt | 90 ++++++++++++++++--------------- 2 files changed, 106 insertions(+), 104 deletions(-) diff --git a/keep_and_drop.txt b/keep_and_drop.txt index e82174f..d022ddd 100644 --- a/keep_and_drop.txt +++ b/keep_and_drop.txt @@ -9,11 +9,11 @@ keep BeamSpot* # # # GEN -keep GenFilter* +#keep GenFilter* # # Others -keep LowPtElectron* -keep nLowPtElectron* +#keep LowPtElectron* +#keep nLowPtElectron* keep OtherPV* keep nOtherPV* keep PV* @@ -21,9 +21,9 @@ keep PV* # # Trigger # -keep HLT* +#keep HLT* # -keep Flag* +#keep Flag* # # keep *4l @@ -42,67 +42,67 @@ keep D_* keep lep* keep *Weight keep *Weight* -keep nPhoton -keep Photon* -keep nElectron -keep Electron* -keep nMuon -keep Muon* -keep nTau -keep Tau* -keep HTXS* -keep btag* -keep CaloMET* -keep ChsMET* -keep nCorrT1METJet -keep CorrT1METJet* -keep DeepMET* -keep nFatJet -keep FatJet* -keep nGenJetAK8 -keep GenJetAK8* -keep nGenJet -keep GenJet* -keep nGenPart -keep GenPart* -keep nSubGenJetAK8 -keep SubGenJetAK8* -keep Generator* -keep GenV* -keep gen* +# keep nPhoton +# keep Photon* +# keep nElectron +# keep Electron* +# keep nMuon +# keep Muon* +# keep nTau +# keep Tau* +# keep HTXS* +# keep btag* +# keep CaloMET* +# keep ChsMET* +# keep nCorrT1METJet +# keep CorrT1METJet* +# keep DeepMET* +# keep nFatJet +# keep FatJet* +# keep nGenJetAK8 +# keep GenJetAK8* +# keep nGenJet +# keep GenJet* +# keep nGenPart +# keep GenPart* +# keep nSubGenJetAK8 +# keep SubGenJetAK8* +# keep Generator* +# keep GenV* +# keep gen* keep LHE* keep nLHE* keep nPS* keep PS* -keep nIsoTrack -keep IsoTrack* -keep nJet -keep Jet* -keep L1* -keep nLowPtElectron -keep LowPtElectron* -keep GenMET* -keep MET* +#keep nIsoTrack +#keep IsoTrack* +#keep nJet +#keep Jet* +#keep L1* +#keep nLowPtElectron +#keep LowPtElectron* +#keep GenMET* +#keep MET* keep Pileup* -keep PuppiMET* -keep RawMET* -keep RawPuppiMET* -keep fixedGridRho* -keep Rho_* -keep nGenDressedLepton -keep GenDressedLepton* -keep nSubJet -keep SubJet* -keep TkMET* -keep genTtbarId +#keep PuppiMET* +#keep RawMET* +#keep RawPuppiMET* +#keep fixedGridRho* +#keep Rho_* +#keep nGenDressedLepton +#keep GenDressedLepton* +#keep nSubJet +#keep SubJet* +#keep TkMET* +#keep genTtbarId keep nOtherPV keep OtherPV* keep PV* -keep nSV -keep SV* -keep Electron_gen* -keep FatJet_* -keep Gen* +#keep nSV +#keep SV* +#keep Electron_gen* +#keep FatJet_* +#keep Gen* keep genWeight -keep Jet_* -keep Muon* +#keep Jet_* +#keep Muon* diff --git a/keep_and_drop_data.txt b/keep_and_drop_data.txt index 1f9c165..aae6702 100644 --- a/keep_and_drop_data.txt +++ b/keep_and_drop_data.txt @@ -7,8 +7,8 @@ keep event keep lumi* keep BeamSpot* # Others -keep LowPtElectron* -keep nLowPtElectron* +#keep LowPtElectron* +#keep nLowPtElectron* keep OtherPV* keep nOtherPV* keep PV* @@ -16,9 +16,9 @@ keep PV* # # Trigger # -keep HLT* +#keep HLT* # -keep Flag* +#keep Flag* # # keep *4l @@ -30,50 +30,52 @@ keep *L3 keep *L4 keep *j1 keep *j2 +keep pass* +#keep GEN* +keep njet* keep D_* keep lep* keep *Weight keep *Weight* -keep nPhoton -keep Photon* -keep nElectron -keep Electron* -keep nMuon -keep Muon* -keep nTau -keep Tau* -keep HTXS* -keep btag* -keep CaloMET* -keep ChsMET* -keep nCorrT1METJet -keep CorrT1METJet* -keep DeepMET* -keep nFatJet -keep FatJet* -keep nIsoTrack -keep IsoTrack* -keep nJet -keep Jet* -keep L1* -keep nLowPtElectron -keep LowPtElectron* -keep MET* -# keep Pileup* -keep PuppiMET* -keep RawMET* -keep RawPuppiMET* -keep fixedGridRho* -keep Rho_* -keep nSubJet -keep SubJet* -keep TkMET* +#keep nPhoton +#keep Photon* +#keep nElectron +#keep Electron* +#keep nMuon +#keep Muon* +#keep nTau +#keep Tau* +#keep HTXS* +#keep btag* +#keep CaloMET* +#keep ChsMET* +#keep nCorrT1METJet +#keep CorrT1METJet* +#keep DeepMET* +#keep nFatJet +#keep FatJet* +#keep nIsoTrack +#keep IsoTrack* +#keep nJet +#keep Jet* +#keep L1* +#keep nLowPtElectron +#keep LowPtElectron* +#keep MET* +keep Pileup* +#keep PuppiMET* +#keep RawMET* +#keep RawPuppiMET* +#keep fixedGridRho* +#keep Rho_* +#keep nSubJet +#keep SubJet* +#keep TkMET* keep nOtherPV keep OtherPV* keep PV* -keep nSV -keep SV* -keep FatJet_* -keep Jet_* -keep Muon* -keep pass* +#keep nSV +#keep SV* +#keep FatJet_* +#keep Jet_* +#keep Muon* From dbe1dc2df760ed1e1199ee0b37378155f66e9ced Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Fri, 1 Mar 2024 15:02:06 +0100 Subject: [PATCH 18/32] Fix conflict --- condor_setup_lxplus.py | 16 ++++++++-------- post_proc.py | 6 ++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index 0d0a52b..8585d2c 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -128,7 +128,7 @@ def main(args): outjdl_file.write("Output = "+output_log_path+"/"+sample_name+"_$(Process).stdout\n") outjdl_file.write("Error = "+output_log_path+"/"+sample_name+"_$(Process).err\n") outjdl_file.write("Log = "+output_log_path+"/"+sample_name+"_$(Process).log\n") - outjdl_file.write("Arguments = "+(xrd_redirector+root_file)+" "+output_path+" "+EOS_Output_path+"\n") + outjdl_file.write("Arguments = "+(xrd_redirector+root_file)+" "+output_path+" "+EOS_Output_path+ " " + (root_file.split('/')[-1]).split('.')[0] + "\n") outjdl_file.write("Queue \n") print("Number of files: ",count_root_files) print("Number of jobs (till now): ",count_jobs) @@ -163,14 +163,14 @@ def main(args): outScript.write("\n"+'echo "====> List root files : " '); outScript.write("\n"+'ls *.root'); outScript.write("\n"+'echo "====> copying *.root file to stores area..." '); - outScript.write("\n"+'if ls *_Skim.root 1> /dev/null 2>&1; then'); - outScript.write("\n"+' echo "File *_Skim.root exists. Copy this."'); - outScript.write("\n"+' echo "cp *_Skim.root ${2}"'); - outScript.write("\n"+' cp *_Skim.root ${2}'); + outScript.write("\n"+'if ls skimmed_nano.root 1> /dev/null 2>&1; then'); + outScript.write("\n"+' echo "File skimmed_nano.root exists. Copy this."'); + outScript.write("\n"+' echo "cp skimmed_nano.root ${2}/${4}_Skim.root"'); + outScript.write("\n"+' cp skimmed_nano.root ${2}/${4}_Skim.root'); outScript.write("\n"+'else'); - outScript.write("\n"+' echo "file *_Skim.root does not exists, so copy *.root file."'); - outScript.write("\n"+' echo "cp *.root ${2}"'); - outScript.write("\n"+' cp *.root ${2}'); + outScript.write("\n"+' echo "file skimmed_nano.root does not exists, so copy *.root file."'); + outScript.write("\n"+' echo "cp *.root ${2}/${4}_Skim.root"'); + outScript.write("\n"+' cp *.root ${2}/${4}_Skim.root'); outScript.write("\n"+'fi'); outScript.write("\n"+'rm *.root'); outScript.write("\n"+'cd ${_CONDOR_SCRATCH_DIR}'); diff --git a/post_proc.py b/post_proc.py index f4b24c9..91a444e 100755 --- a/post_proc.py +++ b/post_proc.py @@ -118,7 +118,9 @@ def main(): if year == 2017: modulesToRun.extend([puAutoWeight_2017()]) if year == 2016: modulesToRun.extend([puAutoWeight_2016()]) - p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=False,haddFileName="skimmed_nano_mc.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") + # INFO: Keep the `fwkJobReport=False` to trigger `haddnano.py` + # otherwise the output file will have larger size then expected. Reference: https://github.com/cms-nanoAOD/nanoAOD-tools/issues/249 + p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=True,haddFileName="skimmed_nano.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") else: #if (not args.NOsyst): # FIXME: JES not used properly @@ -126,7 +128,7 @@ def main(): #fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi") #modulesToRun.extend([jetmetCorrector(), fatJetCorrector()]) - p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=False,haddFileName="skimmed_nano_data.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") + p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=True,haddFileName="skimmed_nano.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") p.run() From 7cca5383340f054fbe01191f8422d4d9dfe98445 Mon Sep 17 00:00:00 2001 From: yuji Date: Tue, 5 Mar 2024 22:05:00 +0100 Subject: [PATCH 19/32] add finalState flag and optimized evt keeping --- FrameworkJobReport.xml | 1 + H4LCppModule.py | 10 ++++++++-- data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc | Bin 2263 -> 2337 bytes data/__init__.pyc | Bin 103 -> 177 bytes interface/H4LTools.h | 3 ++- src/H4LTools.cc | 8 ++++++-- 6 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 FrameworkJobReport.xml diff --git a/FrameworkJobReport.xml b/FrameworkJobReport.xml new file mode 100644 index 0000000..5fd474c --- /dev/null +++ b/FrameworkJobReport.xml @@ -0,0 +1 @@ +/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2520000/dcae7632-2ea5-4832-80f0-de7d45837a7f.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/25212339-d2db-48c4-936d-fc47e9de45e9.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/7a86daa3-36d3-42a4-8962-dc831b8608e0.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/c7c62ee7-13a9-4de1-962d-64503a6fef05.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/a2a64a49-3404-49db-bf42-cb0ceb5218e2.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/b46903af-5d85-479e-b776-0803db6c3e2c.rootprimaryFilessourcePoolSource100skimmed_nano.rootNANOPoolOutputModuledc90308e392b2fa1e0eff46acbfa24bc1 \ No newline at end of file diff --git a/H4LCppModule.py b/H4LCppModule.py index ac4d654..8444b95 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -111,6 +111,7 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): self.out.branch("GENpT4l", "F") self.out.branch("rapidity4l", "F") self.out.branch("njets_pt30_eta4p7", "I") + self.out.branch("finalState", "I") self.out.branch("GENnjets_pt30_eta4p7", "I") self.out.branch("GENrapidity4l", "F") self.out.branch("eta4l", "F") @@ -228,6 +229,7 @@ def analyze(self, event): mass4e=0 mass2e2mu=0 mass4mu=0 + finalState=-1 GENmass4l = -99 GENpT4l = -99 nVECZ = 2 @@ -370,8 +372,11 @@ def analyze(self, event): lep_genindex.append(lep_genindex_vec[i]) if (foundZZCandidate): self.passZZEvts += 1 - keepIt = True - + if (passedFullSelection |passedFiducialSelection ): keepIt = True + if self.worker.RecoFourMuEvent: finalState = 1 + if self.worker.RecoFourEEvent: finalState = 2 + if self.worker.RecoTwoETwoMuEvent: finalState = 3 + if self.worker.RecoTwoMuTwoEEvent: finalState = 4 pTZ1 = self.worker.Z1.Pt() etaZ1 = self.worker.Z1.Eta() phiZ1 = self.worker.Z1.Phi() @@ -451,6 +456,7 @@ def analyze(self, event): self.out.fillBranch("rapidity4l",rapidity4l) self.out.fillBranch("GENrapidity4l",GENrapidity4l) self.out.fillBranch("njets_pt30_eta4p7",njets_pt30_eta4p7) + self.out.fillBranch("finalState",finalState) self.out.fillBranch("GENnjets_pt30_eta4p7",GENnjets_pt30_eta4p7) self.out.fillBranch("eta4l",eta4l) self.out.fillBranch("phi4l",phi4l) diff --git a/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc index 7154e7fee74baf52341b3a4cee89441d14bdb73e..edabac270f033b8bd0d2fc969d9e47394dac20c7 100644 GIT binary patch delta 99 zcmcaExKN0l`7^{mCvIlK~60B)tFt delta 25 hcmZ1|bX}00`7PPL%OiUL delta 22 dcmdnUn9k1pnU||A^ZZ11GZp~`28M~Eval(ZZMass); -} \ No newline at end of file +} From 48243e6d19486161a91a212bd706b97bd174b7b7 Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Sat, 9 Mar 2024 01:14:57 +0100 Subject: [PATCH 20/32] - Updated how condor job identifies data and MC - Updated variable name --- condor_setup_lxplus.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index 8585d2c..a6af985 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -80,45 +80,45 @@ def main(args): outjdl_file.write("x509userproxy = $ENV(X509_USER_PROXY)\n") count = 0 count_jobs = 0 - for lines in in_file: - if lines[0] == "#": continue + for SampleDASName in in_file: + if SampleDASName[0] == "#": continue count = count +1 #if count > 1: break print(style.RED +"="*51+style.RESET+"\n") print ("==> Sample : ",count) - sample_name = lines.split('/')[1] - campaign = lines.split('/')[2].split('-')[0] + sample_name = SampleDASName.split('/')[1] print("==> sample_name = ",sample_name) - print("==> campaign = ",campaign) ######################################## # # Create output directory # ######################################## - if sample_name.find("SingleMuon") != -1 or sample_name.find("SingleElectron") != -1 or sample_name.find("EGamma") != -1 or sample_name.find("DoubleMuon") != -1 or sample_name.find("MuonEG") != -1 or sample_name.find("DoubleEG") != -1: + if (SampleDASName.strip()).endswith("/NANOAOD"): # if the sample name ends with /NANOAOD, then it is a data if it ends with /NANOAODSIM then it is a MC. As the line contain the "\n" at the end, so we need to use the strip() function. + campaign = SampleDASName.split('/')[2].split('-')[0] + print("==> campaign = ",campaign) output_string = sample_name + os.sep + campaign + os.sep + dirName output_path = EOS_Output_path + os.sep + output_string - os.system("mkdir "+EOS_Output_path + os.sep + sample_name) - os.system("mkdir "+EOS_Output_path + os.sep + sample_name + os.sep + campaign) - os.system("mkdir "+ EOS_Output_path + os.sep + sample_name + os.sep + campaign + os.sep + dirName) + os.system("mkdir -p "+EOS_Output_path + os.sep + sample_name) + os.system("mkdir -p "+EOS_Output_path + os.sep + sample_name + os.sep + campaign) + os.system("mkdir -p "+ EOS_Output_path + os.sep + sample_name + os.sep + campaign + os.sep + dirName) infoLogFiles.send_git_log_and_patch_to_eos(EOS_Output_path + os.sep + sample_name + os.sep + campaign + os.sep + dirName) else: output_string = sample_name+os.sep+dirName output_path = EOS_Output_path+ os.sep + output_string - os.system("mkdir "+EOS_Output_path + os.sep + sample_name) - os.system("mkdir "+EOS_Output_path + os.sep + sample_name+os.sep+dirName) + os.system("mkdir -p "+EOS_Output_path + os.sep + sample_name) + os.system("mkdir -p "+EOS_Output_path + os.sep + sample_name+os.sep+dirName) infoLogFiles.send_git_log_and_patch_to_eos(EOS_Output_path + os.sep + sample_name + os.sep + dirName) # print "==> output_path = ",output_path ######################################## - #print 'dasgoclient --query="file dataset='+lines.strip()+'"' + #print 'dasgoclient --query="file dataset='+SampleDASName.strip()+'"' #print "..." if use_custom_eos: xrd_redirector = 'root://cms-xrd-global.cern.ch/' - output = os.popen(use_custom_eos_cmd + lines.strip()).read() + output = os.popen(use_custom_eos_cmd + SampleDASName.strip()).read() else: xrd_redirector = 'root://cms-xrd-global.cern.ch/' - output = os.popen('dasgoclient --query="file dataset='+lines.strip()+'"').read() + output = os.popen('dasgoclient --query="file dataset='+SampleDASName.strip()+'"').read() count_root_files = 0 for root_file in output.split(): From 050ee4acb576cf81b3aacaae3a96785cad5ef52e Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Fri, 1 Mar 2024 15:02:06 +0100 Subject: [PATCH 21/32] Fix: Size of output root file Details here: https://github.com/ram1123/nanoAOD_skim/issues/38 From 706d9912abe7970bd526313d11f98a61b3209ca5 Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Wed, 28 Feb 2024 13:04:17 +0100 Subject: [PATCH 22/32] Fix merge conflict --- Utils/fileshelper.py | 2 +- condor_setup_lxplus.py | 28 ++++++++++++++++------------ keep_and_drop_data.txt | 1 + 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Utils/fileshelper.py b/Utils/fileshelper.py index b2bcf34..dd63b7e 100644 --- a/Utils/fileshelper.py +++ b/Utils/fileshelper.py @@ -44,7 +44,7 @@ def create_store_area(self, path): string -- Path of the created directory in the store area """ # Reference:https://cernbox.docs.cern.ch/desktop/other-access-methods/eos_xrootd/ - os.system('eos root://eosuser.cern.ch mkdir {path}'.format(path = path)) + os.system('eos root://eosuser.cern.ch mkdir -p {path}'.format(path = path)) print("==> Created directory at eos path: {path}".format(path = path)) # Add a check to see if the directory was created print("==> Checking if the directory was created...") diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index a6af985..b22cf9f 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -18,20 +18,20 @@ def main(args): use_custom_eos_cmd = args.use_custom_eos_cmd InputFileFromWhereReadDASNames = args.input_file EOS_Output_path = args.eos_output_path - condor_file_name = args.condor_file_name - condor_queue = args.condor_queue - condor_log_path = args.condor_log_path - DontCreateTarFile = args.DontCreateTarFile - - # Get top-level directory name from PWD - TOP_LEVEL_DIR_NAME = os.path.basename(os.getcwd()) - if EOS_Output_path == "": # Get the username and its initial and set the path as /eos/user///nanoAOD_ntuples username = os.environ['USER'] user_initials = username[0:1] EOS_Output_path = '/eos/user/'+user_initials+'/'+username+'/nanoAOD_ntuples' - EOS_Output_path += submission_name + if submission_name != "": + EOS_Output_path = EOS_Output_path + '/' + submission_name + condor_log_path = args.condor_log_path + + # Get top-level directory name from PWD + TOP_LEVEL_DIR_NAME = os.path.basename(os.getcwd()) + condor_file_name = args.condor_file_name + condor_queue = args.condor_queue + DontCreateTarFile = args.DontCreateTarFile condor_file_name = 'submit_condor_jobs_lnujj_'+submission_name # Create log files @@ -78,6 +78,9 @@ def main(args): outjdl_file.write("WhenToTransferOutput = ON_EXIT\n") outjdl_file.write("Transfer_Input_Files = "+Transfer_Input_Files + ", " + post_proc_to_run+"\n") outjdl_file.write("x509userproxy = $ENV(X509_USER_PROXY)\n") + outjdl_file.write("requirements = TARGET.OpSysAndVer =?= \"AlmaLinux9\"\n") + # MY.WantOS = "el7" + outjdl_file.write("MY.WantOS = \"el7\"\n") count = 0 count_jobs = 0 for SampleDASName in in_file: @@ -194,16 +197,16 @@ class PreserveWhitespaceFormatter(argparse.RawTextHelpFormatter, argparse.Argume if __name__ == "__main__": parser = argparse.ArgumentParser(description="Condor Job Submission", formatter_class=PreserveWhitespaceFormatter) - parser.add_argument("--submission_name", default="Run2018_v9", help="String to be changed by user.") + parser.add_argument("--submission_name", default="SkimNanoAOD", help="String to be changed by user.") parser.add_argument("--use_custom_eos", default=False, action='store_true', help="Use custom EOS.") parser.add_argument("--DontCreateTarFile", default=False, action='store_true', help="Create tar file of CMSSW directory.") parser.add_argument("--use_custom_eos_cmd", default='eos root://cmseos.fnal.gov find -name "*.root" /store/group/lnujj/VVjj_aQGC/custom_nanoAOD', help="Custom EOS command.") # input_file mandatory parser.add_argument("--input_file", default='', required=True, help="Input file from where to read DAS names.") - parser.add_argument("--eos_output_path", default='', help="Initial path for operations.") + parser.add_argument("--eos_output_path", default='', help="EOS path for output files. By default it is `/eos/user///nanoAOD_ntuples`") parser.add_argument("--condor_log_path", default='./', help="Path where condor log should be saved. By default is the current working directory") parser.add_argument("--condor_file_name", default='submit_condor_jobs_lnujj_', help="Name for the condor file.") - parser.add_argument("--condor_queue", default="microcentury", help=""" + parser.add_argument("--condor_queue", default="testmatch", help=""" Condor queue options: (Reference: https://twiki.cern.ch/twiki/bin/view/ABPComputing/LxbatchHTCondor#Queue_Flavours) name Duration @@ -222,3 +225,4 @@ class PreserveWhitespaceFormatter(argparse.RawTextHelpFormatter, argparse.Argume args = parser.parse_args() main(args) +#condor_setup_lxplus.py diff --git a/keep_and_drop_data.txt b/keep_and_drop_data.txt index aae6702..2ef8e37 100644 --- a/keep_and_drop_data.txt +++ b/keep_and_drop_data.txt @@ -79,3 +79,4 @@ keep PV* #keep FatJet_* #keep Jet_* #keep Muon* + From 04802ceaba9187e4c67c2d2d93b8a087081077df Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Wed, 28 Feb 2024 13:04:17 +0100 Subject: [PATCH 23/32] Fix cherry-pick conflict --- keep_and_drop_data.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/keep_and_drop_data.txt b/keep_and_drop_data.txt index 2ef8e37..aae6702 100644 --- a/keep_and_drop_data.txt +++ b/keep_and_drop_data.txt @@ -79,4 +79,3 @@ keep PV* #keep FatJet_* #keep Jet_* #keep Muon* - From a2bd5af39a9774fda8e8036163f970efaf705bc3 Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Sun, 10 Mar 2024 21:28:13 +0100 Subject: [PATCH 24/32] Updated directory structure for condor jobs --- condor_setup_lxplus.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index b22cf9f..ba8784b 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -79,7 +79,6 @@ def main(args): outjdl_file.write("Transfer_Input_Files = "+Transfer_Input_Files + ", " + post_proc_to_run+"\n") outjdl_file.write("x509userproxy = $ENV(X509_USER_PROXY)\n") outjdl_file.write("requirements = TARGET.OpSysAndVer =?= \"AlmaLinux9\"\n") - # MY.WantOS = "el7" outjdl_file.write("MY.WantOS = \"el7\"\n") count = 0 count_jobs = 0 @@ -91,26 +90,25 @@ def main(args): print ("==> Sample : ",count) sample_name = SampleDASName.split('/')[1] print("==> sample_name = ",sample_name) + campaign = SampleDASName.split('/')[2].split('-')[0] + print("==> campaign = ",campaign) ######################################## # # Create output directory # ######################################## if (SampleDASName.strip()).endswith("/NANOAOD"): # if the sample name ends with /NANOAOD, then it is a data if it ends with /NANOAODSIM then it is a MC. As the line contain the "\n" at the end, so we need to use the strip() function. - campaign = SampleDASName.split('/')[2].split('-')[0] - print("==> campaign = ",campaign) output_string = sample_name + os.sep + campaign + os.sep + dirName output_path = EOS_Output_path + os.sep + output_string - os.system("mkdir -p "+EOS_Output_path + os.sep + sample_name) - os.system("mkdir -p "+EOS_Output_path + os.sep + sample_name + os.sep + campaign) - os.system("mkdir -p "+ EOS_Output_path + os.sep + sample_name + os.sep + campaign + os.sep + dirName) - infoLogFiles.send_git_log_and_patch_to_eos(EOS_Output_path + os.sep + sample_name + os.sep + campaign + os.sep + dirName) + print("==> output_path = ",output_path) + os.system("mkdir -p "+ output_path) + infoLogFiles.send_git_log_and_patch_to_eos(output_path) else: - output_string = sample_name+os.sep+dirName + output_string = campaign + os.sep + sample_name + os.sep + dirName output_path = EOS_Output_path+ os.sep + output_string - os.system("mkdir -p "+EOS_Output_path + os.sep + sample_name) - os.system("mkdir -p "+EOS_Output_path + os.sep + sample_name+os.sep+dirName) - infoLogFiles.send_git_log_and_patch_to_eos(EOS_Output_path + os.sep + sample_name + os.sep + dirName) + print("==> output_path = ",output_path) + os.system("mkdir -p "+output_path) + infoLogFiles.send_git_log_and_patch_to_eos(output_path) # print "==> output_path = ",output_path ######################################## From d597e5cb81ad64f249bf22d1caef608377676519 Mon Sep 17 00:00:00 2001 From: YujiLee301 <99654114+YujiLee301@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:30:01 +0800 Subject: [PATCH 25/32] Set KeepIt True --- H4LCppModule.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index 8444b95..1256973 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -211,7 +211,7 @@ def analyze(self, event): self.worker.SetObjectNumGen(event.nGenPart) self.genworker.Initialize() self.genworker.SetObjectNumGen(event.nGenPart, event.nGenJet) - keepIt = False + keepIt = True passedTrig=False passedFullSelection=False @@ -372,7 +372,6 @@ def analyze(self, event): lep_genindex.append(lep_genindex_vec[i]) if (foundZZCandidate): self.passZZEvts += 1 - if (passedFullSelection |passedFiducialSelection ): keepIt = True if self.worker.RecoFourMuEvent: finalState = 1 if self.worker.RecoFourEEvent: finalState = 2 if self.worker.RecoTwoETwoMuEvent: finalState = 3 From 5ed1ca7001f8b17b8d1fa89c471539da0cb14360 Mon Sep 17 00:00:00 2001 From: yuji Date: Thu, 30 May 2024 13:48:31 +0200 Subject: [PATCH 26/32] GENlep fixed --- H4LCppModule.py | 15 ++++++++++----- data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc | Bin 2337 -> 2337 bytes data/__init__.pyc | Bin 177 -> 177 bytes interface/GenAnalysis.h | 3 ++- interface/H4LTools.h | 3 ++- src/GenAnalysis.cc | 4 ++++ 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index 1256973..faab65a 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -167,8 +167,8 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): self.out.branch("passedFiducialSelection", "O") GENHlepNum = 4 GENZNum = 2 - self.out.branch("GENlep_MomId", "I", lenVar = "nGENLeptons") - self.out.branch("GENlep_MomMomId", "I", lenVar = "nGENLeptons") + self.out.branch("GENlep_MomId", "I", lenVar = "nGenPart") + self.out.branch("GENlep_MomMomId", "I", lenVar = "nGenPart") self.out.branch("GENZ_MomId", "I", lenVar = "nVECZ") self.out.branch("GENZ_DaughtersId", "I", lenVar = "GENZNum") self.out.branch("GENlep_Hindex", "I", lenVar = "GENHlepNum") @@ -211,8 +211,8 @@ def analyze(self, event): self.worker.SetObjectNumGen(event.nGenPart) self.genworker.Initialize() self.genworker.SetObjectNumGen(event.nGenPart, event.nGenJet) - keepIt = True - + keepIt = False + Lepointer = 0 passedTrig=False passedFullSelection=False passedZ4lSelection=False @@ -236,6 +236,7 @@ def analyze(self, event): GENrapidity4l = -99 GENnjets_pt30_eta4p7 = -1 nGENLeptons = 0 + nGenPart = 0 pTZ1 = -99 etaZ1 = -99 phiZ1 = -99 @@ -261,6 +262,7 @@ def analyze(self, event): fsrPhotons = Collection(event, "FsrPhoton") jets = Collection(event, "Jet") if isMC: + nGenPart = event.nGenPart genparts = Collection(event, "GenPart") genjets = Collection(event, "GenJet") for xj in genjets: @@ -355,7 +357,6 @@ def analyze(self, event): for i in range(len(GENlep_MomMomId_vec)): GENlep_MomMomId.append(GENlep_MomMomId_vec[i]) - foundZZCandidate = self.worker.ZZSelection() passedFullSelection=foundZZCandidate Lepointer = self.worker.Lepointer @@ -372,6 +373,7 @@ def analyze(self, event): lep_genindex.append(lep_genindex_vec[i]) if (foundZZCandidate): self.passZZEvts += 1 + keepIt = True if self.worker.RecoFourMuEvent: finalState = 1 if self.worker.RecoFourEEvent: finalState = 2 if self.worker.RecoTwoETwoMuEvent: finalState = 3 @@ -445,6 +447,7 @@ def analyze(self, event): phi4l = self.worker.ZZsystemnofsr.Phi() mass4l = self.worker.ZZsystemnofsr.M() rapidity4l = self.worker.ZZsystemnofsr.Rapidity() + self.out.fillBranch("mass4l",mass4l) self.out.fillBranch("GENmass4l",GENmass4l) self.out.fillBranch("mass4e",mass4e) @@ -523,6 +526,8 @@ def analyze(self, event): self.out.fillBranch("Electron_Fsr_eta",Electron_Fsr_eta) self.out.fillBranch("Electron_Fsr_phi",Electron_Fsr_phi) + self.out.fillBranch("lep_Hindex",lep_Hindex) + self.out.fillBranch("lep_genindex",lep_genindex) self.out.fillBranch("Muon_Fsr_pt",Muon_Fsr_pt) self.out.fillBranch("Muon_Fsr_eta",Muon_Fsr_eta) self.out.fillBranch("Muon_Fsr_phi",Muon_Fsr_phi) diff --git a/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc index edabac270f033b8bd0d2fc969d9e47394dac20c7..d3fa64c030cba1341fc7cec65899bbf4046845ab 100644 GIT binary patch delta 17 YcmZ1|v`~nH`7jU1Ak04-?*s{jB1 delta 17 YcmZ1|v`~nH`7<{9 diff --git a/data/__init__.pyc b/data/__init__.pyc index 26cac14f9336c8c476b30a8d2e99e6dab622b21d..aa59bdf56aedc36d8d5a8a4b6b1acbc22c97e4f3 100644 GIT binary patch delta 16 XcmdnUxRH^A`7i5x2dDDnjm delta 16 YcmdnUxRH^A`7 Date: Thu, 30 May 2024 14:07:58 +0200 Subject: [PATCH 27/32] add puppiMET --- keep_and_drop.txt | 2 +- keep_and_drop_data.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keep_and_drop.txt b/keep_and_drop.txt index d022ddd..36ed0c7 100644 --- a/keep_and_drop.txt +++ b/keep_and_drop.txt @@ -84,7 +84,7 @@ keep PS* #keep GenMET* #keep MET* keep Pileup* -#keep PuppiMET* +keep PuppiMET* #keep RawMET* #keep RawPuppiMET* #keep fixedGridRho* diff --git a/keep_and_drop_data.txt b/keep_and_drop_data.txt index aae6702..6d02de8 100644 --- a/keep_and_drop_data.txt +++ b/keep_and_drop_data.txt @@ -63,7 +63,7 @@ keep *Weight* #keep LowPtElectron* #keep MET* keep Pileup* -#keep PuppiMET* +keep PuppiMET* #keep RawMET* #keep RawPuppiMET* #keep fixedGridRho* From 15bc4d0dd1b8ff6d00726984327d719edb0042a4 Mon Sep 17 00:00:00 2001 From: yuji Date: Thu, 30 May 2024 14:32:24 +0200 Subject: [PATCH 28/32] add EvtNum branch --- H4LCppModule.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index faab65a..f0214a1 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -155,6 +155,7 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): self.out.branch("etaj2", "F") self.out.branch("phij2", "F") self.out.branch("mj2", "F") + self.out.branch("EvtNum", "I") self.out.branch("pileupWeight", "F") self.out.branch("dataMCWeight_new", "F") self.out.branch("prefiringWeight", "F") @@ -213,6 +214,7 @@ def analyze(self, event): self.genworker.SetObjectNumGen(event.nGenPart, event.nGenJet) keepIt = False Lepointer = 0 + EvtNum = 0 passedTrig=False passedFullSelection=False passedZ4lSelection=False @@ -373,6 +375,8 @@ def analyze(self, event): lep_genindex.append(lep_genindex_vec[i]) if (foundZZCandidate): self.passZZEvts += 1 + if (foundZZCandidate |passedFiducialSelection ): + EvtNum += 1 keepIt = True if self.worker.RecoFourMuEvent: finalState = 1 if self.worker.RecoFourEEvent: finalState = 2 @@ -483,7 +487,7 @@ def analyze(self, event): self.out.fillBranch("passedZ4lZXCRSelection", passedZ4lZXCRSelection) self.out.fillBranch("passedZXCRSelection", passedZXCRSelection) self.out.fillBranch("passedFiducialSelection", passedFiducialSelection) - + self.out.fillBranch("EvtNum",EvtNum) self.out.fillBranch("massL1",massL1) self.out.fillBranch("pTL1",pTL1) self.out.fillBranch("etaL1",etaL1) From 48177890bb77f5cb3b6a829ef9ee3d94d4c25936 Mon Sep 17 00:00:00 2001 From: yuji Date: Thu, 30 May 2024 14:47:31 +0200 Subject: [PATCH 29/32] add Weight --- H4LCppModule.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index f0214a1..fe83046 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -156,6 +156,7 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): self.out.branch("phij2", "F") self.out.branch("mj2", "F") self.out.branch("EvtNum", "I") + self.out.branch("Weight", "F") self.out.branch("pileupWeight", "F") self.out.branch("dataMCWeight_new", "F") self.out.branch("prefiringWeight", "F") @@ -215,6 +216,7 @@ def analyze(self, event): keepIt = False Lepointer = 0 EvtNum = 0 + Weight = 1 passedTrig=False passedFullSelection=False passedZ4lSelection=False @@ -451,7 +453,7 @@ def analyze(self, event): phi4l = self.worker.ZZsystemnofsr.Phi() mass4l = self.worker.ZZsystemnofsr.M() rapidity4l = self.worker.ZZsystemnofsr.Rapidity() - + Weight = event.genWeight * pileupWeight * dataMCWeight_new * prefiringWeight self.out.fillBranch("mass4l",mass4l) self.out.fillBranch("GENmass4l",GENmass4l) self.out.fillBranch("mass4e",mass4e) @@ -516,7 +518,7 @@ def analyze(self, event): self.out.fillBranch("pileupWeight",pileupWeight) self.out.fillBranch("dataMCWeight_new",dataMCWeight_new) self.out.fillBranch("prefiringWeight",prefiringWeight) - + self.out.fillBranch("Weight",Weight) # self.out.fillBranch("nElectron_Fsr", len(electrons)) # self.out.fillBranch("nMuon_Fsr", len(muons)) From 5acf3864d53d9c6d2cdc0efac16d789bb6a5cf40 Mon Sep 17 00:00:00 2001 From: YujiLee301 <99654114+YujiLee301@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:36:20 +0800 Subject: [PATCH 30/32] Update BDT cut in Input_2022.yml --- Input_2022.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Input_2022.yml b/Input_2022.yml index e406e7f..2e53981 100644 --- a/Input_2022.yml +++ b/Input_2022.yml @@ -43,19 +43,19 @@ Electron: BDTWP: LowEta: LowPT: - 0.9044286167 + 1.6339 HighPT: - 0.1968600840 + 0.3685 MedEta: LowPT: - 0.9094166886 + 1.5499 HighPT: - 0.0759172100 + 0.2662 HighEta: LowPT: - 0.9443653660 + 2.0629 HighPT: - -0.5169136775 + -0.5444 Isocut: 0.35 Muon: @@ -115,4 +115,4 @@ outputdataNPVdown: "data/pileupHistogram_2022down.root" PUweightHistoName: - "pileupWeight" \ No newline at end of file + "pileupWeight" From e31853346c48d8075e5bd8d2d8e10428d830bf94 Mon Sep 17 00:00:00 2001 From: yuji Date: Fri, 7 Jun 2024 17:41:16 +0200 Subject: [PATCH 31/32] PUID fixed --- src/H4LTools.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H4LTools.cc b/src/H4LTools.cc index 92ec593..8617499 100644 --- a/src/H4LTools.cc +++ b/src/H4LTools.cc @@ -115,7 +115,7 @@ std::vector H4LTools::SelectedJets(std::vector ele, //unsigned nJ = (*nJet).Get()[0]; for(unsigned int i=0;iJetPtcut)&&(fabs(Jet_eta[i])0)&&(Jet_puId[i]==7)){ + if((Jet_jetId[i]>0)&&((Jet_pt[i]>50)||(Jet_puId[i]==7))){ int overlaptag=0; TLorentzVector jettest; jettest.SetPtEtaPhiM(Jet_pt[i],Jet_eta[i],Jet_phi[i],Jet_mass[i]); From 0903204b15969b53358449eea0dee7ea5a27a494 Mon Sep 17 00:00:00 2001 From: YujiLee301 <99654114+YujiLee301@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:10:35 +0800 Subject: [PATCH 32/32] Update Input_2022.yml --- Input_2022.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Input_2022.yml b/Input_2022.yml index 2e53981..04fcecf 100644 --- a/Input_2022.yml +++ b/Input_2022.yml @@ -43,19 +43,19 @@ Electron: BDTWP: LowEta: LowPT: - 1.6339 - HighPT: - 0.3685 + 0.926614978724 + HighPT: + 0.352678981617 MedEta: LowPT: - 1.5499 + 0.913768989002 HighPT: - 0.2662 + 0.260085399397 HighEta: LowPT: - 2.0629 + 0.968212252285 HighPT: - -0.5444 + -0.496311372876 Isocut: 0.35 Muon: