From 4bca96095934558d4e75bf59764d3bbf4e3cb4a0 Mon Sep 17 00:00:00 2001 From: YujiLee301 <99654114+YujiLee301@users.noreply.github.com> Date: Sat, 2 Sep 2023 00:47:03 +0800 Subject: [PATCH 01/10] Add files via upload --- H4LCppModule.py | 43 +++++++++--- interface/H4LTools.h | 157 +++++++++++++++++++------------------------ post_proc.py | 14 +++- src/H4LTools.cc | 75 +++++++++++++-------- 4 files changed, 162 insertions(+), 127 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index 1a757f7..7a58940 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -8,7 +8,7 @@ class HZZAnalysisCppProducer(Module): - def __init__(self,year,cfgFile): + def __init__(self,year,cfgFile,isMC): base = "$CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim" ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libJHUGenMELAMELA.so" % base) ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libjhugenmela.so" % base) @@ -39,10 +39,20 @@ def __init__(self,year,cfgFile): with open(cfgFile, 'r') as ymlfile: cfg = yaml.load(ymlfile) RoccoRPath = cfg['RoccoRPath'] - self.worker = ROOT.H4LTools(self.year, RoccoRPath) + self.worker = ROOT.H4LTools(self.year, RoccoRPath) + 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']) + self.worker.InitializeMucut(cfg['Muon']['pTcut'],cfg['Muon']['Etacut'],cfg['Muon']['Sip3dcut'],cfg['Muon']['Loosedxycut'],cfg['Muon']['Loosedzcut'],cfg['Muon']['Isocut'], + cfg['Muon']['Tightdxycut'],cfg['Muon']['Tightdzcut'],cfg['Muon']['TightTrackerLayercut'],cfg['Muon']['TightpTErrorcut'],cfg['Muon']['HighPtBound']) + 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.passtrigEvts = 0 self.passZZEvts = 0 self.cfgFile = cfgFile + self.isMC = isMC pass def beginJob(self): pass @@ -50,12 +60,21 @@ def beginJob(self): def endJob(self): print("PassTrig: "+str(self.passtrigEvts)+" Events") print("Pass4eCut: "+str(self.worker.cut4e)+" Events") + print("Pass4eGhostRemoval: "+str(self.worker.cutghost4e)+" Events") + print("Pass4eLepPtCut: "+str(self.worker.cutLepPt4e)+" Events") + print("Pass4eQCDSupress: "+str(self.worker.cutQCD4e)+" Events") print("PassmZ1mZ2Cut_4e: "+str(self.worker.cutZZ4e)+" Events") print("Passm4l_105_160_Cut_4e: "+str(self.worker.cutm4l4e)+" Events") print("Pass4muCut: "+str(self.worker.cut4mu)+" Events") + print("Pass4muGhostRemoval: "+str(self.worker.cutghost4mu)+" Events") + print("Pass4muLepPtCut: "+str(self.worker.cutLepPt4mu)+" Events") + print("Pass4muQCDSupress: "+str(self.worker.cutQCD4mu)+" Events") print("PassmZ1mZ2Cut_4mu: "+str(self.worker.cutZZ4mu)+" Events") print("Passm4l_105_160_Cut_4mu: "+str(self.worker.cutm4l4mu)+" Events") print("Pass2e2muCut: "+str(self.worker.cut2e2mu)+" Events") + print("Pass2e2muGhostRemoval: "+str(self.worker.cutghost2e2mu)+" Events") + print("Pass2e2muLepPtCut: "+str(self.worker.cutLepPt2e2mu)+" Events") + print("Pass2e2muQCDSupress: "+str(self.worker.cutQCD2e2mu)+" Events") 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") @@ -139,8 +158,10 @@ def analyze(self, event): # do NOT access other branches in python between the check/call to # initReaders and the call to C++ worker code self.worker.Initialize() - self.worker.SetObjectNum(event.nElectron,event.nMuon,event.nJet,event.nGenPart,event.nFsrPhoton) - + isMC = self.isMC + self.worker.SetObjectNum(event.nElectron,event.nMuon,event.nJet,event.nFsrPhoton) + if isMC: + self.worker.SetObjectNumGen(event.nGenPart) keepIt = False passedTrig=False @@ -153,7 +174,6 @@ def analyze(self, event): passedZXCRSelection=False passedFiducialSelection=False nZXCRFailedLeptons=0 - isMC = True passedTrig = PassTrig(event, self.cfgFile) if (passedTrig==True): self.passtrigEvts += 1 @@ -163,21 +183,24 @@ def analyze(self, event): muons = Collection(event, "Muon") fsrPhotons = Collection(event, "FsrPhoton") jets = Collection(event, "Jet") - genparts = Collection(event, "GenPart") + if isMC: + genparts = Collection(event, "GenPart") + for xg in genparts: + self.worker.SetGenParts(xg.pt) + for xm in muons: + self.worker.SetMuonsGen(xm.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) for xm in muons: self.worker.SetMuons(xm.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, xm.genPartIdx) + xm.pdgId, xm.charge, xm.pfRelIso03_all) for xf in fsrPhotons: self.worker.SetFsrPhotons(xf.dROverEt2,xf.eta,xf.phi,xf.pt,xf.relIso03) for xj in jets: self.worker.SetJets(xj.pt,xj.eta,xj.phi,xj.mass,xj.jetId, xj.btagCSVV2, xj.puId) - for xg in genparts: - self.worker.SetGenParts(xg.pt) - + self.worker.MuonPtCorrection(isMC) self.worker.LeptonSelection() if ((self.worker.nTightEle<2)&(self.worker.nTightMu<2)): diff --git a/interface/H4LTools.h b/interface/H4LTools.h index 8249d9a..b84eba6 100644 --- a/interface/H4LTools.h +++ b/interface/H4LTools.h @@ -14,11 +14,57 @@ class H4LTools { public: H4LTools(int year, std::string DATAPATH); - int elePtcut = 7; - int MuPtcut = 5; - int sip3dCut = 4; - float Zmass = 91.1876; - + 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; + float eleBDTWPLELP,eleBDTWPMELP,eleBDTWPHELP,eleBDTWPLEHP,eleBDTWPMEHP,eleBDTWPHEHP; + void InitializeElecut(float elePtcut_,float eleEtacut_,float elesip3dCut_,float eleLoosedxycut_,float eleLoosedzcut_,float eleIsocut_,float eleBDTWPLELP_,float eleBDTWPMELP_, float eleBDTWPHELP_,float eleBDTWPLEHP_,float eleBDTWPMEHP_,float eleBDTWPHEHP_){ + elePtcut = elePtcut_; + eleEtacut = eleEtacut_; + elesip3dCut = elesip3dCut_; + eleLoosedxycut = eleLoosedxycut_; + eleLoosedzcut = eleLoosedzcut_; + eleIsocut = eleIsocut_; + eleBDTWPLELP = eleBDTWPLELP_; + eleBDTWPMELP = eleBDTWPMELP_; + eleBDTWPHELP = eleBDTWPHELP_; + eleBDTWPLEHP = eleBDTWPLEHP_; + eleBDTWPMEHP = eleBDTWPMEHP_; + eleBDTWPHEHP = eleBDTWPHEHP_; + } + void InitializeMucut(float MuPtcut_,float MuEtacut_,float Musip3dCut_,float MuLoosedxycut_,float MuLoosedzcut_,float MuIsocut_,float MuTightdxycut_,float MuTightdzcut_,float MuTightTrackerLayercut_,float MuTightpTErrorcut_,float MuHighPtBound_){ + MuPtcut = MuPtcut_; + MuEtacut = MuEtacut_; + Musip3dCut = Musip3dCut_; + MuLoosedxycut = MuLoosedxycut_; + MuLoosedzcut = MuLoosedzcut_; + MuIsocut = MuIsocut_; + MuTightdxycut = MuTightdxycut_; + MuTightdzcut = MuTightdzcut_; + MuTightTrackerLayercut = MuTightTrackerLayercut_; + MuTightpTErrorcut = MuTightpTErrorcut_; + MuHighPtBound = MuHighPtBound_; + } + void InitializeFsrPhotonCut(float fsrphotonPtcut_, float fsrphotonEtacut_, float fsrphotonIsocut_, float fsrphotondRlcut_, float fsrphotondRlOverPtcut_){ + fsrphotonPtcut = fsrphotonPtcut_; + fsrphotonEtacut = fsrphotonEtacut_; + fsrphotonIsocut = fsrphotonIsocut_; + fsrphotondRlcut = fsrphotondRlcut_; + fsrphotondRlOverPtcut = fsrphotondRlOverPtcut_; + } + void InitializeJetcut(float JetPtcut_, float JetEtacut_){ + JetPtcut = JetPtcut_; + JetEtacut = JetEtacut_; + } + void InitializeEvtCut(float MZ1cut_,float MZZcut_,float HiggscutDown_,float HiggscutUp_,float Zmass_,float MZcutdown_, float MZcutup_){ + MZ1cut = MZ1cut_; + MZZcut = MZZcut_; + HiggscutDown = HiggscutDown_; + HiggscutUp = HiggscutUp_; + Zmass = Zmass_; + MZcutdown = MZcutdown_; + MZcutup = MZcutup_; + } void SetElectrons(float Electron_pt_, float Electron_eta_, float Electron_phi_, float Electron_mass_, float Electron_dxy_,float Electron_dz_, float Electron_sip3d_, float Electron_mvaFall17V2Iso_, int Electron_pdgId_, float Electron_pfRelIso03_all_){ Electron_pt.push_back(Electron_pt_); @@ -33,20 +79,6 @@ class H4LTools { Electron_pfRelIso03_all.push_back(Electron_pfRelIso03_all_); } - - /*void SetElectrons(TTreeReaderArray *Electron_pt_, TTreeReaderArray *Electron_eta_, - TTreeReaderArray *Electron_phi_, TTreeReaderArray *Electron_mass_, TTreeReaderArray *Electron_dxy_,TTreeReaderArray *Electron_dz_, - TTreeReaderArray *Electron_sip3d_, TTreeReaderArray *Electron_mvaFall17V2Iso_WP90_, TTreeReaderArray *Electron_pdgId_){ - Electron_pt = Electron_pt_; - Electron_phi = Electron_phi_; - Electron_eta = Electron_eta_; - Electron_mass = Electron_mass_; - Electron_dxy = Electron_dxy_; - Electron_dz = Electron_dz_; - Electron_sip3d = Electron_sip3d_; - Electron_mvaFall17V2Iso_WP90 = Electron_mvaFall17V2Iso_WP90_; - Electron_pdgId = Electron_pdgId_; - }*/ void SetJets(float Jet_pt_, float Jet_eta_, float Jet_phi_, float Jet_mass_, int Jet_jetId_, float Jet_btagDeepC_, int Jet_puId_){ Jet_pt.push_back(Jet_pt_); @@ -57,22 +89,12 @@ class H4LTools { Jet_jetId.push_back(Jet_jetId_); Jet_puId.push_back(Jet_puId_); //1 or 0? } - /*void SetJets(TTreeReaderArray *Jet_pt_, TTreeReaderArray *Jet_eta_, - TTreeReaderArray *Jet_phi_, TTreeReaderArray *Jet_mass_, TTreeReaderArray *Jet_btagDeepC_, - TTreeReaderArray *Jet_jetId_, TTreeReaderArray *Jet_puId_){ - Jet_pt = Jet_pt_; - Jet_phi = Jet_phi_; - Jet_eta = Jet_eta_; - Jet_mass = Jet_mass_; - Jet_btagDeepC = Jet_btagDeepC_; - Jet_jetId = Jet_jetId_; - Jet_puId = Jet_puId_; //1 or 0? - }*/ + void SetMuons(float Muon_pt_, float Muon_eta_, float Muon_phi_, float Muon_mass_, bool Muon_isGlobal_, bool Muon_isTracker_, float Muon_dxy_, float Muon_dz_,float Muon_sip3d_, float Muon_ptErr_, - int Muon_nTrackerLayers_, bool Muon_isPFcand_, int Muon_pdgId_,int Muon_charge_, float Muon_pfRelIso03_all_, - int Muon_genPartIdx_){ + int Muon_nTrackerLayers_, bool Muon_isPFcand_, int Muon_pdgId_,int Muon_charge_, float Muon_pfRelIso03_all_ + ){ Muon_pt.push_back(Muon_pt_); Muon_phi.push_back(Muon_phi_); Muon_eta.push_back(Muon_eta_); @@ -88,6 +110,9 @@ class H4LTools { Muon_pdgId.push_back(Muon_pdgId_); Muon_charge.push_back(Muon_charge_); Muon_pfRelIso03_all.push_back(Muon_pfRelIso03_all_); + + } + void SetMuonsGen(int Muon_genPartIdx_){ Muon_genPartIdx.push_back(Muon_genPartIdx_); } /*void SetMuons(TTreeReaderArray *Muon_pt_, TTreeReaderArray *Muon_eta_, @@ -136,13 +161,15 @@ class H4LTools { /*void SetGenParts(TTreeReaderArray *GenPart_pt_){ GenPart_pt = GenPart_pt_; }*/ - void SetObjectNum(unsigned nElectron_,unsigned nMuon_,unsigned nJet_,unsigned nGenPart_,unsigned nFsrPhoton_){ + void SetObjectNum(unsigned nElectron_,unsigned nMuon_,unsigned nJet_,unsigned nFsrPhoton_){ nElectron = nElectron_; nMuon = nMuon_; nJet = nJet_; - nGenPart = nGenPart_; nFsrPhoton = nFsrPhoton_; } + void SetObjectNumGen(unsigned nGenPart_){ + nGenPart = nGenPart_; + } std::vector goodLooseElectrons2012(); std::vector goodLooseMuons2012(); @@ -281,7 +308,7 @@ class H4LTools { float getDL1Constant(float ZZMass); float getDL1ZgsConstant(float ZZMass); - int cut4e, cut4mu, cut2e2mu, cutZZ4e, cutZZ4mu, cutZZ2e2mu, cutm4l4e, cutm4l4mu, cutm4l2e2mu; + int cut4e, cut4mu, cut2e2mu, cutZZ4e, cutZZ4mu, cutZZ2e2mu, cutm4l4e, cutm4l4mu, cutm4l2e2mu, cutghost2e2mu, cutQCD2e2mu, cutLepPt2e2mu, cutghost4e, cutQCD4e, cutLepPt4e, cutghost4mu, cutQCD4mu, cutLepPt4mu; float pTL1, etaL1, phiL1, massL1, pTL2, etaL2, phiL2, massL2, pTL3, etaL3, phiL3, massL3, pTL4, etaL4, phiL4, massL4; float pTj1, etaj1, phij1, mj1, pTj2, etaj2, phij2, mj2; @@ -308,57 +335,6 @@ class H4LTools { - - - /*unsigned nElectron; - TTreeReaderArray *Electron_pt = nullptr; - TTreeReaderArray *Electron_eta = nullptr; - TTreeReaderArray *Electron_phi = nullptr; - TTreeReaderArray *Electron_mass = nullptr; - TTreeReaderArray *Electron_dxy = nullptr; - TTreeReaderArray *Electron_dz = nullptr; - TTreeReaderArray *Electron_sip3d = nullptr; - TTreeReaderArray *Electron_mvaFall17V2Iso_WP90 = nullptr; - TTreeReaderArray *Electron_pdgId = nullptr; - - unsigned nMuon; - TTreeReaderArray *Muon_pt = nullptr; - TTreeReaderArray *Muon_eta = nullptr; - TTreeReaderArray *Muon_phi = nullptr; - TTreeReaderArray *Muon_mass = nullptr; - TTreeReaderArray *Muon_isGlobal = nullptr; - TTreeReaderArray *Muon_isTracker = nullptr; - TTreeReaderArray *Muon_isPFcand = nullptr; - TTreeReaderArray *Muon_nTrackerLayers = nullptr; - TTreeReaderArray *Muon_sip3d = nullptr; - TTreeReaderArray *Muon_dxy = nullptr; - TTreeReaderArray *Muon_dz = nullptr; - TTreeReaderArray *Muon_ptErr = nullptr; - TTreeReaderArray *Muon_pdgId = nullptr; - TTreeReaderArray *Muon_charge = nullptr; - TTreeReaderArray *Muon_pfRelIso03_all = nullptr; - TTreeReaderArray *Muon_genPartIdx = nullptr; - - unsigned nFsrPhoton; - TTreeReaderArray *FsrPhoton_dROverEt2 = nullptr; - TTreeReaderArray *FsrPhoton_eta = nullptr; - TTreeReaderArray *FsrPhoton_phi = nullptr; - TTreeReaderArray *FsrPhoton_pt = nullptr; - TTreeReaderArray *FsrPhoton_relIso03 = nullptr; - TTreeReaderArray *FsrPhoton_muonIdx = nullptr; - - unsigned nGenPart; - TTreeReaderArray *GenPart_pt = nullptr; - - unsigned nJet; - TTreeReaderArray *Jet_eta = nullptr; - TTreeReaderArray *Jet_phi = nullptr; - TTreeReaderArray *Jet_pt = nullptr; - TTreeReaderArray *Jet_mass = nullptr; - TTreeReaderArray *Jet_btagDeepC = nullptr; - TTreeReaderArray *Jet_jetId = nullptr; - TTreeReaderArray *Jet_puId = nullptr;*/ - }; H4LTools::H4LTools(int year, std::string DATAPATH){ @@ -386,6 +362,15 @@ H4LTools::H4LTools(int year, std::string DATAPATH){ cut2e2mu = 0; cut4e = 0; cut4mu = 0; + cutghost2e2mu = 0; + cutghost4e = 0; + cutghost4mu = 0; + cutLepPt2e2mu = 0; + cutLepPt4e = 0; + cutLepPt4mu = 0; + cutQCD2e2mu = 0; + cutQCD4e = 0; + cutQCD4mu = 0; cutZZ2e2mu = 0; cutZZ4e = 0; cutZZ4mu = 0; diff --git a/post_proc.py b/post_proc.py index b31b04b..51d4eea 100755 --- a/post_proc.py +++ b/post_proc.py @@ -20,7 +20,7 @@ #testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/VBF_HToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/80000/3F65CE54-8477-C64E-B0BB-BD77E870AB54.root" #testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/7F817CD1-84C1-5347-AEEA-F069CAE84799.root" testfilelist = [] -#testfilelist.append(testfile) +testfilelist.append("root://cms-xrd-global.cern.ch//store/data/Run2018B/SingleMuon/NANOAOD/UL2018_MiniAODv2_NanoAODv9_GT36-v1/2430000/87FA9714-D8D3-1345-BFF5-3B417B1ADC64.root") testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/4743B911-1EA3-7E46-959B-93F466ED622F.root") testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/DE3F93DE-DAF6-DD4A-AC3B-13ACE92EAD68.root") testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/2430000/336F0076-347C-AC40-B1B4-E31E14323B81.root") @@ -37,16 +37,24 @@ testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/C01084F4-328D-0146-B71E-B167AB6A7E86.root") entriesToRun = 0 # 0 if need to run over all entries else put number of entries to run -isMCTrueFalse = True +isMCTrueFalse = False # Keep DownloadFileToLocalThenRun=True this should reduce the file read error from eos. DownloadFileToLocalThenRun=True +if testfilelist[0].find("2018") != -1: + year = 2018 + cfgFile = 'Input_2018.yml' +if testfilelist[0].find("2017") != -1: + year = 2017 + cfgFile = 'Input_2017.yml' if testfilelist[0].find("UL18") != -1: year = 2018 cfgFile = 'Input_2018.yml' if testfilelist[0].find("UL17") != -1: year = 2017 cfgFile = 'Input_2017.yml' -H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile) +if testfilelist[0].find("pythia") != -1: + isMCTrueFalse = True +H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile,isMCTrueFalse) #p=PostProcessor(".",[testfile],"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt") p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt") diff --git a/src/H4LTools.cc b/src/H4LTools.cc index 413c83a..6130ce2 100644 --- a/src/H4LTools.cc +++ b/src/H4LTools.cc @@ -5,9 +5,8 @@ std::vector H4LTools::goodLooseElectrons2012(){ std::vector LooseElectronindex; - //unsigned nE = (*nElectron).Get()[0]; for (unsigned int i=0; ielePtcut)&&(fabs(Electron_eta[i])<2.5)){ + if ((Electron_pt[i]>elePtcut)&&(fabs(Electron_eta[i]) H4LTools::goodLooseElectrons2012(){ std::vector H4LTools::goodLooseMuons2012(){ std::vector LooseMuonindex; - //unsigned nMu = (*nMuon).Get()[0]; for (unsigned int i=0; iMuPtcut)&&(fabs(Muon_eta[i])<2.4)&&((Muon_isGlobal[i]||Muon_isTracker[i]||Muon_isPFcand[i]))){ + if ((Muon_Pt_Corrected[i]>MuPtcut)&&(fabs(Muon_eta[i]) H4LTools::goodLooseMuons2012(){ std::vector H4LTools::goodMuons2015_noIso_noPf(std::vector Muonindex){ std::vector bestMuonindex; for (unsigned int i=0; iMuPtcut)&&(fabs(Muon_eta[Muonindex[i]])<2.4)&&(Muon_isGlobal[Muonindex[i]]||Muon_isTracker[Muonindex[i]])){ - if (Muon_sip3d[Muonindex[i]]MuPtcut)&&(fabs(Muon_eta[Muonindex[i]]) H4LTools::goodElectrons2015_noIso_noBdt(std::vector bestElectronindex; for (unsigned int i=0; ielePtcut){ - if(Electron_sip3d[Electronindex[i]] H4LTools::passTight_BDT_Id(){ //unsigned nE = (*nElectron).Get()[0]; for (unsigned int i=0; i=0.8)&&(fabs(Electron_eta[i])<1.479)) cutVal = 0.9094166886; - if(fabs(Electron_eta[i])>=1.479) cutVal = 0.9443653660; + if(fabs(Electron_eta[i])<0.8) cutVal = eleBDTWPLELP; + if((fabs(Electron_eta[i])>=0.8)&&(fabs(Electron_eta[i])<1.479)) cutVal = eleBDTWPMELP; + if(fabs(Electron_eta[i])>=1.479) cutVal = eleBDTWPHELP; } else{ - if(fabs(Electron_eta[i])<0.8) cutVal = 0.1968600840; - if((fabs(Electron_eta[i])>=0.8)&&(fabs(Electron_eta[i])<1.479)) cutVal = 0.0759172100; - if(fabs(Electron_eta[i])>=1.479) cutVal = -0.5169136775; + if(fabs(Electron_eta[i])<0.8) cutVal = eleBDTWPLEHP; + if((fabs(Electron_eta[i])>=0.8)&&(fabs(Electron_eta[i])<1.479)) cutVal = eleBDTWPMEHP; + if(fabs(Electron_eta[i])>=1.479) cutVal = eleBDTWPHEHP; } mvaVal = Electron_mvaFall17V2Iso[i]; @@ -89,11 +87,11 @@ std::vector H4LTools::passTight_Id(){ std::vector tightid; //unsigned nMu = (*nMuon).Get()[0]; for (unsigned int i=0; i5))); + tightid.push_back(Muon_isPFcand[i]||(((Muon_ptErr[i]/Muon_Pt_Corrected[i])MuTightTrackerLayercut))); } } @@ -105,7 +103,7 @@ std::vector H4LTools::goodFsrPhotons(){ std::vector goodFsrPhoton; //unsigned nFsr = (*nFsrPhoton).Get()[0]; for (unsigned int i=0; i2)&&(fabs(FsrPhoton_eta[i])<2.4)&&(FsrPhoton_relIso03[i]<0.8)){ + if((FsrPhoton_pt[i]>fsrphotonPtcut)&&(fabs(FsrPhoton_eta[i]) H4LTools::SelectedJets(std::vector ele, std::vector goodJets; //unsigned nJ = (*nJet).Get()[0]; for(unsigned int i=0;i30)&&(fabs(Jet_eta[i])<4.7)){ + if((Jet_pt[i]>JetPtcut)&&(fabs(Jet_eta[i])0)&&(Jet_puId[i]==7)){ int overlaptag=0; TLorentzVector jettest; @@ -153,7 +151,7 @@ unsigned H4LTools::doFsrRecovery(TLorentzVector Lep){ float dRlC,dRlOverPtC; dRlC = fsrcand.DeltaR(Lep); dRlOverPtC = dRl/(fsrcand.Pt()*fsrcand.Pt()); - if ((dRlC<0.5)&&(dRlOverPtC<0.012)){ + if ((dRlC 5) + if(isMC && nLayers > MuTightTrackerLayercut) { if(genPt > 0) scale_factor = calibrator->kSpreadMC(charge, pt, eta, phi, genPt); @@ -298,7 +296,12 @@ void H4LTools::MuonPtCorrection(bool isMC){ Muon_Pt_Corrected.clear(); for (unsigned int i=0; i12)&&(Zcan.M()<120)){ + if((Zcan.M()>MZcutdown)&&(Zcan.M()12)&&(Zcan.M()<120)){ + if((Zcan.M()>MZcutdown)&&(Zcan.M() Z1CanIndex; std::vector Z2CanIndex; - + int ghosttag = 0, QCDtag=0, lepPtTag = 0; for (unsigned int m=0; m<(Zlist.size()-1); m++){ for (unsigned int n=m+1; n20) || (Zlep2pt[m]>20) || (Zlep1pt[n]>20) || (Zlep2pt[n]>20); @@ -536,7 +540,7 @@ bool H4LTools::ZZSelection(){ if (Zlep2pt[n]>10) nPassPt10 += 1; if (nPassPt10 < 2) continue; if (nPassPt20 == false) continue; //lep Pt requirements - + lepPtTag++; if ((Zlep1chg[m]+Zlep1chg[n])==0){ TLorentzVector lepA,lepB,lepAB; lepA.SetPtEtaPhiM(Zlep1ptNoFsr[m],Zlep1etaNoFsr[m],Zlep1phiNoFsr[m],Zlep1massNoFsr[m]); @@ -565,7 +569,7 @@ bool H4LTools::ZZSelection(){ lepAB = lepA + lepB; if(lepAB.M()<4) continue; } - + QCDtag++; if ((Zlist[m].M()<40) && (Zlist[n].M()<40)) continue; //Z1 mass TLorentzVector zZ1,zZ2; @@ -608,7 +612,7 @@ bool H4LTools::ZZSelection(){ } } if (passSmartCut==false) continue ; - if (zZ1.M()+zZ2.M()<70) continue; + if (zZ1.M()+zZ2.M()Zlist[n].M()){ Z1CanIndex.push_back(m); @@ -623,6 +627,21 @@ bool H4LTools::ZZSelection(){ } } + if(ghosttag){ + if (flag2e2mu) cutghost2e2mu++; + if (flag4e) cutghost4e++; + if (flag4mu) cutghost4mu++; + } + if(lepPtTag){ + if (flag2e2mu) cutLepPt2e2mu++; + if (flag4e) cutLepPt4e++; + if (flag4mu) cutLepPt4mu++; + } + if(QCDtag){ + if (flag2e2mu) cutQCD2e2mu++; + if (flag4e) cutQCD4e++; + if (flag4mu) cutQCD4mu++; + } if(foundZZCandidate == false){ return foundZZCandidate; } @@ -662,7 +681,7 @@ bool H4LTools::ZZSelection(){ ZZsystemnofsr = Z1nofsr+Z2nofsr; float massZZ; massZZ = ZZsystem.M(); - if ((massZZ>105)&&(massZZ<160)){ + if ((massZZ>HiggscutDown)&&(massZZ Date: Sun, 3 Sep 2023 22:48:11 +0800 Subject: [PATCH 02/10] yml updated --- Input_2017.yml | 91 ++++++++++++++++++++++++++++++++++++++++++++++++-- Input_2018.yml | 90 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 178 insertions(+), 3 deletions(-) diff --git a/Input_2017.yml b/Input_2017.yml index f884928..9ba37ab 100644 --- a/Input_2017.yml +++ b/Input_2017.yml @@ -14,10 +14,97 @@ Triggers: - event.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ - event.HLT_Mu8_DiEle12_CaloIdL_TrackIdL - event.HLT_Ele35_WPTight_Gsf - - event.HLT_Ele35_WPTight_Gsf_L1EGMT - event.HLT_Ele38_WPTight_Gsf - event.HLT_Ele40_WPTight_Gsf - event.HLT_IsoMu27 RoccoRPath: - KalmanMuonCalibrationsProducer/data/roccor.Run2.v5/RoccoR2017UL.txt \ No newline at end of file + KalmanMuonCalibrationsProducer/data/roccor.Run2.v5/RoccoR2017UL.txt + +Zmass: + 91.1876 +MZ1cut: + 40 +MZcut: + down: + 12 + up: + 120 +MZZcut: + 70 +Higgscut: + up: + 160 + down: + 105 + +Electron: + pTcut: + 7 + Etacut: + 2.5 + Sip3dcut: + 4 + Loosedxycut: + 0.5 + Loosedzcut: + 1 + BDTWP: + LowEta: + LowPT: + 0.9128577458 + HighPT: + 0.1559788054 + MedEta: + LowPT: + 0.9056792368 + HighPT: + 0.0273863727 + HighEta: + LowPT: + 0.9439440575 + HighPT: + -0.5532483665 + Isocut: + 0.35 +Muon: + pTcut: + 5 + Etacut: + 2.4 + Sip3dcut: + 4 + Loosedxycut: + 0.5 + Loosedzcut: + 1 + Tightdxycut: + 0.2 + Tightdzcut: + 0.5 + TightTrackerLayercut: + 5 + TightpTErrorcut: + 0.3 + HighPtBound: + 200 + Isocut: + 0.35 + +FsrPhoton: + pTcut: + 2 + Etacut: + 2.4 + Isocut: + 0.8 + dRlcut: + 0.5 + dRlOverPtcut: + 0.012 + +Jet: + pTcut: + 30 + Etacut: + 4.7 \ No newline at end of file diff --git a/Input_2018.yml b/Input_2018.yml index c6e7746..faa8908 100644 --- a/Input_2018.yml +++ b/Input_2018.yml @@ -9,4 +9,92 @@ Triggers: - event.HLT_IsoMu24 RoccoRPath: - KalmanMuonCalibrationsProducer/data/roccor.Run2.v5/RoccoR2018UL.txt \ No newline at end of file + KalmanMuonCalibrationsProducer/data/roccor.Run2.v5/RoccoR2018UL.txt + +Zmass: + 91.1876 +MZ1cut: + 40 +MZcut: + down: + 12 + up: + 120 +MZZcut: + 70 +Higgscut: + up: + 160 + down: + 105 + +Electron: + pTcut: + 7 + Etacut: + 2.5 + Sip3dcut: + 4 + Loosedxycut: + 0.5 + Loosedzcut: + 1 + BDTWP: + LowEta: + LowPT: + 0.9044286167 + HighPT: + 0.1968600840 + MedEta: + LowPT: + 0.9094166886 + HighPT: + 0.0759172100 + HighEta: + LowPT: + 0.9443653660 + HighPT: + -0.5169136775 + Isocut: + 0.35 +Muon: + pTcut: + 5 + Etacut: + 2.4 + Sip3dcut: + 4 + Loosedxycut: + 0.5 + Loosedzcut: + 1 + Tightdxycut: + 0.2 + Tightdzcut: + 0.5 + TightTrackerLayercut: + 5 + TightpTErrorcut: + 0.3 + HighPtBound: + 200 + Isocut: + 0.35 + +FsrPhoton: + pTcut: + 2 + Etacut: + 2.4 + Isocut: + 0.8 + dRlcut: + 0.5 + dRlOverPtcut: + 0.012 + +Jet: + pTcut: + 30 + Etacut: + 4.7 From ba283d8d30cdf19924ffd7187d9a9f4091becd13 Mon Sep 17 00:00:00 2001 From: Anusree Date: Fri, 8 Sep 2023 19:05:58 +0200 Subject: [PATCH 03/10] changes for 2l2nu branch --- H4LCppModule.py | 27 +++++++-- condor_setup_lxplus.py | 4 +- .../sample_list_v9_2018_campaign.dat | 24 +++++++- post_proc.py | 56 ++++++++++--------- 4 files changed, 77 insertions(+), 34 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index 0ce53f3..038f00e 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -102,6 +102,9 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): self.out.branch("etaZ2_2j", "F") self.out.branch("pTZ2_2j", "F") self.out.branch("EneZ2_2j", "F") + self.out.branch("phiZ2_met", "F") + self.out.branch("pTZ2_met", "F") + self.out.branch("EneZ2_met", "F") self.out.branch("D_CP", "F") self.out.branch("D_0m", "F") self.out.branch("D_0hp", "F") @@ -193,6 +196,7 @@ def analyze(self, event): jets = Collection(event, "Jet") FatJets = Collection(event, "FatJet") genparts = Collection(event, "GenPart") + met = Collection(events, "MET") 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) @@ -208,7 +212,7 @@ def analyze(self, event): self.worker.SetFatJets(xj.pt, xj.eta, xj.phi, xj.msoftdrop, xj.jetId, xj.btagDeepB, xj.particleNet_ZvsQCD) for xg in genparts: self.worker.SetGenParts(xg.pt) - + self.worker.SetMET(met.pt,met.phi,met.sumEt) self.worker.MuonPtCorrection(self.isMC) self.worker.LeptonSelection() foundZZCandidate = False # for 4l @@ -218,7 +222,7 @@ def analyze(self, event): if ((self.worker.nTightEle<2)&(self.worker.nTightMu<2)): pass - if ((self.worker.nTightEle + self.worker.nTightMu == 2) and (not self.worker.nTightMu == 1)): + if ((self.worker.nTightEle + self.worker.nTightMu == 2) and (not self.worker.nTightMu == 1) and (self.worker.MET_sumEt < 150)): # This event should belong to either 2l2q or 2l2nu \ # nTightEle + nTightMu == 2 => 2l2q or 2l2nu => (2,0), (0,2), (1,1) # => Reject (1,1) combination: ( (nTightEle + nTightMu == 2) and (not nTightEle == 1)) @@ -231,13 +235,16 @@ def analyze(self, event): elif (self.worker.nTightEle + self.worker.nTightMu >= 4): # This event should belong to 4l; nTightEle + nTightMu >= 4 foundZZCandidate = self.worker.ZZSelection_4l() + elif ((self.worker.nTightEle + self.worker.nTightMu >= 4) and (self.worker.MET_sumEt > 150)): + # This event should belong to 4l; nTightEle + nTightMu >= 4 + foundZZCandidate_2l2nu = self.worker.ZZSelection_2l2nu() if (foundZZCandidate_2l2q): keepIt = True self.passZZEvts += 1 # FatJet_PNZvsQCD = self.worker.FatJet_PNZvsQCD # self.out.fillBranch("FatJet_PNZvsQCD",FatJet_PNZvsQCD) - massZ2_2j = self.worker.Z2_2j.M() #Anusree + massZ2_2j = self.worker.Z2_2j.M() phiZ2_2j = self.worker.Z2_2j.Phi() etaZ2_2j = self.worker.Z2_2j.Eta() pTZ2_2j = self.worker.Z2_2j.Pt() @@ -248,7 +255,19 @@ def analyze(self, event): self.out.fillBranch("pTZ2_2j",pTZ2_2j) self.out.fillBranch("EneZ2_2j",EneZ2_2j) - if (foundZZCandidate or foundZZCandidate_2l2q): + if (foundZZCandidate_2l2nu): + keepIt = True + self.passZZEvts += 1 + # FatJet_PNZvsQCD = self.worker.FatJet_PNZvsQCD + # self.out.fillBranch("FatJet_PNZvsQCD",FatJet_PNZvsQCD) + phiZ2_met = self.worker.Z2_met.Phi() + pTZ2_met = self.worker.Z2_met.Pt() + EneZ2_met = self.worker.Z2_met.sumEt() + self.out.fillBranch("phiZ2_met",phiZ2_met) + self.out.fillBranch("pTZ2_2j",pTZ2_2j) + self.out.fillBranch("EneZ2_met",EneZ2_met) + + if (foundZZCandidate or foundZZCandidate_2l2q or foundZZCandidate_2l2nu): keepIt = True self.passZZEvts += 1 diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index 7851e4c..0a3c41e 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -177,8 +177,8 @@ def main(args): print("\n#===> Set Proxy Using:") print("voms-proxy-init --voms cms --valid 168:00") print("\n# It is assumed that the proxy is created in file: /tmp/x509up_u48539. Update this in below two lines:") - print("cp /tmp/x509up_u48539 ~/") - print("export X509_USER_PROXY=~/x509up_u48539") + print("cp /tmp/x509up_u153104 ~/") + print("export X509_USER_PROXY=~/x509up_u153104") print("\n#Submit jobs:") print("condor_submit "+condor_file_name+".jdl") #os.system("condor_submit "+condor_file_name+".jdl") diff --git a/input_data_Files/sample_list_v9_2018_campaign.dat b/input_data_Files/sample_list_v9_2018_campaign.dat index 24f40eb..cc0c1dd 100644 --- a/input_data_Files/sample_list_v9_2018_campaign.dat +++ b/input_data_Files/sample_list_v9_2018_campaign.dat @@ -1 +1,23 @@ -/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +#Signal +#/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +## Background +#DY +/DYJetsToLL_M-4to50_HT-70to100_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v3/NANOAODSIM +/DYJetsToLL_M-4to50_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v2/NANOAODSIM +/DYJetsToLL_M-4to50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v3/NANOAODSIM +/DYJetsToLL_M-4to50_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v2/NANOAODSIM +/DYJetsToLL_M-4to50_HT-600toInf_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v2/NANOAODSIM +/DYJetsToLL_M-50_HT-70to100_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +/DYJetsToLL_M-50_HT-100to200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +/DYJetsToLL_M-50_HT-200to400_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +/DYJetsToLL_M-50_HT-400to600_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +/DYJetsToLL_M-50_HT-600to800_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +/DYJetsToLL_M-50_HT-800to1200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +/DYJetsToLL_M-50_HT-1200to2500_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +/DYJetsToLL_M-50_HT-2500toInf_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +##TTbar +#/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +##Diboson +#/WWTo2L2Nu_TuneCP5_13TeV-powheg-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v2/NANOAODSIM +#/WZTo2Q2L_mllmin4p0_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +#/ZZTo2Q2L_mllmin4p0_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM diff --git a/post_proc.py b/post_proc.py index e310ea4..25f6bce 100755 --- a/post_proc.py +++ b/post_proc.py @@ -7,13 +7,13 @@ from PhysicsTools.NanoAODTools.postprocessing.modules.jme.jetmetHelperRun2 import * from PhysicsTools.NanoAODTools.postprocessing.modules.btv.btagSFProducer import * -ifRunningOnCondor = False +ifRunningOnCondor = True WhichSample = "2l2q" # options: "4l", "2l2q", "2l2nu" testfilelist = [] if ifRunningOnCondor: - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root" + testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root" testfilelist.append(testfile) if WhichSample == "4l" and (not ifRunningOnCondor): @@ -34,32 +34,34 @@ # 2l2q ggH Sample 1000 GeV - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/F920B631-39E7-EE4C-9D8D-B242A2103115.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/0188520D-6137-9546-8D8A-546D089E4F79.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/CB8568FB-F94F-5C4D-B763-2390FE18E0C9.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/130000/39E6146D-1A47-5042-B843-5F7263B262E9.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/2E79070C-3860-C84E-A0E9-B63E85E42B8A.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/A226A60B-9BD4-B64B-B53E-A26DB011BD7B.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2261826-B5D4-A544-9AF0-03FCF04EDFCE.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2D8B29B-E543-2444-86BB-726AF4060A2A.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/7F817CD1-84C1-5347-AEEA-F069CAE84799.root" - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/844A1B6D-AC02-3641-B9D2-08446FBEA30B.root" - testfile = "root://cms-xrd-global.cern.ch/ /store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/90E68AE8-1691-CC40-B817-71AF5A46B429.root" - +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" +## BKG + testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/ZZTo2Q2L_mllmin4p0_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/2540000/A58AE71A-0273-8546-8FBD-3F729CAF6516.root" if WhichSample == "2l2q" and (not ifRunningOnCondor): ## UL2018 - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/130000/39E6146D-1A47-5042-B843-5F7263B262E9.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/A226A60B-9BD4-B64B-B53E-A26DB011BD7B.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/2E79070C-3860-C84E-A0E9-B63E85E42B8A.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/0188520D-6137-9546-8D8A-546D089E4F79.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/90E68AE8-1691-CC40-B817-71AF5A46B429.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2D8B29B-E543-2444-86BB-726AF4060A2A.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/7F817CD1-84C1-5347-AEEA-F069CAE84799.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/CB8568FB-F94F-5C4D-B763-2390FE18E0C9.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2261826-B5D4-A544-9AF0-03FCF04EDFCE.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/844A1B6D-AC02-3641-B9D2-08446FBEA30B.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/F920B631-39E7-EE4C-9D8D-B242A2103115.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/data/Run2018A/SingleMuon/NANOAOD/UL2018_MiniAODv2_NanoAODv9_GT36-v1/2820000/06EFD7A6-A6F1-E145-B1F8-C6794FE4EDDD.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/130000/39E6146D-1A47-5042-B843-5F7263B262E9.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/A226A60B-9BD4-B64B-B53E-A26DB011BD7B.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/2E79070C-3860-C84E-A0E9-B63E85E42B8A.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/0188520D-6137-9546-8D8A-546D089E4F79.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/90E68AE8-1691-CC40-B817-71AF5A46B429.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2D8B29B-E543-2444-86BB-726AF4060A2A.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/7F817CD1-84C1-5347-AEEA-F069CAE84799.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/CB8568FB-F94F-5C4D-B763-2390FE18E0C9.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2261826-B5D4-A544-9AF0-03FCF04EDFCE.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/844A1B6D-AC02-3641-B9D2-08446FBEA30B.root") +# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/F920B631-39E7-EE4C-9D8D-B242A2103115.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/ZZTo2Q2L_mllmin4p0_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/2540000/A58AE71A-0273-8546-8FBD-3F729CAF6516.root") + ##testfilelist.append("root://cms-xrd-global.cern.ch//store/data/Run2018A/SingleMuon/NANOAOD/UL2018_MiniAODv2_NanoAODv9_GT36-v1/2820000/06EFD7A6-A6F1-E145-B1F8-C6794FE4EDDD.root") ## UL2017 # testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v1/40000/4E6C744B-023A-E14A-9ADD-663C7101E98E.root") @@ -68,7 +70,7 @@ if WhichSample == "2l2nu" and (not ifRunningOnCondor): #2l2nu testfilelist.append("root://cms-xrd-global.cern.ch/") -entriesToRun = 10 # 0 if need to run over all entries else put number of entries to run +entriesToRun = 0 # 0 if need to run over all entries else put number of entries to run isMC = True # Keep DownloadFileToLocalThenRun=True this should reduce the file read error from eos. DownloadFileToLocalThenRun=True From 9d8b35cb7b7163b740954e5359f1756734548ae9 Mon Sep 17 00:00:00 2001 From: Anusree Date: Thu, 14 Sep 2023 10:54:41 +0200 Subject: [PATCH 04/10] update to the 2l2nu part --- H4LCppModule.py | 11 +++++++ interface/H4LTools.h | 14 +++++++- src/H4LTools.cc | 78 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 101 insertions(+), 2 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index 038f00e..98e4a5b 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -76,6 +76,16 @@ def endJob(self): print("{:27}:{:7} {}".format("Pass2l1JCut: ", str(self.worker.cut2l1J), " Events")) print("{:27}:{:7} {}".format("Pass2l2jCut: ", str(self.worker.cut2l2j), " Events")) print("{:27}:{:7} {}".format("Pass2l1Jor2jCut: ", str(self.worker.cut2l1Jor2j), " Events")) + + print("\n================== 2l2nu ==============\n") + print("{:27}:{:7} {}".format("Total: ", str(self.noCutsEvts), " Events")) + print("{:27}:{:7} {}".format("PassTrig: ", str(self.passtrigEvts), " Events")) + print("{:27}:{:7} {}".format("Pass2e_metCut: ", str(self.worker.cut2e_met), " Events")) + print("{:27}:{:7} {}".format("Pass2mu_metCut: ", str(self.worker.cut2mu_met), " Events")) + print("{:27}:{:7} {}".format("Pass2l_metCut: ", str(self.worker.cut2l_met), " Events")) + print("{:27}:{:7} {}".format("Pass2e_metCut (40 < mll < 180): ", str(self.worker.cut2e_met_m40_180), " Events")) + print("{:27}:{:7} {}".format("Pass2l_metCut (40 < mll < 180): ", str(self.worker.cut2l_met_m40_180), " Events")) + print("{:27}:{:7} {}".format("Pass2l1metCut: ", str(self.worker.cut2l1met), " Events")) print("\n========== END: Print Cut flow table ====================\n") pass @@ -212,6 +222,7 @@ def analyze(self, event): self.worker.SetFatJets(xj.pt, xj.eta, xj.phi, xj.msoftdrop, xj.jetId, xj.btagDeepB, xj.particleNet_ZvsQCD) for xg in genparts: self.worker.SetGenParts(xg.pt) + # for xn in MET: self.worker.SetMET(met.pt,met.phi,met.sumEt) self.worker.MuonPtCorrection(self.isMC) self.worker.LeptonSelection() diff --git a/interface/H4LTools.h b/interface/H4LTools.h index 5ef79dd..e0c346f 100644 --- a/interface/H4LTools.h +++ b/interface/H4LTools.h @@ -201,6 +201,11 @@ class H4LTools { bool flag2e; bool flag2mu; bool flag2l; + bool flag2e_met; + bool flag2mu_met; + bool flag2l_met; + + void LeptonSelection(); std::vector looseEle,looseMu,bestEle,bestMu, tighteleforjetidx, tightmuforjetidx; @@ -262,6 +267,7 @@ class H4LTools { flag4e=false; flag4mu=false; flag2e2mu=false; flag2e=false; flag2mu=false; flag2l=false; + flag2e_met=false; flag2mu_met=false; flag2l_met=false; } TSpline *spline_g4; @@ -271,15 +277,19 @@ class H4LTools { bool findZCandidate(); bool ZZSelection_4l(); bool ZZSelection_2l2q(); + bool ZZSelection_2l2nu(); TLorentzVector Z1; TLorentzVector Z1nofsr; TLorentzVector Z2; TLorentzVector Z2_2j; + TLorentzVector Z2_met; TLorentzVector Z2nofsr; TLorentzVector ZZsystem; TLorentzVector ZZsystemnofsr; TLorentzVector ZZ_2jsystem; TLorentzVector ZZ_2jsystemnofsr; + TLorentzVector ZZ_metsystem; + TLorentzVector ZZ_metsystemnofsr; RoccoR *calibrator; Mela* mela; @@ -298,7 +308,9 @@ class H4LTools { int cut4e, cut4mu, cut2e2mu, cutZZ4e, cutZZ4mu, cutZZ2e2mu, cutm4l4e, cutm4l4mu, cutm4l2e2mu; int cut2e_m40_180, cut2mu_m40_180, cut2l_m40_180; - int cut2e, cut2mu, cut2l, cut2l1J, cut2l2j, cut2l1Jor2j; + int cut2l_met_m40_180, cut2e_met_m40_180, cut2mu_met_m40_180; + int cut2e, cut2mu, cut2l, cut2l1J, cut2l2j, cut2l1Jor2j, cut2l1met; + int cut2e_met, cut2mu_met, cut2l_met; float pTL1, etaL1, phiL1, massL1, pTL2, etaL2, phiL2, massL2, pTL3, etaL3, phiL3, massL3, pTL4, etaL4, phiL4, massL4; float pTj1, etaj1, phij1, mj1, pTj2, etaj2, phij2, mj2; diff --git a/src/H4LTools.cc b/src/H4LTools.cc index 4048776..71cb447 100644 --- a/src/H4LTools.cc +++ b/src/H4LTools.cc @@ -995,13 +995,89 @@ bool H4LTools::ZZSelection_2l2q(){ float massZZ; massZZ = ZZsystem.M(); - + float massZZ_2j; massZZ_2j = ZZ_2jsystem.M(); } return foundZZCandidate; } +//////new implementation//////////////////////////////////////////////////////////// +bool H4LTools::ZZSelection_2l2nu(){ + if (nTightEle>=2) { + cut2e_met++; + cut2l_met++; + flag2e_met = true; + flag2l_met = true; + } + else if (nTightMu>=2){ + cut2mu_met++; + cut2l_met++; + flag2mu_met = true; + flag2l_met = true; + } + bool foundZZCandidate = false; + if(!findZCandidate()){ + return foundZZCandidate; + } + if((nTightMu+nTightEle)<2){ + return foundZZCandidate; + } + if (abs(nTightEleChgSum) != 0 and abs(nTightMuChgSum) != 0) + { + return foundZZCandidate; + } + + if(Zlist.size()<1){ + return foundZZCandidate; + } + // Find ZZ candidate + std::vector Z1CanIndex; + std::vector Z2CanIndex; + for (unsigned int m=0; m<(Zlist.size()); m++){ + Z1CanIndex.push_back(m); + } + + int Z1index,Z2index; + Z1index = Z1CanIndex[0]; + Z1 = Zlist[Z1index]; + Z1nofsr = Zlistnofsr[Z1index]; + + if (Z1.M() < 40.0 || Z1.M() > 180) + { + return foundZZCandidate; + } + + cut2l_met_m40_180++; + if (flag2e_met) + cut2e_met_m40_180++; + if (flag2mu) + cut2mu_met_m40_180++; + + jetidx = SelectedJets(tighteleforjetidx, tightmuforjetidx); + FatJetidx = SelectedFatJets(tighteleforjetidx, tightmuforjetidx); + + if (MET_sumEt > 150) + { + foundZZCandidate = true; + Z2_met.SetPtPhiMt(MET_pt[0], MET_phi[0], MET_sumEt[0]); + cut2l1met++; + } + ZZ_metsystem = Z1 + Z2_met; + ZZ_metsystemnofsr = Z1nofsr + Z2_met; + + float METZZ_met; + METZZ_met = ZZ_metsystem.sumEt(); + + + return foundZZCandidate; +} + +/////////////////////////////////////////////////////////////////////////////// + + + + float H4LTools::getDg4Constant(float ZZMass){ return spline_g4->Eval(ZZMass); From 4774ebf28a8fa21469a93dd90759af254d32fca0 Mon Sep 17 00:00:00 2001 From: Ramkrishna Sharma Date: Tue, 19 Sep 2023 09:31:45 +0200 Subject: [PATCH 05/10] Revert "Adding HZZ->2l2nu Category" (#15) --- H4LCppModule.py | 38 +------- condor_setup_lxplus.py | 13 ++- .../sample_list_v9_2018_campaign.dat | 24 +---- interface/H4LTools.h | 14 +-- post_proc.py | 89 +++++++++---------- src/H4LTools.cc | 78 +--------------- 6 files changed, 52 insertions(+), 204 deletions(-) diff --git a/H4LCppModule.py b/H4LCppModule.py index 98e4a5b..0ce53f3 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -76,16 +76,6 @@ def endJob(self): print("{:27}:{:7} {}".format("Pass2l1JCut: ", str(self.worker.cut2l1J), " Events")) print("{:27}:{:7} {}".format("Pass2l2jCut: ", str(self.worker.cut2l2j), " Events")) print("{:27}:{:7} {}".format("Pass2l1Jor2jCut: ", str(self.worker.cut2l1Jor2j), " Events")) - - print("\n================== 2l2nu ==============\n") - print("{:27}:{:7} {}".format("Total: ", str(self.noCutsEvts), " Events")) - print("{:27}:{:7} {}".format("PassTrig: ", str(self.passtrigEvts), " Events")) - print("{:27}:{:7} {}".format("Pass2e_metCut: ", str(self.worker.cut2e_met), " Events")) - print("{:27}:{:7} {}".format("Pass2mu_metCut: ", str(self.worker.cut2mu_met), " Events")) - print("{:27}:{:7} {}".format("Pass2l_metCut: ", str(self.worker.cut2l_met), " Events")) - print("{:27}:{:7} {}".format("Pass2e_metCut (40 < mll < 180): ", str(self.worker.cut2e_met_m40_180), " Events")) - print("{:27}:{:7} {}".format("Pass2l_metCut (40 < mll < 180): ", str(self.worker.cut2l_met_m40_180), " Events")) - print("{:27}:{:7} {}".format("Pass2l1metCut: ", str(self.worker.cut2l1met), " Events")) print("\n========== END: Print Cut flow table ====================\n") pass @@ -112,9 +102,6 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree): self.out.branch("etaZ2_2j", "F") self.out.branch("pTZ2_2j", "F") self.out.branch("EneZ2_2j", "F") - self.out.branch("phiZ2_met", "F") - self.out.branch("pTZ2_met", "F") - self.out.branch("EneZ2_met", "F") self.out.branch("D_CP", "F") self.out.branch("D_0m", "F") self.out.branch("D_0hp", "F") @@ -206,7 +193,6 @@ def analyze(self, event): jets = Collection(event, "Jet") FatJets = Collection(event, "FatJet") genparts = Collection(event, "GenPart") - met = Collection(events, "MET") 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) @@ -222,8 +208,7 @@ def analyze(self, event): self.worker.SetFatJets(xj.pt, xj.eta, xj.phi, xj.msoftdrop, xj.jetId, xj.btagDeepB, xj.particleNet_ZvsQCD) for xg in genparts: self.worker.SetGenParts(xg.pt) - # for xn in MET: - self.worker.SetMET(met.pt,met.phi,met.sumEt) + self.worker.MuonPtCorrection(self.isMC) self.worker.LeptonSelection() foundZZCandidate = False # for 4l @@ -233,7 +218,7 @@ def analyze(self, event): if ((self.worker.nTightEle<2)&(self.worker.nTightMu<2)): pass - if ((self.worker.nTightEle + self.worker.nTightMu == 2) and (not self.worker.nTightMu == 1) and (self.worker.MET_sumEt < 150)): + if ((self.worker.nTightEle + self.worker.nTightMu == 2) and (not self.worker.nTightMu == 1)): # This event should belong to either 2l2q or 2l2nu \ # nTightEle + nTightMu == 2 => 2l2q or 2l2nu => (2,0), (0,2), (1,1) # => Reject (1,1) combination: ( (nTightEle + nTightMu == 2) and (not nTightEle == 1)) @@ -246,16 +231,13 @@ def analyze(self, event): elif (self.worker.nTightEle + self.worker.nTightMu >= 4): # This event should belong to 4l; nTightEle + nTightMu >= 4 foundZZCandidate = self.worker.ZZSelection_4l() - elif ((self.worker.nTightEle + self.worker.nTightMu >= 4) and (self.worker.MET_sumEt > 150)): - # This event should belong to 4l; nTightEle + nTightMu >= 4 - foundZZCandidate_2l2nu = self.worker.ZZSelection_2l2nu() if (foundZZCandidate_2l2q): keepIt = True self.passZZEvts += 1 # FatJet_PNZvsQCD = self.worker.FatJet_PNZvsQCD # self.out.fillBranch("FatJet_PNZvsQCD",FatJet_PNZvsQCD) - massZ2_2j = self.worker.Z2_2j.M() + massZ2_2j = self.worker.Z2_2j.M() #Anusree phiZ2_2j = self.worker.Z2_2j.Phi() etaZ2_2j = self.worker.Z2_2j.Eta() pTZ2_2j = self.worker.Z2_2j.Pt() @@ -266,19 +248,7 @@ def analyze(self, event): self.out.fillBranch("pTZ2_2j",pTZ2_2j) self.out.fillBranch("EneZ2_2j",EneZ2_2j) - if (foundZZCandidate_2l2nu): - keepIt = True - self.passZZEvts += 1 - # FatJet_PNZvsQCD = self.worker.FatJet_PNZvsQCD - # self.out.fillBranch("FatJet_PNZvsQCD",FatJet_PNZvsQCD) - phiZ2_met = self.worker.Z2_met.Phi() - pTZ2_met = self.worker.Z2_met.Pt() - EneZ2_met = self.worker.Z2_met.sumEt() - self.out.fillBranch("phiZ2_met",phiZ2_met) - self.out.fillBranch("pTZ2_2j",pTZ2_2j) - self.out.fillBranch("EneZ2_met",EneZ2_met) - - if (foundZZCandidate or foundZZCandidate_2l2q or foundZZCandidate_2l2nu): + if (foundZZCandidate or foundZZCandidate_2l2q): keepIt = True self.passZZEvts += 1 diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index 0a3c41e..d40ea28 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -21,7 +21,6 @@ def main(args): condor_file_name = args.condor_file_name condor_queue = args.condor_queue condor_log_path = args.condor_log_path - createTarFile = args.createTarFile # Get top-level directory name from PWD TOP_LEVEL_DIR_NAME = os.path.basename(os.getcwd()) @@ -47,9 +46,9 @@ def main(args): dirName = dirsToCreate.dir_name # create tarball of present working CMSSW base directory - if createTarFile: os.system('rm -f CMSSW*.tgz') + os.system('rm -f CMSSW*.tgz') import makeTarFile - if createTarFile: makeTarFile.make_tarfile(cmsswDirPath, CMSSWRel+".tgz") + makeTarFile.make_tarfile(cmsswDirPath, CMSSWRel+".tgz") print("copying the "+CMSSWRel+".tgz file to eos path: "+storeDir+"\n") os.system('cp ' + CMSSWRel+".tgz" + ' '+storeDir+'/' + CMSSWRel+".tgz") @@ -146,7 +145,6 @@ def main(args): outScript.write("\n"+'rm *.root'); outScript.write("\n"+'scramv1 b ProjectRename'); outScript.write("\n"+'eval `scram runtime -sh`'); - outScript.write("\n"+'sed -i "s/ifRunningOnCondor = .*/ifRunningOnCondor = True/g" '+post_proc_to_run); outScript.write("\n"+'sed -i "s/testfile = .*/testfile = \\"${1}\\"/g" '+post_proc_to_run); outScript.write("\n"+'echo "========================================="'); outScript.write("\n"+'echo "cat post_proc.py"'); @@ -177,8 +175,8 @@ def main(args): print("\n#===> Set Proxy Using:") print("voms-proxy-init --voms cms --valid 168:00") print("\n# It is assumed that the proxy is created in file: /tmp/x509up_u48539. Update this in below two lines:") - print("cp /tmp/x509up_u153104 ~/") - print("export X509_USER_PROXY=~/x509up_u153104") + print("cp /tmp/x509up_u48539 ~/") + print("export X509_USER_PROXY=~/x509up_u48539") print("\n#Submit jobs:") print("condor_submit "+condor_file_name+".jdl") #os.system("condor_submit "+condor_file_name+".jdl") @@ -191,10 +189,9 @@ class PreserveWhitespaceFormatter(argparse.RawTextHelpFormatter, argparse.Argume 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("--use_custom_eos", default=False, action='store_true', help="Use custom EOS.") - parser.add_argument("--createTarFile", default=True, action='store_false', help="Use custom EOS.") 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.") parser.add_argument("--input_file", default='sample_list_v9_2018_campaign.dat', help="Input file from where to read DAS names.") - parser.add_argument("--eos_output_path", default='/eos/user/a/avijay/Higgs_020723', help="Initial path for operations.") + parser.add_argument("--eos_output_path", default='/eos/user/r/rasharma/post_doc_ihep/h2l2Q/', help="Initial path for operations.") 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=""" diff --git a/input_data_Files/sample_list_v9_2018_campaign.dat b/input_data_Files/sample_list_v9_2018_campaign.dat index cc0c1dd..24f40eb 100644 --- a/input_data_Files/sample_list_v9_2018_campaign.dat +++ b/input_data_Files/sample_list_v9_2018_campaign.dat @@ -1,23 +1 @@ -#Signal -#/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -## Background -#DY -/DYJetsToLL_M-4to50_HT-70to100_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v3/NANOAODSIM -/DYJetsToLL_M-4to50_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v2/NANOAODSIM -/DYJetsToLL_M-4to50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v3/NANOAODSIM -/DYJetsToLL_M-4to50_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v2/NANOAODSIM -/DYJetsToLL_M-4to50_HT-600toInf_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v2/NANOAODSIM -/DYJetsToLL_M-50_HT-70to100_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -/DYJetsToLL_M-50_HT-100to200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -/DYJetsToLL_M-50_HT-200to400_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -/DYJetsToLL_M-50_HT-400to600_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -/DYJetsToLL_M-50_HT-600to800_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -/DYJetsToLL_M-50_HT-800to1200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -/DYJetsToLL_M-50_HT-1200to2500_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -/DYJetsToLL_M-50_HT-2500toInf_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -##TTbar -#/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -##Diboson -#/WWTo2L2Nu_TuneCP5_13TeV-powheg-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v2/NANOAODSIM -#/WZTo2Q2L_mllmin4p0_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM -#/ZZTo2Q2L_mllmin4p0_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM +/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/RunIISummer20UL18NanoAODv9-106X_upgrade2018_realistic_v16_L1v1-v1/NANOAODSIM diff --git a/interface/H4LTools.h b/interface/H4LTools.h index e0c346f..5ef79dd 100644 --- a/interface/H4LTools.h +++ b/interface/H4LTools.h @@ -201,11 +201,6 @@ class H4LTools { bool flag2e; bool flag2mu; bool flag2l; - bool flag2e_met; - bool flag2mu_met; - bool flag2l_met; - - void LeptonSelection(); std::vector looseEle,looseMu,bestEle,bestMu, tighteleforjetidx, tightmuforjetidx; @@ -267,7 +262,6 @@ class H4LTools { flag4e=false; flag4mu=false; flag2e2mu=false; flag2e=false; flag2mu=false; flag2l=false; - flag2e_met=false; flag2mu_met=false; flag2l_met=false; } TSpline *spline_g4; @@ -277,19 +271,15 @@ class H4LTools { bool findZCandidate(); bool ZZSelection_4l(); bool ZZSelection_2l2q(); - bool ZZSelection_2l2nu(); TLorentzVector Z1; TLorentzVector Z1nofsr; TLorentzVector Z2; TLorentzVector Z2_2j; - TLorentzVector Z2_met; TLorentzVector Z2nofsr; TLorentzVector ZZsystem; TLorentzVector ZZsystemnofsr; TLorentzVector ZZ_2jsystem; TLorentzVector ZZ_2jsystemnofsr; - TLorentzVector ZZ_metsystem; - TLorentzVector ZZ_metsystemnofsr; RoccoR *calibrator; Mela* mela; @@ -308,9 +298,7 @@ class H4LTools { int cut4e, cut4mu, cut2e2mu, cutZZ4e, cutZZ4mu, cutZZ2e2mu, cutm4l4e, cutm4l4mu, cutm4l2e2mu; int cut2e_m40_180, cut2mu_m40_180, cut2l_m40_180; - int cut2l_met_m40_180, cut2e_met_m40_180, cut2mu_met_m40_180; - int cut2e, cut2mu, cut2l, cut2l1J, cut2l2j, cut2l1Jor2j, cut2l1met; - int cut2e_met, cut2mu_met, cut2l_met; + int cut2e, cut2mu, cut2l, cut2l1J, cut2l2j, cut2l1Jor2j; float pTL1, etaL1, phiL1, massL1, pTL2, etaL2, phiL2, massL2, pTL3, etaL3, phiL3, massL3, pTL4, etaL4, phiL4, massL4; float pTj1, etaj1, phij1, mj1, pTj2, etaj2, phij2, mj2; diff --git a/post_proc.py b/post_proc.py index 25f6bce..f867c71 100755 --- a/post_proc.py +++ b/post_proc.py @@ -7,83 +7,74 @@ from PhysicsTools.NanoAODTools.postprocessing.modules.jme.jetmetHelperRun2 import * from PhysicsTools.NanoAODTools.postprocessing.modules.btv.btagSFProducer import * -ifRunningOnCondor = True +ifRunningOnCondor = False WhichSample = "2l2q" # options: "4l", "2l2q", "2l2nu" testfilelist = [] if ifRunningOnCondor: - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root" + testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root" testfilelist.append(testfile) -if WhichSample == "4l" and (not ifRunningOnCondor): -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/4743B911-1EA3-7E46-959B-93F466ED622F.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/DE3F93DE-DAF6-DD4A-AC3B-13ACE92EAD68.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/2430000/336F0076-347C-AC40-B1B4-E31E14323B81.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/100D0E96-C700-5244-874F-38DB4B410228.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/28512C40-9C25-864A-98E9-4746C0471E63.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/2BAB6B06-FFE2-DC4F-A57F-3A33B3326A30.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/453FC70D-8164-1B4B-A756-81E7432C1D61.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/5C1E0BC2-F153-E946-9B61-470E8AF85C58.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/9DB74D60-0434-A04C-B430-173D6D6538C3.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/DB3B1648-246F-314E-9DD8-FACEA0AE62F6.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/FD91C4F0-7DE3-4947-817D-3EA957A0BC50.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/6021CDF7-AE6F-464D-81E2-AB75ABC4809D.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/77B90DAA-35B9-004E-9C49-52E516FB15D6.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/C01084F4-328D-0146-B71E-B167AB6A7E86.root") +if WhichSample == "4l": + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/4743B911-1EA3-7E46-959B-93F466ED622F.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/DE3F93DE-DAF6-DD4A-AC3B-13ACE92EAD68.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/2430000/336F0076-347C-AC40-B1B4-E31E14323B81.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/100D0E96-C700-5244-874F-38DB4B410228.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/28512C40-9C25-864A-98E9-4746C0471E63.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/2BAB6B06-FFE2-DC4F-A57F-3A33B3326A30.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/453FC70D-8164-1B4B-A756-81E7432C1D61.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/5C1E0BC2-F153-E946-9B61-470E8AF85C58.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/9DB74D60-0434-A04C-B430-173D6D6538C3.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/DB3B1648-246F-314E-9DD8-FACEA0AE62F6.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/FD91C4F0-7DE3-4947-817D-3EA957A0BC50.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/6021CDF7-AE6F-464D-81E2-AB75ABC4809D.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/77B90DAA-35B9-004E-9C49-52E516FB15D6.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/C01084F4-328D-0146-B71E-B167AB6A7E86.root") # 2l2q ggH Sample 1000 GeV -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -# testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/50000/3822B676-3F8E-5F46-96E2-1BB4040641B9.root" -## BKG - testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/ZZTo2Q2L_mllmin4p0_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/2540000/A58AE71A-0273-8546-8FBD-3F729CAF6516.root" -if WhichSample == "2l2q" and (not ifRunningOnCondor): +testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/F920B631-39E7-EE4C-9D8D-B242A2103115.root" + +======= +if WhichSample == "2l2q": ## UL2018 -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/130000/39E6146D-1A47-5042-B843-5F7263B262E9.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/A226A60B-9BD4-B64B-B53E-A26DB011BD7B.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/2E79070C-3860-C84E-A0E9-B63E85E42B8A.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/0188520D-6137-9546-8D8A-546D089E4F79.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/90E68AE8-1691-CC40-B817-71AF5A46B429.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2D8B29B-E543-2444-86BB-726AF4060A2A.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/7F817CD1-84C1-5347-AEEA-F069CAE84799.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/CB8568FB-F94F-5C4D-B763-2390FE18E0C9.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2261826-B5D4-A544-9AF0-03FCF04EDFCE.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/844A1B6D-AC02-3641-B9D2-08446FBEA30B.root") -# testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/F920B631-39E7-EE4C-9D8D-B242A2103115.root") - testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/ZZTo2Q2L_mllmin4p0_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/2540000/A58AE71A-0273-8546-8FBD-3F729CAF6516.root") - ##testfilelist.append("root://cms-xrd-global.cern.ch//store/data/Run2018A/SingleMuon/NANOAOD/UL2018_MiniAODv2_NanoAODv9_GT36-v1/2820000/06EFD7A6-A6F1-E145-B1F8-C6794FE4EDDD.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/130000/39E6146D-1A47-5042-B843-5F7263B262E9.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/A226A60B-9BD4-B64B-B53E-A26DB011BD7B.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/2E79070C-3860-C84E-A0E9-B63E85E42B8A.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/0188520D-6137-9546-8D8A-546D089E4F79.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/90E68AE8-1691-CC40-B817-71AF5A46B429.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2D8B29B-E543-2444-86BB-726AF4060A2A.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/7F817CD1-84C1-5347-AEEA-F069CAE84799.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/CB8568FB-F94F-5C4D-B763-2390FE18E0C9.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/F2261826-B5D4-A544-9AF0-03FCF04EDFCE.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/844A1B6D-AC02-3641-B9D2-08446FBEA30B.root") + testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/F920B631-39E7-EE4C-9D8D-B242A2103115.root") ## UL2017 # testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v1/40000/4E6C744B-023A-E14A-9ADD-663C7101E98E.root") # 2l2nu ggH Sample 1000 GeV -if WhichSample == "2l2nu" and (not ifRunningOnCondor): #2l2nu +if WhichSample == "2l2nu": testfilelist.append("root://cms-xrd-global.cern.ch/") entriesToRun = 0 # 0 if need to run over all entries else put number of entries to run -isMC = True +isMCTrueFalse = True # Keep DownloadFileToLocalThenRun=True this should reduce the file read error from eos. DownloadFileToLocalThenRun=True -if testfilelist[0].find("/data/") != -1: isMC = False +if testfile.find("UL18") != -1: + year = 2018 +if testfile.find("UL17") != -1: +======= if testfilelist[0].find("UL18") != -1: year = 2018 cfgFile = 'Input_2018.yml' - if testfilelist[0].find("UL17") != -1: + year = 2017 cfgFile = 'Input_2017.yml' -H4LCppModule = lambda: HZZAnalysisCppProducer(isMC, year,cfgFile) +H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile) #p=PostProcessor(".",[testfile],"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt") p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt") diff --git a/src/H4LTools.cc b/src/H4LTools.cc index 71cb447..4048776 100644 --- a/src/H4LTools.cc +++ b/src/H4LTools.cc @@ -995,89 +995,13 @@ bool H4LTools::ZZSelection_2l2q(){ float massZZ; massZZ = ZZsystem.M(); - + float massZZ_2j; massZZ_2j = ZZ_2jsystem.M(); } return foundZZCandidate; } -//////new implementation//////////////////////////////////////////////////////////// -bool H4LTools::ZZSelection_2l2nu(){ - if (nTightEle>=2) { - cut2e_met++; - cut2l_met++; - flag2e_met = true; - flag2l_met = true; - } - else if (nTightMu>=2){ - cut2mu_met++; - cut2l_met++; - flag2mu_met = true; - flag2l_met = true; - } - bool foundZZCandidate = false; - if(!findZCandidate()){ - return foundZZCandidate; - } - if((nTightMu+nTightEle)<2){ - return foundZZCandidate; - } - if (abs(nTightEleChgSum) != 0 and abs(nTightMuChgSum) != 0) - { - return foundZZCandidate; - } - - if(Zlist.size()<1){ - return foundZZCandidate; - } - // Find ZZ candidate - std::vector Z1CanIndex; - std::vector Z2CanIndex; - for (unsigned int m=0; m<(Zlist.size()); m++){ - Z1CanIndex.push_back(m); - } - - int Z1index,Z2index; - Z1index = Z1CanIndex[0]; - Z1 = Zlist[Z1index]; - Z1nofsr = Zlistnofsr[Z1index]; - - if (Z1.M() < 40.0 || Z1.M() > 180) - { - return foundZZCandidate; - } - - cut2l_met_m40_180++; - if (flag2e_met) - cut2e_met_m40_180++; - if (flag2mu) - cut2mu_met_m40_180++; - - jetidx = SelectedJets(tighteleforjetidx, tightmuforjetidx); - FatJetidx = SelectedFatJets(tighteleforjetidx, tightmuforjetidx); - - if (MET_sumEt > 150) - { - foundZZCandidate = true; - Z2_met.SetPtPhiMt(MET_pt[0], MET_phi[0], MET_sumEt[0]); - cut2l1met++; - } - ZZ_metsystem = Z1 + Z2_met; - ZZ_metsystemnofsr = Z1nofsr + Z2_met; - - float METZZ_met; - METZZ_met = ZZ_metsystem.sumEt(); - - - return foundZZCandidate; -} - -/////////////////////////////////////////////////////////////////////////////// - - - - float H4LTools::getDg4Constant(float ZZMass){ return spline_g4->Eval(ZZMass); From d0a6de62357b2b734dd88bda68f99ff68ba75521 Mon Sep 17 00:00:00 2001 From: YujiLee301 <99654114+YujiLee301@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:48:40 +0800 Subject: [PATCH 06/10] Lep ID and FSR fixes (#10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * H4L updates * “Fsr Recovery & Rochester correction” * Jet Selection Updated * Mela loaded * Delete helloworld.h * Delete NJettiness.h * Delete NJettiness.cc * Delete helloworld.cc * Delete proxy.sh * Delete condor_setup_lpc.py * Delete JetSFMaker.py * Delete HZZAnalysisModule.py * Delete condor_setup_lxplus.py * Add files via upload * Remove redundancy * Update README.md * Add files via upload * Update README.md * Update README.md * Update README.md * RoccoR Added * Path fixed * Add files via upload * Add files via upload * Delete __init__.pyc * Delete RoccoR.cc * Delete RoccoR.h * Update README.md * Update H4LCppModule.py * Update keep_and_drop.txt * Update README.md Following updates: - Updated to `CMSSW_10_6_30` from `CMSSW_10_6_20` - Updated to the latest version of official nanoAOD-tools - Added back the instruction of batch job. * Update README.md * MELA updates * Delete KalmanMuonCalibrationsProducer/interface directory * Delete KalmanMuonCalibrationsProducer/plugins directory * Delete KalmanMuonCalibrationsProducer/python directory * Delete KalmanMuonCalibrationsProducer/src directory * Delete BuildFile.xml * Trigger selection added * Trigger Updated * Update keep_and_drop.txt with Mela branches * Update keep_and_drop.txt * Update keep_and_drop.txt * Sync for Lepton * Add Z selection * Lepton Module Changed * hard code removed * Reading branch modified * Jet Selection fixed * tight Electron corrected * Add files via upload * Gen issue fixed * RoccoR module updated * Add files via upload * Update post_proc.py * FSR bug fixed * - Updated input file reading method, while running locally - Added two example.txt file for local running - Updated condor script --------- Co-authored-by: Ramkrishna Sharma Co-authored-by: Ram Krishna Sharma --- ExampleInputFileList.txt | 1 + ExampleInputFileList_data.txt | 1 + H4LCppModule.py | 20 +- Utils | 2 +- condor_setup_lxplus.py | 391 ++++++++++++++++++---------------- interface/H4LTools.h | 4 +- post_proc.py | 82 ++++--- src/H4LTools.cc | 67 +++--- 8 files changed, 318 insertions(+), 250 deletions(-) create mode 100644 ExampleInputFileList.txt create mode 100644 ExampleInputFileList_data.txt diff --git a/ExampleInputFileList.txt b/ExampleInputFileList.txt new file mode 100644 index 0000000..2620325 --- /dev/null +++ b/ExampleInputFileList.txt @@ -0,0 +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 diff --git a/ExampleInputFileList_data.txt b/ExampleInputFileList_data.txt new file mode 100644 index 0000000..10276de --- /dev/null +++ b/ExampleInputFileList_data.txt @@ -0,0 +1 @@ +/store/data/Run2018B/SingleMuon/NANOAOD/UL2018_MiniAODv2_NanoAODv9_GT36-v1/2430000/333071A2-4043-B340-BBDC-395EBF78EA33.root diff --git a/H4LCppModule.py b/H4LCppModule.py index 7a58940..813ff44 100644 --- a/H4LCppModule.py +++ b/H4LCppModule.py @@ -8,7 +8,7 @@ class HZZAnalysisCppProducer(Module): - def __init__(self,year,cfgFile,isMC): + def __init__(self,year,cfgFile,isMC,isFSR): base = "$CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim" ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libJHUGenMELAMELA.so" % base) ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libjhugenmela.so" % base) @@ -53,6 +53,7 @@ def __init__(self,year,cfgFile,isMC): self.passZZEvts = 0 self.cfgFile = cfgFile self.isMC = isMC + self.worker.isFSR = isFSR pass def beginJob(self): pass @@ -275,10 +276,27 @@ def analyze(self, event): 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 + + pT4l = self.worker.ZZsystem.Pt() eta4l = self.worker.ZZsystem.Eta() phi4l = self.worker.ZZsystem.Phi() mass4l = self.worker.ZZsystem.M() + 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("pT4l",pT4l) self.out.fillBranch("eta4l",eta4l) diff --git a/Utils b/Utils index 1901556..b06a036 160000 --- a/Utils +++ b/Utils @@ -1 +1 @@ -Subproject commit 19015568863964e49c13ada0ba36fbcfa4750df3 +Subproject commit b06a03675a56ff87d048d5a2bea987d719192809 diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index a536344..7851e4c 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -1,4 +1,8 @@ -import subprocess +""" +# How to run: +python3 condor_setup_lxplus.py +""" +import argparse import os import sys @@ -6,182 +10,209 @@ from color_style import style -# Variables to be changed by user -#StringToChange = "Run2016_v6_15June2020_MatteoWJetBinned" -#StringToChange = "Run2018_v6_DataReDoJEC" -StringToChange = "Run2017_v7_18Aug2020_Hadd" -customEOS = False -customEOS_cmd = 'eos root://cmseos.fnal.gov find -name "*.root" /store/group/lnujj/VVjj_aQGC/custom_nanoAOD' -#InputFileFromWhereReadDASNames = 'sample_list_v6_2016_campaign.dat' -#InputFileFromWhereReadDASNames = 'sample_list_v6_2017_campaign.dat' -#InputFileFromWhereReadDASNames = 'sample_list_v6_2018_campaign.dat' -#InputFileFromWhereReadDASNames = 'sample_list_v7_2016_campaign.dat' -#InputFileFromWhereReadDASNames = 'sample_list_v7_2017_eos_custom.dat' -InputFileFromWhereReadDASNames = 'sample_list_v7_2017_campaign.dat' - -Initial_path = '/eos/user/r/rasharma/post_doc_ihep/h2l2Q/' -Initial_path += StringToChange -condor_file_name = 'submit_condor_jobs_lnujj_'+StringToChange -condor_queue = "microcentury" -""" -Reference: https://twiki.cern.ch/twiki/bin/view/ABPComputing/LxbatchHTCondor#Queue_Flavours -Condor queue options -name Duration ------------------------- -espresso 20min -microcentury 1h -longlunch 2h -workday 8h 1nd -tomorrow 1d -testmatch 3d -nextweek 1w -""" - - -# Create log files -import infoCreaterGit -SumamryOfCurrentSubmission = raw_input("\n\nWrite summary for current job submission: ") -infoLogFiles = infoCreaterGit.BasicInfoCreater('summary.dat',SumamryOfCurrentSubmission) -infoLogFiles.GenerateGitPatchAndLog() - -# Get CMSSW directory path and name -cmsswDirPath = os.environ['CMSSW_BASE'] -CMSSWRel = cmsswDirPath.split("/")[-1] - -# Create directories for storing log files and output files at EOS. -import fileshelper -dirsToCreate = fileshelper.FileHelper('condor_logs/'+StringToChange, Initial_path) -output_log_path = dirsToCreate.CreateLogDirWithDate() -storeDir = dirsToCreate.CreateSotreArea(Initial_path) -dirName = dirsToCreate.dirName - -# create tarball of present working CMSSW base directory -os.system('rm -f CMSSW*.tgz') -import makeTarFile -makeTarFile.make_tarfile(cmsswDirPath, CMSSWRel+".tgz") -print "copying the "+CMSSWRel+".tgz file to eos path: "+storeDir+"\n" -os.system('cp ' + CMSSWRel+".tgz" + ' '+storeDir+'/' + CMSSWRel+".tgz") - -post_proc_to_run = "post_proc.py" -command = "python "+post_proc_to_run - -Transfer_Input_Files = ("Cert_271036-284044_13TeV_PromptReco_Collisions16_JSON.txt, " + - "Cert_294927-306462_13TeV_PromptReco_Collisions17_JSON.txt, " + - "Cert_314472-325175_13TeV_PromptReco_Collisions18_JSON.txt, " + - "keep_and_drop_data.txt") - -#with open('input_data_Files/sample_list_v6_2017_campaign.dat') as in_file: -with open('input_data_Files/'+InputFileFromWhereReadDASNames) as in_file: - outjdl_file = open(condor_file_name+".jdl","w") - outjdl_file.write("+JobFlavour = \""+condor_queue+"\"\n") - outjdl_file.write("Executable = "+condor_file_name+".sh\n") - outjdl_file.write("Universe = vanilla\n") - outjdl_file.write("Notification = ERROR\n") - outjdl_file.write("Should_Transfer_Files = YES\n") - 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") - count = 0 - count_jobs = 0 - for lines in in_file: - if lines[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] - 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: - output_string = sample_name + os.sep + campaign + os.sep + dirName - output_path = Initial_path + os.sep + output_string - os.system("mkdir "+Initial_path + os.sep + sample_name) - os.system("mkdir "+Initial_path + os.sep + sample_name + os.sep + campaign) - os.system("mkdir "+ Initial_path + os.sep + sample_name + os.sep + campaign + os.sep + dirName) - infoLogFiles.SendGitLogAndPatchToEos(Initial_path + os.sep + sample_name + os.sep + campaign + os.sep + dirName) - else: - output_string = sample_name+os.sep+dirName - output_path = Initial_path+ os.sep + output_string - os.system("mkdir "+Initial_path + os.sep + sample_name) - os.system("mkdir "+Initial_path + os.sep + sample_name+os.sep+dirName) - infoLogFiles.SendGitLogAndPatchToEos(Initial_path + os.sep + sample_name + os.sep + dirName) - print "==> output_path = ",output_path - - ######################################## - #print 'dasgoclient --query="file dataset='+lines.strip()+'"' - #print "..." - if customEOS: - xrd_redirector = 'root://cmseos.fnal.gov/' - output = os.popen(customEOS_cmd + lines.strip()).read() - else: - xrd_redirector = 'root://cms-xrd-global.cern.ch/' - output = os.popen('dasgoclient --query="file dataset='+lines.strip()+'"').read() - - count_root_files = 0 - for root_file in output.split(): - #print "=> ",root_file - count_root_files+=1 - count_jobs += 1 - outjdl_file.write("Output = "+output_log_path+"/"+sample_name+"_$(Process).stdout\n") - outjdl_file.write("Error = "+output_log_path+"/"+sample_name+"_$(Process).stdout\n") - outjdl_file.write("Log = "+output_log_path+"/"+sample_name+"_$(Process).log\n") - outjdl_file.write("Arguments = "+(xrd_redirector+root_file).replace('/','\/')+" "+output_path+" "+Initial_path+"\n") - outjdl_file.write("Queue \n") - print "Number of files: ",count_root_files - print "Number of jobs (till now): ",count_jobs - outjdl_file.close(); - - -outScript = open(condor_file_name+".sh","w"); -outScript.write('#!/bin/bash'); -outScript.write("\n"+'echo "Starting job on " `date`'); -outScript.write("\n"+'echo "Running on: `uname -a`"'); -outScript.write("\n"+'echo "System software: `cat /etc/redhat-release`"'); -outScript.write("\n"+'source /cvmfs/cms.cern.ch/cmsset_default.sh'); -outScript.write("\n"+'echo "copy cmssw tar file from store area"'); -outScript.write("\n"+'cp -s ${3}/'+CMSSWRel +'.tgz .'); -outScript.write("\n"+'tar -xf '+ CMSSWRel +'.tgz' ); -outScript.write("\n"+'rm '+ CMSSWRel +'.tgz' ); -outScript.write("\n"+'cd ' + CMSSWRel + '/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS/' ); -#outScript.write("\n"+'echo "====> List files : " '); -#outScript.write("\n"+'ls -alh'); -outScript.write("\n"+'rm *.root'); -outScript.write("\n"+'scramv1 b ProjectRename'); -outScript.write("\n"+'eval `scram runtime -sh`'); -outScript.write("\n"+'sed -i "s/testfile = .*/testfile = \\"${1}\\"/g" '+post_proc_to_run); -outScript.write("\n"+'echo "========================================="'); -outScript.write("\n"+'echo "cat post_proc.py"'); -outScript.write("\n"+'echo "..."'); -outScript.write("\n"+'cat post_proc.py'); -outScript.write("\n"+'echo "..."'); -outScript.write("\n"+'echo "========================================="'); -outScript.write("\n"+command); -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"+'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"+'fi'); -outScript.write("\n"+'rm *.root'); -outScript.write("\n"+'cd ${_CONDOR_SCRATCH_DIR}'); -outScript.write("\n"+'rm -rf ' + CMSSWRel); -outScript.write("\n"); -outScript.close(); -os.system("chmod 777 "+condor_file_name+".sh"); - -print "===> Set Proxy Using:"; -print "\tvoms-proxy-init --voms cms --valid 168:00"; -print "\"condor_submit "+condor_file_name+".jdl\" to submit"; -#os.system("condor_submit "+condor_file_name+".jdl") +def main(args): + + # Variables from argparse + submission_name = args.submission_name + use_custom_eos = args.use_custom_eos + 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 + createTarFile = args.createTarFile + + # Get top-level directory name from PWD + TOP_LEVEL_DIR_NAME = os.path.basename(os.getcwd()) + + EOS_Output_path += submission_name + condor_file_name = 'submit_condor_jobs_lnujj_'+submission_name + + # Create log files + import infoCreaterGit + SumamryOfCurrentSubmission = input("\n\nWrite summary for current job submission: ") + infoLogFiles = infoCreaterGit.BasicInfoCreater('summary.dat',SumamryOfCurrentSubmission) + infoLogFiles.generate_git_patch_and_log() + + # Get CMSSW directory path and name + cmsswDirPath = os.environ['CMSSW_BASE'] + CMSSWRel = cmsswDirPath.split("/")[-1] + + # Create directories for storing log files and output files at EOS. + import fileshelper + dirsToCreate = fileshelper.FileHelper( (condor_log_path + '/condor_logs/'+submission_name).replace("//","/"), EOS_Output_path) + output_log_path = dirsToCreate.create_log_dir_with_date() + storeDir = dirsToCreate.create_store_area(EOS_Output_path) + dirName = dirsToCreate.dir_name + + # create tarball of present working CMSSW base directory + if createTarFile: os.system('rm -f CMSSW*.tgz') + import makeTarFile + if createTarFile: makeTarFile.make_tarfile(cmsswDirPath, CMSSWRel+".tgz") + print("copying the "+CMSSWRel+".tgz file to eos path: "+storeDir+"\n") + os.system('cp ' + CMSSWRel+".tgz" + ' '+storeDir+'/' + CMSSWRel+".tgz") + + post_proc_to_run = "post_proc.py" + command = "python "+post_proc_to_run + + Transfer_Input_Files = ("keep_and_drop.txt") # FIXME: Generalise this. + # Transfer_Input_Files = ("Cert_271036-284044_13TeV_PromptReco_Collisions16_JSON.txt, " + + # "Cert_294927-306462_13TeV_PromptReco_Collisions17_JSON.txt, " + + # "Cert_314472-325175_13TeV_PromptReco_Collisions18_JSON.txt, " + + # "keep_and_drop_data.txt") + + #with open('input_data_Files/sample_list_v6_2017_campaign.dat') as in_file: + with open('input_data_Files/'+InputFileFromWhereReadDASNames) as in_file: + outjdl_file = open(condor_file_name+".jdl","w") + outjdl_file.write("+JobFlavour = \""+condor_queue+"\"\n") + outjdl_file.write("Executable = "+condor_file_name+".sh\n") + outjdl_file.write("Universe = vanilla\n") + outjdl_file.write("Notification = ERROR\n") + outjdl_file.write("Should_Transfer_Files = YES\n") + 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") + count = 0 + count_jobs = 0 + for lines in in_file: + if lines[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] + 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: + 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) + 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) + 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 "..." + if use_custom_eos: + xrd_redirector = 'root://cms-xrd-global.cern.ch/' + output = os.popen(use_custom_eos_cmd + lines.strip()).read() + else: + xrd_redirector = 'root://cms-xrd-global.cern.ch/' + output = os.popen('dasgoclient --query="file dataset='+lines.strip()+'"').read() + + count_root_files = 0 + for root_file in output.split(): + #print "=> ",root_file + count_root_files+=1 + count_jobs += 1 + outjdl_file.write("Output = "+output_log_path+"/"+sample_name+"_$(Process).stdout\n") + outjdl_file.write("Error = "+output_log_path+"/"+sample_name+"_$(Process).stdout\n") + outjdl_file.write("Log = "+output_log_path+"/"+sample_name+"_$(Process).log\n") + outjdl_file.write("Arguments = "+(xrd_redirector+root_file).replace('/','\/')+" "+output_path+" "+EOS_Output_path+"\n") + outjdl_file.write("Queue \n") + print("Number of files: ",count_root_files) + print("Number of jobs (till now): ",count_jobs) + outjdl_file.close(); + + + outScript = open(condor_file_name+".sh","w"); + outScript.write('#!/bin/bash'); + outScript.write("\n"+'echo "Starting job on " `date`'); + outScript.write("\n"+'echo "Running on: `uname -a`"'); + outScript.write("\n"+'echo "System software: `cat /etc/redhat-release`"'); + outScript.write("\n"+'source /cvmfs/cms.cern.ch/cmsset_default.sh'); + outScript.write("\n"+'echo "copy cmssw tar file from store area"'); + outScript.write("\n"+'cp -s ${3}/'+CMSSWRel +'.tgz .'); + outScript.write("\n"+'tar -xf '+ CMSSWRel +'.tgz' ); + outScript.write("\n"+'rm '+ CMSSWRel +'.tgz' ); + outScript.write("\n"+'cd ' + CMSSWRel + '/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/'+TOP_LEVEL_DIR_NAME+'/' ); + #outScript.write("\n"+'echo "====> List files : " '); + #outScript.write("\n"+'ls -alh'); + outScript.write("\n"+'rm *.root'); + outScript.write("\n"+'scramv1 b ProjectRename'); + outScript.write("\n"+'eval `scram runtime -sh`'); + outScript.write("\n"+'sed -i "s/ifRunningOnCondor = .*/ifRunningOnCondor = True/g" '+post_proc_to_run); + outScript.write("\n"+'sed -i "s/testfile = .*/testfile = \\"${1}\\"/g" '+post_proc_to_run); + outScript.write("\n"+'echo "========================================="'); + outScript.write("\n"+'echo "cat post_proc.py"'); + outScript.write("\n"+'echo "..."'); + outScript.write("\n"+'cat post_proc.py'); + outScript.write("\n"+'echo "..."'); + outScript.write("\n"+'echo "========================================="'); + outScript.write("\n"+command); + 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"+'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"+'fi'); + outScript.write("\n"+'rm *.root'); + outScript.write("\n"+'cd ${_CONDOR_SCRATCH_DIR}'); + outScript.write("\n"+'rm -rf ' + CMSSWRel); + outScript.write("\n"); + outScript.close(); + os.system("chmod 777 "+condor_file_name+".sh"); + + print("\n#===> Set Proxy Using:") + print("voms-proxy-init --voms cms --valid 168:00") + print("\n# It is assumed that the proxy is created in file: /tmp/x509up_u48539. Update this in below two lines:") + print("cp /tmp/x509up_u48539 ~/") + print("export X509_USER_PROXY=~/x509up_u48539") + print("\n#Submit jobs:") + print("condor_submit "+condor_file_name+".jdl") + #os.system("condor_submit "+condor_file_name+".jdl") + +# Below patch is to format the help command as it is +class PreserveWhitespaceFormatter(argparse.RawTextHelpFormatter, argparse.ArgumentDefaultsHelpFormatter): + pass + +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("--use_custom_eos", default=False, action='store_true', help="Use custom EOS.") + parser.add_argument("--createTarFile", default=True, action='store_false', help="Use custom EOS.") + 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.") + parser.add_argument("--input_file", default='sample_list_v9_2018_campaign.dat', help="Input file from where to read DAS names.") + parser.add_argument("--eos_output_path", default='/eos/user/a/avijay/Higgs_020723', help="Initial path for operations.") + 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=""" + Condor queue options: (Reference: https://twiki.cern.ch/twiki/bin/view/ABPComputing/LxbatchHTCondor#Queue_Flavours) + + name Duration + ------------------------ + espresso 20min + microcentury 1h + longlunch 2h + workday 8h 1nd + tomorrow 1d + testmatch 3d + nextweek 1w + """) + + parser.add_argument("--post_proc", default="post_proc.py", help="Post process script to run.") + parser.add_argument("--transfer_input_files", default="keep_and_drop.txt", help="Files to be transferred as input.") + + args = parser.parse_args() + main(args) diff --git a/interface/H4LTools.h b/interface/H4LTools.h index b84eba6..6ef7f56 100644 --- a/interface/H4LTools.h +++ b/interface/H4LTools.h @@ -253,6 +253,7 @@ class H4LTools { FsrPhoton_dROverEt2.clear();FsrPhoton_phi.clear();FsrPhoton_eta.clear();FsrPhoton_pt.clear();FsrPhoton_relIso03.clear(); GenPart_pt.clear(); Zlist.clear(); + Zlistnofsr.clear(); Zflavor.clear(); Zlep1index.clear(); Zlep2index.clear(); @@ -279,7 +280,8 @@ class H4LTools { flag4e=false; flag4mu=false; flag2e2mu=false; } - + bool isFSR=true; + unsigned int Zsize=0; TSpline *spline_g4; TSpline *spline_g2; TSpline *spline_L1; diff --git a/post_proc.py b/post_proc.py index 51d4eea..c738598 100755 --- a/post_proc.py +++ b/post_proc.py @@ -7,56 +7,54 @@ from PhysicsTools.NanoAODTools.postprocessing.modules.jme.jetmetHelperRun2 import * from PhysicsTools.NanoAODTools.postprocessing.modules.btv.btagSFProducer import * -testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root" -#testfile1 = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/1B1D7372-F369-7C40-A85F-841308D42D2C.root" -#testfile2 = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/2BA7CCC9-BA73-3C45-9844-474A92E58A28.root" -#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M120_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/1D8ACDF9-FCA6-7649-95A4-487A132F318D.root" -#testfile1 = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M120_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/130000/6EA35A9B-C42E-0447-ACED-E3AC70A7AD7E.root" -#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M124_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/1AAFFFBE-330D-EF42-B39E-BA70A7E90669.root" -#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M126_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/8198816C-2B6D-CB41-9B96-6B02BD81CAAE.root" -#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/VBF_HToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/2430000/13F76A9B-76DD-144B-B328-A8C207376C08.root" -#testfile1 = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M130_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/00305042-7CD7-2C46-8FD6-D1089E4C4163.root" -#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/FD91C4F0-7DE3-4947-817D-3EA957A0BC50.root" -#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/VBF_HToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/80000/3F65CE54-8477-C64E-B0BB-BD77E870AB54.root" -#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/7F817CD1-84C1-5347-AEEA-F069CAE84799.root" +ifRunningOnCondor = False + testfilelist = [] -testfilelist.append("root://cms-xrd-global.cern.ch//store/data/Run2018B/SingleMuon/NANOAOD/UL2018_MiniAODv2_NanoAODv9_GT36-v1/2430000/87FA9714-D8D3-1345-BFF5-3B417B1ADC64.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/4743B911-1EA3-7E46-959B-93F466ED622F.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/DE3F93DE-DAF6-DD4A-AC3B-13ACE92EAD68.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/2430000/336F0076-347C-AC40-B1B4-E31E14323B81.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/100D0E96-C700-5244-874F-38DB4B410228.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/28512C40-9C25-864A-98E9-4746C0471E63.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/2BAB6B06-FFE2-DC4F-A57F-3A33B3326A30.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/453FC70D-8164-1B4B-A756-81E7432C1D61.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/5C1E0BC2-F153-E946-9B61-470E8AF85C58.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/9DB74D60-0434-A04C-B430-173D6D6538C3.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/DB3B1648-246F-314E-9DD8-FACEA0AE62F6.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/FD91C4F0-7DE3-4947-817D-3EA957A0BC50.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/6021CDF7-AE6F-464D-81E2-AB75ABC4809D.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/77B90DAA-35B9-004E-9C49-52E516FB15D6.root") -testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/C01084F4-328D-0146-B71E-B167AB6A7E86.root") - -entriesToRun = 0 # 0 if need to run over all entries else put number of entries to run -isMCTrueFalse = False + +if ifRunningOnCondor: + testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root" + testfilelist.append(testfile) + +else: + if len(sys.argv) > 1: + InputFileList = sys.argv[1] + else: + InputFileList = "ExampleInputFileList.txt" + with open(InputFileList, 'r') as file: + for line in file: + # Remove newline characters + line = line.strip() + # Append the line to the list with the "root://cms-xrd-global.cern.ch//" prefix + testfilelist.append("root://cms-xrd-global.cern.ch/" + line) + +# Set entriesToRun = 0 if need to run over all entries else put number of entries to run +entriesToRun = 0 if ifRunningOnCondor else 100 + +isMC = True +isFSR = False + +outputbranchsel = "keep_and_drop.txt" # Keep DownloadFileToLocalThenRun=True this should reduce the file read error from eos. DownloadFileToLocalThenRun=True -if testfilelist[0].find("2018") != -1: - year = 2018 - cfgFile = 'Input_2018.yml' -if testfilelist[0].find("2017") != -1: - year = 2017 - cfgFile = 'Input_2017.yml' -if testfilelist[0].find("UL18") != -1: + +if testfilelist[0].find("/data/") != -1: + isMC = False + outputbranchsel = "keep_and_drop_data.txt" + +if testfilelist[0].find("UL18") != -1 or testfilelist[0].find("UL2018") != -1: # UL2018 for identification of 2018 UL data and UL18 for identification of 2018 UL MC year = 2018 cfgFile = 'Input_2018.yml' -if testfilelist[0].find("UL17") != -1: + +if testfilelist[0].find("UL17") != -1 or testfilelist[0].find("UL2017") != -1: year = 2017 cfgFile = 'Input_2017.yml' -if testfilelist[0].find("pythia") != -1: - isMCTrueFalse = True -H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile,isMCTrueFalse) + +H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile, isMC, isFSR) +print("outputbranchsel = ",outputbranchsel) +print("isMC = ",isMC) +print("isFSR = ",isFSR) #p=PostProcessor(".",[testfile],"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt") -p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt") +p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel=outputbranchsel) p.run() print "DONE" diff --git a/src/H4LTools.cc b/src/H4LTools.cc index 6130ce2..9e5fa63 100644 --- a/src/H4LTools.cc +++ b/src/H4LTools.cc @@ -150,11 +150,10 @@ unsigned H4LTools::doFsrRecovery(TLorentzVector Lep){ fsrcand.SetPtEtaPhiM(FsrPhoton_pt[BestFsrPhotons[i]],FsrPhoton_eta[BestFsrPhotons[i]],FsrPhoton_phi[BestFsrPhotons[i]],0); float dRlC,dRlOverPtC; dRlC = fsrcand.DeltaR(Lep); - dRlOverPtC = dRl/(fsrcand.Pt()*fsrcand.Pt()); - if ((dRlCkSmearMC(charge, pt, eta, phi, nLayers, u1); } } @@ -354,37 +354,44 @@ void H4LTools::LeptonSelection(){ ElelistFsr = BatchFsrRecovery(Elelist); MulistFsr = BatchFsrRecovery(Mulist); - + for(unsigned int ae=0; ae0.01){ - RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt(); - } + if (isFSR){ + unsigned int FsrEleidx; + 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]; } + } for(unsigned int amu=0; amu0.01){ - RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt(); - } + if (isFSR){ + unsigned int FsrMuonidx; + FsrMuonidx = doFsrRecovery(Mulist[amu]); + 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++; @@ -490,7 +497,9 @@ bool H4LTools::findZCandidate(){ Zlistnofsr.push_back(Zcannofsr); } - if (Zlist.size()>0){ + + Zsize = Zlist.size(); + if (Zsize>0){ return true; } else{ @@ -514,7 +523,7 @@ bool H4LTools::ZZSelection(){ if((abs(nTightEleChgSum)+abs(nTightMuChgSum))>(nTightMu+nTightEle-4)){ return foundZZCandidate; } - if(Zlist.size()<2){ + if(Zsize<2){ return foundZZCandidate; } @@ -676,11 +685,17 @@ bool H4LTools::ZZSelection(){ Z1nofsr = Zlistnofsr[Z1index]; Z2nofsr = Zlistnofsr[Z2index]; - ZZsystem = Z1+Z2; ZZsystemnofsr = Z1nofsr+Z2nofsr; + + /*if(abs(ZZsystemnofsr.M()-ZZsystem.M())>0.000001){ + std::cout<<"FSR works "<HiggscutDown)&&(massZZ Date: Mon, 25 Sep 2023 13:41:14 +0200 Subject: [PATCH 07/10] - Removed the submodule utils --- .gitignore | 18 +++ .gitmodules | 3 - PrintHist.py | 66 +++++++++++ README.md | 34 +++--- Utils | 1 - Utils/check_condor_stuck_or_not.py | 42 +++++++ Utils/color_style.py | 14 +++ Utils/condorJobHelper.py | 71 ++++++++++++ Utils/fileList.py | 44 ++++++++ Utils/fileshelper.py | 88 +++++++++++++++ Utils/infoCreaterGit.py | 41 +++++++ Utils/makeTarFile.py | 34 ++++++ Utils/nanoAOD_condor_resubmit.py | 159 +++++++++++++++++++++++++++ condor_setup_lxplus.py | 2 +- scripts/GetLogSummary.py | 61 ++++++++++ scripts/check_condor_stuck_or_not.py | 2 +- 16 files changed, 659 insertions(+), 21 deletions(-) delete mode 100644 .gitmodules create mode 100644 PrintHist.py delete mode 160000 Utils create mode 100644 Utils/check_condor_stuck_or_not.py create mode 100644 Utils/color_style.py create mode 100644 Utils/condorJobHelper.py create mode 100644 Utils/fileList.py create mode 100644 Utils/fileshelper.py create mode 100644 Utils/infoCreaterGit.py create mode 100644 Utils/makeTarFile.py create mode 100644 Utils/nanoAOD_condor_resubmit.py create mode 100644 scripts/GetLogSummary.py diff --git a/.gitignore b/.gitignore index a5965fa..f8b45c1 100644 --- a/.gitignore +++ b/.gitignore @@ -140,3 +140,21 @@ dmypy.json # Pyre type checker .pyre/ + +# user added... +br.sm1 +br.sm2 +*.dat +*.DAT +*.txt +*.tbl +*.LHgrid +*.pcm +*.cxx* +*.o +*.in +*.out +*.d +*maincc +*linkdef.h +JHUGenMELA/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index c5dca0b..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "Utils"] - path = Utils - url = git@github.com:ram1123/Utils.git diff --git a/PrintHist.py b/PrintHist.py new file mode 100644 index 0000000..822f490 --- /dev/null +++ b/PrintHist.py @@ -0,0 +1,66 @@ +import ROOT + +# Set ROOT to run in batch mode +ROOT.gROOT.SetBatch(True) + +def print_bins_noSort(hist): + xaxis = hist.GetXaxis() + for i in range(1, hist.GetNbinsX() + 1): + bin_content = hist.GetBinContent(i) + bin_label = xaxis.GetBinLabel(i) + print("Bin {:33}: {:.2f}".format(bin_label, bin_content)) + +def print_bins(hist): + xaxis = hist.GetXaxis() + bins_info = [] + + for i in range(1, hist.GetNbinsX() + 1): + bin_content = hist.GetBinContent(i) + bin_label = xaxis.GetBinLabel(i) + bins_info.append((bin_label, bin_content)) + + # Sort the bins_info list based on bin content + sorted_bins = sorted(bins_info, key=lambda x: x[1], reverse=True) + + prev_bin_content = None + print("Bin {:33}: {:15} {}%".format("Cut string name", "nEvents left", "change")) + for bin_label, bin_content in sorted_bins: + if prev_bin_content is not None: + percentage_change = ((bin_content - prev_bin_content) / prev_bin_content) * 100 + print("Bin {:33}: {:>15.2f} {:>10.2f}%".format(bin_label, bin_content, percentage_change)) + else: + print("Bin {:33}: {:>15.2f}".format(bin_label, bin_content)) + prev_bin_content = bin_content + + print("\n\n") + print("| {:<33} | {:>10} | {:>6} |".format("Cut string name", "left nEvents", "Change (%)")) + print("|{}|{}|{}|".format("-" * 35, "-" * 12, "-" * 9)) + for bin_label, bin_content in sorted_bins: + if prev_bin_content is not None: + percentage_change = ((bin_content - prev_bin_content) / prev_bin_content) * 100 + print("| {:<33} | {:>10.2f} | {:>6.2f} |".format(bin_label, bin_content, percentage_change)) + else: + print("| {:<33} | {:>10.2f} | {:>6} |".format(bin_label, bin_content, "-")) + prev_bin_content = bin_content + + +def print_histogram(hist): + print("Histogram Name: {}".format(hist.GetName())) + print("Entries: {}, Total Sum: {:.6e}".format(hist.GetEntries(), hist.GetSumOfWeights())) + + print("Bin Contents:") + print_bins(hist) + +def print_cutflow_histogram(): + file = ROOT.TFile("/eos/user/g/guoj/Sample/2L2Q/UL_Legacy/2018/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8__v16_L1v1-v1_0.root") + cutflow = file.Get("cutflow") + + if cutflow: + print_histogram(cutflow) + else: + print("Histogram not found.") + + file.Close() + +print_cutflow_histogram() + diff --git a/README.md b/README.md index b567eaf..896e151 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,9 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. ```bash cd $CMSSW_BASE/src - git clone git@github.com:YujiLee301/nanoAOD_skim.git PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim + 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 submodule init - git submodule update + git checkout HZZ_Analysis cd - cmsenv # patch PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/nanoAOD_tools.patch @@ -41,7 +40,7 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. find PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/.git/ -name "*.py*" -delete ``` -4. Step: 4: interactive running +4. Step: 4: Get the MELA package ```bash cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim @@ -49,27 +48,32 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. sh JHUGenMELA/MELA/setup.sh -j 8 cd JHUGenMELA/MELA make + ``` + +4. Step: 4: interactive running + + ```bash cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim python post_proc.py ``` 5. batch job submission. - 1. Crab-job submission - ```bash - cd crab/ - voms-proxy-init -voms cms --valid 200:00 - source /cvmfs/cms.cern.ch/crab3/crab.sh - crab submit -c crab_cfg.py - ``` - - 2. Step: 5 (b): Condor-job submission - 1. In the file `condor_setup.py`, specify the correct input text file from which you need to take input NanoAOD DAS names. Also, updated the output EOS path. Then do the following: + 1. Step: 5 (a): Condor-job submission (recommended) + 1. In the file `condor_setup.py`, specify the correct input text file (present inside directory `input_data_Files`) from which you need to take input NanoAOD DAS names. Also, updated the output EOS path. Then do the following: ```bash cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS # Edit condor_setup.py, then - python condor_setup.py + python condor_setup.py --input-file sample_list_v9.dat # Set proxy before submitting the condor jobs. voms-proxy-init -voms cms --valid 200:00 condor_submit .jdl ``` + + 1. Step: 5(b): Crab-job submission (Not tested recently) + ```bash + cd crab/ + voms-proxy-init -voms cms --valid 200:00 + source /cvmfs/cms.cern.ch/crab3/crab.sh + crab submit -c crab_cfg.py + ``` diff --git a/Utils b/Utils deleted file mode 160000 index b06a036..0000000 --- a/Utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b06a03675a56ff87d048d5a2bea987d719192809 diff --git a/Utils/check_condor_stuck_or_not.py b/Utils/check_condor_stuck_or_not.py new file mode 100644 index 0000000..9664c7c --- /dev/null +++ b/Utils/check_condor_stuck_or_not.py @@ -0,0 +1,42 @@ +import os +import sys + +sys.path.append("Utils/.") +from color_style import style + +output = os.popen('condor_q -submitter rasharma').read() + +error_check_string = [ 'Server responded with an error', + 'The remote file is not open'] + +#Oprint output.split("\t") +lpcschedd = "" +print type(output) +for outputs in output.split('\n'): + print outputs + if outputs.find('Submitter') != -1: + lpcschedd = outputs.split()[2].split('.')[0] + if outputs.find('rasharma') != -1 and outputs.split()[5] == 'R': + """This if condition checks the username and if the job is in + Running (R) condition. + """ + condor_tail = "condor_tail "+outputs.split()[0]+" -name "+lpcschedd + + print "\n","-"*51,"\n\n" + print(style.GREEN + outputs+style.RESET+"\n\n") + print "COMMAND: ",condor_tail + print "\n" + # os.system(condor_tail) + output = os.popen(condor_tail).read() + + foundOrNot = any(match in output for match in error_check_string) + + if foundOrNot: + print(style.RED + "ERROR: Going to kill this job" + style.RESET) + killCommand = "condor_rm "+outputs.split()[0]+" -name "+lpcschedd + print(style.RED + "Running Command: " + killCommand + style.RESET) + os.system(killCommand) + print(style.RED + "Successfully killed." + style.RESET) + else: + print output +print "\n\n" diff --git a/Utils/color_style.py b/Utils/color_style.py new file mode 100644 index 0000000..dd1103e --- /dev/null +++ b/Utils/color_style.py @@ -0,0 +1,14 @@ +import os +# Group of Different functions for different styles +os.system("") +class style(): + BLACK = '\033[30m' + RED = '\033[31m' + GREEN = '\033[32m' + YELLOW = '\033[33m' + BLUE = '\033[34m' + MAGENTA = '\033[35m' + CYAN = '\033[36m' + WHITE = '\033[37m' + UNDERLINE = '\033[4m' + RESET = '\033[0m' diff --git a/Utils/condorJobHelper.py b/Utils/condorJobHelper.py new file mode 100644 index 0000000..8fc5282 --- /dev/null +++ b/Utils/condorJobHelper.py @@ -0,0 +1,71 @@ +import os +import sys + +class condorJobHelper(object): + """docstring for condorJobHelper""" + def __init__(self, fileName="test", + listOfFilesToTransfer="", + request_memory=0, + request_cpus=0, + logFilePath = 'test', + logFileName = 'test', + Arguments="", + JobFlavour="longlunch", + Queue=1): + self.fileName = fileName + self.listOfFilesToTransfer = listOfFilesToTransfer + self.request_memory = request_memory + self.request_cpus = request_cpus + self.logFilePath = logFilePath + self.logFileName = logFileName + self.Arguments = Arguments + self.JobFlavour = JobFlavour + self.Queue = Queue + + def jdlFileHeaderCreater(self): + outJdl = open(self.fileName+'.jdl','w') + outJdl.write('Executable = '+self.fileName+'.sh') + outJdl.write('\n'+'Universe = vanilla') + outJdl.write('\n'+'Notification = ERROR') + outJdl.write('\n'+'Should_Transfer_Files = YES') + outJdl.write('\n'+'WhenToTransferOutput = ON_EXIT') + outJdl.write('\n'+'Transfer_Input_Files = '+self.fileName+'.sh, ' + self.listOfFilesToTransfer) + outJdl.write('\n'+'x509userproxy = $ENV(X509_USER_PROXY)') + outJdl.write('\n'+'+JobFlavour = "'+self.JobFlavour+'"') + if self.request_memory != 0: outJdl.write('\n'+'request_memory = '+str(self.request_memory)) + if self.request_cpus != 0: outJdl.write('\n'+'request_cpus = '+ str(self.request_cpus)) + return self.fileName+'.jdl' + + def jdlFileAppendLogInfo(self): + outJdl = open(self.fileName+'.jdl','a') + outJdl.write('\n'+'Output = '+self.logFilePath+os.sep+self.logFileName+'_$(Cluster)_$(Process).stdout') + outJdl.write('\n'+'Error = '+self.logFilePath+os.sep+self.logFileName+'_$(Cluster)_$(Process).stdout') + outJdl.write('\n'+'Log = '+self.logFilePath+os.sep+self.logFileName+'_$(Cluster)_$(Process).log') + outJdl.write('\n'+'Arguments = $(Cluster) $(Process) '+self.Arguments) + outJdl.write('\n'+'Queue '+str(self.Queue)) + outJdl.close() + + def shFileHeaderCreater(self): + outScript = open(self.fileName+".sh","w"); + outScript.write('#!/bin/bash') + outScript.write('\n'+'echo "Starting job on " `date`') + outScript.write('\n'+'echo "Running on: `uname -a`"') + outScript.write('\n'+'echo "System software: `cat /etc/redhat-release`"') + outScript.write('\n'+'source /cvmfs/cms.cern.ch/cmsset_default.sh') + outScript.write('\n'+'echo "'+'#'*51+'"') + outScript.write('\n'+'echo "# List of Input Arguments: "') + outScript.write('\n'+'echo "'+'#'*51+'"') + outScript.write('\n'+'echo "Input Arguments (CluserID): $1" ') + outScript.write('\n'+'echo "Input Arguments (ProcessID): $2" ') + for x in xrange(3,len(self.Arguments)+3): + outScript.write('\n'+'echo "Input Arguments: $'+x+'" ') + outScript.write('\n'+'echo "'+'#'*51+'"') + outScript.write('\n'+'') + outScript.close() + return self.fileName+'.sh' + + def jdlAndShFileCreater(self): + jdlFile = self.jdlFileHeaderCreater() + jdlFile = self.jdlFileAppendLogInfo() + shFile = self.shFileCreater() + return jdlFile, shFile diff --git a/Utils/fileList.py b/Utils/fileList.py new file mode 100644 index 0000000..063a355 --- /dev/null +++ b/Utils/fileList.py @@ -0,0 +1,44 @@ +import os +import sys +from datetime import datetime + +CURRENT_DATETIME = datetime.now() + +class FileHelper(): + """docstring for FileHelper""" + def __init__(self, InputDirectoryPath, OutputDirectoryPath, ifeos=False): + self.ifeos = ifeos + self.InputDirectoryPath = InputDirectoryPath + self.OutputDirectoryPath = OutputDirectoryPath + self.AllSubDirectoryLists = [] + self.ListOfAllInputRootFiles = [] + self.ListOfAllOutputRootFiles = [] + + def list_files(self): + flist = [] + flistWithPath = [] + for root, directories, filenames in os.walk(self.InputDirectoryPath): + self.AllSubDirectoryLists.append(root) + # print root, directories, filenames + for filename in filenames: + if filename.endswith(".root"): + fileWithPath = os.path.join(root,filename) # Get file name with path + self.ListOfAllInputRootFiles.append(fileWithPath) + + def CreateSameHirarcyDirsSameAsListFiles(self): + if self.InputDirectoryPath[-1] == "/": + ReplaceString = self.InputDirectoryPath.split("/")[-2] + else: + ReplaceString = self.InputDirectoryPath.split("/")[-1] + DirectoryPathToReplace = self.InputDirectoryPath.replace(ReplaceString,"") + for directories in self.AllSubDirectoryLists: + NewDirecotyName = directories.replace(DirectoryPathToReplace,(self.OutputDirectoryPath+"/").replace("//","/")) + os.system("eos root://cmseos.fnal.gov mkdir "+NewDirecotyName) + + def GetOutPutFileList(self): + if self.InputDirectoryPath[-1] == "/": + ReplaceString = self.InputDirectoryPath.split("/")[-2] + else: + ReplaceString = self.InputDirectoryPath.split("/")[-1] + DirectoryPathToReplace = (self.InputDirectoryPath.replace(ReplaceString,"")).replace("//","/") + self.ListOfAllOutputRootFiles = [files.replace(DirectoryPathToReplace,(self.OutputDirectoryPath+"/").replace("//","/")) for files in self.ListOfAllInputRootFiles] diff --git a/Utils/fileshelper.py b/Utils/fileshelper.py new file mode 100644 index 0000000..b2bcf34 --- /dev/null +++ b/Utils/fileshelper.py @@ -0,0 +1,88 @@ +import os +from datetime import datetime + +CURRENT_DATETIME = datetime.now() + +class FileHelper: + """ + A class to assist in creating directories and paths for log and store areas. + """ + def __init__(self, log_path, store_area, if_eos=False): + self.if_eos = if_eos + self.log_path = log_path + self.store_area = store_area + self.dir_name = ( + str(CURRENT_DATETIME.year)[-2:] + + str(format(CURRENT_DATETIME.month, '02d')) + + str(format(CURRENT_DATETIME.day, '02d')) + + "_" + + str(format(CURRENT_DATETIME.hour, '02d')) + + str(format(CURRENT_DATETIME.minute, '02d')) + + str(format(CURRENT_DATETIME.second, '02d')) + ) + self.eos_string = '/eos/uscms' + print("==> Time stamp: {}".format(self.dir_name)) + + def create_log_dir_with_date(self): + """ + Create a directory to store log files. + Returns: + string -- Path of the created directory + """ + log_dir_name = os.path.join(self.log_path, self.dir_name) + if not os.path.exists(log_dir_name): + os.makedirs(log_dir_name) + print("==> Created directory for log files: {}".format(log_dir_name)) + return log_dir_name + + def create_store_area(self, path): + """ + Create a directory in the store area. + Arguments: + path {string} -- Name of the directory with path + Returns: + 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)) + 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...") + if self.if_eos: + if os.path.exists(self.eos_string + path): + print("==> Directory was created.") + else: + print("==> Directory was not created.") + exit(1) + return path + + def create_store_dir_with_date(self, *additional_strings): + """ + Create the store area directory with a date. + Arguments: + additional_strings {tuple} -- Additional directory names to append + Returns: + string -- Path of the created directory + """ + path = self.create_store_area(self.store_area) + for additional_string in additional_strings: + if additional_string: + path = self.create_store_area(os.path.join(path, additional_string)) + path = self.create_store_area(os.path.join(path, self.dir_name)) + return path + + def create_dir_with_date(self): + """ + Create both log and store area directories. + Returns: + string -- Path of the created log directory + string -- Path of the created store area directory + """ + log_dir_name = os.path.join(self.log_path, self.dir_name) + store_area_dir_name = os.path.join(self.store_area, self.dir_name) + os.makedirs(log_dir_name, exist_ok=True) + self.create_store_area(self.store_area) + self.create_store_area(store_area_dir_name) + print("==> Created directory for log files: {log_dir_name}".format(log_dir_name = log_dir_name)) + print("==> Created directory at eos path: {store_area_dir_name}".format(store_area_dir_name = store_area_dir_name)) + return log_dir_name, store_area_dir_name diff --git a/Utils/infoCreaterGit.py b/Utils/infoCreaterGit.py new file mode 100644 index 0000000..3f9dcd0 --- /dev/null +++ b/Utils/infoCreaterGit.py @@ -0,0 +1,41 @@ +import os + +class BasicInfoCreater: + """ + A class to create Git logs and patches for job submissions. + """ + + GITPATCH = 'gitDiff.patch' + + def __init__(self, log_file_name="summary.dat", summary=""): + self.CMSSWDirPath = os.environ['CMSSW_BASE'] + self.CMSSWRel = self.CMSSWDirPath.split("/")[-1] + self.logFileName = log_file_name + self.summary = summary + + def generate_git_log(self): + git_log = ( + """CMSSW Version used: {}\n + Current directory path: {}\n + Summary for current setup: {}\n""".format(self.CMSSWRel, self.CMSSWDirPath, self.summary) + ) + + with open(self.logFileName, "w") as out_script: + out_script.write(git_log) + out_script.write("\n\n============\n== Latest commit summary \n\n\n") + os.system("git log -1 --pretty=tformat:' Commit: %h %n Date: %ad %n Relative time: %ar %n Commit Message: %s' >> {}".format(self.logFileName)) + out_script.write("\n\n============\n\n") + os.system("git log -1 --format='%H' >> {}".format(self.logFileName)) + + def generate_git_patch(self): + os.system('git diff > {}'.format(self.GITPATCH)) + + def generate_git_patch_and_log(self): + self.generate_git_patch() + self.generate_git_log() + + def send_git_log_and_patch_to_eos(self, output_folder): + print("Copying {} to path: {}".format(self.logFileName, output_folder)) + os.system('cp -f {} {}/{}'.format(self.logFileName, output_folder, self.logFileName)) + print("Copying {} to path: {}".format(self.GITPATCH, output_folder)) + os.system('cp -f {} {}/{}'.format(self.GITPATCH, output_folder, self.GITPATCH)) diff --git a/Utils/makeTarFile.py b/Utils/makeTarFile.py new file mode 100644 index 0000000..1a9ad46 --- /dev/null +++ b/Utils/makeTarFile.py @@ -0,0 +1,34 @@ +import tarfile +import os + +EXCLUDE_FILES = [".tmp", ".log", ".stdout", ".stderr"] + +def filter_function(tarinfo): + """ + Helper function for creating the tarball. + + This function filters out unwanted files to be added to the tarball. + + Arguments: + tarinfo {TarInfo} -- TarInfo object + + Returns: + bool -- True if the file should be included, False otherwise. + """ + if os.path.splitext(tarinfo.name)[1] in EXCLUDE_FILES: + return None + else: + return tarinfo + +def make_tarfile(source_dir, output_filename): + """ + Create a tarball from a given directory. + + Arguments: + source_dir {string} -- Name of the directory to be tarballed. + output_filename {string} -- Output file name for the tarball. + """ + with tarfile.open(output_filename, "w:gz") as tar: + print("make_tarfile:: Started creating tar file...") + tar.add(source_dir, arcname=os.path.basename(source_dir), filter=filter_function) + print("make_tarfile:: Done...") diff --git a/Utils/nanoAOD_condor_resubmit.py b/Utils/nanoAOD_condor_resubmit.py new file mode 100644 index 0000000..5bc8ba0 --- /dev/null +++ b/Utils/nanoAOD_condor_resubmit.py @@ -0,0 +1,159 @@ +# Example Usage: +# +# python Utils/nanoAOD_condor_resubmit.py --dir condor_logs/Run2017_v7_18Aug2020_Hadd/200817_180337/ -s /eos/uscms/store/user/lnujj/VVjj_aQGC/nanoAOD_skim/Run2017_v7_18Aug2020_Hadd -i submit_condor_jobs_lnujj_Run2017_v7_18Aug2020_Hadd.jdl +# +# Fix hardcoded number 7 + +import os +from optparse import OptionParser +import ROOT +from ROOT import TFile + +DEBUG = False + +def files_to_remove(files,dir): + filelist_to_remove = [] + for file in files: + try: + tfile = TFile.Open(file); + except: + pass + if tfile: + if (tfile.IsZombie()): + filelist_to_remove.append(file) + else: + print('File could not be opened, adding it to missing files') + filelist_to_remove.append(file) + + if DEBUG: print(filelist_to_remove) + return filelist_to_remove + +def list_files(file_name): + with open(file_name) as f: + datafile = f.readlines() + file_list = [] + for line in datafile: + if "USER_" in line: + start_pt = line.find("output") + end_pt = line.find(".root", start_pt + 1) + res = line[start_pt:end_pt+5] + if "/" in res : + res = res[res.find("/")+1:] + file_list.append(res) + return file_list + +def get_files_from_jdl(path_jdl): + import re + with open(path_jdl) as myfile: + content = myfile.read() + + flist = re.findall("[a-z0-9A-Z-]+.root", content) + return flist + +def list_root(directory): + flist = [] + flistWithPath = [] + for root, directories, filenames in os.walk(directory): + for filename in filenames: + if filename.endswith(".root"): + flist.append(filename.replace("_SkimHadd","")) + fileWithPath = os.path.join(root,filename) # Get file name with path + flistWithPath.append(fileWithPath) + return flist,flistWithPath + +def submit_missing(InputJdlFile,resubmit=True): + bashCommand = "condor_submit %s"%(InputJdlFile) + if resubmit : + print 'Resubmitting now!' + os.system(bashCommand) + else : + print 'Ready to resubmit, please set resubmit to True if you are ready : ' + print bashCommand + +def prepare_runJobs_missing(FailedJobRootFile,InputJdlFile,CondorLogDir,EOSDir,Resubmit_no): + if DEBUG: print "FailedJobRootFile: ",FailedJobRootFile + if DEBUG: print "InputJdlFile: ",InputJdlFile + if DEBUG: print "CondorLogDir: ",CondorLogDir + if DEBUG: print "EOSDir: ",EOSDir + + bashCommand = "cp %s original_%s"%(InputJdlFile,InputJdlFile) + os.system(bashCommand) + + outjdl_fileName = InputJdlFile.replace(".jdl","")+'_resubmit_'+Resubmit_no+".jdl" + + outjdl_file = open(outjdl_fileName,"w") + + with open(InputJdlFile) as myfile: + head = [next(myfile) for x in xrange(7)] # FIX: remove hardcoded number 7 + + for lines in head: + outjdl_file.write(lines) + + for RootFiles in FailedJobRootFile: + if DEBUG: print RootFiles + bashCommand = "grep %s %s/*.stdout"%(RootFiles.replace(".root",""),CondorLogDir) + if DEBUG: print bashCommand + grep_stdout_files = os.popen(bashCommand).read() + if DEBUG: print "~~"*51 + if DEBUG: print grep_stdout_files.strip() + if DEBUG: print len(grep_stdout_files) + if DEBUG: print "~~"*51 + OldRefFile = "" + if grep_stdout_files.strip() != "": + if DEBUG: print "==> ",grep_stdout_files.strip().split(':')[0].replace('.stdout','') + if grep_stdout_files.strip().split(':')[0].replace('.stdout','').split('_')[-2] == "resubmit": + OldRefFile = grep_stdout_files.strip().split(':')[0].replace('.stdout','').split('_')[-4] + else: + OldRefFile = grep_stdout_files.strip().split(':')[0].replace('.stdout','').split('_')[-1] + grepCommand_GetJdlInfo = 'grep -A1 -B3 "'+RootFiles+'" '+InputJdlFile + if DEBUG: print grepCommand_GetJdlInfo + grep_condor_jdl_part = os.popen(grepCommand_GetJdlInfo).read() + if DEBUG: print "=="*51 + if DEBUG: print grep_condor_jdl_part + updateString = grep_condor_jdl_part.replace('$(Process)',OldRefFile+'_$(Process)'+ '_resubmit_' +Resubmit_no) + if DEBUG: print "=="*51 + if DEBUG: print updateString + if DEBUG: print "=="*51 + outjdl_file.write(updateString) + outjdl_file.close() + return outjdl_fileName + + +def main(): + parser = OptionParser() + parser.add_option("-d", "--dir", dest="dir",default="task_config.json",help="directory") + parser.add_option("-s", "--stage-dest", dest="stage_dest",help="directory output files were staged to") + parser.add_option("-i", "--input", dest="input",default="all_root.jdl",help="input jdl file with all root files present") + parser.add_option("-r", "--resubmit", action="store_false", dest="resubmit",default=True,help="resubmit") + parser.add_option("-n", "--resubmit_no", dest="resubmit_no",default=1,help="resubmit counter") + + (options, args) = parser.parse_args() + + if options.stage_dest is not None: + stageDir = os.path.abspath(options.stage_dest) + else: + stageDir = dir + + full_output = get_files_from_jdl(options.input) + # print full_output + present_output, present_output_WithPath = list_root(stageDir) + # print present_output + print "length(jdl file): ",len(full_output) + print "Length(output root file): ",len(present_output) + not_finished = list(set(full_output) - set(present_output)) + print not_finished + corrupted_files = files_to_remove(present_output_WithPath,stageDir) + not_finished += corrupted_files + print(not_finished) + print 'Number of missing files : ',len(not_finished) + print 'Missing the following files : ',not_finished + jdlfile = prepare_runJobs_missing(not_finished,options.input,options.dir,stageDir,str(options.resubmit_no)) + print jdlfile + print 'Submitting missing jobs : ' + submit_missing(jdlfile,options.resubmit) + + + +if __name__ == "__main__": + main() + diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index 7851e4c..ee220af 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -6,7 +6,7 @@ import os import sys -sys.path.append("Utils/python_utils/.") +sys.path.append("Utils/.") from color_style import style diff --git a/scripts/GetLogSummary.py b/scripts/GetLogSummary.py new file mode 100644 index 0000000..fc99606 --- /dev/null +++ b/scripts/GetLogSummary.py @@ -0,0 +1,61 @@ +import argparse +import os +import re + +# Set up the parser +parser = argparse.ArgumentParser(description="Process some logs.") +parser.add_argument("-d", "--directory", type=str, help="Path to the directory containing the *.stdout files", required=True) +parser.add_argument("--debug", action="store_true", help="Enable debug mode") + +# Parse the arguments +args = parser.parse_args() + +# Use the parsed arguments +DEBUG = args.debug +log_files_dir = args.directory + +# Regular expression patterns to match the desired lines +patterns = { + "Total": re.compile(r'Total:\s+:(\d+)\s+Events'), + "PassTrig": re.compile(r'PassTrig:\s+:(\d+)\s+Events'), + "Pass2eCut": re.compile(r'Pass2eCut:\s+:(\d+)\s+Events'), + "Pass2muCut": re.compile(r'Pass2muCut:\s+:(\d+)\s+Events'), + "Pass2lCut": re.compile(r'Pass2lCut:\s+:(\d+)\s+Events'), + "40 < m_ee < 180": re.compile(r'Pass2eCut \(40 < mll < 180\):\s+:(\d+)\s+Events'), + "40 < m_mumu < 180": re.compile(r'Pass2muCut \(40 < mll < 180\):\s+:(\d+)\s+Events'), + "40 < mll < 180": re.compile(r'Pass2lCut \(40 < mll < 180\):\s+:(\d+)\s+Events'), + "Pass2l1JCut": re.compile(r'Pass2l1JCut:\s+:(\d+)\s+Events'), + "Pass2l2jCut": re.compile(r'Pass2l2jCut:\s+:(\d+)\s+Events'), + "Pass2l1Jor2jCut": re.compile(r'Pass2l1Jor2jCut:\s+:(\d+)\s+Events'), + "PassZZSelection": re.compile(r'PassZZSelection:\s+:(\d+)\s+Events') +} + +# Dictionary to store the sum of events for each category +category_sums = {} + +# Loop through each *.stdout file in the directory +for filename in os.listdir(log_files_dir): + if filename.endswith('.stdout'): + file_path = os.path.join(log_files_dir, filename) + if DEBUG: print("\n\nFilename: "+log_files_dir+'/'+filename) + + with open(file_path, 'r') as f: + content = f.read() + + # Find events for each category based on the specified patterns + for category, pattern in patterns.items(): + match = pattern.search(content) + if DEBUG: print("{} {}".format(category, pattern)) + if DEBUG: print("Match: {}".format(match)) + if match: + events = int(match.group(1)) + if DEBUG: print("{:25} {}".format(category, events)) + if category in category_sums: + category_sums[category] += events + else: + category_sums[category] = events + +# Print the sum of events for each category +if DEBUG: print("\n\n") +for category, events in category_sums.items(): + print("{category:17}: {events:>7} Events".format(category=category, events=events)) diff --git a/scripts/check_condor_stuck_or_not.py b/scripts/check_condor_stuck_or_not.py index c3016aa..5023688 100644 --- a/scripts/check_condor_stuck_or_not.py +++ b/scripts/check_condor_stuck_or_not.py @@ -1,7 +1,7 @@ import os import sys -sys.path.append("Utils/python_utils/.") +sys.path.append("Utils/.") from color_style import style output = os.popen('condor_q -submitter rasharma').read() From 62fad4facbd21287ca4bbbf42b8d84368db8dd73 Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Mon, 25 Sep 2023 17:02:24 +0200 Subject: [PATCH 08/10] - Minor update in condor submission script. - Added summary of additional script information in the README file --- README.md | 35 +++++++++++++++++++++++++++--- PrintHist.py => Utils/PrintHist.py | 18 ++++++++------- condor_setup_lxplus.py | 12 +++++++--- 3 files changed, 51 insertions(+), 14 deletions(-) rename PrintHist.py => Utils/PrintHist.py (92%) diff --git a/README.md b/README.md index 896e151..480b5ec 100644 --- a/README.md +++ b/README.md @@ -59,12 +59,12 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. 5. batch job submission. 1. Step: 5 (a): Condor-job submission (recommended) - 1. In the file `condor_setup.py`, specify the correct input text file (present inside directory `input_data_Files`) from which you need to take input NanoAOD DAS names. Also, updated the output EOS path. Then do the following: + 1. In the file [condor_setup_lxplus.py](condor_setup_lxplus.py), specify the correct 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 cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS - # Edit condor_setup.py, then - python condor_setup.py --input-file sample_list_v9.dat + # Use the arguments that you need. + python condor_setup_lxplus.py --input-file sample_list_v9.dat # Set proxy before submitting the condor jobs. voms-proxy-init -voms cms --valid 200:00 condor_submit .jdl @@ -77,3 +77,32 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. source /cvmfs/cms.cern.ch/crab3/crab.sh crab submit -c crab_cfg.py ``` + +## Few additioanl scripts + +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 + ``` + This will create the condor job files and the condor log files. + +1. [scripts/GetLogSummary.py](scripts/GetLogSummary.py): This script can be used to get the summary of the condor jobs. It takes the condor log files as input and gives the summary of the jobs. This summary contains the cut-flow table. It can be used as follows: + + ```bash + python scripts/GetLogSummary.py + ``` + +2. [scripts/check_das_sample.py](scripts/check_das_sample.py): This script can be used to check the status of the DAS samples. It takes the DAS name of the sample as input and gives the status of the sample. It can be used as follows: + + ```bash + python scripts/check_das_sample.py + ``` + +3. [scripts/condor_resubmit.py](scripts/condor_resubmit.py): This script can be used to resubmit the failed condor jobs. It takes the condor log files as input and resubmits the failed jobs. It can be used as follows: + + ```bash + python scripts/condor_resubmit.py + ``` + +## Few important points diff --git a/PrintHist.py b/Utils/PrintHist.py similarity index 92% rename from PrintHist.py rename to Utils/PrintHist.py index 822f490..efe78cc 100644 --- a/PrintHist.py +++ b/Utils/PrintHist.py @@ -1,6 +1,8 @@ +"""From the root file having cut-flow histogram, print the cut-flow table.""" + import ROOT -# Set ROOT to run in batch mode +# Set ROOT to run in batch mode ROOT.gROOT.SetBatch(True) def print_bins_noSort(hist): @@ -18,10 +20,10 @@ def print_bins(hist): bin_content = hist.GetBinContent(i) bin_label = xaxis.GetBinLabel(i) bins_info.append((bin_label, bin_content)) - + # Sort the bins_info list based on bin content sorted_bins = sorted(bins_info, key=lambda x: x[1], reverse=True) - + prev_bin_content = None print("Bin {:33}: {:15} {}%".format("Cut string name", "nEvents left", "change")) for bin_label, bin_content in sorted_bins: @@ -47,19 +49,19 @@ def print_bins(hist): def print_histogram(hist): print("Histogram Name: {}".format(hist.GetName())) print("Entries: {}, Total Sum: {:.6e}".format(hist.GetEntries(), hist.GetSumOfWeights())) - + print("Bin Contents:") print_bins(hist) def print_cutflow_histogram(): - file = ROOT.TFile("/eos/user/g/guoj/Sample/2L2Q/UL_Legacy/2018/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8__v16_L1v1-v1_0.root") - cutflow = file.Get("cutflow") - + file = ROOT.TFile("/eos/user/g/guoj/Sample/2L2Q/UL_Legacy/2018/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8__v16_L1v1-v1_0.root") + cutflow = file.Get("cutflow") + if cutflow: print_histogram(cutflow) else: print("Histogram not found.") - + file.Close() print_cutflow_histogram() diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py index ee220af..ab9d6d2 100644 --- a/condor_setup_lxplus.py +++ b/condor_setup_lxplus.py @@ -26,12 +26,17 @@ def main(args): # 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 condor_file_name = 'submit_condor_jobs_lnujj_'+submission_name # Create log files import infoCreaterGit - SumamryOfCurrentSubmission = input("\n\nWrite summary for current job submission: ") + SumamryOfCurrentSubmission = raw_input("\n\nWrite summary for current job submission: ") infoLogFiles = infoCreaterGit.BasicInfoCreater('summary.dat',SumamryOfCurrentSubmission) infoLogFiles.generate_git_patch_and_log() @@ -193,8 +198,9 @@ class PreserveWhitespaceFormatter(argparse.RawTextHelpFormatter, argparse.Argume parser.add_argument("--use_custom_eos", default=False, action='store_true', help="Use custom EOS.") parser.add_argument("--createTarFile", default=True, action='store_false', help="Use custom EOS.") 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.") - parser.add_argument("--input_file", default='sample_list_v9_2018_campaign.dat', help="Input file from where to read DAS names.") - parser.add_argument("--eos_output_path", default='/eos/user/a/avijay/Higgs_020723', help="Initial path for operations.") + # 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("--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=""" From 793729605f338ff725518cd1909ee8721ee6bf61 Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Mon, 25 Sep 2023 17:52:34 +0200 Subject: [PATCH 09/10] Added golden json information to post-proc --- ...044_13TeV_Legacy2016_Collisions16_JSON.txt | 535 +++++++++++++++ ...2_13TeV_UL2017_Collisions17_GoldenJSON.txt | 615 +++++++++++++++++ ...175_13TeV_Legacy2018_Collisions18_JSON.txt | 648 ++++++++++++++++++ post_proc.py | 14 +- 4 files changed, 1808 insertions(+), 4 deletions(-) create mode 100644 golden_Json/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt create mode 100644 golden_Json/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSON.txt create mode 100644 golden_Json/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt diff --git a/golden_Json/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt b/golden_Json/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt new file mode 100644 index 0000000..a9a0464 --- /dev/null +++ b/golden_Json/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt @@ -0,0 +1,535 @@ +{ + "273158": [[1, 1283]], + "273302": [[1, 459]], + "273402": [[100, 292]], + "273403": [[1, 68]], + "273404": [[1, 22]], + "273405": [[2, 34]], + "273406": [[1, 125]], + "273408": [[1, 9]], + "273409": [[1, 317]], + "273410": [[1, 99]], + "273411": [[1, 29]], + "273425": [[62, 352], [354, 742]], + "273446": [[1, 48]], + "273447": [[1, 113], [115, 420]], + "273448": [[1, 396]], + "273449": [[1, 216]], + "273450": [[1, 214], [219, 647]], + "273492": [ + [71, 282], + [284, 325], + [327, 343] + ], + "273493": [[1, 241]], + "273494": [[1, 192]], + "273502": [ + [73, 256], + [258, 318], + [320, 813], + [815, 1077] + ], + "273503": [[1, 598]], + "273554": [[77, 444]], + "273555": [[1, 173]], + "273725": [[83, 252], [254, 2556]], + "273728": [[1, 112]], + "273730": [[1, 2126]], + "274094": [[108, 332]], + "274146": [[1, 73]], + "274157": [[105, 537]], + "274159": [[1, 47]], + "274160": [[1, 214]], + "274161": [[1, 516]], + "274172": [[31, 95]], + "274198": [[81, 192]], + "274199": [[1, 630]], + "274200": [[1, 678]], + "274240": [[1, 40], [42, 86]], + "274241": [[1, 1180]], + "274244": [[1, 607]], + "274250": [[1, 704]], + "274251": [[1, 546]], + "274283": [[1, 22]], + "274284": [[1, 215]], + "274286": [[1, 154]], + "274314": [[97, 165]], + "274315": [[1, 432]], + "274316": [[1, 974]], + "274317": [[1, 22]], + "274319": [[1, 225]], + "274335": [[60, 1013]], + "274336": [[1, 20]], + "274337": [[1, 22]], + "274338": [[1, 703]], + "274339": [[1, 99]], + "274344": [[1, 639]], + "274345": [[1, 170]], + "274382": [[94, 144]], + "274387": [[88, 447]], + "274388": [[1, 1820]], + "274420": [[93, 268]], + "274421": [[1, 356]], + "274422": [[1, 2207]], + "274440": [[92, 498]], + "274441": [[1, 443]], + "274442": [[1, 752]], + "274954": [[37, 60]], + "274955": [[1, 98]], + "274968": [[1, 1206]], + "274969": [[1, 1007]], + "274970": [[1, 47]], + "274971": [[1, 905]], + "274998": [[63, 794]], + "274999": [[1, 1257]], + "275000": [[1, 140]], + "275001": [[1, 1781], [1786, 2061]], + "275059": [[78, 81], [105, 150]], + "275066": [[1, 111]], + "275067": [[1, 396]], + "275068": [[1, 922]], + "275073": [[1, 523]], + "275074": [[1, 647]], + "275124": [[106, 433]], + "275125": [[1, 989]], + "275282": [[90, 185]], + "275283": [[1, 137]], + "275284": [[1, 74]], + "275290": [[96, 150]], + "275291": [[1, 356]], + "275292": [[1, 125]], + "275293": [[1, 142], [144, 201]], + "275309": [[55, 627]], + "275310": [[1, 1939]], + "275311": [[1, 1253]], + "275319": [[141, 292]], + "275337": [[1, 433]], + "275338": [[1, 520]], + "275344": [[76, 368]], + "275345": [[1, 353]], + "275370": [[81, 371]], + "275371": [[1, 569]], + "275375": [[127, 1453]], + "275376": [[1, 3096]], + "275657": [[1, 111]], + "275658": [[1, 344]], + "275659": [[1, 17]], + "275761": [[1, 11]], + "275767": [[1, 8]], + "275772": [[1, 61]], + "275773": [[1, 21]], + "275774": [[1, 317]], + "275776": [[1, 149]], + "275777": [[1, 304]], + "275778": [[1, 319]], + "275782": [[1, 131], [133, 762]], + "275832": [[1, 371]], + "275833": [ + [1, 53], + [56, 115], + [117, 254] + ], + "275834": [[1, 303]], + "275835": [[1, 20]], + "275836": [ + [1, 429], + [431, 1163], + [1166, 1170], + [1184, 1306] + ], + "275837": [[1, 186], [198, 726]], + "275847": [[1, 2263]], + "275886": [[70, 109]], + "275890": [[1, 1393]], + "275911": [ + [62, 298], + [300, 354], + [356, 445] + ], + "275912": [[1, 303]], + "275913": [[1, 484]], + "275918": [[1, 318], [348, 361]], + "275920": [[1, 472]], + "275921": [[1, 32]], + "275923": [[1, 127]], + "275931": [[1, 89]], + "275963": [[82, 139], [141, 172]], + "276092": [[74, 153]], + "276097": [[1, 507]], + "276242": [[1, 7], [18, 61], [72, 1669]], + "276243": [[1, 15], [18, 627]], + "276244": [[1, 1202]], + "276282": [[75, 534], [537, 1151]], + "276283": [[1, 1087]], + "276315": [[40, 175], [178, 227]], + "276317": [[1, 147]], + "276318": [[1, 103], [106, 576]], + "276355": [[1, 34]], + "276361": [ + [1, 161], + [169, 208], + [210, 800], + [802, 844] + ], + "276363": [[1, 238], [242, 1489]], + "276384": [[1, 1117]], + "276437": [ + [63, 224], + [227, 1074], + [1076, 2190] + ], + "276454": [[1, 527]], + "276458": [[1, 341]], + "276495": [[87, 279]], + "276501": [[1, 221], [223, 2556]], + "276502": [[1, 741]], + "276525": [[87, 1606], [1626, 2904]], + "276527": [[1, 214]], + "276528": [[1, 394]], + "276542": [[74, 858]], + "276543": [[1, 961]], + "276544": [[1, 163]], + "276545": [[1, 110], [117, 213]], + "276581": [[79, 447]], + "276582": [[1, 873]], + "276583": [[1, 60]], + "276584": [[1, 2]], + "276585": [[1, 253]], + "276586": [[1, 658], [680, 781]], + "276587": [[1, 1006]], + "276653": [[72, 562]], + "276655": [[1, 593], [595, 1114]], + "276659": [[1, 127], [129, 252]], + "276775": [[96, 1269]], + "276776": [[1, 1823]], + "276794": [[1, 885]], + "276807": [[66, 227]], + "276808": [[1, 883]], + "276810": [[1, 291]], + "276811": [[1, 2563]], + "276831": [[64, 2711]], + "276834": [[1, 729]], + "276870": [ + [78, 1354], + [1356, 3108], + [3111, 3258], + [3260, 3484] + ], + "276935": [ + [79, 184], + [186, 838], + [842, 906] + ], + "276940": [[70, 214]], + "276946": [[1, 34]], + "276947": [[1, 150]], + "276948": [[1, 481]], + "276950": [[1, 2353]], + "277069": [[81, 394]], + "277070": [[1, 1063]], + "277071": [[1, 82], [90, 178]], + "277072": [[1, 253], [256, 484]], + "277073": [[1, 98]], + "277076": [ + [1, 3], + [5, 7], + [9, 35], + [38, 1037] + ], + "277087": [[204, 1191]], + "277094": [[1, 161], [164, 598]], + "277096": [[1, 2093]], + "277112": [[1, 155]], + "277126": [[42, 60]], + "277127": [[1, 438], [440, 902]], + "277148": [[83, 715]], + "277166": [[77, 433]], + "277168": [[1, 2223]], + "277180": [[88, 228]], + "277194": [[113, 139], [144, 2070]], + "277305": [[62, 744]], + "277420": [[84, 346]], + "277981": [[82, 83], [85, 163]], + "277991": [[1, 98]], + "277992": [[1, 260], [262, 312]], + "278017": [ + [77, 97], + [99, 213], + [215, 512], + [514, 600] + ], + "278018": [ + [1, 263], + [265, 627], + [642, 1011], + [1020, 1181] + ], + "278167": [[87, 1660], [1662, 2260]], + "278175": [[1, 88]], + "278193": [[77, 231]], + "278239": [[76, 754]], + "278240": [ + [1, 64], + [70, 113], + [115, 1309] + ], + "278273": [[75, 114]], + "278274": [[1, 85]], + "278288": [[67, 84]], + "278289": [[1, 42], [44, 60]], + "278290": [[1, 11]], + "278308": [ + [87, 216], + [219, 1200], + [1217, 1848], + [1876, 1885] + ], + "278310": [[1, 709]], + "278315": [ + [73, 254], + [256, 661], + [663, 767] + ], + "278345": [[84, 500], [503, 833]], + "278346": [[1, 150]], + "278349": [ + [1, 401], + [403, 612], + [630, 639] + ], + "278366": [[1, 453]], + "278406": [[85, 360], [362, 1682]], + "278509": [[91, 1557]], + "278769": [[75, 111]], + "278770": [[1, 767]], + "278801": [[48, 92]], + "278802": [[1, 21]], + "278803": [[1, 330]], + "278804": [[1, 8]], + "278805": [[1, 26], [30, 291]], + "278808": [ + [1, 445], + [447, 462], + [464, 1793] + ], + "278820": [[17, 1540]], + "278822": [[1, 1627]], + "278873": [[70, 136]], + "278874": [[1, 484]], + "278875": [[1, 834]], + "278923": [[55, 467]], + "278957": [[79, 227]], + "278962": [[68, 418]], + "278963": [[1, 23], [25, 175]], + "278969": [ + [70, 1051], + [1053, 1291], + [1293, 1465] + ], + "278975": [[1, 857]], + "278976": [[1, 20]], + "278986": [[71, 199]], + "279024": [[82, 382]], + "279029": [[1, 260]], + "279071": [[71, 244]], + "279080": [[68, 224]], + "279115": [[118, 524]], + "279116": [[38, 485]], + "279479": [[86, 190]], + "279588": [[100, 1259]], + "279653": [[77, 77], [82, 268]], + "279654": [ + [1, 108], + [110, 1231], + [1285, 1307] + ], + "279656": [[1, 43], [82, 87]], + "279658": [[1, 713]], + "279667": [[68, 1033]], + "279681": [[77, 111]], + "279682": [[1, 47]], + "279683": [[1, 34]], + "279684": [[1, 34]], + "279685": [[1, 93], [95, 209]], + "279691": [[71, 124]], + "279694": [[1, 2235]], + "279715": [ + [71, 474], + [476, 477], + [480, 480], + [511, 511], + [523, 691] + ], + "279716": [ + [1, 860], + [875, 1528], + [1530, 1653] + ], + "279760": [ + [68, 578], + [585, 728], + [798, 806] + ], + "279766": [[1, 1694]], + "279767": [[1, 776]], + "279794": [[77, 1100]], + "279823": [[61, 395]], + "279841": [[75, 398], [407, 2122]], + "279844": [[72, 304]], + "279887": [[79, 397]], + "279931": [ + [84, 628], + [630, 801], + [803, 1043], + [1045, 3022] + ], + "279966": [[79, 441]], + "279975": [ + [70, 190], + [192, 253], + [256, 281], + [283, 709], + [734, 1121] + ], + "279993": [[85, 163]], + "279994": [[1, 59]], + "280013": [[1, 34]], + "280015": [ + [1, 39], + [41, 56], + [59, 554], + [560, 584] + ], + "280016": [[1, 163]], + "280017": [[1, 613]], + "280018": [[1, 1282]], + "280020": [[1, 47]], + "280024": [[1, 427]], + "280187": [[4, 70]], + "280188": [[1, 253]], + "280191": [[1, 781], [783, 909]], + "280194": [[1, 238]], + "280242": [[1, 411], [414, 639]], + "280249": [[1, 1437]], + "280251": [[1, 165], [167, 372]], + "280327": [[49, 98]], + "280330": [[1, 870]], + "280349": [[1, 247], [252, 639]], + "280363": [[1, 367]], + "280364": [ + [1, 619], + [621, 1090], + [1102, 1363] + ], + "280383": [[64, 73]], + "280384": [[1, 47]], + "280385": [[1, 519], [523, 2022]], + "281613": [[101, 903]], + "281639": [[1, 136]], + "281641": [[1, 319]], + "281693": [[1, 2191]], + "281707": [ + [99, 982], + [1000, 1065], + [1087, 1089] + ], + "281726": [[1, 291]], + "281727": [[1, 1605]], + "281797": [[125, 2176]], + "281975": [[1, 215]], + "281976": [[1, 2166]], + "282033": [[82, 124]], + "282034": [[1, 35]], + "282035": [[1, 47]], + "282037": [[1, 457], [459, 1862]], + "282092": [[92, 222], [624, 2276]], + "282708": [[1, 8]], + "282710": [[1, 9]], + "282712": [[1, 1], [10, 68]], + "282730": [[89, 171]], + "282731": [[1, 176]], + "282732": [[1, 73]], + "282733": [[1, 178]], + "282734": [[1, 330]], + "282735": [[1, 1823]], + "282800": [[1, 382]], + "282807": [[1, 330]], + "282814": [[1, 1843]], + "282842": [[1, 80]], + "282917": [[117, 201]], + "282918": [[1, 59]], + "282919": [[1, 243]], + "282922": [[1, 137]], + "282923": [ + [1, 17], + [19, 30], + [32, 86], + [88, 229] + ], + "283042": [[1, 10]], + "283043": [[1, 519]], + "283049": [[82, 98]], + "283050": [[1, 227]], + "283052": [[1, 124]], + "283059": [[1, 458]], + "283270": [[76, 1913]], + "283283": [[1, 1748]], + "283305": [[79, 93]], + "283306": [[1, 291]], + "283307": [[1, 461]], + "283308": [ + [1, 547], + [549, 571], + [573, 948] + ], + "283353": [[80, 832]], + "283358": [[1, 243], [245, 986]], + "283359": [[1, 428]], + "283407": [[82, 124]], + "283408": [ + [1, 2125], + [2203, 2416], + [2528, 2543] + ], + "283416": [[49, 245]], + "283453": [[83, 537]], + "283469": [[74, 74]], + "283478": [[76, 303], [324, 973]], + "283548": [[144, 291]], + "283680": [[1, 87]], + "283681": [[1, 23]], + "283682": [[1, 389]], + "283685": [[1, 314]], + "283820": [[67, 1552]], + "283830": [[1, 729]], + "283834": [[1, 85]], + "283835": [[1, 112]], + "283865": [[1, 1177]], + "283876": [[65, 736]], + "283877": [[1, 1496]], + "283884": [[349, 756]], + "283885": [[1, 1723]], + "283933": [[88, 240]], + "283934": [ + [1, 784], + [793, 870], + [875, 1245], + [1267, 1291] + ], + "283946": [[85, 1462]], + "283964": [[1, 388]], + "284006": [[73, 394]], + "284014": [[1, 266]], + "284025": [[109, 162]], + "284029": [[1, 112]], + "284035": [[1, 369]], + "284036": [[1, 356]], + "284037": [[1, 343]], + "284038": [[1, 60]], + "284039": [[1, 34]], + "284040": [[1, 35]], + "284041": [[1, 47]], + "284042": [[1, 137]], + "284043": [[1, 227]], + "284044": [[1, 30]] +} \ No newline at end of file diff --git a/golden_Json/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSON.txt b/golden_Json/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSON.txt new file mode 100644 index 0000000..5882756 --- /dev/null +++ b/golden_Json/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSON.txt @@ -0,0 +1,615 @@ +{ + "297050": [[12, 137], [193, 776]], + "297056": [[12, 203]], + "297057": [[1, 4], [14, 105], [112, 377], [385, 418], [424, 509], [516, 906]], + "297099": [[24, 62]], + "297100": [[1, 15], [21, 369], [375, 381]], + "297101": [[1, 668], [673, 697], [700, 856], [862, 937], [943, 1101]], + "297113": [[1, 204], [211, 252]], + "297114": [[1, 99], [106, 161]], + "297175": [[1, 85]], + "297176": [[11, 120], [125, 214]], + "297177": [[1, 162]], + "297178": [ + [1, 54], + [59, 334], + [342, 749], + [754, 967], + [972, 1037], + [1043, 1264], + [1272, 1282], + [1290, 1385] + ], + "297179": [[1, 6], [12, 97]], + "297215": [[1, 47]], + "297218": [[1, 27]], + "297219": [ + [1, 80], + [85, 281], + [288, 579], + [585, 916], + [921, 1429], + [1436, 2004], + [2010, 2638] + ], + "297224": [[10, 19], [24, 138]], + "297225": [[1, 32]], + "297227": [[9, 192]], + "297292": [[1, 125], [130, 131], [136, 667], [675, 753]], + "297293": [[1, 121], [127, 150]], + "297296": [[1, 236], [240, 401], [406, 418], [425, 497]], + "297308": [[1, 44]], + "297359": [[39, 70], [164, 180]], + "297411": [[32, 737], [740, 800], [807, 950]], + "297424": [[32, 149]], + "297425": [[1, 107], [112, 157]], + "297426": [[1, 28], [34, 84], [90, 111]], + "297429": [[1, 72]], + "297430": [[1, 199]], + "297431": [[1, 49], [55, 64], [71, 188]], + "297432": [[1, 112]], + "297433": [[1, 159]], + "297434": [[1, 161]], + "297435": [[1, 94]], + "297467": [[50, 138]], + "297468": [[1, 74]], + "297469": [[1, 4], [9, 70]], + "297483": [[37, 68], [71, 201], [206, 214]], + "297484": [[1, 47], [53, 208], [214, 214]], + "297485": [[1, 16], [23, 253], [258, 299], [302, 314], [321, 420]], + "297486": [[1, 74], [79, 598], [603, 625]], + "297487": [[1, 433], [439, 491], [495, 603], [609, 613]], + "297488": [[1, 73], [80, 424]], + "297503": [ + [5, 275], + [282, 559], + [566, 606], + [612, 635], + [642, 772], + [777, 779] + ], + "297504": [[1, 41], [125, 136]], + "297505": [[1, 394]], + "297557": [[8, 28], [67, 113], [119, 167], [173, 174], [180, 394]], + "297558": [[9, 266]], + "297562": [[1, 69], [120, 369]], + "297563": [[1, 254], [260, 264]], + "297598": [[17, 17], [22, 33]], + "297599": [[1, 169], [211, 225], [230, 312], [319, 385], [395, 407]], + "297603": [[1, 420]], + "297604": [[1, 126], [131, 272], [279, 375], [381, 407]], + "297605": [[1, 6], [13, 20], [24, 89], [95, 223], [257, 407]], + "297606": [[1, 94], [99, 231]], + "297620": [[32, 318]], + "297656": [ + [64, 116], + [123, 135], + [140, 230], + [269, 307], + [313, 330], + [341, 388], + [393, 433] + ], + "297665": [[1, 153], [159, 209], [214, 279]], + "297666": [[1, 11], [17, 81], [86, 121]], + "297670": [[21, 34]], + "297674": [[3, 102], [108, 188]], + "297675": [[1, 123], [129, 239], [244, 328], [334, 467], [470, 471]], + "297722": [[55, 160], [165, 353]], + "297723": [[1, 13], [51, 222]], + "298996": [[33, 216]], + "298997": [[1, 37], [47, 47]], + "299000": [[4, 77]], + "299042": [[33, 55]], + "299061": [[38, 355]], + "299062": [[1, 163], [166, 303]], + "299064": [[7, 85]], + "299065": [[13, 248], [251, 342]], + "299067": [[1, 459]], + "299096": [[2, 97]], + "299149": [[29, 470]], + "299178": [[37, 56], [58, 111]], + "299180": [[5, 98]], + "299184": [[1, 561]], + "299185": [[1, 120]], + "299327": [[1, 72]], + "299329": [[1, 172]], + "299368": [[37, 175]], + "299369": [[1, 303]], + "299370": [[1, 7], [47, 705]], + "299380": [[34, 227]], + "299381": [[1, 45]], + "299394": [[5, 33]], + "299395": [[1, 187]], + "299396": [[1, 81]], + "299420": [[2, 50]], + "299443": [[145, 164]], + "299450": [[39, 88]], + "299477": [[39, 42], [82, 87]], + "299478": [[1, 175]], + "299479": [[1, 123]], + "299480": [[1, 6], [8, 715]], + "299481": [ + [1, 196], + [199, 236], + [260, 479], + [487, 940], + [943, 1037], + [1061, 1257] + ], + "299593": [[95, 177], [179, 896]], + "299594": [[1, 317]], + "299595": [[1, 134], [138, 138]], + "299597": [[3, 91], [93, 540]], + "299649": [[151, 332]], + "300087": [[36, 59], [61, 126], [128, 216], [218, 239]], + "300105": [[1, 21]], + "300106": [[1, 74]], + "300107": [[1, 28], [30, 47]], + "300117": [[35, 67]], + "300122": [[46, 730], [735, 924], [927, 1295]], + "300123": [[1, 384], [387, 612]], + "300155": [[35, 1229]], + "300156": [[1, 72]], + "300157": [[9, 1107]], + "300226": [[43, 448]], + "300233": [[43, 162]], + "300234": [[1, 59]], + "300235": [[1, 187]], + "300236": [[11, 187]], + "300237": [[1, 713], [716, 717]], + "300238": [[30, 58], [62, 329]], + "300239": [[1, 145], [148, 167], [171, 213]], + "300240": [[1, 7], [11, 46], [51, 362]], + "300280": [ + [52, 56], + [61, 69], + [73, 150], + [155, 165], + [178, 198], + [207, 222], + [226, 251], + [255, 268], + [275, 345], + [349, 370], + [381, 548], + [553, 607], + [617, 639], + [663, 691] + ], + "300281": [[3, 8]], + "300282": [[1, 9], [13, 59], [73, 92], [97, 114], [142, 151], [156, 186]], + "300283": [[1, 34]], + "300284": [ + [1, 22], + [38, 47], + [50, 82], + [90, 98], + [108, 130], + [133, 152], + [156, 250], + [260, 414], + [420, 561], + [568, 585], + [590, 680], + [691, 751] + ], + "300364": [[27, 46]], + "300372": [[1, 8]], + "300375": [[1, 93]], + "300389": [[1, 1], [4, 5], [8, 8], [11, 20], [23, 39], [60, 149]], + "300399": [[1, 20]], + "300400": [[1, 677]], + "300401": [[19, 673]], + "300459": [[40, 332]], + "300461": [[1, 98]], + "300462": [[1, 97]], + "300463": [[1, 124]], + "300464": [[1, 103], [126, 265]], + "300466": [[1, 650]], + "300467": [[1, 563]], + "300497": [[26, 175]], + "300514": [[38, 150]], + "300515": [[1, 838], [957, 1013]], + "300516": [[1, 111]], + "300517": [[1, 8], [103, 623]], + "300558": [[8, 548]], + "300560": [[1, 640], [645, 844]], + "300574": [[15, 111]], + "300575": [[1, 82]], + "300576": [[7, 123], [125, 1206]], + "300631": [[41, 49], [63, 66], [75, 226]], + "300632": [[1, 21]], + "300633": [[1, 447]], + "300635": [[1, 23], [26, 176]], + "300636": [[1, 335], [338, 1572]], + "300673": [[41, 47], [49, 49], [52, 56], [59, 66]], + "300674": [[1, 33]], + "300675": [[1, 33]], + "300676": [[1, 26]], + "300742": [[56, 343]], + "300777": [[21, 509]], + "300780": [[3, 341]], + "300785": [[1, 549], [552, 750], [752, 1201], [1219, 1272]], + "300806": [[36, 214]], + "300811": [[6, 508]], + "300812": [[1, 59]], + "300816": [[6, 161]], + "300817": [[1, 33], [36, 74], [80, 383], [410, 493]], + "301046": [[162, 223]], + "301141": [[25, 31]], + "301142": [[1, 897]], + "301161": [[36, 805]], + "301165": [[1, 145]], + "301179": [[35, 59]], + "301180": [[1, 97]], + "301183": [[3, 10], [13, 303]], + "301281": [[38, 157]], + "301283": [[3, 886]], + "301298": [[45, 949]], + "301323": [[35, 474], [477, 990]], + "301330": [[22, 353]], + "301359": [[33, 319]], + "301384": [[1, 476]], + "301391": [[38, 214]], + "301392": [[1, 627]], + "301393": [[2, 18]], + "301396": [[1, 33]], + "301397": [[1, 228], [231, 517], [519, 728]], + "301398": [[1, 9]], + "301399": [[1, 108]], + "301417": [[50, 367]], + "301447": [[86, 96], [99, 400], [404, 512]], + "301448": [[1, 329]], + "301449": [[1, 404]], + "301450": [[1, 173]], + "301461": [[28, 581]], + "301472": [[35, 830]], + "301475": [[1, 18]], + "301476": [[1, 844]], + "301519": [[42, 250]], + "301524": [[1, 110], [117, 263]], + "301529": [[1, 49]], + "301530": [[1, 110]], + "301531": [[1, 394]], + "301532": [[1, 611]], + "301567": [[14, 372]], + "301627": [[57, 943]], + "301664": [[28, 445]], + "301665": [[1, 294], [319, 487]], + "301694": [[36, 102]], + "301912": [[43, 52], [101, 422]], + "301913": [[1, 58]], + "301914": [[1, 350]], + "301941": [[31, 568]], + "301959": [[30, 1938]], + "301960": [[1, 147]], + "301970": [[6, 123]], + "301984": [[17, 317]], + "301985": [[1, 367]], + "301986": [[1, 381]], + "301987": [[1, 1128]], + "301997": [[37, 407]], + "301998": [[1, 1704]], + "302019": [[34, 86]], + "302026": [[24, 53], [66, 72]], + "302029": [[1, 98]], + "302031": [[1, 401], [403, 446], [448, 675], [678, 818]], + "302033": [[1, 40], [44, 46]], + "302034": [[1, 20]], + "302037": [[18, 20]], + "302038": [[10, 10]], + "302040": [[1, 174]], + "302041": [[1, 72]], + "302042": [[1, 523]], + "302043": [[1, 228]], + "302131": [[71, 943]], + "302159": [[33, 140]], + "302163": [[32, 671], [674, 1230]], + "302165": [[1, 85]], + "302166": [[1, 16]], + "302225": [[54, 133], [136, 923]], + "302228": [[58, 78], [81, 293]], + "302229": [[1, 457]], + "302240": [[1, 960]], + "302262": [[37, 471]], + "302263": [[1, 1250]], + "302277": [[15, 17], [22, 192], [194, 391]], + "302279": [[1, 71]], + "302280": [[1, 152]], + "302322": [[33, 870]], + "302328": [[42, 722]], + "302337": [[27, 162]], + "302342": [[19, 72]], + "302343": [[1, 98]], + "302344": [[3, 482]], + "302350": [[1, 136]], + "302388": [[27, 157], [164, 717]], + "302392": [[45, 407]], + "302393": [[1, 887]], + "302448": [[21, 312], [317, 442], [445, 483], [486, 1926]], + "302472": [[28, 808]], + "302473": [[1, 368], [398, 406]], + "302474": [[1, 305]], + "302475": [[1, 7]], + "302476": [[1, 259]], + "302479": [[30, 222], [225, 340]], + "302484": [[8, 176]], + "302485": [[1, 922]], + "302492": [[10, 21], [23, 59]], + "302493": [[1, 7]], + "302494": [[1, 618]], + "302509": [[73, 92]], + "302513": [[37, 89]], + "302522": [[29, 46]], + "302523": [[1, 59]], + "302525": [[1, 677], [747, 778]], + "302526": [[1, 582]], + "302548": [[40, 124]], + "302551": [[1, 7]], + "302553": [[1, 188]], + "302554": [[1, 7]], + "302555": [[1, 11]], + "302563": [[40, 46]], + "302565": [[1, 7]], + "302572": [[6, 291]], + "302573": [[1, 693], [730, 1285]], + "302596": [[47, 534], [545, 705], [710, 986]], + "302597": [[1, 1054]], + "302634": [ + [37, 73], + [75, 123], + [125, 129], + [133, 165], + [168, 175], + [177, 216], + [218, 358], + [361, 375], + [378, 404], + [407, 423], + [425, 503], + [505, 578], + [581, 594], + [596, 638] + ], + "302635": [ + [1, 22], + [24, 28], + [30, 39], + [41, 53], + [55, 132], + [134, 144], + [146, 265], + [267, 271], + [274, 344], + [347, 357], + [359, 375], + [378, 384], + [386, 414], + [416, 494], + [497, 608], + [611, 634], + [637, 684], + [687, 706], + [708, 724], + [726, 901], + [904, 954], + [957, 982], + [984, 1072], + [1075, 1124], + [1126, 1129], + [1132, 1206], + [1209, 1234], + [1236, 1291] + ], + "302651": [[1, 149]], + "302654": [[1, 317]], + "302661": [[1, 72]], + "302663": [[1, 706]], + "303825": [[1, 180]], + "303832": [[54, 1334], [1338, 1913]], + "303838": [[54, 54], [83, 2044]], + "303885": [[60, 2052]], + "303948": [[55, 1678]], + "303998": [[58, 319]], + "303999": [[1, 751]], + "304000": [[1, 56]], + "304062": [[54, 2014]], + "304119": [[71, 138], [143, 150]], + "304120": [[1, 253]], + "304125": [[1, 1769]], + "304144": [[76, 2596], [2598, 2656]], + "304158": [[165, 1750], [1752, 2087]], + "304169": [[50, 1714], [1731, 1733]], + "304170": [[1, 620]], + "304199": [[10, 18]], + "304200": [[1, 321]], + "304204": [[55, 607]], + "304209": [[52, 98], [100, 133], [135, 157], [176, 253], [255, 477]], + "304291": [[56, 85]], + "304292": [[1, 1125], [1183, 1779], [1781, 1811]], + "304333": [[74, 1653]], + "304354": [[82, 295]], + "304366": [ + [44, 1387], + [1390, 1396], + [1399, 1402], + [1404, 1407], + [1409, 1412], + [1414, 1416], + [1419, 1421], + [1424, 1873] + ], + "304446": [[40, 92], [110, 111]], + "304447": [[1, 534], [540, 1644]], + "304451": [[1, 60]], + "304505": [[60, 86]], + "304506": [[1, 370]], + "304507": [[1, 239]], + "304508": [[1, 1324]], + "304562": [[52, 56], [60, 848]], + "304616": [[52, 223], [227, 740], [747, 1002]], + "304625": [[73, 536]], + "304626": [[1, 8]], + "304654": [[53, 704]], + "304655": [[1, 1194]], + "304661": [[53, 67], [69, 143], [147, 173], [175, 198], [237, 240]], + "304662": [[1, 150]], + "304663": [[1, 689]], + "304671": [[51, 1193]], + "304672": [[1, 60]], + "304737": [[69, 149]], + "304738": [[1, 1681]], + "304739": [[3, 16]], + "304740": [[1, 278]], + "304776": [[49, 98]], + "304777": [[1, 431], [438, 510]], + "304778": [[4, 1300]], + "304797": [[28, 87], [91, 306], [308, 377], [385, 1202], [1205, 2950]], + "305044": [[3, 203], [302, 306], [309, 310], [313, 313], [318, 330]], + "305045": [[1, 873]], + "305046": [[1, 667], [671, 686]], + "305059": [[63, 518], [520, 575]], + "305062": [[1, 8]], + "305063": [[1, 35]], + "305064": [[1, 2045]], + "305081": [[52, 1107]], + "305112": [[68, 1527]], + "305113": [[9, 72]], + "305114": [[1, 526]], + "305178": [[69, 124]], + "305179": [[1, 21]], + "305180": [[1, 9]], + "305181": [[1, 8]], + "305182": [[1, 8]], + "305183": [[1, 231], [262, 266]], + "305184": [[1, 8]], + "305186": [[1, 112], [120, 422]], + "305188": [[1, 1002]], + "305202": [[74, 132], [136, 729]], + "305204": [[1, 1229]], + "305207": [[52, 1077]], + "305208": [[1, 372]], + "305234": [[52, 99]], + "305236": [[1, 23]], + "305237": [[1, 16], [18, 1147]], + "305247": [[57, 433]], + "305248": [[1, 957]], + "305252": [[1, 548]], + "305282": [[75, 207]], + "305310": [[60, 157], [163, 458]], + "305311": [[1, 153]], + "305312": [[1, 227]], + "305313": [[1, 741]], + "305314": [[1, 404]], + "305336": [[36, 241]], + "305338": [[1, 107]], + "305341": [[1, 503]], + "305349": [[1, 34]], + "305350": [[1, 21]], + "305351": [[1, 868]], + "305358": [[91, 231], [233, 253]], + "305364": [[50, 147]], + "305365": [[1, 668], [676, 832]], + "305366": [[1, 721], [724, 756], [769, 934], [936, 1254]], + "305376": [[71, 168]], + "305377": [[9, 1292], [1294, 1383], [1386, 1525]], + "305405": [[44, 536], [573, 575]], + "305406": [[1, 394], [401, 520], [528, 535], [540, 1475]], + "305440": [[20, 291]], + "305441": [[1, 121]], + "305516": [[46, 518], [558, 639]], + "305517": [[1, 163]], + "305518": [[1, 1134]], + "305586": [[53, 583]], + "305589": [[1, 691]], + "305590": [[1, 500], [517, 1020]], + "305636": [[60, 339], [342, 667], [671, 2390]], + "305766": [[55, 902]], + "305809": [[56, 197]], + "305814": [[85, 689], [692, 978], [980, 1074], [1077, 1912]], + "305821": [[59, 830]], + "305832": [[87, 266]], + "305840": [[1, 1144]], + "305842": [[1, 862]], + "305862": [[81, 705]], + "305898": [[70, 780]], + "305902": [[53, 521]], + "305967": [[1, 32]], + "306029": [[63, 96]], + "306030": [[1, 110]], + "306036": [[60, 63]], + "306037": [[1, 49]], + "306038": [[1, 139]], + "306041": [[1, 320]], + "306042": [[1, 371]], + "306048": [[1, 140]], + "306049": [[1, 358]], + "306051": [[1, 415]], + "306091": [[422, 629]], + "306092": [[1, 588], [593, 976]], + "306095": [[1, 300]], + "306121": [[57, 152]], + "306122": [[1, 127]], + "306125": [[1, 756], [770, 2642], [2667, 3007]], + "306126": [[1, 497]], + "306134": [[53, 84]], + "306135": [[1, 1095]], + "306138": [[1, 1298]], + "306139": [[1, 1112]], + "306153": [[78, 165]], + "306154": [[1, 251], [253, 691], [709, 1233]], + "306155": [[1, 1440]], + "306169": [[1, 745]], + "306170": [[1, 22]], + "306171": [[1, 503]], + "306418": [[1, 33], [35, 75]], + "306419": [[1, 62]], + "306420": [[1, 108]], + "306422": [[9, 126]], + "306423": [[1, 333]], + "306432": [[1, 339]], + "306454": [[13, 101]], + "306455": [[1, 11]], + "306456": [[1, 237], [239, 787]], + "306457": [[1, 31]], + "306458": [ + [1, 17], + [20, 35], + [37, 41], + [43, 47], + [49, 53], + [56, 60], + [62, 66], + [68, 72], + [74, 77], + [79, 83], + [85, 89], + [93, 102], + [104, 108], + [110, 114], + [116, 120], + [122, 126], + [129, 139], + [141, 145], + [147, 151], + [153, 166], + [169, 173], + [175, 179], + [181, 185], + [187, 191], + [193, 197], + [200, 210], + [212, 216], + [218, 222], + [225, 229], + [231, 235], + [237, 241], + [243, 247], + [249, 249], + [252, 256], + [258, 268] + ], + "306459": [[1, 512], [514, 2275]], + "306460": [[1, 73]] +} \ No newline at end of file diff --git a/golden_Json/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt b/golden_Json/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt new file mode 100644 index 0000000..e8f503a --- /dev/null +++ b/golden_Json/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt @@ -0,0 +1,648 @@ +{ + "315257": [[1, 88], [91, 92]], + "315259": [[1, 172]], + "315264": [[32, 261]], + "315265": [[4, 58]], + "315267": [[1, 244]], + "315270": [[1, 633]], + "315322": [[23, 118], [122, 1354]], + "315339": [[37, 654]], + "315357": [[44, 732], [736, 770], [780, 831]], + "315361": [[40, 619]], + "315363": [[1, 35], [37, 47], [49, 67], [69, 80], [82, 90]], + "315366": [[10, 61], [67, 750]], + "315420": [[28, 920], [924, 942], [954, 1748]], + "315488": [[42, 843]], + "315489": [[1, 653], [672, 709]], + "315490": [[1, 24]], + "315506": [[13, 100]], + "315510": [[1, 345]], + "315512": [[1, 1122]], + "315543": [[55, 171]], + "315555": [[22, 97]], + "315556": [[1, 26]], + "315557": [[1, 279]], + "315640": [[46, 87]], + "315641": [[1, 4]], + "315642": [[1, 92]], + "315644": [[1, 184]], + "315645": [[1, 40], [47, 390], [395, 565], [567, 594]], + "315646": [[1, 1033]], + "315647": [[1, 58]], + "315648": [[1, 110]], + "315689": [[24, 1127], [1180, 1186]], + "315690": [[10, 654]], + "315702": [[38, 113]], + "315703": [[1, 545]], + "315704": [[1, 61]], + "315705": [[1, 160],[162,162],[164,700]], + "315713": [[35, 359], [374, 385], [400, 1123]], + "315721": [[33, 50], [56, 626]], + "315741": [[34, 92]], + "315764": [[37, 309]], + "315770": [[39, 332]], + "315784": [[29, 33], [40, 156], [158, 161]], + "315785": [[1, 198], [201, 305]], + "315786": [[1, 72]], + "315790": [[1, 716], [718, 922]], + "315800": [[41, 621]], + "315801": [[1, 344]], + "315840": [[33, 1154]], + "315973": [[39, 240], [262, 914]], + "315974": [[1, 71]], + "316058": [[42, 405]], + "316059": [[1, 321], [323, 567]], + "316060": [[1, 935]], + "316061": [[1, 23], [194, 206]], + "316062": [[1, 4]], + "316082": [[37, 407]], + "316110": [[1, 210]], + "316111": [[1, 48]], + "316113": [[1, 64]], + "316114": [[1, 777], [779, 1562]], + "316153": [[1, 770]], + "316186": [[38, 81]], + "316187": [[1, 1091], [1093, 1100], [1207, 2077]], + "316199": [[33, 1197]], + "316200": [[1, 10]], + "316201": [[1, 498]], + "316202": [[1, 403]], + "316216": [[25, 466]], + "316217": [[1, 264]], + "316218": [[1, 1008]], + "316219": [[1, 283]], + "316239": [[38, 626]], + "316240": [[1, 1224]], + "316241": [[1, 325]], + "316271": [[36, 121]], + "316361": [ + [22, 124], + [126, 131], + [133, 135], + [137, 137], + [139, 142], + [144, 145], + [147, 147], + [149, 159], + [161, 174], + [176, 178], + [180, 189], + [191, 197], + [199, 208], + [210, 223] + ], + "316362": [ + [1, 208], + [210, 212], + [214, 225], + [227, 242], + [244, 269], + [271, 319], + [332, 392], + [394, 395], + [397, 402], + [404, 404], + [406, 410], + [412, 412], + [414, 418], + [420, 428], + [430, 450] + ], + "316363": [[1, 39], [41, 49]], + "316377": [[19, 19], [21, 40]], + "316378": [[1, 29]], + "316379": [[1, 70]], + "316380": [[1, 708], [714, 1213]], + "316455": [[36, 71]], + "316457": [[1, 1454]], + "316469": [[17, 444]], + "316470": [[1, 476]], + "316472": [[1, 70], [76, 333]], + "316505": [[44, 205], [207, 921], [923, 1364]], + "316569": [[20, 703], [742, 1945]], + "316590": [[17, 526]], + "316613": [[49, 241]], + "316615": [[1, 338]], + "316666": [[1, 981]], + "316667": [[1, 197]], + "316700": [[46, 346], [388, 397]], + "316701": [[1, 479]], + "316702": [[1, 388]], + "316715": [[33, 45]], + "316716": [[1, 181]], + "316717": [[1, 192]], + "316718": [[1, 311]], + "316719": [[1, 91], [100, 144]], + "316720": [[1, 182]], + "316721": [[1, 15]], + "316722": [[1, 751]], + "316723": [[1, 64]], + "316758": [[11, 1609]], + "316766": [[51, 1920], [1922, 2199]], + "316876": [[34, 38], [40, 644]], + "316877": [[1, 164], [171, 401]], + "316879": [[1, 156]], + "316928": [[40, 188]], + "316985": [[33, 503]], + "316993": [[44, 254]], + "316994": [[1, 14]], + "316995": [[1, 623]], + "317080": [[41, 66]], + "317087": [[43, 177], [213, 222], [257, 852]], + "317089": [[1, 1003]], + "317182": [[47, 63], [65, 1424]], + "317212": [[36, 175]], + "317213": [[1, 375]], + "317279": [[43, 508]], + "317291": [[34, 824]], + "317292": [[1, 330]], + "317297": [[1, 283], [347, 760]], + "317319": [[44, 182]], + "317320": [[1, 326], [333, 411], [413, 1827]], + "317338": [[66, 107]], + "317339": [[1, 163]], + "317340": [[1, 418]], + "317382": [[58, 128]], + "317383": [[1, 58]], + "317391": [[39, 46]], + "317392": [[1, 1116], [1119, 1900]], + "317435": [[1, 1397]], + "317438": [[1, 68], [71, 309]], + "317475": [[33, 89], [105, 115]], + "317478": [[1, 23]], + "317484": [[1, 448], [467, 514], [519, 545]], + "317488": [[1, 844]], + "317527": [[41, 1487]], + "317591": [[43, 334]], + "317626": [[40, 2045]], + "317640": [[29, 829]], + "317641": [[1, 1390]], + "317648": [[45, 139]], + "317649": [[1, 621]], + "317650": [[1, 1304]], + "317661": [[35, 1256]], + "317663": [[1, 858]], + "317683": [[83, 402]], + "317696": [[38, 682]], + "318733": [[1, 33]], + "318828": [[54, 123]], + "318872": [[16, 287]], + "318874": [[1, 320]], + "318876": [[1, 161]], + "318877": [[1, 615]], + "319077": [[52, 92]], + "319337": [[48, 2240]], + "319347": [[40, 690]], + "319348": [[1, 37]], + "319349": [[1, 148]], + "319449": [[35, 559], [562, 734]], + "319450": [[1, 287], [290, 683]], + "319456": [[138, 346]], + "319459": [[1, 78]], + "319486": [[38, 103]], + "319503": [[1, 317]], + "319524": [[36, 1459]], + "319526": [[1, 282]], + "319528": [[1, 259]], + "319579": [[41, 3168]], + "319625": [[17, 206]], + "319639": [[31, 1509]], + "319656": [[51, 310]], + "319657": [[1, 167]], + "319658": [[1, 225]], + "319659": [[1, 87]], + "319678": [[36, 294]], + "319687": [[46, 90]], + "319697": [[47, 482], [490, 490]], + "319698": [[1, 312]], + "319756": [[44, 1966]], + "319840": [[41, 388]], + "319841": [[1, 167]], + "319847": [[49, 51]], + "319848": [[1, 53]], + "319849": [[1, 492]], + "319851": [[1, 4]], + "319853": [[1, 40], [47, 262]], + "319854": [[1, 225]], + "319908": [[1, 40], [43, 53]], + "319909": [[1, 7]], + "319910": [[1, 983]], + "319912": [[1, 59]], + "319913": [[1, 56]], + "319914": [[1, 32]], + "319915": [[1, 416]], + "319941": [[43, 298]], + "319942": [[1, 50]], + "319950": [[38, 205]], + "319991": [[46, 882]], + "319992": [[1, 264]], + "319993": [[1, 955]], + "320002": [[52, 192]], + "320006": [[1, 34], [36, 341]], + "320010": [[1, 330]], + "320011": [[1, 302]], + "320012": [[1, 99]], + "320023": [[17, 292]], + "320024": [[1, 410]], + "320025": [[1, 113]], + "320026": [[1, 204]], + "320038": [[43, 663]], + "320039": [[1, 30]], + "320040": [[1, 737]], + "320059": [[1, 105]], + "320060": [[1, 42]], + "320061": [[1, 49]], + "320062": [[1, 21]], + "320063": [[1, 64]], + "320064": [[1, 200]], + "320065": [[1, 920]], + "320673": [[35, 901]], + "320674": [[1, 599]], + "320688": [[49, 531]], + "320712": [[39, 242]], + "320757": [[51, 382]], + "320804": [[46, 1274]], + "320807": [[1, 7]], + "320809": [[1, 716]], + "320821": [[41, 221]], + "320822": [[1, 523]], + "320823": [[1, 360]], + "320824": [[1, 1051]], + "320838": [[93, 357]], + "320840": [[1, 471]], + "320841": [[1, 205]], + "320853": [[41, 369]], + "320854": [[1, 125]], + "320855": [[1, 565]], + "320856": [[1, 159]], + "320857": [[1, 272]], + "320858": [[1, 230]], + "320859": [[1, 40]], + "320887": [[49, 321]], + "320888": [[1, 26]], + "320916": [[2, 25]], + "320917": [[1, 1926]], + "320920": [[1, 178]], + "320933": [[40, 214]], + "320934": [[1, 831]], + "320936": [[1, 407]], + "320941": [[1, 93]], + "320980": [[44, 142]], + "320995": [[26, 214]], + "320996": [[1, 380]], + "321004": [[39, 188]], + "321005": [[1, 61]], + "321006": [[1, 162]], + "321007": [[1, 831]], + "321009": [[1, 85]], + "321010": [[1, 342]], + "321011": [[1, 213]], + "321012": [[1, 35], [190, 201]], + "321051": [[58, 1179]], + "321055": [[1, 302], [304, 326], [328, 340], [368, 759]], + "321067": [[39, 225], [232, 639]], + "321068": [[1, 715]], + "321069": [[1, 313]], + "321119": [[45, 214]], + "321121": [[1, 47]], + "321122": [[1, 395]], + "321124": [[1, 819]], + "321126": [[1, 493]], + "321134": [[33, 70]], + "321138": [[1, 741]], + "321140": [[1, 798]], + "321149": [ + [35, 86], + [88, 1424], + [1426, 1475], + [1478, 1553], + [1558, 1575], + [1578, 1588], + [1591, 1743] + ], + "321165": [[1, 8]], + "321166": [[1, 10]], + "321167": [ + [1, 141], + [143, 143], + [145, 510], + [512, 552], + [554, 691], + [693, 923] + ], + "321177": [ + [38, 74], + [77, 214], + [216, 232], + [234, 247], + [249, 321], + [323, 365], + [367, 455] + ], + "321178": [[5, 78]], + "321218": [[49, 962]], + "321219": [[1, 934]], + "321221": [[1, 40]], + "321230": [[41, 124]], + "321231": [[1, 59]], + "321232": [[1, 30]], + "321233": [[1, 727]], + "321262": [[1, 4]], + "321283": [[48, 357]], + "321294": [[1, 62]], + "321295": [ + [1, 307], + [309, 316], + [318, 384], + [390, 394], + [396, 604], + [606, 616], + [619, 646], + [649, 690], + [693, 754] + ], + "321296": [[1, 24], [34, 41], [44, 67]], + "321305": [[20, 2600], [2605, 2651]], + "321311": [[1, 10]], + "321312": [[1, 768]], + "321313": [[1, 408]], + "321393": [[1, 127], [134, 148]], + "321396": [[1, 1475]], + "321397": [[1, 365]], + "321414": [[31, 1283]], + "321415": [[1, 804]], + "321431": [[30, 189]], + "321432": [[1, 47]], + "321433": [[1, 125]], + "321434": [[1, 642]], + "321436": [[1, 710]], + "321457": [[43, 451], [453, 1888]], + "321461": [[1, 149]], + "321475": [[50, 518], [526, 2084]], + "321710": [[1, 57]], + "321712": [[1, 2], [16, 54], [57, 115], [117, 263]], + "321730": [[2, 257], [259, 291]], + "321732": [ + [1, 127], + [129, 181], + [185, 189], + [192, 245], + [248, 252], + [254, 373], + [375, 381], + [386, 386], + [389, 392], + [395, 424], + [426, 432], + [434, 448], + [450, 452], + [454, 459], + [467, 586], + [589, 680], + [682, 686], + [689, 903], + [905, 973], + [975, 1448] + ], + "321735": [[1, 146]], + "321755": [[33, 361], [363, 470], [472, 473], [475, 487], [489, 729]], + "321758": [ + [1, 47], + [49, 75], + [77, 121], + [128, 130], + [146, 148], + [151, 155], + [161, 165], + [168, 189] + ], + "321760": [ + [1, 171], + [175, 205], + [207, 238], + [240, 258], + [260, 420], + [422, 520], + [526, 586], + [588, 593], + [598, 602], + [604, 607], + [613, 716], + [719, 721], + [727, 788], + [794, 818], + [822, 824], + [828, 830], + [834, 836], + [840, 841], + [845, 855] + ], + "321773": [[11, 14], [25, 35], [39, 52], [54, 79]], + "321774": [[1, 12], [14, 52], [54, 119]], + "321775": [[1, 12], [14, 14]], + "321776": [[1, 12], [15, 19], [30, 45]], + "321777": [[1, 81], [83, 169], [174, 176], [192, 207]], + "321778": [[8, 150]], + "321780": [ + [1, 332], + [336, 338], + [342, 346], + [351, 357], + [359, 360], + [362, 371], + [374, 383], + [392, 412], + [414, 420], + [422, 493], + [496, 499], + [502, 503], + [505, 508], + [517, 518] + ], + "321781": [ + [6, 37], + [53, 56], + [58, 66], + [69, 69], + [77, 180], + [186, 209], + [212, 265], + [269, 274], + [276, 290], + [293, 312], + [316, 410], + [412, 427] + ], + "321813": [[32, 352]], + "321815": [[1, 23]], + "321817": [[1, 536]], + "321818": [[1, 690]], + "321820": [[1, 214]], + "321831": [[25, 781]], + "321832": [[1, 389], [403, 510]], + "321833": [[1, 407]], + "321834": [[1, 333]], + "321879": [ + [39, 47], + [50, 52], + [55, 68], + [71, 73], + [77, 89], + [93, 95], + [99, 111], + [114, 116], + [120, 132], + [136, 138], + [141, 154], + [157, 159], + [163, 175], + [178, 181], + [185, 197], + [200, 202], + [207, 218], + [222, 356] + ], + "321880": [[1, 41], [44, 132]], + "321887": [[54, 948]], + "321908": [[43, 472]], + "321909": [[1, 208], [210, 1654]], + "321917": [[4, 156], [164, 808]], + "321919": [[1, 6]], + "321933": [[43, 232], [235, 326]], + "321960": [[18, 47]], + "321961": [[1, 354]], + "321973": [[37, 746], [748, 968], [972, 1253]], + "321975": [[1, 866]], + "321988": [[45, 996], [1106, 1486]], + "321990": [[1, 471]], + "322013": [[14, 22]], + "322014": [[1, 17]], + "322022": [[42, 185], [201, 1805]], + "322040": [[32, 70]], + "322057": [[38, 58]], + "322068": [[51, 724]], + "322079": [[39, 200], [216, 393], [409, 428]], + "322106": [[48, 871]], + "322113": [[48, 159]], + "322118": [[1, 516], [530, 874]], + "322179": [[43, 820], [823, 1783]], + "322201": [[39, 266]], + "322204": [[1, 280], [282, 301], [303, 331], [337, 1143]], + "322222": [[1, 526]], + "322252": [[42, 1586]], + "322317": [[48, 101]], + "322319": [[1, 163]], + "322322": [[1, 170], [267, 1205]], + "322324": [[1, 416]], + "322332": [[37, 1055]], + "322348": [[40, 1505]], + "322355": [[36, 137]], + "322356": [[1, 779]], + "322381": [[45, 577]], + "322407": [[46, 582]], + "322430": [[46, 794]], + "322431": [[1, 53], [59, 1166]], + "322480": [[60, 408]], + "322492": [[1, 1386]], + "322510": [[37, 45]], + "322599": [[43, 294]], + "322602": [[1, 69], [72, 72]], + "322603": [[1, 10]], + "322605": [[1, 280]], + "322617": [[1, 601]], + "322625": [[41, 484], [492, 1167]], + "322633": [[1, 249]], + "323414": [[1, 46]], + "323423": [[1, 136]], + "323470": [[38, 172], [176, 218], [223, 266]], + "323471": [[1, 238]], + "323472": [[1, 64]], + "323473": [[1, 227]], + "323474": [[1, 355]], + "323475": [[1, 77]], + "323487": [[42, 177], [184, 498]], + "323488": [[1, 514], [555, 734], [738, 793]], + "323492": [[1, 33]], + "323493": [[1, 144]], + "323495": [[1, 187]], + "323524": [[25, 561]], + "323525": [[1, 91], [97, 1126]], + "323526": [[1, 248], [253, 466]], + "323693": [[38, 151]], + "323696": [[1, 257]], + "323702": [[1, 808]], + "323725": [[18, 346]], + "323726": [[1, 60]], + "323727": [[1, 83], [88, 677], [682, 813], [819, 822], [826, 987]], + "323755": [ + [27, 815], + [818, 823], + [826, 826], + [828, 830], + [833, 861], + [864, 964] + ], + "323775": [[38, 81], [84, 171]], + "323778": [[1, 934]], + "323790": [[45, 948]], + "323794": [[1, 68]], + "323841": [[46, 510]], + "323857": [[1, 357]], + "323940": [[49, 1567]], + "323954": [[1, 77]], + "323976": [[31, 85]], + "323978": [[1, 73]], + "323980": [[1, 202]], + "323983": [[1, 188]], + "323997": [[1, 498]], + "324021": [[44, 819]], + "324022": [[1, 554]], + "324077": [[54, 710], [712, 753]], + "324201": [[20, 834], [837, 1385]], + "324202": [[1, 240]], + "324205": [[1, 163]], + "324206": [[1, 149]], + "324207": [[1, 34]], + "324209": [[1, 142]], + "324237": [[33, 236]], + "324245": [[23, 1681]], + "324293": [[39, 1440], [1442, 2176], [2178, 2342]], + "324315": [[1, 200], [203, 204]], + "324318": [[1, 332]], + "324420": [[1, 625]], + "324729": [[1, 193]], + "324747": [[63, 1139]], + "324764": [[1, 150]], + "324765": [[1, 481]], + "324769": [[1, 328]], + "324772": [[1, 165]], + "324785": [[77, 664]], + "324791": [[1, 1217]], + "324835": [[40, 230], [302, 369]], + "324840": [[1, 96]], + "324841": [[1, 1347]], + "324846": [[1, 151], [154, 517]], + "324878": [[62, 111], [113, 175], [180, 1800]], + "324897": [[30, 170]], + "324970": [[1, 425], [428, 598], [606, 632], [634, 1529], [1532, 2195]], + "324980": [[39, 917], [919, 954], [956, 968], [1005, 1042], [1044, 2340]], + "324997": [[29, 150]], + "324998": [[1, 368]], + "324999": [[1, 14]], + "325000": [[1, 371]], + "325001": [[1, 105], [108, 171], [173, 595]], + "325022": [[45, 1594]], + "325057": [[42, 383]], + "325097": [[40, 96]], + "325098": [[1, 8]], + "325099": [[1, 394]], + "325100": [[1, 254]], + "325101": [[1, 462], [464, 485]], + "325110": [[1, 21]], + "325117": [[1, 533]], + "325159": [[48, 266]], + "325168": [[1, 21]], + "325169": [[1, 23]], + "325170": [[1, 692], [694, 1205]], + "325172": [[1, 267], [269, 485]] +} diff --git a/post_proc.py b/post_proc.py index c738598..e4ee4fa 100755 --- a/post_proc.py +++ b/post_proc.py @@ -44,17 +44,23 @@ if testfilelist[0].find("UL18") != -1 or testfilelist[0].find("UL2018") != -1: # 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" if testfilelist[0].find("UL17") != -1 or testfilelist[0].find("UL2017") != -1: year = 2017 cfgFile = 'Input_2017.yml' + jsonFileName="golden_Json/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSON.txt" + H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile, isMC, isFSR) -print("outputbranchsel = ",outputbranchsel) -print("isMC = ",isMC) -print("isFSR = ",isFSR) +print("Input json file: {}".format(jsonFileName)) +print("Input cfg file: {}".format(cfgFile)) +print("output branch: {}".format(outputbranchsel)) +print("isMC: {}".format(isMC)) +print("isFSR: {}".format(isFSR)) + #p=PostProcessor(".",[testfile],"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt") -p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel=outputbranchsel) +p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel=outputbranchsel) p.run() print "DONE" From 9d778d9be7b40007204ab92fdb5775c131140606 Mon Sep 17 00:00:00 2001 From: Ram Krishna Sharma Date: Tue, 26 Sep 2023 07:39:24 +0200 Subject: [PATCH 10/10] - Few files changed "nanoAOD_vvVBS" -> "nanoAOD_skim" - Added golden josn file (last commit there was a bug) - Added JME corrector - Added PU SF module - Added bTag SF module (For now its not working) --- JetSFMaker.py | 20 ++++++++++---------- README.md | 2 +- crab/crab_cfg.py | 2 +- crab/crab_script.py | 2 +- crab/crab_scriptMC.py | 2 +- data/JetPUID_cfg.py | 10 +++++----- post_proc.py | 23 +++++++++++++++++------ 7 files changed, 36 insertions(+), 25 deletions(-) diff --git a/JetSFMaker.py b/JetSFMaker.py index a6400ff..5003c05 100644 --- a/JetSFMaker.py +++ b/JetSFMaker.py @@ -4,7 +4,7 @@ import ROOT from PhysicsTools.NanoAODTools.postprocessing.framework.eventloop import Module -from PhysicsTools.NanoAODTools.postprocessing.framework.datamodel import Collection +from PhysicsTools.NanoAODTools.postprocessing.framework.datamodel import Collection class JetSFMaker(Module): #---------------------------------------------------------------------------- @@ -13,11 +13,11 @@ class JetSFMaker(Module): #weight. Same for up/down variations (weights). #---------------------------------------------------------------------------- - def __init__(self, cmssw, puid_sf_config='PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS/data/JetPUID_cfg.py'): + def __init__(self, cmssw, puid_sf_config='PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/data/JetPUID_cfg.py'): cmssw_base = os.getenv('CMSSW_BASE') with open(cmssw_base + '/src/' + puid_sf_config) as src: exec(src) - + puid_sf_cfg = jet_puid_sf[cmssw] source = ROOT.TFile.Open(cmssw_base + '/src/' + puid_sf_cfg['source']) @@ -77,7 +77,7 @@ def analyze(self, event): up = 1 + abs(sf-1) down = 1 - abs(sf-1) puid_upjw = up - puid_downjw = down + puid_downjw = down else: puid_jw = (1.-sf*eff)/(1.-eff) if (jtype == 'real') or (jtype == 'pu' and abs(jet.eta)>=2.5): @@ -87,7 +87,7 @@ def analyze(self, event): up = 1 + abs(sf-1) down = 1 - abs(sf-1) puid_upjw = (1.-up*eff)/(1.-eff) - puid_downjw = (1.-down*eff)/(1.-eff) + puid_downjw = (1.-down*eff)/(1.-eff) #store per jet weights and variations sfs[wp].append(puid_jw) @@ -95,7 +95,7 @@ def analyze(self, event): sfs_down[wp].append(puid_downjw) for wp in ['loose', 'medium', 'tight']: - self.out.fillBranch('Jet_PUIDSF_%s' % wp, sfs[wp]) + self.out.fillBranch('Jet_PUIDSF_%s' % wp, sfs[wp]) self.out.fillBranch('Jet_PUIDSF_%s_up' % wp, sfs_up[wp]) self.out.fillBranch('Jet_PUIDSF_%s_down' % wp, sfs_down[wp]) @@ -103,12 +103,12 @@ def analyze(self, event): def get_sf_and_eff(self, jtype, wp, jet): sf_map = self.sf_maps['%s_%s' % (jtype, wp)] - sf_uncty_map = self.sf_uncty_maps['%s_%s_uncty' % (jtype, wp)] + sf_uncty_map = self.sf_uncty_maps['%s_%s_uncty' % (jtype, wp)] eff_map = self.eff_maps['%s_mc_%s' % (jtype, wp)] - if jet.pt < 30. or jet.pt > 50. or abs(jet.eta) > 4.7: - #do not apply SF outside CleanJet region and where PUID was not applied - return 1.,0.,0.,0. + if jet.pt < 30. or jet.pt > 50. or abs(jet.eta) > 4.7: + #do not apply SF outside CleanJet region and where PUID was not applied + return 1.,0.,0.,0. ix = min(max(1, sf_map.GetXaxis().FindFixBin(jet.pt)), sf_map.GetNbinsX()) iy = min(max(1, sf_map.GetYaxis().FindFixBin(jet.eta)), sf_map.GetNbinsY()) diff --git a/README.md b/README.md index 480b5ec..b360f67 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ nanoAOD skiming code for H->ZZ->2l2Q studies. 1. In the file [condor_setup_lxplus.py](condor_setup_lxplus.py), specify the correct 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 - cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS + 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 # Set proxy before submitting the condor jobs. diff --git a/crab/crab_cfg.py b/crab/crab_cfg.py index 4940e53..c23e3ef 100644 --- a/crab/crab_cfg.py +++ b/crab/crab_cfg.py @@ -5,7 +5,7 @@ config.section_("General") config.General.requestName = 'nanoAOD_testing_2' -config.General.workArea = '/uscms/home/rasharma/nobackup/nanoAOD/CMSSW_10_2_22/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS/crab/crab_projects_sendPythonFolderFalse' +config.General.workArea = '/uscms/home/rasharma/nobackup/nanoAOD/CMSSW_10_2_22/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/crab/crab_projects_sendPythonFolderFalse' config.General.transferLogs=True config.General.transferOutputs = True config.section_("JobType") diff --git a/crab/crab_script.py b/crab/crab_script.py index ae74309..6136e5e 100644 --- a/crab/crab_script.py +++ b/crab/crab_script.py @@ -4,7 +4,7 @@ #this takes care of converting the input files from CRAB from PhysicsTools.NanoAODTools.postprocessing.framework.crabhelper import inputFiles,runsAndLumis -from PhysicsTools.NanoAODTools.postprocessing.analysis.nanoAOD_vvVBS.wvAnalysisModule import wvAnalysisModule +from PhysicsTools.NanoAODTools.postprocessing.analysis.nanoAOD_skim.wvAnalysisModule import wvAnalysisModule from PhysicsTools.NanoAODTools.postprocessing.modules.jme.jetmetHelperRun2 import * diff --git a/crab/crab_scriptMC.py b/crab/crab_scriptMC.py index c594ba2..4cb7b72 100644 --- a/crab/crab_scriptMC.py +++ b/crab/crab_scriptMC.py @@ -4,7 +4,7 @@ #this takes care of converting the input files from CRAB from PhysicsTools.NanoAODTools.postprocessing.framework.crabhelper import inputFiles,runsAndLumis -from PhysicsTools.NanoAODTools.postprocessing.analysis.nanoAOD_vvVBS.wvAnalysisModule import wvAnalysisModule +from PhysicsTools.NanoAODTools.postprocessing.analysis.nanoAOD_skim.wvAnalysisModule import wvAnalysisModule from PhysicsTools.NanoAODTools.postprocessing.modules.jme.jetmetHelperRun2 import * diff --git a/data/JetPUID_cfg.py b/data/JetPUID_cfg.py index 07cfbdf..69c6190 100644 --- a/data/JetPUID_cfg.py +++ b/data/JetPUID_cfg.py @@ -6,12 +6,12 @@ # /afs/cern.ch/work/l/lathomas/public/PileUpIDScaleFactor_PreliminaryRun2/ # see twiki https://twiki.cern.ch/twiki/bin/viewauth/CMS/PileupJetID # following Laurent's updated talk in -# https://indico.cern.ch/event/860457/ +# https://indico.cern.ch/event/860457/ _jet_puid_sf = { - '2016': {'source': 'PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS/data/PUID_80XTraining_EffSFandUncties.root'}, - '2017': {'source': 'PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS/data/PUID_80XTraining_EffSFandUncties.root'}, - '2018': {'source': 'PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_vvVBS/data/PUID_80XTraining_EffSFandUncties.root'} + '2016': {'source': 'PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/data/PUID_80XTraining_EffSFandUncties.root'}, + '2017': {'source': 'PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/data/PUID_80XTraining_EffSFandUncties.root'}, + '2018': {'source': 'PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/data/PUID_80XTraining_EffSFandUncties.root'} } for jet, jetTag in [('real','eff'), ('pu','mistag')]: @@ -20,7 +20,7 @@ jcfg['%s_%s' % (jet, wp)] = 'h2_%s_sf%s_%s' % (jetTag, year, iwp) jcfg['%s_mc_%s' % (jet, wp)] = 'h2_%s_mc%s_%s' % (jetTag, year, iwp) jcfg['%s_%s_uncty' % (jet, wp)] = 'h2_%s_sf%s_%s_Systuncty' % (jetTag, year, iwp) - + jet_puid_sf = {} jet_puid_sf['2016'] = _jet_puid_sf['2016'] diff --git a/post_proc.py b/post_proc.py index e4ee4fa..f0b8483 100755 --- a/post_proc.py +++ b/post_proc.py @@ -6,6 +6,7 @@ from H4LCppModule import * from PhysicsTools.NanoAODTools.postprocessing.modules.jme.jetmetHelperRun2 import * from PhysicsTools.NanoAODTools.postprocessing.modules.btv.btagSFProducer import * +from JetSFMaker import * ifRunningOnCondor = False @@ -32,35 +33,45 @@ isMC = True isFSR = False - -outputbranchsel = "keep_and_drop.txt" +jsonFileName = "" # Keep DownloadFileToLocalThenRun=True this should reduce the file read error from eos. DownloadFileToLocalThenRun=True if testfilelist[0].find("/data/") != -1: isMC = False - outputbranchsel = "keep_and_drop_data.txt" if testfilelist[0].find("UL18") != -1 or testfilelist[0].find("UL2018") != -1: # 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" if testfilelist[0].find("UL17") != -1 or testfilelist[0].find("UL2017") != -1: year = 2017 cfgFile = 'Input_2017.yml' jsonFileName="golden_Json/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSON.txt" + sfFileName="DeepCSV_94XSF_V5_B_F.csv" +if testfilelist[0].find("UL16") != -1 or testfilelist[0].find("UL2016") != -1: + sfFileName="DeepCSV_2016LegacySF_V1.csv" H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile, isMC, isFSR) print("Input json file: {}".format(jsonFileName)) print("Input cfg file: {}".format(cfgFile)) -print("output branch: {}".format(outputbranchsel)) print("isMC: {}".format(isMC)) print("isFSR: {}".format(isFSR)) -#p=PostProcessor(".",[testfile],"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt") -p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel=outputbranchsel) +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) + puidSF = lambda: JetSFMaker("%s" % year) + # p=PostProcessor(".",testfilelist, None, None,[H4LCppModule(), jetmetCorrector(), fatJetCorrector(), btagSF(), puidSF()], provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt") + p=PostProcessor(".",testfilelist, None, None,[H4LCppModule(), jetmetCorrector(), fatJetCorrector(), puidSF()], provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.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") + p=PostProcessor(".",testfilelist, None, None,[H4LCppModule(), jetmetCorrector(), fatJetCorrector()], provenance=False, fwkJobReport=False,haddFileName="nano_M125_cpp.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt") p.run() print "DONE"