diff --git a/.gitignore b/.gitignore
index f8b45c1..a17efcb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
# Ignore root files
+crab_project*/
*.bkup
*.patch
summary.dat
diff --git a/ExampleInputFileList.txt b/ExampleInputFileList.txt
index 2620325..910059d 100644
--- a/ExampleInputFileList.txt
+++ b/ExampleInputFileList.txt
@@ -1 +1,6 @@
-/store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root
+/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2520000/dcae7632-2ea5-4832-80f0-de7d45837a7f.root
+/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/25212339-d2db-48c4-936d-fc47e9de45e9.root
+/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/7a86daa3-36d3-42a4-8962-dc831b8608e0.root
+/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/c7c62ee7-13a9-4de1-962d-64503a6fef05.root
+/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/a2a64a49-3404-49db-bf42-cb0ceb5218e2.root
+/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/b46903af-5d85-479e-b776-0803db6c3e2c.root
\ No newline at end of file
diff --git a/FrameworkJobReport.xml b/FrameworkJobReport.xml
new file mode 100644
index 0000000..5fd474c
--- /dev/null
+++ b/FrameworkJobReport.xml
@@ -0,0 +1 @@
+/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2520000/dcae7632-2ea5-4832-80f0-de7d45837a7f.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/25212339-d2db-48c4-936d-fc47e9de45e9.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/7a86daa3-36d3-42a4-8962-dc831b8608e0.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2530000/c7c62ee7-13a9-4de1-962d-64503a6fef05.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/a2a64a49-3404-49db-bf42-cb0ceb5218e2.rootprimaryFilessourcePoolSource100/store/mc/Run3Summer22NanoAODv12/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/NANOAODSIM/130X_mcRun3_2022_realistic_v5-v2/2540000/b46903af-5d85-479e-b776-0803db6c3e2c.rootprimaryFilessourcePoolSource100skimmed_nano.rootNANOPoolOutputModuledc90308e392b2fa1e0eff46acbfa24bc1
\ No newline at end of file
diff --git a/H4LCppModule.py b/H4LCppModule.py
index b8f3a58..fe83046 100644
--- a/H4LCppModule.py
+++ b/H4LCppModule.py
@@ -14,8 +14,19 @@ def __init__(self,year,cfgFile,isMC,isFSR):
ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libjhugenmela.so" % base)
ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libmcfm_707.so" % base)
ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libcollier.so" % base)
+ if "/GenAnalysis_cc.so" not in ROOT.gSystem.GetLibraries():
+ print("Load GenAnalysis C++ module")
+ base = "$CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim"
+ if base:
+ ROOT.gROOT.ProcessLine(
+ ".L %s/src/GenAnalysis.cc+O" % base)
+ else:
+ base = "$CMSSW_BASE//src/PhysicsTools/NanoAODTools"
+ ROOT.gSystem.Load("libPhysicsToolsNanoAODTools.so")
+ ROOT.gROOT.ProcessLine(
+ ".L %s/interface/GenAnalysis.h" % base)
if "/H4LTools_cc.so" not in ROOT.gSystem.GetLibraries():
- print("Load C++ module")
+ print("Load H4LTools C++ module")
base = "$CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim"
if base:
ROOT.gROOT.ProcessLine(
@@ -26,9 +37,11 @@ def __init__(self,year,cfgFile,isMC,isFSR):
ROOT.gROOT.ProcessLine(
".L %s/interface/H4LTools.h" % base)
self.year = year
+ self.isMC = isMC
+ self.genworker = ROOT.GenAnalysis()
with open(cfgFile, 'r') as ymlfile:
cfg = yaml.load(ymlfile)
- self.worker = ROOT.H4LTools(self.year)
+ self.worker = ROOT.H4LTools(self.year,self.isMC)
self.worker.InitializeElecut(cfg['Electron']['pTcut'],cfg['Electron']['Etacut'],cfg['Electron']['Sip3dcut'],cfg['Electron']['Loosedxycut'],cfg['Electron']['Loosedzcut'],
cfg['Electron']['Isocut'],cfg['Electron']['BDTWP']['LowEta']['LowPT'],cfg['Electron']['BDTWP']['MedEta']['LowPT'],cfg['Electron']['BDTWP']['HighEta']['LowPT'],
cfg['Electron']['BDTWP']['LowEta']['HighPT'],cfg['Electron']['BDTWP']['MedEta']['HighPT'],cfg['Electron']['BDTWP']['HighEta']['HighPT'])
@@ -37,11 +50,17 @@ def __init__(self,year,cfgFile,isMC,isFSR):
self.worker.InitializeFsrPhotonCut(cfg['FsrPhoton']['pTcut'],cfg['FsrPhoton']['Etacut'],cfg['FsrPhoton']['Isocut'],cfg['FsrPhoton']['dRlcut'],cfg['FsrPhoton']['dRlOverPtcut'])
self.worker.InitializeJetcut(cfg['Jet']['pTcut'],cfg['Jet']['Etacut'])
self.worker.InitializeEvtCut(cfg['MZ1cut'],cfg['MZZcut'],cfg['Higgscut']['down'],cfg['Higgscut']['up'],cfg['Zmass'],cfg['MZcut']['down'],cfg['MZcut']['up'])
-
+ self.PUweightfile = cfg["outputdataNPV"]
+ self.PUweighthisto = cfg["PUweightHistoName"]
+ PUinput_file = ROOT.TFile.Open(self.PUweightfile)
+ PUinput_hist = PUinput_file.Get(self.PUweighthisto)
+ self.PUweight_list = []
+ for i in range(1, PUinput_hist.GetNbinsX() + 1):
+ self.PUweight_list.append(PUinput_hist.GetBinContent(i))
+ PUinput_file.Close()
self.passtrigEvts = 0
self.passZZEvts = 0
self.cfgFile = cfgFile
- self.isMC = isMC
self.worker.isFSR = isFSR
pass
def beginJob(self):
@@ -68,13 +87,33 @@ def endJob(self):
print("PassmZ1mZ2Cut_2e2mu: "+str(self.worker.cutZZ2e2mu)+" Events")
print("Passm4l_105_160_Cut_2e2mu: "+str(self.worker.cutm4l2e2mu)+" Events")
print("PassZZSelection: "+str(self.passZZEvts)+" Events")
+ if self.isMC:
+ print("PassGEN4eCut: "+str(self.genworker.nGEN4e)+" Events")
+ print("PassGEN4eZ1Cut: "+str(self.genworker.nGEN4epassZ1)+" Events")
+ print("PassGEN4efidCut: "+str(self.genworker.nGEN4epassFid)+" Events")
+ print("PassGEN2e2muCut: "+str(self.genworker.nGEN2e2mu)+" Events")
+ print("PassGEN2e2muZ1Cut: "+str(self.genworker.nGEN2e2mupassZ1)+" Events")
+ print("PassGEN2e2mufidCut: "+str(self.genworker.nGEN2e2mupassFid)+" Events")
+ print("PassGEN4muCut: "+str(self.genworker.nGEN4mu)+" Events")
+ print("PassGEN4muZ1Cut: "+str(self.genworker.nGEN4mupassZ1)+" Events")
+ print("PassGEN4mufidCut: "+str(self.genworker.nGEN4mupassFid)+" Events")
pass
def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree):
self.initReaders(inputTree) # initReaders must be called in beginFile
self.out = wrappedOutputTree
self.out.branch("mass4l", "F")
+ self.out.branch("GENmass4l", "F")
+ self.out.branch("mass4e", "F")
+ self.out.branch("mass4mu", "F")
+ self.out.branch("mass2e2mu", "F")
self.out.branch("pT4l", "F")
+ self.out.branch("GENpT4l", "F")
+ self.out.branch("rapidity4l", "F")
+ self.out.branch("njets_pt30_eta4p7", "I")
+ self.out.branch("finalState", "I")
+ self.out.branch("GENnjets_pt30_eta4p7", "I")
+ self.out.branch("GENrapidity4l", "F")
self.out.branch("eta4l", "F")
self.out.branch("phi4l", "F")
self.out.branch("massZ1", "F")
@@ -112,12 +151,32 @@ def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree):
self.out.branch("pTj1", "F")
self.out.branch("etaj1", "F")
self.out.branch("phij1", "F")
- self.out.branch("mj2", "F")
self.out.branch("pTj2", "F")
self.out.branch("etaj2", "F")
self.out.branch("phij2", "F")
-
-
+ self.out.branch("mj2", "F")
+ self.out.branch("EvtNum", "I")
+ self.out.branch("Weight", "F")
+ self.out.branch("pileupWeight", "F")
+ self.out.branch("dataMCWeight_new", "F")
+ self.out.branch("prefiringWeight", "F")
+ self.out.branch("passedTrig", "O")
+ self.out.branch("passedFullSelection", "O")
+ self.out.branch("passedZ4lSelection", "O")
+ self.out.branch("passedZ4lZ1LSelection", "O")
+ self.out.branch("passedZ4lZXCRSelection", "O")
+ self.out.branch("passedZXCRSelection", "O")
+ self.out.branch("passedFiducialSelection", "O")
+ GENHlepNum = 4
+ GENZNum = 2
+ self.out.branch("GENlep_MomId", "I", lenVar = "nGenPart")
+ self.out.branch("GENlep_MomMomId", "I", lenVar = "nGenPart")
+ self.out.branch("GENZ_MomId", "I", lenVar = "nVECZ")
+ self.out.branch("GENZ_DaughtersId", "I", lenVar = "GENZNum")
+ self.out.branch("GENlep_Hindex", "I", lenVar = "GENHlepNum")
+ self.out.branch("lep_Hindex", "I", lenVar = "GENHlepNum")
+ self.out.branch("GENlep_id", "I", lenVar = "nGENLeptons")
+ self.out.branch("lep_genindex", "I", lenVar = "Lepointer")
self.out.branch("Electron_Fsr_pt", "F", lenVar = "nElectron_Fsr")
self.out.branch("Electron_Fsr_eta", "F", lenVar = "nElectron_Fsr")
self.out.branch("Electron_Fsr_phi", "F", lenVar = "nElectron_Fsr")
@@ -152,8 +211,12 @@ def analyze(self, event):
self.worker.SetObjectNum(event.nElectron,event.nMuon,event.nJet,event.nFsrPhoton)
if isMC:
self.worker.SetObjectNumGen(event.nGenPart)
+ self.genworker.Initialize()
+ self.genworker.SetObjectNumGen(event.nGenPart, event.nGenJet)
keepIt = False
-
+ Lepointer = 0
+ EvtNum = 0
+ Weight = 1
passedTrig=False
passedFullSelection=False
passedZ4lSelection=False
@@ -164,37 +227,82 @@ def analyze(self, event):
passedZXCRSelection=False
passedFiducialSelection=False
nZXCRFailedLeptons=0
+ prefiringWeight = 1
+ dataMCWeight_new = 1
+ pileupWeight = 1
+ mass4e=0
+ mass2e2mu=0
+ mass4mu=0
+ finalState=-1
+ GENmass4l = -99
+ GENpT4l = -99
+ nVECZ = 2
+ GENrapidity4l = -99
+ GENnjets_pt30_eta4p7 = -1
+ nGENLeptons = 0
+ nGenPart = 0
+ pTZ1 = -99
+ etaZ1 = -99
+ phiZ1 = -99
+ massZ1 = 0
+ pTZ2 = -99
+ etaZ2 = -99
+ phiZ2 = -99
+ massZ2 = -99
+ pT4l = -99
+ eta4l = -99
+ phi4l = -99
+ mass4l = 0
+ rapidity4l = -99
passedTrig = PassTrig(event, self.cfgFile)
if (passedTrig==True):
self.passtrigEvts += 1
else:
return keepIt
+ if(isMC):
+ pileupWeight = self.PUweight_list[event.Pileup_nPU]
electrons = Collection(event, "Electron")
muons = Collection(event, "Muon")
fsrPhotons = Collection(event, "FsrPhoton")
jets = Collection(event, "Jet")
if isMC:
+ nGenPart = event.nGenPart
genparts = Collection(event, "GenPart")
+ genjets = Collection(event, "GenJet")
+ for xj in genjets:
+ self.genworker.SetGenJets(xj.pt,xj.eta,xj.phi,xj.mass)
for xg in genparts:
self.worker.SetGenParts(xg.pt)
+ self.genworker.SetGenParts(xg.pt,xg.eta,xg.phi,xg.mass,xg.pdgId,xg.status,xg.statusFlags,xg.genPartIdxMother)
for xm in muons:
self.worker.SetMuonsGen(xm.genPartIdx)
+ for xe in electrons:
+ self.worker.SetElectronsGen(xe.genPartIdx)
for xe in electrons:
self.worker.SetElectrons(xe.pt, xe.eta, xe.phi, xe.mass, xe.dxy,
- xe.dz, xe.sip3d, xe.mvaFall17V2Iso, xe.pdgId, xe.pfRelIso03_all)
+ xe.dz, xe.sip3d, xe.mvaHZZIso, xe.pdgId, xe.pfRelIso03_all)
for xm in muons:
self.worker.SetMuons(xm.corrected_pt, xm.eta, xm.phi, xm.mass, xm.isGlobal, xm.isTracker,
xm.dxy, xm.dz, xm.sip3d, xm.ptErr, xm.nTrackerLayers, xm.isPFcand,
xm.pdgId, xm.charge, xm.pfRelIso03_all)
for xf in fsrPhotons:
- self.worker.SetFsrPhotons(xf.dROverEt2,xf.eta,xf.phi,xf.pt,xf.relIso03)
+ self.worker.SetFsrPhotons(xf.dROverEt2,xf.eta,xf.phi,xf.pt,xf.relIso03,xf.electronIdx,xf.muonIdx)
for xj in jets:
- self.worker.SetJets(xj.pt,xj.eta,xj.phi,xj.mass,xj.jetId, xj.btagCSVV2, xj.puId)
-
+ self.worker.SetJets(xj.pt,xj.eta,xj.phi,xj.mass,xj.jetId, 0.8, 7)
+ self.worker.BatchFsrRecovery_Run3()
+
self.worker.LeptonSelection()
if ((self.worker.nTightEle<2)&(self.worker.nTightMu<2)):
pass
-
+ if isMC:
+ self.genworker.SetGenVariables()
+ GENmass4l = self.genworker.GENmass4l
+ GENpT4l = self.genworker.GENpT4l
+ GENrapidity4l = self.genworker.GENrapidity4l
+ GENnjets_pt30_eta4p7 = self.genworker.GENnjets_pt30_eta4p7
+ nGENLeptons = self.genworker.nGENLeptons
+
+ passedFiducialSelection = self.genworker.passedFiducialSelection
Electron_Fsr_pt_vec = self.worker.ElectronFsrPt()
Electron_Fsr_eta_vec = self.worker.ElectronFsrEta()
@@ -202,14 +310,14 @@ def analyze(self, event):
Muon_Fsr_pt_vec = self.worker.MuonFsrPt()
Muon_Fsr_eta_vec = self.worker.MuonFsrEta()
Muon_Fsr_phi_vec = self.worker.MuonFsrPhi()
-
-
+
Electron_Fsr_pt = []
Electron_Fsr_eta = []
Electron_Fsr_phi = []
Muon_Fsr_pt = []
Muon_Fsr_eta = []
Muon_Fsr_phi = []
+
if len(Electron_Fsr_pt_vec)>0:
for i in range(len(Electron_Fsr_pt_vec)):
Electron_Fsr_pt.append(Electron_Fsr_pt_vec[i])
@@ -220,128 +328,215 @@ def analyze(self, event):
Muon_Fsr_pt.append(Muon_Fsr_pt_vec[i])
Muon_Fsr_eta.append(Muon_Fsr_eta_vec[i])
Muon_Fsr_phi.append(Muon_Fsr_phi_vec[i])
+ GENlep_id = []
+ GENlep_Hindex = []
+ GENZ_DaughtersId = []
+ GENZ_MomId = []
+ GENlep_MomId = []
+ GENlep_MomMomId = []
+ if isMC:
+ GENlep_id_vec = self.genworker.GENlep_id
+ if len(GENlep_id_vec)>0:
+ for i in range(len(GENlep_id_vec)):
+ GENlep_id.append(GENlep_id_vec[i])
+ GENlep_Hindex_vec = self.genworker.GENlep_Hindex
+ if len(GENlep_Hindex_vec)>0:
+ for i in range(len(GENlep_Hindex_vec)):
+ GENlep_Hindex.append(GENlep_Hindex_vec[i])
+ GENZ_DaughtersId_vec = self.genworker.GENZ_DaughtersId
+ if len(GENZ_DaughtersId_vec)>0:
+ for i in range(len(GENZ_DaughtersId_vec)):
+ GENZ_DaughtersId.append(GENZ_DaughtersId_vec[i])
+ nVECZ = self.genworker.nVECZ
+ GENZ_MomId_vec = self.genworker.GENZ_MomId
+ if len(GENZ_MomId_vec)>0:
+ for i in range(len(GENZ_MomId_vec)):
+ GENZ_MomId.append(GENZ_MomId_vec[i])
+ GENlep_MomId_vec = self.genworker.GENlep_MomId
+ if len(GENlep_MomId_vec)>0:
+ for i in range(len(GENlep_MomId_vec)):
+ GENlep_MomId.append(GENlep_MomId_vec[i])
+ GENlep_MomMomId_vec = self.genworker.GENlep_MomMomId
+ if len(GENlep_MomMomId_vec)>0:
+ for i in range(len(GENlep_MomMomId_vec)):
+ GENlep_MomMomId.append(GENlep_MomMomId_vec[i])
foundZZCandidate = self.worker.ZZSelection()
-
+ passedFullSelection=foundZZCandidate
+ Lepointer = self.worker.Lepointer
+ lep_Hindex = []
+ lep_Hindex_vec = self.worker.lep_Hindex
+ if len(lep_Hindex_vec)>0:
+ for i in range(len(lep_Hindex_vec)):
+ lep_Hindex.append(lep_Hindex_vec[i])
+ lep_genindex = []
+ if isMC:
+ lep_genindex_vec = self.worker.lep_genindex
+ if len(lep_genindex_vec)>0:
+ for i in range(len(lep_genindex_vec)):
+ lep_genindex.append(lep_genindex_vec[i])
if (foundZZCandidate):
- keepIt = True
self.passZZEvts += 1
- pTZ1 = self.worker.Z1.Pt()
- etaZ1 = self.worker.Z1.Eta()
- phiZ1 = self.worker.Z1.Phi()
- massZ1 = self.worker.Z1.M()
- pTZ2 = self.worker.Z2.Pt()
- etaZ2 = self.worker.Z2.Eta()
- phiZ2 = self.worker.Z2.Phi()
- massZ2 = self.worker.Z2.M()
- D_CP = self.worker.D_CP
- D_0m = self.worker.D_0m
- D_0hp = self.worker.D_0hp
- D_int = self.worker.D_int
- D_L1 = self.worker.D_L1
- D_L1Zg = self.worker.D_L1Zg
-
- pTL1 = self.worker.pTL1
- etaL1 = self.worker.etaL1
- phiL1 = self.worker.phiL1
- massL1 = self.worker.massL1
- pTL2 = self.worker.pTL2
- etaL2 = self.worker.etaL2
- phiL2 = self.worker.phiL2
- massL2 = self.worker.massL2
- pTL3 = self.worker.pTL3
- etaL3 = self.worker.etaL3
- phiL3 = self.worker.phiL3
- massL3 = self.worker.massL3
- pTL4 = self.worker.pTL4
- etaL4 = self.worker.etaL4
- phiL4 = self.worker.phiL4
- massL4 = self.worker.massL4
- pTj1 = self.worker.pTj1
- etaj1 = self.worker.etaj1
- phij1 = self.worker.phij1
- mj1 = self.worker.mj1
- pTj2 = self.worker.pTj2
- etaj2 = self.worker.etaj2
- phij2 = self.worker.phij2
- mj2 = self.worker.mj2
-
- if pTL2>pTL1:
- pTL1, pTl2 = pTL2, pTL1
- etaL1, etaL2 = etaL2, etaL1
- phiL1, phiL2 = phiL2, phiL1
- massL1,massL2 = massL2, massL1
- if pTL4>pTL3:
- pTL3, pTL4 = pTL4, pTL3
- etaL3, etaL4 = etaL4, etaL3
- phiL3, phiL4 = phiL4, phiL3
- massL3, massL4 = massL4, massL3
-
-
+ if (foundZZCandidate |passedFiducialSelection ):
+ EvtNum += 1
+ keepIt = True
+ if self.worker.RecoFourMuEvent: finalState = 1
+ if self.worker.RecoFourEEvent: finalState = 2
+ if self.worker.RecoTwoETwoMuEvent: finalState = 3
+ if self.worker.RecoTwoMuTwoEEvent: finalState = 4
+ pTZ1 = self.worker.Z1.Pt()
+ etaZ1 = self.worker.Z1.Eta()
+ phiZ1 = self.worker.Z1.Phi()
+ massZ1 = self.worker.Z1.M()
+ pTZ2 = self.worker.Z2.Pt()
+ etaZ2 = self.worker.Z2.Eta()
+ phiZ2 = self.worker.Z2.Phi()
+ massZ2 = self.worker.Z2.M()
+ D_CP = self.worker.D_CP
+ D_0m = self.worker.D_0m
+ D_0hp = self.worker.D_0hp
+ D_int = self.worker.D_int
+ D_L1 = self.worker.D_L1
+ D_L1Zg = self.worker.D_L1Zg
+
+ pTL1 = self.worker.pTL1
+ etaL1 = self.worker.etaL1
+ phiL1 = self.worker.phiL1
+ massL1 = self.worker.massL1
+ pTL2 = self.worker.pTL2
+ etaL2 = self.worker.etaL2
+ phiL2 = self.worker.phiL2
+ massL2 = self.worker.massL2
+ pTL3 = self.worker.pTL3
+ etaL3 = self.worker.etaL3
+ phiL3 = self.worker.phiL3
+ massL3 = self.worker.massL3
+ pTL4 = self.worker.pTL4
+ etaL4 = self.worker.etaL4
+ phiL4 = self.worker.phiL4
+ massL4 = self.worker.massL4
+ pTj1 = self.worker.pTj1
+ etaj1 = self.worker.etaj1
+ phij1 = self.worker.phij1
+ mj1 = self.worker.mj1
+ pTj2 = self.worker.pTj2
+ etaj2 = self.worker.etaj2
+ phij2 = self.worker.phij2
+ mj2 = self.worker.mj2
+
+ if pTL2>pTL1:
+ pTL1, pTl2 = pTL2, pTL1
+ etaL1, etaL2 = etaL2, etaL1
+ phiL1, phiL2 = phiL2, phiL1
+ massL1,massL2 = massL2, massL1
+ if pTL4>pTL3:
+ pTL3, pTL4 = pTL4, pTL3
+ etaL3, etaL4 = etaL4, etaL3
+ phiL3, phiL4 = phiL4, phiL3
+ massL3, massL4 = massL4, massL3
+ if passedFullSelection:
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)
- self.out.fillBranch("phi4l",phi4l)
- self.out.fillBranch("massZ1",massZ1)
- self.out.fillBranch("pTZ1",pTZ1)
- self.out.fillBranch("etaZ1",etaZ1)
- self.out.fillBranch("phiZ1",phiZ1)
- self.out.fillBranch("massZ2",massZ2)
- self.out.fillBranch("pTZ2",pTZ2)
- self.out.fillBranch("etaZ2",etaZ2)
- self.out.fillBranch("phiZ2",phiZ2)
- self.out.fillBranch("D_CP",D_CP)
- self.out.fillBranch("D_0m",D_0m)
- self.out.fillBranch("D_0hp",D_0hp)
- self.out.fillBranch("D_int",D_int)
- self.out.fillBranch("D_L1",D_L1)
- self.out.fillBranch("D_L1Zg",D_L1Zg)
-
- self.out.fillBranch("massL1",massL1)
- self.out.fillBranch("pTL1",pTL1)
- self.out.fillBranch("etaL1",etaL1)
- self.out.fillBranch("phiL1",phiL1)
- self.out.fillBranch("massL2",massL2)
- self.out.fillBranch("pTL2",pTL2)
- self.out.fillBranch("etaL2",etaL2)
- self.out.fillBranch("phiL2",phiL2)
- self.out.fillBranch("massL3",massL3)
- self.out.fillBranch("pTL3",pTL3)
- self.out.fillBranch("etaL3",etaL3)
- self.out.fillBranch("phiL3",phiL3)
- self.out.fillBranch("massL4",massL4)
- self.out.fillBranch("pTL4",pTL4)
- self.out.fillBranch("etaL4",etaL4)
- self.out.fillBranch("phiL4",phiL4)
-
- self.out.fillBranch("mj1",mj1)
- self.out.fillBranch("pTj1",pTj1)
- self.out.fillBranch("etaj1",etaj1)
- self.out.fillBranch("phij1",phij1)
- self.out.fillBranch("mj2",mj2)
- self.out.fillBranch("pTj2",pTj2)
- self.out.fillBranch("etaj2",etaj2)
- self.out.fillBranch("phij2",phij2)
-
- # self.out.fillBranch("nElectron_Fsr", len(electrons))
- # self.out.fillBranch("nMuon_Fsr", len(muons))
-
- self.out.fillBranch("Electron_Fsr_pt",Electron_Fsr_pt)
- self.out.fillBranch("Electron_Fsr_eta",Electron_Fsr_eta)
- self.out.fillBranch("Electron_Fsr_phi",Electron_Fsr_phi)
-
- self.out.fillBranch("Muon_Fsr_pt",Muon_Fsr_pt)
- self.out.fillBranch("Muon_Fsr_eta",Muon_Fsr_eta)
- self.out.fillBranch("Muon_Fsr_phi",Muon_Fsr_phi)
+ rapidity4l = self.worker.ZZsystem.Rapidity()
+ njets_pt30_eta4p7 = self.worker.njets_pt30_eta4p7
+ if self.worker.flag4e:
+ mass4e = mass4l
+ if self.worker.flag2e2mu:
+ mass4e = mass4l
+ if self.worker.flag4mu:
+ mass4mu = mass4l
+ if (self.worker.isFSR==False & passedFullSelection):
+ pT4l = self.worker.ZZsystemnofsr.Pt()
+ eta4l = self.worker.ZZsystemnofsr.Eta()
+ phi4l = self.worker.ZZsystemnofsr.Phi()
+ mass4l = self.worker.ZZsystemnofsr.M()
+ rapidity4l = self.worker.ZZsystemnofsr.Rapidity()
+ Weight = event.genWeight * pileupWeight * dataMCWeight_new * prefiringWeight
+ self.out.fillBranch("mass4l",mass4l)
+ self.out.fillBranch("GENmass4l",GENmass4l)
+ self.out.fillBranch("mass4e",mass4e)
+ self.out.fillBranch("mass2e2mu",mass2e2mu)
+ self.out.fillBranch("mass4mu",mass4mu)
+ self.out.fillBranch("pT4l",pT4l)
+ self.out.fillBranch("GENpT4l",GENpT4l)
+ self.out.fillBranch("rapidity4l",rapidity4l)
+ self.out.fillBranch("GENrapidity4l",GENrapidity4l)
+ self.out.fillBranch("njets_pt30_eta4p7",njets_pt30_eta4p7)
+ self.out.fillBranch("finalState",finalState)
+ self.out.fillBranch("GENnjets_pt30_eta4p7",GENnjets_pt30_eta4p7)
+ self.out.fillBranch("eta4l",eta4l)
+ self.out.fillBranch("phi4l",phi4l)
+ self.out.fillBranch("massZ1",massZ1)
+ self.out.fillBranch("pTZ1",pTZ1)
+ self.out.fillBranch("etaZ1",etaZ1)
+ self.out.fillBranch("phiZ1",phiZ1)
+ self.out.fillBranch("massZ2",massZ2)
+ self.out.fillBranch("pTZ2",pTZ2)
+ self.out.fillBranch("etaZ2",etaZ2)
+ self.out.fillBranch("phiZ2",phiZ2)
+ self.out.fillBranch("D_CP",D_CP)
+ self.out.fillBranch("D_0m",D_0m)
+ self.out.fillBranch("D_0hp",D_0hp)
+ self.out.fillBranch("D_int",D_int)
+ self.out.fillBranch("D_L1",D_L1)
+ self.out.fillBranch("D_L1Zg",D_L1Zg)
+ self.out.fillBranch("passedTrig", passedTrig)
+ self.out.fillBranch("passedFullSelection", passedFullSelection)
+ self.out.fillBranch("passedZ4lSelection", passedZ4lSelection)
+ self.out.fillBranch("passedZ4lZ1LSelection", passedZ4lZ1LSelection)
+ self.out.fillBranch("passedZ4lZXCRSelection", passedZ4lZXCRSelection)
+ self.out.fillBranch("passedZXCRSelection", passedZXCRSelection)
+ self.out.fillBranch("passedFiducialSelection", passedFiducialSelection)
+ self.out.fillBranch("EvtNum",EvtNum)
+ self.out.fillBranch("massL1",massL1)
+ self.out.fillBranch("pTL1",pTL1)
+ self.out.fillBranch("etaL1",etaL1)
+ self.out.fillBranch("phiL1",phiL1)
+ self.out.fillBranch("massL2",massL2)
+ self.out.fillBranch("pTL2",pTL2)
+ self.out.fillBranch("etaL2",etaL2)
+ self.out.fillBranch("phiL2",phiL2)
+ self.out.fillBranch("massL3",massL3)
+ self.out.fillBranch("pTL3",pTL3)
+ self.out.fillBranch("etaL3",etaL3)
+ self.out.fillBranch("phiL3",phiL3)
+ self.out.fillBranch("massL4",massL4)
+ self.out.fillBranch("pTL4",pTL4)
+ self.out.fillBranch("etaL4",etaL4)
+ self.out.fillBranch("phiL4",phiL4)
+
+ self.out.fillBranch("mj1",mj1)
+ self.out.fillBranch("pTj1",pTj1)
+ self.out.fillBranch("etaj1",etaj1)
+ self.out.fillBranch("phij1",phij1)
+ self.out.fillBranch("mj2",mj2)
+ self.out.fillBranch("pTj2",pTj2)
+ self.out.fillBranch("etaj2",etaj2)
+ self.out.fillBranch("phij2",phij2)
+ self.out.fillBranch("pileupWeight",pileupWeight)
+ self.out.fillBranch("dataMCWeight_new",dataMCWeight_new)
+ self.out.fillBranch("prefiringWeight",prefiringWeight)
+ self.out.fillBranch("Weight",Weight)
+ # self.out.fillBranch("nElectron_Fsr", len(electrons))
+ # self.out.fillBranch("nMuon_Fsr", len(muons))
+
+ self.out.fillBranch("GENlep_id",GENlep_id)
+ self.out.fillBranch("GENlep_Hindex",GENlep_Hindex)
+ self.out.fillBranch("GENZ_DaughtersId",GENZ_DaughtersId)
+ self.out.fillBranch("GENZ_MomId",GENZ_MomId)
+ self.out.fillBranch("GENlep_MomId",GENlep_MomId)
+ self.out.fillBranch("GENlep_MomMomId",GENlep_MomMomId)
+ self.out.fillBranch("Electron_Fsr_pt",Electron_Fsr_pt)
+ self.out.fillBranch("Electron_Fsr_eta",Electron_Fsr_eta)
+ self.out.fillBranch("Electron_Fsr_phi",Electron_Fsr_phi)
+
+ self.out.fillBranch("lep_Hindex",lep_Hindex)
+ self.out.fillBranch("lep_genindex",lep_genindex)
+ self.out.fillBranch("Muon_Fsr_pt",Muon_Fsr_pt)
+ self.out.fillBranch("Muon_Fsr_eta",Muon_Fsr_eta)
+ self.out.fillBranch("Muon_Fsr_phi",Muon_Fsr_phi)
"""with open("SyncLepton2018GGH.txt", 'a') as f:
if(foundZZCandidate):
diff --git a/Input_2022.yml b/Input_2022.yml
new file mode 100644
index 0000000..04fcecf
--- /dev/null
+++ b/Input_2022.yml
@@ -0,0 +1,118 @@
+Triggers:
+ - event.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL
+ - event.HLT_DoubleEle25_CaloIdL_MW
+ - event.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8
+ - event.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ
+ - event.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ
+ - event.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ
+ - event.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ
+ - event.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ
+ - event.HLT_TripleMu_10_5_5_DZ
+ - event.HLT_TripleMu_12_10_5
+ - event.HLT_Ele30_WPTight_Gsf
+ - event.HLT_IsoMu24
+
+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.926614978724
+ HighPT:
+ 0.352678981617
+ MedEta:
+ LowPT:
+ 0.913768989002
+ HighPT:
+ 0.260085399397
+ HighEta:
+ LowPT:
+ 0.968212252285
+ HighPT:
+ -0.496311372876
+ 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
+
+inputdataNPV:
+ "data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-69200ub-99bins.root"
+inputdataNPVup:
+ "data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-72400ub-99bins.root"
+inputdataNPVdown:
+ "data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-66000ub-99bins.root"
+
+outputdataNPV:
+ "data/pileupHistogram_2022.root"
+outputdataNPVup:
+ "data/pileupHistogram_2022up.root"
+outputdataNPVdown:
+ "data/pileupHistogram_2022down.root"
+
+PUweightHistoName:
+ "pileupWeight"
diff --git a/PileupWeightHistoMaker.py b/PileupWeightHistoMaker.py
new file mode 100644
index 0000000..94a1e77
--- /dev/null
+++ b/PileupWeightHistoMaker.py
@@ -0,0 +1,42 @@
+import ROOT
+import yaml
+from data.Run3_2022_LHC_Simulation_10h_2h_cfi import *
+
+def getPUweight(pileupdatafile, inputhistoname, outputhistoname, outdir):
+
+ input_file = ROOT.TFile.Open(pileupdatafile)
+ input_hist = input_file.Get(inputhistoname)
+ output_hist = ROOT.TH1D(outputhistoname, outputhistoname, input_hist.GetNbinsX(), input_hist.GetXaxis().GetXmin(), input_hist.GetXaxis().GetXmax())
+ sum_data_entries = 0
+ sum_MC_entries = 0
+ for j in range(1, input_hist.GetNbinsX() + 1):
+ sum_data_entries += input_hist.GetBinContent(j)
+ sum_MC_entries += probValue[j-1]
+ for i in range(1, input_hist.GetNbinsX() + 1):
+ bin_content = input_hist.GetBinContent(i)/(probValue[i-1]*sum_data_entries/sum_MC_entries)
+ output_hist.SetBinContent(i, bin_content)
+ output_file = ROOT.TFile.Open(outdir, "RECREATE")
+ output_hist.Write()
+ input_file.Close()
+ output_file.Close()
+
+def MakeHisto(year):
+
+ if year == 2022:
+ cfgFile = "Input_2022.yml"
+ with open(cfgFile, 'r') as ymlfile:
+ cfg = yaml.load(ymlfile)
+ inputdataNPV = cfg['inputdataNPV']
+ inputdataNPVup = cfg['inputdataNPVup']
+ inputdataNPVdown = cfg['inputdataNPVdown']
+ outputdataNPV = cfg['outputdataNPV']
+ outputdataNPVup = cfg['outputdataNPVup']
+ outputdataNPVdown = cfg['outputdataNPVdown']
+ outputhistoname = cfg['PUweightHistoName']
+
+ getPUweight(inputdataNPV, "pileup", outputhistoname, outputdataNPV)
+ getPUweight(inputdataNPVup, "pileup", outputhistoname, outputdataNPVup)
+ getPUweight(inputdataNPVdown, "pileup", outputhistoname, outputdataNPVdown)
+
+MakeHisto(2022)
+
diff --git a/README.md b/README.md
index b360f67..d7734f3 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ nanoAOD skiming code for H->ZZ->2l2Q studies.
cd $CMSSW_BASE/src
git clone git@github.com:ram1123/nanoAOD_skim.git PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim
cd PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim
- git checkout HZZ_Analysis
+ git checkout HZZ_Analysis_Run3
cd -
cmsenv
# patch PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/nanoAOD_tools.patch
@@ -64,7 +64,7 @@ nanoAOD skiming code for H->ZZ->2l2Q studies.
```bash
cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim
# Use the arguments that you need.
- python condor_setup_lxplus.py --input-file sample_list_v9.dat
+ python condor_setup_lxplus.py --input-file sample_list_v12_2022.dat
# Set proxy before submitting the condor jobs.
voms-proxy-init -voms cms --valid 200:00
condor_submit .jdl
@@ -83,7 +83,7 @@ nanoAOD skiming code for H->ZZ->2l2Q studies.
1. [condor_setup_lxplus.py](condor_setup_lxplus.py): This script can be used to setup the condor jobs. It takes the input text file (present inside directory [input_data_Files](input_data_Files)) from which you need to take input NanoAOD DAS names. Also, updated the output EOS path. Then do the following:
```bash
- python condor_setup_lxplus.py --input-file sample_list_v9.dat
+ python condor_setup_lxplus.py --input-file sample_list_v12_2022.dat
```
This will create the condor job files and the condor log files.
diff --git a/Utils/fileshelper.py b/Utils/fileshelper.py
index b2bcf34..dd63b7e 100644
--- a/Utils/fileshelper.py
+++ b/Utils/fileshelper.py
@@ -44,7 +44,7 @@ def create_store_area(self, path):
string -- Path of the created directory in the store area
"""
# Reference:https://cernbox.docs.cern.ch/desktop/other-access-methods/eos_xrootd/
- os.system('eos root://eosuser.cern.ch mkdir {path}'.format(path = path))
+ os.system('eos root://eosuser.cern.ch mkdir -p {path}'.format(path = path))
print("==> Created directory at eos path: {path}".format(path = path))
# Add a check to see if the directory was created
print("==> Checking if the directory was created...")
diff --git a/condor_setup_lxplus.py b/condor_setup_lxplus.py
index 0d0a52b..ba8784b 100644
--- a/condor_setup_lxplus.py
+++ b/condor_setup_lxplus.py
@@ -18,20 +18,20 @@ def main(args):
use_custom_eos_cmd = args.use_custom_eos_cmd
InputFileFromWhereReadDASNames = args.input_file
EOS_Output_path = args.eos_output_path
- condor_file_name = args.condor_file_name
- condor_queue = args.condor_queue
- condor_log_path = args.condor_log_path
- DontCreateTarFile = args.DontCreateTarFile
-
- # Get top-level directory name from PWD
- TOP_LEVEL_DIR_NAME = os.path.basename(os.getcwd())
-
if EOS_Output_path == "":
# Get the username and its initial and set the path as /eos/user///nanoAOD_ntuples
username = os.environ['USER']
user_initials = username[0:1]
EOS_Output_path = '/eos/user/'+user_initials+'/'+username+'/nanoAOD_ntuples'
- EOS_Output_path += submission_name
+ if submission_name != "":
+ EOS_Output_path = EOS_Output_path + '/' + submission_name
+ condor_log_path = args.condor_log_path
+
+ # Get top-level directory name from PWD
+ TOP_LEVEL_DIR_NAME = os.path.basename(os.getcwd())
+ condor_file_name = args.condor_file_name
+ condor_queue = args.condor_queue
+ DontCreateTarFile = args.DontCreateTarFile
condor_file_name = 'submit_condor_jobs_lnujj_'+submission_name
# Create log files
@@ -78,47 +78,48 @@ def main(args):
outjdl_file.write("WhenToTransferOutput = ON_EXIT\n")
outjdl_file.write("Transfer_Input_Files = "+Transfer_Input_Files + ", " + post_proc_to_run+"\n")
outjdl_file.write("x509userproxy = $ENV(X509_USER_PROXY)\n")
+ outjdl_file.write("requirements = TARGET.OpSysAndVer =?= \"AlmaLinux9\"\n")
+ outjdl_file.write("MY.WantOS = \"el7\"\n")
count = 0
count_jobs = 0
- for lines in in_file:
- if lines[0] == "#": continue
+ for SampleDASName in in_file:
+ if SampleDASName[0] == "#": continue
count = count +1
#if count > 1: break
print(style.RED +"="*51+style.RESET+"\n")
print ("==> Sample : ",count)
- sample_name = lines.split('/')[1]
- campaign = lines.split('/')[2].split('-')[0]
+ sample_name = SampleDASName.split('/')[1]
print("==> sample_name = ",sample_name)
+ campaign = SampleDASName.split('/')[2].split('-')[0]
print("==> campaign = ",campaign)
########################################
#
# Create output directory
#
########################################
- if sample_name.find("SingleMuon") != -1 or sample_name.find("SingleElectron") != -1 or sample_name.find("EGamma") != -1 or sample_name.find("DoubleMuon") != -1 or sample_name.find("MuonEG") != -1 or sample_name.find("DoubleEG") != -1:
+ if (SampleDASName.strip()).endswith("/NANOAOD"): # if the sample name ends with /NANOAOD, then it is a data if it ends with /NANOAODSIM then it is a MC. As the line contain the "\n" at the end, so we need to use the strip() function.
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)
+ print("==> output_path = ",output_path)
+ os.system("mkdir -p "+ output_path)
+ infoLogFiles.send_git_log_and_patch_to_eos(output_path)
else:
- output_string = sample_name+os.sep+dirName
+ output_string = campaign + os.sep + sample_name + os.sep + dirName
output_path = EOS_Output_path+ os.sep + output_string
- os.system("mkdir "+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)
+ os.system("mkdir -p "+output_path)
+ infoLogFiles.send_git_log_and_patch_to_eos(output_path)
# print "==> output_path = ",output_path
########################################
- #print 'dasgoclient --query="file dataset='+lines.strip()+'"'
+ #print 'dasgoclient --query="file dataset='+SampleDASName.strip()+'"'
#print "..."
if use_custom_eos:
xrd_redirector = 'root://cms-xrd-global.cern.ch/'
- output = os.popen(use_custom_eos_cmd + lines.strip()).read()
+ output = os.popen(use_custom_eos_cmd + SampleDASName.strip()).read()
else:
xrd_redirector = 'root://cms-xrd-global.cern.ch/'
- output = os.popen('dasgoclient --query="file dataset='+lines.strip()+'"').read()
+ output = os.popen('dasgoclient --query="file dataset='+SampleDASName.strip()+'"').read()
count_root_files = 0
for root_file in output.split():
@@ -128,7 +129,7 @@ def main(args):
outjdl_file.write("Output = "+output_log_path+"/"+sample_name+"_$(Process).stdout\n")
outjdl_file.write("Error = "+output_log_path+"/"+sample_name+"_$(Process).err\n")
outjdl_file.write("Log = "+output_log_path+"/"+sample_name+"_$(Process).log\n")
- outjdl_file.write("Arguments = "+(xrd_redirector+root_file)+" "+output_path+" "+EOS_Output_path+"\n")
+ outjdl_file.write("Arguments = "+(xrd_redirector+root_file)+" "+output_path+" "+EOS_Output_path+ " " + (root_file.split('/')[-1]).split('.')[0] + "\n")
outjdl_file.write("Queue \n")
print("Number of files: ",count_root_files)
print("Number of jobs (till now): ",count_jobs)
@@ -163,14 +164,14 @@ def main(args):
outScript.write("\n"+'echo "====> List root files : " ');
outScript.write("\n"+'ls *.root');
outScript.write("\n"+'echo "====> copying *.root file to stores area..." ');
- outScript.write("\n"+'if ls *_Skim.root 1> /dev/null 2>&1; then');
- outScript.write("\n"+' echo "File *_Skim.root exists. Copy this."');
- outScript.write("\n"+' echo "cp *_Skim.root ${2}"');
- outScript.write("\n"+' cp *_Skim.root ${2}');
+ outScript.write("\n"+'if ls skimmed_nano.root 1> /dev/null 2>&1; then');
+ outScript.write("\n"+' echo "File skimmed_nano.root exists. Copy this."');
+ outScript.write("\n"+' echo "cp skimmed_nano.root ${2}/${4}_Skim.root"');
+ outScript.write("\n"+' cp skimmed_nano.root ${2}/${4}_Skim.root');
outScript.write("\n"+'else');
- outScript.write("\n"+' echo "file *_Skim.root does not exists, so copy *.root file."');
- outScript.write("\n"+' echo "cp *.root ${2}"');
- outScript.write("\n"+' cp *.root ${2}');
+ outScript.write("\n"+' echo "file skimmed_nano.root does not exists, so copy *.root file."');
+ outScript.write("\n"+' echo "cp *.root ${2}/${4}_Skim.root"');
+ outScript.write("\n"+' cp *.root ${2}/${4}_Skim.root');
outScript.write("\n"+'fi');
outScript.write("\n"+'rm *.root');
outScript.write("\n"+'cd ${_CONDOR_SCRATCH_DIR}');
@@ -194,16 +195,16 @@ class PreserveWhitespaceFormatter(argparse.RawTextHelpFormatter, argparse.Argume
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Condor Job Submission", formatter_class=PreserveWhitespaceFormatter)
- parser.add_argument("--submission_name", default="Run2018_v9", help="String to be changed by user.")
+ parser.add_argument("--submission_name", default="SkimNanoAOD", help="String to be changed by user.")
parser.add_argument("--use_custom_eos", default=False, action='store_true', help="Use custom EOS.")
parser.add_argument("--DontCreateTarFile", default=False, action='store_true', help="Create tar file of CMSSW directory.")
parser.add_argument("--use_custom_eos_cmd", default='eos root://cmseos.fnal.gov find -name "*.root" /store/group/lnujj/VVjj_aQGC/custom_nanoAOD', help="Custom EOS command.")
# input_file mandatory
parser.add_argument("--input_file", default='', required=True, help="Input file from where to read DAS names.")
- parser.add_argument("--eos_output_path", default='', help="Initial path for operations.")
+ parser.add_argument("--eos_output_path", default='', help="EOS path for output files. By default it is `/eos/user///nanoAOD_ntuples`")
parser.add_argument("--condor_log_path", default='./', help="Path where condor log should be saved. By default is the current working directory")
parser.add_argument("--condor_file_name", default='submit_condor_jobs_lnujj_', help="Name for the condor file.")
- parser.add_argument("--condor_queue", default="microcentury", help="""
+ parser.add_argument("--condor_queue", default="testmatch", help="""
Condor queue options: (Reference: https://twiki.cern.ch/twiki/bin/view/ABPComputing/LxbatchHTCondor#Queue_Flavours)
name Duration
@@ -222,3 +223,4 @@ class PreserveWhitespaceFormatter(argparse.RawTextHelpFormatter, argparse.Argume
args = parser.parse_args()
main(args)
+#condor_setup_lxplus.py
diff --git a/data/Run3_2022_LHC_Simulation_10h_2h_cfi.py b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.py
new file mode 100644
index 0000000..00fd2dc
--- /dev/null
+++ b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.py
@@ -0,0 +1,46 @@
+probFunctionVariable = [
+ 0, 1, 2, 3,
+ 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83,
+ 84, 85, 86, 87, 88,
+ 89, 90, 91, 92, 93,
+ 94, 95, 96, 97, 98,
+ 99]
+
+
+probValue = [
+ 7.075550618391933e-8, 1.8432226484975646e-7, 4.6156514471969593e-7, 0.0000011111611991838491,
+ 0.0000025719752161798103, 0.000005724865812608344, 0.000012255841383374045, 0.000025239403069596116, 0.00005001054998201597,
+ 0.00009536530158990567, 0.00017505633393457624, 0.00030942214916825035, 0.0005268123536229287, 0.0008642843968521786,
+ 0.0013669182280399903, 0.0020851167548246985, 0.0030695148409245446, 0.004363635945105083, 0.005995143197404548,
+ 0.007967247822222358, 0.010252302872826594, 0.01278957659177177, 0.015488544412469806, 0.01823784978331645,
+ 0.020918669702105028, 0.023420019399650906, 0.025652949149203495, 0.027560835627835043, 0.02912397347687914,
+ 0.030358091266301533, 0.03130778480604892, 0.03203676872496023, 0.0326170853351521, 0.03311902652393314,
+ 0.033602777248239, 0.0341120235754556, 0.03466927947785801, 0.03527261707506484, 0.035893786618889145,
+ 0.03647817900850185, 0.036947435730750315, 0.03720550450678737, 0.037148460727673235, 0.03667753703450604,
+ 0.03571377296329832, 0.034211859754226276, 0.032170439241889726, 0.029636506070368274, 0.02670262519076345,
+ 0.023497154911314072, 0.020169158697337236, 0.016870783471647905, 0.013740289679427057, 0.010888563843704815,
+ 0.008390977574442656, 0.006285186751143873, 0.004574246293656772, 0.003233538335807419, 0.002219622271900557,
+ 0.0014792038980537092, 0.0009568560481315006, 0.0006007171037926386, 0.00036596934105178995, 0.0002163349104153549,
+ 0.00012407362512604619, 0.0000690356949524181, 0.000037263645547231494, 0.00001951170588910065, 0.000009910336118978026,
+ 0.0000048826244075428666, 0.0000023333596885075797, 0.0000010816029570543702, 4.863048449289416e-7, 2.1208148308081624e-7,
+ 8.97121135679932e-8, 3.6809172420519874e-8, 1.4649459937201982e-8, 5.655267024863598e-9, 2.117664468591336e-9,
+ 7.692038404370259e-10, 2.7102837405697987e-10, 9.263749466613295e-11, 3.071624552355945e-11, 9.880298997379985e-12,
+ 3.0832214331312204e-12, 9.33436314183754e-13, 2.7417209623761203e-13, 7.813293248960901e-14, 2.1603865264197903e-14,
+ 5.796018523167997e-15, 1.5088422256459697e-15, 3.811436255838504e-16, 9.342850737730402e-17, 2.2224464483477953e-17,
+ 5.130498608124184e-18, 1.1494216669980747e-18, 2.499227229379666e-19, 5.2741621866055994e-20, 1.080281961755894e-20,
+ 2.1476863811171814e-21]
diff --git a/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc
new file mode 100644
index 0000000..d3fa64c
Binary files /dev/null and b/data/Run3_2022_LHC_Simulation_10h_2h_cfi.pyc differ
diff --git a/data/__init__.py b/data/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/data/__init__.pyc b/data/__init__.pyc
new file mode 100644
index 0000000..aa59bdf
Binary files /dev/null and b/data/__init__.pyc differ
diff --git a/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-66000ub-99bins.root b/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-66000ub-99bins.root
new file mode 100755
index 0000000..164030c
Binary files /dev/null and b/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-66000ub-99bins.root differ
diff --git a/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-69200ub-99bins.root b/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-69200ub-99bins.root
new file mode 100755
index 0000000..2251360
Binary files /dev/null and b/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-69200ub-99bins.root differ
diff --git a/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-72400ub-99bins.root b/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-72400ub-99bins.root
new file mode 100755
index 0000000..d858c17
Binary files /dev/null and b/data/pileupHistogram-Cert_Collisions2022_355100_362760_GoldenJson-13p6TeV-72400ub-99bins.root differ
diff --git a/data/pileupHistogram_2022.root b/data/pileupHistogram_2022.root
new file mode 100644
index 0000000..11aac40
Binary files /dev/null and b/data/pileupHistogram_2022.root differ
diff --git a/data/pileupHistogram_2022down.root b/data/pileupHistogram_2022down.root
new file mode 100644
index 0000000..31e0252
Binary files /dev/null and b/data/pileupHistogram_2022down.root differ
diff --git a/data/pileupHistogram_2022up.root b/data/pileupHistogram_2022up.root
new file mode 100644
index 0000000..e4ffc17
Binary files /dev/null and b/data/pileupHistogram_2022up.root differ
diff --git a/golden_Json/Cert_Collisions2022_355100_362760_Golden.json b/golden_Json/Cert_Collisions2022_355100_362760_Golden.json
new file mode 100644
index 0000000..3170a83
--- /dev/null
+++ b/golden_Json/Cert_Collisions2022_355100_362760_Golden.json
@@ -0,0 +1,453 @@
+{
+ "355374": [[59, 84]],
+ "355381": [[1, 358]],
+ "355418": [[1, 41]],
+ "355419": [[1, 98]],
+ "355429": [[42, 89]],
+ "355435": [[42, 84]],
+ "355442": [[1, 22]],
+ "355443": [[1, 240]],
+ "355444": [[1, 153]],
+ "355445": [[1, 242]],
+ "355454": [[38, 118]],
+ "355455": [[1, 40]],
+ "355456": [[1, 501]],
+ "355558": [[122, 409]],
+ "355559": [[1, 162]],
+ "355679": [[27, 85]],
+ "355680": [[1, 1651]],
+ "355768": [[82, 126]],
+ "355769": [[1, 541]],
+ "355862": [[121, 133]],
+ "355863": [[1, 14]],
+ "355870": [[31, 67]],
+ "355871": [[1, 5]],
+ "355872": [
+ [1, 738],
+ [758, 995],
+ [997, 1217]
+ ],
+ "355892": [[14, 197]],
+ "355912": [[43, 200]],
+ "355913": [[1, 106]],
+ "355921": [[38, 442]],
+ "355933": [[75, 448]],
+ "355942": [[24, 189], [193, 213]],
+ "355988": [[43, 80], [85, 90]],
+ "355989": [[1, 24]],
+ "355998": [[1, 35]],
+ "355999": [[1, 9]],
+ "356004": [[1, 19]],
+ "356005": [[1, 187]],
+ "356043": [[1, 65]],
+ "356071": [[37, 191]],
+ "356074": [[1, 26]],
+ "356075": [[1, 125]],
+ "356076": [[1, 153]],
+ "356077": [[1, 472]],
+ "356135": [[46, 71]],
+ "356309": [[61, 184]],
+ "356316": [[45, 185]],
+ "356322": [[1, 19]],
+ "356323": [[1, 67], [69, 650]],
+ "356371": [[41, 50], [67, 72]],
+ "356375": [[35, 77], [101, 125]],
+ "356378": [
+ [8, 208],
+ [210, 219],
+ [221, 304]
+ ],
+ "356381": [[1, 1193]],
+ "356383": [[1, 33]],
+ "356385": [[1, 30]],
+ "356386": [[1, 122]],
+ "356426": [[39, 60]],
+ "356428": [[1, 300]],
+ "356433": [[1, 310]],
+ "356434": [[1, 13]],
+ "356435": [[1, 3], [8, 8]],
+ "356446": [[10, 623]],
+ "356523": [[32, 410], [412, 898]],
+ "356531": [[1, 56]],
+ "356563": [
+ [36, 113],
+ [117, 164],
+ [168, 177],
+ [181, 191],
+ [193, 194],
+ [199, 343]
+ ],
+ "356568": [[42, 64]],
+ "356569": [[1, 251]],
+ "356570": [[1, 98]],
+ "356576": [[58, 240]],
+ "356578": [[1, 865]],
+ "356580": [[1, 51]],
+ "356582": [[7, 104]],
+ "356614": [[1, 10], [16, 19], [27, 62]],
+ "356615": [[1, 1297]],
+ "356619": [[1, 173]],
+ "356810": [[44, 163]],
+ "356811": [[1, 44]],
+ "356812": [[1, 107]],
+ "356813": [[1, 54]],
+ "356814": [
+ [1, 305],
+ [307, 309],
+ [311, 366],
+ [368, 672]
+ ],
+ "356815": [[1, 54], [176, 219]],
+ "356824": [[1, 66]],
+ "356908": [[1, 26]],
+ "356919": [[29, 116]],
+ "356937": [[20, 138]],
+ "356946": [[1, 129]],
+ "356947": [[1, 350]],
+ "356948": [[1, 88]],
+ "356949": [[1, 94]],
+ "356951": [[1, 274]],
+ "356954": [[1, 364]],
+ "356955": [[1, 380]],
+ "356956": [[1, 109]],
+ "356968": [[81, 252]],
+ "356969": [[1, 236]],
+ "356970": [[1, 366]],
+ "356998": [[1, 5]],
+ "356999": [[1, 58]],
+ "357000": [[1, 50]],
+ "357001": [[1, 183]],
+ "357079": [[1, 22]],
+ "357080": [[1, 616]],
+ "357081": [[1, 759]],
+ "357101": [[54, 103]],
+ "357102": [[1, 13], [43, 134]],
+ "357104": [[1, 4]],
+ "357106": [[1, 60]],
+ "357112": [[1, 519]],
+ "357268": [[70, 143]],
+ "357271": [[1, 20], [22, 1570]],
+ "357328": [[44, 105]],
+ "357329": [[1, 668]],
+ "357330": [[1, 157]],
+ "357331": [[1, 23]],
+ "357332": [[1, 430]],
+ "357333": [[1, 207]],
+ "357401": [[48, 664]],
+ "357406": [[50, 174]],
+ "357438": [[35, 230]],
+ "357440": [[1, 354]],
+ "357441": [[1, 83]],
+ "357442": [[1, 1373]],
+ "357447": [[40, 50]],
+ "357472": [[34, 60]],
+ "357478": [[43, 50]],
+ "357479": [[1, 1046]],
+ "357482": [[1, 5], [21, 220]],
+ "357538": [[39, 63]],
+ "357542": [[1, 11], [13, 252]],
+ "357550": [[1, 36]],
+ "357610": [[63, 253]],
+ "357611": [[1, 412]],
+ "357612": [[1, 736]],
+ "357613": [[1, 256]],
+ "357688": [[1, 380]],
+ "357696": [[31, 319], [341, 410]],
+ "357697": [[1, 39]],
+ "357698": [[1, 63]],
+ "357699": [[1, 30]],
+ "357700": [[1, 757]],
+ "357701": [[1, 310]],
+ "357705": [[1, 202]],
+ "357706": [[1, 161]],
+ "357720": [[32, 92]],
+ "357732": [[30, 157]],
+ "357734": [[1, 300]],
+ "357735": [
+ [1, 387],
+ [389, 821],
+ [823, 947],
+ [949, 1126]
+ ],
+ "357754": [[29, 145]],
+ "357756": [[1, 425]],
+ "357757": [[1, 9]],
+ "357758": [[1, 85]],
+ "357759": [[1, 70]],
+ "357766": [[10, 124]],
+ "357777": [[1, 85]],
+ "357778": [[1, 359]],
+ "357779": [[1, 74]],
+ "357781": [[1, 10]],
+ "357802": [[43, 206]],
+ "357803": [[1, 153]],
+ "357804": [[1, 23]],
+ "357805": [[1, 88]],
+ "357806": [[1, 56]],
+ "357807": [[1, 244]],
+ "357808": [[1, 17]],
+ "357809": [[1, 41]],
+ "357812": [[1, 50]],
+ "357813": [[1, 293]],
+ "357814": [[1, 212]],
+ "357815": [[1, 944]],
+ "357898": [[1, 313]],
+ "357899": [[1, 637]],
+ "357900": [[1, 516]],
+ "359569": [[1, 83]],
+ "359571": [
+ [1, 4],
+ [7, 28],
+ [30, 39],
+ [41, 50],
+ [52, 61],
+ [63, 72],
+ [74, 83],
+ [85, 94],
+ [96, 105],
+ [107, 116],
+ [118, 127],
+ [129, 138],
+ [140, 149],
+ [151, 160],
+ [162, 169]
+ ],
+ "359575": [
+ [1, 13],
+ [15, 24],
+ [26, 35],
+ [37, 46],
+ [48, 57],
+ [59, 68],
+ [70, 89]
+ ],
+ "359595": [[17, 289]],
+ "359597": [[1, 94]],
+ "359602": [[1, 74]],
+ "359609": [[1, 25]],
+ "359612": [[1, 12]],
+ "359661": [[42, 233]],
+ "359685": [[1, 132]],
+ "359686": [[1, 934]],
+ "359691": [[19, 139]],
+ "359693": [[1, 604]],
+ "359694": [[1, 1080]],
+ "359699": [[28, 1883]],
+ "359718": [[1, 199], [202, 368]],
+ "359750": [[52, 186]],
+ "359751": [[15, 1007]],
+ "359762": [[44, 266]],
+ "359763": [[1, 410], [412, 459]],
+ "359764": [[28, 1111]],
+ "359776": [[104, 432]],
+ "359806": [[42, 410]],
+ "359808": [[1, 46]],
+ "359809": [[1, 43]],
+ "359810": [[1, 183]],
+ "359812": [[1, 227]],
+ "359814": [[1, 366]],
+ "359870": [[2, 7]],
+ "359871": [[1, 228]],
+ "359887": [[30, 502]],
+ "359899": [[19, 305]],
+ "359903": [[1, 12]],
+ "359998": [
+ [24, 757],
+ [759, 759],
+ [761, 785],
+ [787, 1918]
+ ],
+ "360017": [[42, 81]],
+ "360019": [[1, 153], [155, 1489]],
+ "360075": [[20, 429], [462, 809]],
+ "360090": [[1, 794]],
+ "360116": [[77, 432]],
+ "360125": [
+ [132, 195],
+ [200, 262],
+ [264, 324]
+ ],
+ "360126": [[1, 35], [37, 370]],
+ "360127": [[1, 201]],
+ "360128": [[1, 163]],
+ "360130": [[87, 91]],
+ "360131": [[1, 378]],
+ "360141": [[25, 775]],
+ "360224": [[43, 259]],
+ "360225": [[1, 169], [171, 356]],
+ "360295": [[35, 771], [774, 1475]],
+ "360296": [[1, 519]],
+ "360327": [[32, 383]],
+ "360390": [[5, 36], [38, 76]],
+ "360391": [[1, 4]],
+ "360392": [[1, 61]],
+ "360393": [[1, 124]],
+ "360400": [[40, 119]],
+ "360413": [[37, 126]],
+ "360428": [[50, 123]],
+ "360432": [[1, 28]],
+ "360435": [[1, 37], [43, 53]],
+ "360437": [[1, 40]],
+ "360438": [[1, 6]],
+ "360458": [[45, 215], [234, 246]],
+ "360459": [[1, 1332]],
+ "360460": [[1, 1077]],
+ "360486": [[45, 322]],
+ "360490": [[8, 936], [940, 1187]],
+ "360491": [[3, 157], [159, 179]],
+ "360737": [[10, 27]],
+ "360761": [[34, 190]],
+ "360794": [[37, 713]],
+ "360795": [[1, 395]],
+ "360797": [[1, 5]],
+ "360820": [[1, 885]],
+ "360825": [[1, 358]],
+ "360826": [[1, 91], [93, 119]],
+ "360856": [[42, 97]],
+ "360874": [[31, 82]],
+ "360876": [[1, 341]],
+ "360887": [[12, 134]],
+ "360888": [[1, 289]],
+ "360889": [[1, 36]],
+ "360890": [[1, 216], [219, 506]],
+ "360892": [[1, 296]],
+ "360895": [[1, 700]],
+ "360919": [[39, 836]],
+ "360920": [[1, 4]],
+ "360921": [[1, 218]],
+ "360927": [
+ [37, 331],
+ [333, 581],
+ [583, 1930]
+ ],
+ "360941": [[1, 72]],
+ "360942": [[1, 344]],
+ "360945": [[1, 91]],
+ "360946": [[1, 364]],
+ "360948": [[1, 119]],
+ "360950": [
+ [1, 179],
+ [181, 468],
+ [470, 718]
+ ],
+ "360951": [[1, 190]],
+ "360991": [[41, 270]],
+ "360992": [[1, 99]],
+ "361020": [[41, 439]],
+ "361044": [[42, 166]],
+ "361045": [[1, 322], [325, 947]],
+ "361050": [[1, 10]],
+ "361052": [[1, 65]],
+ "361054": [[1, 461]],
+ "361083": [[6, 59]],
+ "361091": [[38, 418]],
+ "361105": [[41, 448]],
+ "361106": [[1, 31]],
+ "361107": [[1, 156]],
+ "361108": [[1, 7]],
+ "361110": [[1, 197]],
+ "361188": [[46, 186]],
+ "361193": [[1, 29]],
+ "361195": [[1, 20]],
+ "361197": [[1, 960], [991, 2177]],
+ "361223": [[36, 730]],
+ "361239": [[35, 1090]],
+ "361240": [[1, 1015]],
+ "361272": [[1, 125]],
+ "361280": [[1, 267]],
+ "361283": [[1, 26]],
+ "361284": [[1, 36]],
+ "361297": [[38, 970]],
+ "361303": [[36, 2275]],
+ "361318": [[34, 490]],
+ "361319": [[1, 162]],
+ "361320": [[1, 382]],
+ "361333": [[36, 337]],
+ "361361": [[60, 105]],
+ "361362": [[1, 31]],
+ "361363": [[1, 27]],
+ "361365": [[1, 489]],
+ "361366": [[1, 201]],
+ "361400": [[41, 496]],
+ "361417": [[38, 1659]],
+ "361443": [[40, 2313]],
+ "361468": [[3, 1883]],
+ "361475": [
+ [37, 614],
+ [617, 836],
+ [838, 838],
+ [840, 1121],
+ [1124, 1273]
+ ],
+ "361512": [[36, 849], [851, 1573]],
+ "361569": [[35, 598]],
+ "361573": [[1, 305]],
+ "361579": [[43, 905]],
+ "361580": [[1, 422]],
+ "361957": [[1, 1163]],
+ "361971": [[38, 731], [733, 2381]],
+ "361989": [[37, 112], [114, 151]],
+ "361990": [[1, 204]],
+ "361994": [[1, 116]],
+ "362058": [[39, 209]],
+ "362059": [[1, 63]],
+ "362060": [[1, 83], [85, 85]],
+ "362061": [[1, 314]],
+ "362062": [[1, 207]],
+ "362063": [[1, 70], [77, 92]],
+ "362064": [
+ [93, 218],
+ [220, 508],
+ [510, 1067]
+ ],
+ "362087": [[1, 13], [15, 146]],
+ "362091": [[1, 1418]],
+ "362104": [[33, 147]],
+ "362105": [[1, 179]],
+ "362106": [[1, 78]],
+ "362107": [[1, 785]],
+ "362148": [[39, 758]],
+ "362153": [[1, 140]],
+ "362154": [[1, 784]],
+ "362159": [[29, 35]],
+ "362161": [[1, 120]],
+ "362163": [[1, 65]],
+ "362166": [[1, 331]],
+ "362167": [[1, 646]],
+ "362437": [[1, 11], [73, 92]],
+ "362439": [[8, 34], [249, 1595]],
+ "362597": [[1, 139]],
+ "362614": [[1, 153]],
+ "362615": [[1, 149]],
+ "362616": [[1, 351]],
+ "362617": [[1, 244]],
+ "362618": [[1, 274]],
+ "362653": [[40, 305]],
+ "362654": [[1, 26]],
+ "362655": [
+ [1, 140],
+ [143, 144],
+ [148, 338]
+ ],
+ "362657": [[1, 198]],
+ "362695": [[39, 372]],
+ "362696": [
+ [1, 1112],
+ [1114, 1120],
+ [1122, 1124],
+ [1126, 1128],
+ [1130, 1132],
+ [1134, 1140],
+ [1142, 1144],
+ [1146, 1148],
+ [1150, 1152],
+ [1154, 1720]
+ ],
+ "362698": [[1, 374]],
+ "362720": [[52, 949]],
+ "362727": [[4, 7]],
+ "362728": [[1, 388]],
+ "362757": [[32, 93]],
+ "362758": [[1, 205]],
+ "362760": [[1, 728]]
+}
\ No newline at end of file
diff --git a/input_data_Files/sample_list_v12_2022.dat b/input_data_Files/sample_list_v12_2022.dat
new file mode 100644
index 0000000..50f55ea
--- /dev/null
+++ b/input_data_Files/sample_list_v12_2022.dat
@@ -0,0 +1,35 @@
+# Data
+#/SingleMuon/Run2022C-16Dec2023-v1/NANOAOD
+#/DoubleMuon/Run2022C-16Dec2023-v1/NANOAOD
+#/Muon/Run2022C-16Dec2023-v1/NANOAOD
+#/Muon/Run2022D-16Dec2023-v1/NANOAOD
+#/Muon/Run2022E-16Dec2023-v1/NANOAOD
+#/Muon/Run2022F-16Dec2023-v1/NANOAOD
+#/Muon/Run2022G-19Dec2023-v2/NANOAOD
+#/MuonEG/Run2022C-22Sep2023-v1/NANOAOD
+#/MuonEG/Run2022D-22Sep2023-v1/NANOAOD
+#/MuonEG/Run2022E-22Sep2023-v1/NANOAOD
+#/MuonEG/Run2022F-22Sep2023-v1/NANOAOD
+#/MuonEG/Run2022G-22Sep2023-v1/NANOAOD
+#/EGamma/Run2022C-16Dec2023-v1/NANOAOD
+#/EGamma/Run2022D-16Dec2023-v1/NANOAOD
+#/EGamma/Run2022E-16Dec2023-v1/NANOAOD
+#/EGamma/Run2022F-16Dec2023-v1/NANOAOD
+#/EGamma/Run2022G-16Dec2023-v1/NANOAOD
+#
+# MC
+#/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM
+#/GluGluHtoZZto4L_M-125_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM
+#/VBFHto2Zto4L_M125_TuneCP5_13p6TeV_powheg-jhugenv752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM
+#/VBFHto2Zto4L_M125_TuneCP5_13p6TeV_powheg-jhugenv752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM
+#/WminusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM
+#/WminusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM
+#/WplusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM
+#/WplusH_Hto2Zto4L_M-125_TuneCP5_13p6TeV_powheg2-minlo-HWJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM
+#/ZHto2Zto4L_M125_TuneCP5_13p6TeV_powheg2-minlo-HZJ-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM
+#/ZHto2Zto4L_M125_TuneCP5_13p6TeV_powheg2-minlo-HZJ-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM
+#/TTH_Hto2Z_M-125_4LFilter_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5-v2/NANOAODSIM
+#/TTH_Hto2Z_M-125_4LFilter_TuneCP5_13p6TeV_powheg2-JHUGenV752-pythia8/Run3Summer22EENanoAODv12-130X_mcRun3_2022_realistic_postEE_v6-v2/NANOAODSIM
+#
+#bkg MC
+/ZZto4L_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22NanoAODv12-130X_mcRun3_2022_realistic_v5_ext1-v2/NANOAODSIM
diff --git a/interface/GenAnalysis.h b/interface/GenAnalysis.h
new file mode 100644
index 0000000..2e6c1da
--- /dev/null
+++ b/interface/GenAnalysis.h
@@ -0,0 +1,121 @@
+#ifndef GenAnalysis_h
+#define GenAnalysis_h
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "yaml-cpp/yaml.h"
+#include "../JHUGenMELA/MELA/interface/Mela.h"
+
+class GenAnalysis{
+ public:
+ GenAnalysis(); //Importing Ficducial Space cuts
+ std::vector GENlep_pt;
+ std::vector GENlep_eta;
+ std::vector GENlep_phi;
+ std::vector GENlep_mass;
+ std::vector GENZ_pt;
+ std::vector GENZ_eta;
+ std::vector GENZ_phi;
+ std::vector GENZ_mass;
+ std::vector GENZ_MomId;
+ std::vector GENH_pt;
+ std::vector GENH_eta;
+ std::vector GENH_phi;
+ std::vector GENH_mass;
+ std::vector GENjet_pt;
+ std::vector GENjet_eta;
+ std::vector GENjet_phi;
+ std::vector GENjet_mass;
+ std::vector GENlep_RelIso;
+ std::vector GENlep_id;
+ std::vector GENlep_status;
+ std::vector GENlep_MomId;
+ std::vector GENlep_MomMomId;
+ float GENMH, GENmassZZ, GENpTZZ;
+ float Zmass=91.1876;
+ double genIsoConeSizeEl, genIsoConeSizeMu;
+ float genIsoCutEl, genIsoCutMu;
+ float GENmass4l,GENmass4e,GENmass4mu, GENmass2e2mu;
+ float GENmassZ1,GENmassZ2,GENpT4l,GENeta4l,GENrapidity4l,GENphi4l;
+ float GENpt_leadingjet_pt30_eta4p7,GENpt_leadingjet_pt30_eta2p5;
+ float GENpT4lj, GENpT4ljj, GENmass4lj, GENmass4ljj;
+ float leadingPtCut,subleadingPtCut;
+ bool passedFiducialSelection;
+ int GENnjets_pt30_eta4p7,GENnjets_pt30_eta2p5,nGENLeptons;
+ int GENZ_DaughtersId[2];
+ int nVECZ;
+ int GENlep_Hindex[4];
+ int flag4e, flag4mu, flag2e2mu,flagpassZ1,flagpassFid;
+ int nGEN4e, nGEN4mu, nGEN2e2mu,nGEN4epassZ1,nGEN4epassFid,nGEN4mupassZ1,nGEN4mupassFid, nGEN2e2mupTEtaisocuts,nGEN2e2mupassZ1,nGEN2e2mupassFid;
+ void SetGenParts(float GenPart_pt_, float GenPart_eta_,float GenPart_phi_,float GenPart_mass_,int GenPart_pdgId_,int GenPart_status_,int GenPart_statusFlags_,int GenPart_genPartIdxMother_){
+ GenPart_pt.push_back(GenPart_pt_);
+ GenPart_eta.push_back(GenPart_eta_);
+ GenPart_phi.push_back(GenPart_phi_);
+ GenPart_mass.push_back(GenPart_mass_);
+ GenPart_pdgId.push_back(GenPart_pdgId_);
+ GenPart_statusFlags.push_back(GenPart_statusFlags_);
+ GenPart_status.push_back(GenPart_status_);
+ GenPart_genPartIdxMother.push_back(GenPart_genPartIdxMother_);
+ }
+
+ void SetGenJets(float GenJet_pt_, float GenJet_eta_,float GenJet_phi_,float GenJet_mass_){
+ GenJet_pt.push_back(GenJet_pt_);
+ GenJet_eta.push_back(GenJet_eta_);
+ GenJet_phi.push_back(GenJet_phi_);
+ GenJet_mass.push_back(GenJet_mass_);
+ }
+ void SetObjectNumGen(unsigned nGenPart_, unsigned nGenJet_){
+ nGenPart = nGenPart_;
+ nGenJet = nGenJet_;
+ }
+ void Initialize(){
+ passedFiducialSelection=false;
+ nGenPart = 0; nGENLeptons=0;nGenJet = 0; GENMH = 0; GENmassZZ= 0; GENpTZZ= 0; GENnjets_pt30_eta4p7=0;GENnjets_pt30_eta2p5=0;
+ GENpt_leadingjet_pt30_eta4p7=0; GENpt_leadingjet_pt30_eta2p5=0;nVECZ=0;GENmass4l=-99;GENmass4e=-99;GENmass4mu=-99; GENmass2e2mu=-99;
+ GENmassZ1=0;GENmassZ2=0;GENpT4l=0;GENeta4l=-99;GENrapidity4l=-99;GENphi4l=-99;
+ GENZ_DaughtersId[0]=0;GENZ_DaughtersId[1]=0;
+ for (int i=0; i<4; i++) {GENlep_Hindex[i]=-1;}
+ GenPart_pt.clear(); GenPart_eta.clear(); GenPart_phi.clear(); GenPart_mass.clear(); GenPart_pdgId.clear();GenPart_status.clear();GenPart_statusFlags.clear(); GenPart_genPartIdxMother.clear();
+ GenJet_pt.clear(); GenJet_eta.clear(); GenJet_phi.clear(); GenJet_mass.clear();
+ GENZ_phi.clear(); GENZ_pt.clear(); GENZ_eta.clear(); GENZ_mass.clear();GENZ_MomId.clear();
+ GENH_phi.clear(); GENH_pt.clear(); GENH_eta.clear(); GENH_mass.clear();
+ GENjet_pt.clear();GENjet_eta.clear();GENjet_phi.clear();GENjet_mass.clear();
+ GENlep_eta.clear();GENlep_pt.clear();GENlep_phi.clear();GENlep_mass.clear();GENlep_id.clear();GENlep_status.clear();GENlep_MomMomId.clear();GENlep_MomId.clear();GENlep_RelIso.clear();
+ flag4e=0; flag4mu=0; flag2e2mu=0;flagpassZ1=0;flagpassFid=0;
+
+ }
+ int motherID(int Genidx);
+ int mothermotherID(int Genidx);
+ void SetGenVariables();
+ bool mZ1_mZ2(unsigned int& L1, unsigned int& L2, unsigned int& L3, unsigned int& L4, bool makeCuts);
+
+
+ private:
+ std::vector GenPart_pt;
+ std::vector GenPart_eta;
+ std::vector GenPart_phi;
+ std::vector GenPart_mass;
+ std::vector GenPart_pdgId;
+ std::vector GenPart_status;
+ std::vector GenPart_statusFlags;
+ std::vector GenPart_genPartIdxMother;
+
+ std::vector GenJet_pt;
+ std::vector GenJet_eta;
+ std::vector GenJet_phi;
+ std::vector GenJet_mass;
+
+ unsigned nGenPart, nGenJet;
+};
+GenAnalysis::GenAnalysis(){
+ // FIXME: Add the values to the yaml file
+ genIsoConeSizeEl=0.3; genIsoConeSizeMu=0.3;
+ genIsoCutEl=0.35; genIsoCutMu=0.35;
+ leadingPtCut=20;subleadingPtCut=10;
+ nGEN4e=0; nGEN4mu=0; nGEN2e2mu=0;nGEN4epassZ1=0;nGEN4epassFid=0;nGEN4mupassZ1=0;nGEN4mupassFid=0;nGEN2e2mupTEtaisocuts=0;nGEN2e2mupassZ1=0;nGEN2e2mupassFid=0;
+}
+#endif
diff --git a/interface/H4LTools.h b/interface/H4LTools.h
index 7336cc3..3cbfafe 100644
--- a/interface/H4LTools.h
+++ b/interface/H4LTools.h
@@ -12,11 +12,12 @@
class H4LTools {
public:
- H4LTools(int year);
+ H4LTools(int year, bool isMC_);
float elePtcut, MuPtcut, eleEtacut, MuEtacut, elesip3dCut, Musip3dCut,Zmass,MZ1cut,MZcutup,MZcutdown,MZZcut,HiggscutUp,HiggscutDown;
float eleLoosedxycut,eleLoosedzcut,MuLoosedxycut,MuLoosedzcut,MuTightdxycut,MuTightdzcut,MuTightTrackerLayercut,MuTightpTErrorcut,MuHighPtBound,eleIsocut,MuIsocut;
float fsrphotonPtcut,fsrphotonEtacut,fsrphotonIsocut,fsrphotondRlcut,fsrphotondRlOverPtcut, JetPtcut,JetEtacut;
float eleBDTWPLELP,eleBDTWPMELP,eleBDTWPHELP,eleBDTWPLEHP,eleBDTWPMEHP,eleBDTWPHEHP;
+ bool RecoFourMuEvent, RecoFourEEvent, RecoTwoETwoMuEvent, RecoTwoMuTwoEEvent;
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_;
@@ -114,6 +115,9 @@ class H4LTools {
void SetMuonsGen(int Muon_genPartIdx_){
Muon_genPartIdx.push_back(Muon_genPartIdx_);
}
+ void SetElectronsGen(int Electron_genPartIdx_){
+ Electron_genPartIdx.push_back(Electron_genPartIdx_);
+ }
/*void SetMuons(TTreeReaderArray *Muon_pt_, TTreeReaderArray *Muon_eta_,
TTreeReaderArray *Muon_phi_, TTreeReaderArray *Muon_mass_, TTreeReaderArray *Muon_isGlobal_, TTreeReaderArray *Muon_isTracker_,
TTreeReaderArray *Muon_dxy_, TTreeReaderArray *Muon_dz_,TTreeReaderArray *Muon_sip3d_, TTreeReaderArray *Muon_ptErr_,
@@ -137,12 +141,14 @@ class H4LTools {
Muon_genPartIdx = Muon_genPartIdx_;
}*/
void SetFsrPhotons(float FsrPhoton_dROverEt2_, float FsrPhoton_eta_,
- float FsrPhoton_phi_, float FsrPhoton_pt_, float FsrPhoton_relIso03_){
+ float FsrPhoton_phi_, float FsrPhoton_pt_, float FsrPhoton_relIso03_, int FsrPhoton_electronIdx_, int FsrPhoton_muonIdx_){
FsrPhoton_dROverEt2.push_back(FsrPhoton_dROverEt2_);
FsrPhoton_phi.push_back(FsrPhoton_phi_);
FsrPhoton_eta.push_back(FsrPhoton_eta_);
FsrPhoton_pt.push_back(FsrPhoton_pt_);
FsrPhoton_relIso03.push_back(FsrPhoton_relIso03_);
+ FsrPhoton_electronIdx.push_back(FsrPhoton_electronIdx_);
+ FsrPhoton_muonIdx.push_back(FsrPhoton_muonIdx_);
}
/*void SetFsrPhotons(TTreeReaderArray *FsrPhoton_dROverEt2_, TTreeReaderArray *FsrPhoton_eta_,
TTreeReaderArray *FsrPhoton_phi_, TTreeReaderArray *FsrPhoton_pt_,
@@ -169,7 +175,7 @@ class H4LTools {
void SetObjectNumGen(unsigned nGenPart_){
nGenPart = nGenPart_;
}
-
+ bool isMC;
std::vector goodLooseElectrons2012();
std::vector goodLooseMuons2012();
std::vector goodMuons2015_noIso_noPf(std::vector Muonindex);
@@ -178,7 +184,9 @@ class H4LTools {
std::vector passTight_Id();
std::vector goodFsrPhotons();
unsigned doFsrRecovery(TLorentzVector Lep);
+ unsigned doFsrRecovery_Run3(std::vector goodfsridx, unsigned lepidx, int lepflavor);//lepflavor 11 or 13
std::vector BatchFsrRecovery(std::vector LepList);
+ void BatchFsrRecovery_Run3();
std::vector ElectronFsr();
std::vector MuonFsr();
std::vector ElectronFsrPt();
@@ -188,12 +196,15 @@ class H4LTools {
std::vector MuonFsrEta();
std::vector MuonFsrPhi();
std::vector SelectedJets(std::vector ele, std::vector mu);
-
+ std::vector Electrondressed_Run3;
+ std::vector Muondressed_Run3;
std::vector Zlist;
std::vector Zlistnofsr;
std::vector Zflavor; //mu->13, e->11
std::vector Zlep1index;
std::vector Zlep2index;
+ std::vector Zlep1lepindex;
+ std::vector Zlep2lepindex;
std::vector Zlep1pt;
std::vector Zlep1eta;
std::vector Zlep1phi;
@@ -213,11 +224,12 @@ class H4LTools {
std::vector Zlep2phiNoFsr;
std::vector Zlep2massNoFsr;
std::vector jetidx;
-
int nTightEle;
int nTightMu;
int nTightEleChgSum;
int nTightMuChgSum;
+ int njets_pt30_eta4p7;
+ int Lepointer;
bool flag4e;
bool flag4mu;
@@ -238,22 +250,48 @@ class H4LTools {
std::vector Muiso,Eiso;
std::vector Eid;
std::vector muid;
+ std::vector lep_genindex;
+ std::vector TightElelep_index;
+ std::vector TightMulep_index;
+ int lep_Hindex[4];
+ TLorentzVector Z1;
+ TLorentzVector Z1nofsr;
+ TLorentzVector Z2;
+ TLorentzVector Z2nofsr;
+ TLorentzVector ZZsystem;
+ TLorentzVector ZZsystemnofsr;
std::vector TightEleindex;
std::vector TightMuindex;
void Initialize(){
+ looseEle.clear();
+ looseMu.clear();
+ bestEle.clear();
+ bestMu.clear();
+ tighteleforjetidx.clear();
+ tightmuforjetidx.clear();
+ Electronindex.clear();
+ Muonindex.clear();
+ AllEid.clear();
+ AllMuid.clear();
+ Elelist.clear();
+ Mulist.clear();
+ ElelistFsr.clear();
+ MulistFsr.clear();
Electron_pt.clear();Electron_phi.clear();Electron_eta.clear();Electron_mass.clear();Electron_dxy.clear();Electron_dz.clear();Electron_sip3d.clear();
- Electron_mvaFall17V2Iso.clear();Electron_pdgId.clear();Electron_pfRelIso03_all.clear();
+ Electron_mvaFall17V2Iso.clear();Electron_pdgId.clear();Electron_genPartIdx.clear();Electron_pfRelIso03_all.clear();
Muon_pt.clear();Muon_phi.clear();Muon_eta.clear();Muon_mass.clear();Muon_dxy.clear();Muon_dz.clear();Muon_sip3d.clear();Muon_ptErr.clear();Muon_pfRelIso03_all.clear();
Muon_nTrackerLayers.clear();Muon_genPartIdx.clear();Muon_pdgId.clear();Muon_charge.clear();
Muon_isTracker.clear();Muon_isGlobal.clear();Muon_isPFcand.clear();
Jet_pt.clear();Jet_phi.clear();Jet_eta.clear();Jet_mass.clear();Jet_btagDeepC.clear();
- Jet_jetId.clear();Jet_puId.clear();
- FsrPhoton_dROverEt2.clear();FsrPhoton_phi.clear();FsrPhoton_eta.clear();FsrPhoton_pt.clear();FsrPhoton_relIso03.clear();
+ Jet_jetId.clear();Jet_puId.clear(); Zlep1lepindex.clear();Zlep2lepindex.clear();
+ FsrPhoton_dROverEt2.clear();FsrPhoton_phi.clear();FsrPhoton_eta.clear();FsrPhoton_pt.clear();FsrPhoton_relIso03.clear(); FsrPhoton_electronIdx.clear(); FsrPhoton_muonIdx.clear();
GenPart_pt.clear();
Zlist.clear();
Zlistnofsr.clear();
Zflavor.clear();
+ Electrondressed_Run3.clear();
+ Muondressed_Run3.clear();
Zlep1index.clear();
Zlep2index.clear();
Zlep1pt.clear(); Zlep1eta.clear(); Zlep1phi.clear(); Zlep1mass.clear();
@@ -261,12 +299,20 @@ class H4LTools {
Zlep1chg.clear(); Zlep2chg.clear();
Zlep1ptNoFsr.clear(); Zlep1etaNoFsr.clear(); Zlep1phiNoFsr.clear(); Zlep1massNoFsr.clear();
Zlep2ptNoFsr.clear(); Zlep2etaNoFsr.clear(); Zlep2phiNoFsr.clear(); Zlep2massNoFsr.clear();
- jetidx.clear();
+ jetidx.clear(); lep_genindex.clear(); TightElelep_index.clear();TightMulep_index.clear();
looseEle.clear(); looseMu.clear(); bestEle.clear(); bestMu.clear(); tighteleforjetidx.clear(); tightmuforjetidx.clear();
Electronindex.clear(); Muonindex.clear(); AllEid.clear(); AllMuid.clear(); Elelist.clear(); Mulist.clear(); ElelistFsr.clear(); Mulist.clear();
Elechg.clear(); Muchg.clear(); Muiso.clear();Eiso.clear(); Eid.clear(); muid.clear(); TightEleindex.clear(); TightMuindex.clear();
+ for (int i=0; i<4; i++) {lep_Hindex[i]=-1;}
+ Z1.SetPtEtaPhiM(0,0,0,0);
+ Z1nofsr.SetPtEtaPhiM(0,0,0,0);
+ Z2.SetPtEtaPhiM(0,0,0,0);
+ Z2nofsr.SetPtEtaPhiM(0,0,0,0);
+ ZZsystem.SetPtEtaPhiM(0,0,0,0);
+ ZZsystemnofsr.SetPtEtaPhiM(0,0,0,0);
nElectron = 0; nMuon = 0; nJet = 0; nFsrPhoton = 0; nGenPart = 0;
nTightEle = 0; nTightMu = 0; nTightEleChgSum = 0; nTightMuChgSum = 0;
+ Lepointer = 0;
pTL1 = -999; etaL1 = -999; phiL1 = -999; massL1 = -999;
pTL2 = -999; etaL2 = -999; phiL2 = -999; massL2 = -999;
@@ -275,7 +321,8 @@ class H4LTools {
pTj1 = -99; etaj1 = -99; phij1 = -99; mj1 = -99;
pTj2 = -99; etaj2 = -99; phij2 = -99; mj2 = -99;
-
+ njets_pt30_eta4p7 = 0;
+ RecoFourMuEvent=false; RecoFourEEvent=false; RecoTwoETwoMuEvent=false; RecoTwoMuTwoEEvent=false;
flag4e=false; flag4mu=false; flag2e2mu=false;
}
bool isFSR=true;
@@ -286,12 +333,6 @@ class H4LTools {
TSpline *spline_L1Zgs;
bool findZCandidate();
bool ZZSelection();
- TLorentzVector Z1;
- TLorentzVector Z1nofsr;
- TLorentzVector Z2;
- TLorentzVector Z2nofsr;
- TLorentzVector ZZsystem;
- TLorentzVector ZZsystemnofsr;
Mela* mela;
float me_0plus_JHU, me_qqZZ_MCFM, p0plus_m4l, bkg_m4l;
@@ -313,7 +354,7 @@ class H4LTools {
private:
std::vector Electron_pt,Electron_phi,Electron_eta,Electron_mass,Electron_dxy,Electron_dz,Electron_sip3d;
std::vector Electron_mvaFall17V2Iso,Electron_pfRelIso03_all;
- std::vector Electron_pdgId;
+ std::vector Electron_pdgId,Electron_genPartIdx;
std::vector Jet_pt,Jet_phi,Jet_eta,Jet_mass,Jet_btagDeepC;
std::vector Jet_jetId,Jet_puId;
@@ -322,7 +363,7 @@ class H4LTools {
std::vector Muon_nTrackerLayers,Muon_genPartIdx,Muon_pdgId,Muon_charge;
std::vector Muon_isTracker,Muon_isGlobal,Muon_isPFcand;
- std::vector FsrPhoton_dROverEt2,FsrPhoton_phi,FsrPhoton_pt,FsrPhoton_relIso03,FsrPhoton_eta;
+ std::vector FsrPhoton_dROverEt2,FsrPhoton_phi,FsrPhoton_pt,FsrPhoton_relIso03,FsrPhoton_eta,FsrPhoton_muonIdx,FsrPhoton_electronIdx;
std::vector GenPart_pt;
@@ -333,7 +374,8 @@ class H4LTools {
};
-H4LTools::H4LTools(int year){
+H4LTools::H4LTools(int year, bool isMC_){
+ isMC = isMC_;
std::cout<<"year"<<" "<setCandidateDecayMode(TVar::CandidateDecay_ZZ);
diff --git a/keep_and_drop.txt b/keep_and_drop.txt
index 6e6d10a..36ed0c7 100644
--- a/keep_and_drop.txt
+++ b/keep_and_drop.txt
@@ -5,13 +5,25 @@ drop * # start with all
keep run
keep event
keep lumi*
+keep BeamSpot*
+#
+#
+# GEN
+#keep GenFilter*
+#
+# Others
+#keep LowPtElectron*
+#keep nLowPtElectron*
+keep OtherPV*
+keep nOtherPV*
+keep PV*
#
#
# Trigger
#
-keep HLT*
+#keep HLT*
#
-keep Flag*
+#keep Flag*
#
#
keep *4l
@@ -23,66 +35,74 @@ keep *L3
keep *L4
keep *j1
keep *j2
+keep pass*
+keep GEN*
+keep njet*
keep D_*
+keep lep*
+keep *Weight
+keep *Weight*
# keep nPhoton
# keep Photon*
-keep nElectron
-keep Electron*
-keep nMuon
-keep Muon*
+# keep nElectron
+# keep Electron*
+# keep nMuon
+# keep Muon*
# keep nTau
# keep Tau*
-keep HTXS*
-keep btag*
-keep CaloMET*
-keep ChsMET*
-keep nCorrT1METJet
-keep CorrT1METJet*
-keep DeepMET*
-keep nFatJet
-keep FatJet*
-keep nGenJetAK8
-keep GenJetAK8*
-keep nGenJet
-keep GenJet*
-keep nGenPart
-keep GenPart*
-keep nSubGenJetAK8
-keep SubGenJetAK8*
-keep Generator*
-keep GenV*
-keep gen*
+# keep HTXS*
+# keep btag*
+# keep CaloMET*
+# keep ChsMET*
+# keep nCorrT1METJet
+# keep CorrT1METJet*
+# keep DeepMET*
+# keep nFatJet
+# keep FatJet*
+# keep nGenJetAK8
+# keep GenJetAK8*
+# keep nGenJet
+# keep GenJet*
+# keep nGenPart
+# keep GenPart*
+# keep nSubGenJetAK8
+# keep SubGenJetAK8*
+# keep Generator*
+# keep GenV*
+# keep gen*
keep LHE*
keep nLHE*
-keep nPSWeight
-keep PSWeight*
-keep nIsoTrack
-keep IsoTrack*
-keep nJet
-keep Jet*
-keep L1PreFiring*
-keep nLowPtElectron
-keep LowPtElectron*
-keep GenMET*
-keep MET*
+keep nPS*
+keep PS*
+#keep nIsoTrack
+#keep IsoTrack*
+#keep nJet
+#keep Jet*
+#keep L1*
+#keep nLowPtElectron
+#keep LowPtElectron*
+#keep GenMET*
+#keep MET*
keep Pileup*
keep PuppiMET*
-keep RawMET*
-keep RawPuppiMET*
-keep fixedGridRho*
-keep nGenDressedLepton
-keep GenDressedLepton*
-keep nSubJet
-keep SubJet*
-keep TkMET*
-keep genTtbarId
+#keep RawMET*
+#keep RawPuppiMET*
+#keep fixedGridRho*
+#keep Rho_*
+#keep nGenDressedLepton
+#keep GenDressedLepton*
+#keep nSubJet
+#keep SubJet*
+#keep TkMET*
+#keep genTtbarId
keep nOtherPV
keep OtherPV*
keep PV*
-keep nSV
-keep SV*
-keep Electron_gen*
-keep FatJet_*
-keep Gen*
-keep Jet_*
-keep Muon*
+#keep nSV
+#keep SV*
+#keep Electron_gen*
+#keep FatJet_*
+#keep Gen*
+keep genWeight
+#keep Jet_*
+#keep Muon*
diff --git a/keep_and_drop_data.txt b/keep_and_drop_data.txt
new file mode 100644
index 0000000..6d02de8
--- /dev/null
+++ b/keep_and_drop_data.txt
@@ -0,0 +1,81 @@
+# this is a comment
+drop * # start with all
+#
+#
+keep run
+keep event
+keep lumi*
+keep BeamSpot*
+# Others
+#keep LowPtElectron*
+#keep nLowPtElectron*
+keep OtherPV*
+keep nOtherPV*
+keep PV*
+#
+#
+# Trigger
+#
+#keep HLT*
+#
+#keep Flag*
+#
+#
+keep *4l
+keep *Z1
+keep *Z2
+keep *L1
+keep *L2
+keep *L3
+keep *L4
+keep *j1
+keep *j2
+keep pass*
+#keep GEN*
+keep njet*
+keep D_*
+keep lep*
+keep *Weight
+keep *Weight*
+#keep nPhoton
+#keep Photon*
+#keep nElectron
+#keep Electron*
+#keep nMuon
+#keep Muon*
+#keep nTau
+#keep Tau*
+#keep HTXS*
+#keep btag*
+#keep CaloMET*
+#keep ChsMET*
+#keep nCorrT1METJet
+#keep CorrT1METJet*
+#keep DeepMET*
+#keep nFatJet
+#keep FatJet*
+#keep nIsoTrack
+#keep IsoTrack*
+#keep nJet
+#keep Jet*
+#keep L1*
+#keep nLowPtElectron
+#keep LowPtElectron*
+#keep MET*
+keep Pileup*
+keep PuppiMET*
+#keep RawMET*
+#keep RawPuppiMET*
+#keep fixedGridRho*
+#keep Rho_*
+#keep nSubJet
+#keep SubJet*
+#keep TkMET*
+keep nOtherPV
+keep OtherPV*
+keep PV*
+#keep nSV
+#keep SV*
+#keep FatJet_*
+#keep Jet_*
+#keep Muon*
diff --git a/nano_changes.patch b/nano_changes.patch
new file mode 100644
index 0000000..bbd85f0
--- /dev/null
+++ b/nano_changes.patch
@@ -0,0 +1,26 @@
+diff --git a/python/postprocessing/modules/jme/fatJetUncertainties.py b/python/postprocessing/modules/jme/fatJetUncertainties.py
+index d0b5b89..2ada36f 100644
+--- a/python/postprocessing/modules/jme/fatJetUncertainties.py
++++ b/python/postprocessing/modules/jme/fatJetUncertainties.py
+@@ -112,7 +112,7 @@ class fatJetUncertaintiesProducer(Module):
+ self.doGroomed = False
+ else:
+ raise ValueError("ERROR: Invalid jet type = '%s'!" % jetType)
+- self.rhoBranchName = "fixedGridRhoFastjetAll"
++ self.rhoBranchName = "Rho_fixedGridRhoFastjetAll"
+ self.lenVar = "n" + self.jetBranchName
+
+ # jet mass scale
+diff --git a/python/postprocessing/modules/jme/jetmetUncertainties.py b/python/postprocessing/modules/jme/jetmetUncertainties.py
+index cb31351..71e840a 100644
+--- a/python/postprocessing/modules/jme/jetmetUncertainties.py
++++ b/python/postprocessing/modules/jme/jetmetUncertainties.py
+@@ -46,7 +46,7 @@ class jetmetUncertaintiesProducer(Module):
+ else:
+ self.splitJERIDs = [""] # "empty" ID for the overall JER
+ self.metBranchName = metBranchName
+- self.rhoBranchName = "fixedGridRhoFastjetAll"
++ self.rhoBranchName = "Rho_fixedGridRhoFastjetAll"
+ # --------------------------------------------------------------------
+ # CV: globalTag and jetType not yet used in the jet smearer, as there
+ # is no consistent set of txt files for JES uncertainties and JER scale
diff --git a/post_proc.py b/post_proc.py
index c708eb0..91a444e 100755
--- a/post_proc.py
+++ b/post_proc.py
@@ -20,6 +20,7 @@ def parse_arguments():
parser.add_argument("-i", "--inputFile", default="", type=str, help="Input file name")
parser.add_argument("-n", "--entriesToRun", default=100, type=int, help="Set to 0 if need to run over all entries else put number of entries to run")
parser.add_argument("-d", "--DownloadFileToLocalThenRun", default=True, type=bool, help="Download file to local then run")
+ parser.add_argument("--NOsyst", default=False, action="store_true", help="Do not run systematics")
return parser.parse_args()
@@ -58,10 +59,21 @@ def main():
print("ERROR: No input files found. Exiting.")
exit(1)
- # Determine the year and type (MC or Data)
+ """Determine the year and type (MC or Data) of input ROOT file:
+ For data the string "/data/" is always there. So, we take this
+ as handle to decide if the root file is MC or data.
+ """
first_file = testfilelist[0]
isMC = "/data/" not in first_file
+ if "Summer22" in first_file or "Run2022" in first_file:
+ """Summer22 and Run2022 for identification of 2022 MC and data respectiverly
+ """
+ year = 2022
+ cfgFile = "Input_2022.yml"
+ jsonFileName = "golden_Json/Cert_Collisions2022_355100_362760_Golden.json"
+ sfFileName = "DeepCSV_102XSF_V2.csv" # FIXME: Update for year 2022
+ modulesToRun.extend([muonScaleRes2018()]) # FIXME: Update for year 2022
if "UL18" in first_file or "UL2018" in first_file:
"""UL2018 for identification of 2018 UL data and UL18 for identification of 2018 UL MC
"""
@@ -81,6 +93,7 @@ def main():
jsonFileName = "golden_Json/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt"
sfFileName = "DeepCSV_102XSF_V2.csv"
modulesToRun.extend([muonScaleRes2016()])
+
H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile, isMC, isFSR)
modulesToRun.extend([H4LCppModule()])
@@ -90,25 +103,32 @@ def main():
print("isFSR: {}".format(isFSR))
if isMC:
- jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs")
- fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi")
- # btagSF = lambda: btagSFProducer("UL"+str(year), algo="deepjet",selectedWPs=['L','M','T','shape_corr'], sfFileName=sfFileName)
- btagSF = lambda: btagSFProducer(era = "UL"+str(year), algo = "deepcsv")
- puidSF = lambda: JetSFMaker("%s" % year)
- modulesToRun.extend([jetmetCorrector(), fatJetCorrector(), puidSF()])
- # # modulesToRun.extend([jetmetCorrector(), fatJetCorrector(), btagSF(), puidSF()])
-
+ if (not args.NOsyst):
+ # FIXME: JES not used properly
+ #jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs")
+ #fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi")
+ # btagSF = lambda: btagSFProducer("UL"+str(year), algo="deepjet",selectedWPs=['L','M','T','shape_corr'], sfFileName=sfFileName)
+ btagSF = lambda: btagSFProducer(era = "UL"+str(year), algo = "deepcsv")
+ puidSF = lambda: JetSFMaker("%s" % year)
+ #modulesToRun.extend([jetmetCorrector(), fatJetCorrector()])#, puidSF()
+ # # modulesToRun.extend([jetmetCorrector(), fatJetCorrector(), btagSF(), puidSF()])
+
+ # FIXME: No PU weight for 2022
if year == 2018: modulesToRun.extend([puAutoWeight_2018()])
if year == 2017: modulesToRun.extend([puAutoWeight_2017()])
if year == 2016: modulesToRun.extend([puAutoWeight_2016()])
- p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=False,haddFileName="skimmed_nano_mc.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt")
+ # INFO: Keep the `fwkJobReport=False` to trigger `haddnano.py`
+ # otherwise the output file will have larger size then expected. Reference: https://github.com/cms-nanoAOD/nanoAOD-tools/issues/249
+ p=PostProcessor(".",testfilelist, None, None,modules = modulesToRun, provenance=True,fwkJobReport=True,haddFileName="skimmed_nano.root", maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop.txt")
else:
- jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs")
- fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi")
- modulesToRun.extend([jetmetCorrector(), fatJetCorrector()])
+ #if (not args.NOsyst):
+ # FIXME: JES not used properly
+ #jetmetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK4PFchs")
+ #fatJetCorrector = createJMECorrector(isMC=isMC, dataYear=year, jesUncert="All", jetType = "AK8PFPuppi")
+ #modulesToRun.extend([jetmetCorrector(), fatJetCorrector()])
- p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=False,haddFileName="skimmed_nano_data.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt")
+ p=PostProcessor(".",testfilelist, None, None, modules = modulesToRun, provenance=True, fwkJobReport=True,haddFileName="skimmed_nano.root", jsonInput=jsonFileName, maxEntries=entriesToRun, prefetch=DownloadFileToLocalThenRun, outputbranchsel="keep_and_drop_data.txt")
p.run()
diff --git a/src/GenAnalysis.cc b/src/GenAnalysis.cc
new file mode 100644
index 0000000..d1e6567
--- /dev/null
+++ b/src/GenAnalysis.cc
@@ -0,0 +1,413 @@
+#include "../interface/GenAnalysis.h"
+#include
+#include
+#include
+int GenAnalysis::motherID(int Genidx){
+ int ID=0;
+ while(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]!=2212 || abs(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]])!=21 || abs(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]])>6){
+ if(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]!=GenPart_pdgId[Genidx]){
+ ID=GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]; return ID;
+ }
+ else{
+ Genidx=GenPart_genPartIdxMother[Genidx];
+ }
+ }
+ return 2212;
+}
+int GenAnalysis::mothermotherID(int Genidx){
+ int ID=0;
+ while(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]!=2212 || abs(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]])!=21 || abs(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]])>6){
+ if(GenPart_pdgId[GenPart_genPartIdxMother[Genidx]]!=GenPart_pdgId[Genidx] && GenPart_pdgId[GenPart_genPartIdxMother[GenPart_genPartIdxMother[Genidx]]]!=GenPart_pdgId[Genidx] && GenPart_pdgId[GenPart_genPartIdxMother[GenPart_genPartIdxMother[Genidx]]]!=GenPart_pdgId[GenPart_genPartIdxMother[Genidx]] ){
+ ID=GenPart_pdgId[GenPart_genPartIdxMother[GenPart_genPartIdxMother[Genidx]]]; return ID;
+ }
+ else{
+ Genidx=GenPart_genPartIdxMother[Genidx];
+ }
+ }
+ return 2212;
+}
+void GenAnalysis::SetGenVariables(){
+ TLorentzVector GENmom1, GENmom2;
+ TLorentzVector LS3_Z1_1, LS3_Z1_2, LS3_Z2_1, LS3_Z2_2, GEN_HVec;
+ int GENmom1_id=-999, GENmom2_id=-999;
+ int counter_initParticle=0;
+ for(unsigned int genpidx=0; genpidx gen_fsrset;
+ for(size_t k=0; k=20 && GenPart_status[genpidx]<30) ){
+ GENZ_pt.push_back(GenPart_pt[genpidx]);
+ GENZ_eta.push_back(GenPart_eta[genpidx]);
+ GENZ_phi.push_back(GenPart_phi[genpidx]);
+ GENZ_mass.push_back(GenPart_mass[genpidx]);
+ GENZ_MomId.push_back(motherID(genpidx));
+ nVECZ++;
+ }
+ }
+ if (GENlep_pt.size()>=4) {
+
+ unsigned int L1_nocuts=99; unsigned int L2_nocuts=99; unsigned int L3_nocuts=99; unsigned int L4_nocuts=99;
+ bool passedFiducialSelectionNoCuts = mZ1_mZ2(L1_nocuts, L2_nocuts, L3_nocuts, L4_nocuts, false);
+ if (passedFiducialSelectionNoCuts) {
+ TLorentzVector Z1_1, Z1_2, Z2_1, Z2_2;
+ Z1_1.SetPtEtaPhiM(GENlep_pt[L1_nocuts],GENlep_eta[L1_nocuts],GENlep_phi[L1_nocuts],GENlep_mass[L1_nocuts]);
+ Z1_2.SetPtEtaPhiM(GENlep_pt[L2_nocuts],GENlep_eta[L2_nocuts],GENlep_phi[L2_nocuts],GENlep_mass[L2_nocuts]);
+ Z2_1.SetPtEtaPhiM(GENlep_pt[L3_nocuts],GENlep_eta[L3_nocuts],GENlep_phi[L3_nocuts],GENlep_mass[L3_nocuts]);
+ Z2_2.SetPtEtaPhiM(GENlep_pt[L4_nocuts],GENlep_eta[L4_nocuts],GENlep_phi[L4_nocuts],GENlep_mass[L4_nocuts]);
+ GENmassZZ = (Z1_1+Z1_2+Z2_1+Z2_2).M();
+ GENpTZZ = (Z1_1+Z1_2+Z2_1+Z2_2).Pt();
+ int genfs;
+ if (abs(GENlep_id[L1_nocuts])==abs(GENlep_id[L3_nocuts])) genfs=1;
+ else genfs=2;
+ }
+
+ }
+ /////// DO THE FIDUCIAL VOLUME CALCULATION //////////////
+ passedFiducialSelection=false;
+ int nFiducialLeptons = 0;
+ int nFiducialPtLead=0;
+ int nFiducialPtSublead=0;
+
+ int nGENe, nGENmu;
+ nGENe=0; nGENmu=0;
+ for (unsigned int i=0; i 5.0 && abs(thisLep.Eta()) < 2.4)
+ || (abs(GENlep_id[i]) == 11 && thisLep.Pt() > 7.0 && abs(thisLep.Eta()) < 2.5) )
+ && GENlep_RelIso[i]<((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu) ) {
+ nFiducialLeptons++;
+ if (thisLep.Pt()>leadingPtCut) nFiducialPtLead++;
+ if (thisLep.Pt()>subleadingPtCut) nFiducialPtSublead++;
+ }
+ if (abs(GENlep_id[i]) == 13) nGENmu++;
+ if (abs(GENlep_id[i]) == 11) nGENe++;
+ }
+ if(nGENmu>3) {flag4mu++;nGEN4mu++;}
+ if(nGENe>3) {flag4e++;nGEN4e++;}
+ if((nGENe>1)&&(nGENmu>1)) {flag2e2mu++;nGEN2e2mu++;}
+ if (nFiducialLeptons>=4 && nFiducialPtLead>=1 && nFiducialPtSublead>=2 ){
+ // START FIDUCIAL EVENT TOPOLOGY CUTS
+ unsigned int L1=99; unsigned int L2=99; unsigned int L3=99; unsigned int L4=99;
+ GENmass4l = -1.0; GENmass4e = -1.0; GENmass4mu = -1.0; GENmass2e2mu = -1.0;
+ GENmassZ1 = -1.0; GENmassZ2 = -1.0; GENpT4l = -1.0; GENeta4l = 999.; GENrapidity4l = 999.; GENphi4l = 999.;
+ GENpT4lj = -1.0; GENpT4ljj=-1.0; GENmass4lj = -1.0; GENmass4ljj=-1.0;
+
+ passedFiducialSelection = mZ1_mZ2(L1, L2, L3, L4, true);
+ if(flag2e2mu){
+ if(flagpassZ1){
+ nGEN2e2mupassZ1++;
+ if(flagpassFid){
+ nGEN2e2mupassFid++;
+ }
+ }
+ }
+ if(flag4e){
+ if(flagpassZ1){
+ nGEN4epassZ1++;
+ if(flagpassFid){
+ nGEN4epassFid++;
+ }
+ }
+ }
+ if(flag4mu){
+ if(flagpassZ1){
+ nGEN4mupassZ1++;
+ if(flagpassFid){
+ nGEN4mupassFid++;
+ }
+ }
+ }
+ GENlep_Hindex[0] = L1; GENlep_Hindex[1] = L2; GENlep_Hindex[2] = L3; GENlep_Hindex[3] = L4;
+ if (passedFiducialSelection) {
+
+ // TLorentzVector LS3_Z1_1, LS3_Z1_2, LS3_Z2_1, LS3_Z2_2;
+ LS3_Z1_1.SetPtEtaPhiM(GENlep_pt[L1],GENlep_eta[L1],GENlep_phi[L1],GENlep_mass[L1]);
+ LS3_Z1_2.SetPtEtaPhiM(GENlep_pt[L2],GENlep_eta[L2],GENlep_phi[L2],GENlep_mass[L2]);
+ LS3_Z2_1.SetPtEtaPhiM(GENlep_pt[L3],GENlep_eta[L3],GENlep_phi[L3],GENlep_mass[L3]);
+ LS3_Z2_2.SetPtEtaPhiM(GENlep_pt[L4],GENlep_eta[L4],GENlep_phi[L4],GENlep_mass[L4]);
+ GEN_HVec = LS3_Z1_1 + LS3_Z1_2 + LS3_Z2_1 + LS3_Z2_2;
+
+ GENmass4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).M();
+
+ if (abs(GENlep_id[L1])==11 && abs(GENlep_id[L3])==11) {GENmass4e = GENmass4l;}
+ if (abs(GENlep_id[L1])==13 && abs(GENlep_id[L3])==13) {GENmass4mu = GENmass4l;}
+ if ( (abs(GENlep_id[L1])==11 || abs(GENlep_id[L1])==13) &&
+ (abs(GENlep_id[L3])==11 || abs(GENlep_id[L3])==13) &&
+ (abs(GENlep_id[L1])!=abs(GENlep_id[L3]) ) ) {GENmass2e2mu = GENmass4l;}
+ GENpT4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Pt();
+ GENeta4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Eta();
+ GENphi4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Phi();
+ GENrapidity4l = (LS3_Z1_1+LS3_Z1_2+LS3_Z2_1+LS3_Z2_2).Rapidity();
+ GENmassZ1 = (LS3_Z1_1+LS3_Z1_2).M();
+ GENmassZ2 = (LS3_Z2_1+LS3_Z2_2).M();
+
+ int tmpIdL1,tmpIdL2,tmpIdL3,tmpIdL4;
+ TLorentzVector GENL11P4, GENL12P4, GENL21P4, GENL22P4;
+ if(GENlep_id[L1] < 0){ GENL11P4.SetPxPyPzE(LS3_Z1_1.Px(),LS3_Z1_1.Py(),LS3_Z1_1.Pz(),LS3_Z1_1.E()); tmpIdL1 = GENlep_id[L1];}
+ else{ GENL11P4.SetPxPyPzE(LS3_Z1_2.Px(),LS3_Z1_2.Py(),LS3_Z1_2.Pz(),LS3_Z1_2.E()); tmpIdL1 = GENlep_id[L2];}
+ if(GENlep_id[L2] > 0){ GENL12P4.SetPxPyPzE(LS3_Z1_2.Px(),LS3_Z1_2.Py(),LS3_Z1_2.Pz(),LS3_Z1_2.E()); tmpIdL2 = GENlep_id[L2];}
+ else{ GENL12P4.SetPxPyPzE(LS3_Z1_1.Px(),LS3_Z1_1.Py(),LS3_Z1_1.Pz(),LS3_Z1_1.E()); tmpIdL2 = GENlep_id[L1];}
+ if(GENlep_id[L3] < 0){ GENL21P4.SetPxPyPzE(LS3_Z2_1.Px(),LS3_Z2_1.Py(),LS3_Z2_1.Pz(),LS3_Z2_1.E()); tmpIdL3 = GENlep_id[L3];}
+ else{ GENL21P4.SetPxPyPzE(LS3_Z2_2.Px(),LS3_Z2_2.Py(),LS3_Z2_2.Pz(),LS3_Z2_2.E()); tmpIdL3 = GENlep_id[L4];}
+ if(GENlep_id[L4] > 0) { GENL22P4.SetPxPyPzE(LS3_Z2_2.Px(),LS3_Z2_2.Py(),LS3_Z2_2.Pz(),LS3_Z2_2.E()); tmpIdL4 = GENlep_id[L4];}
+ else{ GENL22P4.SetPxPyPzE(LS3_Z2_1.Px(),LS3_Z2_1.Py(),LS3_Z2_1.Pz(),LS3_Z2_1.E()); tmpIdL4 = GENlep_id[L3];}
+
+ }
+ bool passedMassOS = true; bool passedElMuDeltaR = true; bool passedDeltaR = true;
+ unsigned int N=GENlep_pt.size();
+ for(unsigned int i = 0; i GEN_goodJetsidx;
+
+ for(unsigned genjetidx=0; genjetidx4.7) continue;
+
+ bool inDR_pt30_eta4p7 = false;
+ unsigned int N=GENlep_pt.size();
+ TLorentzVector thisJ;
+ thisJ.SetPtEtaPhiM(GenJet_pt[genjetidx],GenJet_eta[genjetidx],GenJet_phi[genjetidx],GenJet_mass[genjetidx]);
+ for(unsigned int i = 0; iGENpt_leadingjet_pt30_eta4p7) {
+ GENpt_leadingjet_pt30_eta4p7=pt;
+ }
+ if (abs(thisJ.Eta())<2.5) {
+ GENnjets_pt30_eta2p5++;
+ if (pt>GENpt_leadingjet_pt30_eta2p5) {
+ GENpt_leadingjet_pt30_eta2p5=pt;
+ }
+ }
+ }
+ }// loop over gen jets
+
+ }
+
+ }
+ return;
+}
+
+bool GenAnalysis::mZ1_mZ2(unsigned int& L1, unsigned int& L2, unsigned int& L3, unsigned int& L4, bool makeCuts)
+{
+ // Reference: https://github.com/qyguo/UFHZZAnalysisRun2/blob/e51073652729067c8be7c1334f749aae76931a7b/UFHZZ4LAna/src/UFHZZ4LAna.cc#L9009
+
+ double offshell = 999.0; bool findZ1 = false; bool passZ1 = false;
+
+ L1 = 0; L2 = 0;
+
+ unsigned int N = GENlep_pt.size();
+
+ for(unsigned int i=0; i 2.4)) continue;
+ if ( abs(GENlep_id[i]) == 11 && (li.Pt() < 7.0 || abs(li.Eta()) > 2.5)) continue;
+ if ( GENlep_RelIso[i]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue;
+
+ if ( abs(GENlep_id[j]) == 13 && (lj.Pt() < 5.0 || abs(lj.Eta()) > 2.4)) continue;
+ if ( abs(GENlep_id[j]) == 11 && (lj.Pt() < 7.0 || abs(lj.Eta()) > 2.5)) continue;
+ if ( GENlep_RelIso[j]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue;
+ }
+
+ TLorentzVector mll = li+lj;
+
+ if(abs(mll.M()-Zmass)40 && ml1l2.M()<120 && findZ1) passZ1 = true;
+ if (!makeCuts) passZ1 = true;
+ if (makeCuts && passZ1) flagpassZ1++;
+
+ double pTL34 = 0.0; bool findZ2 = false;
+ //bool m4lwindow=false; double window_lo=70.0; double window_hi=140.0;
+
+ //cout<<"findZ2"< 2.4)) continue;
+ if ( abs(GENlep_id[i]) == 11 && (li.Pt() < 7.0 || abs(li.Eta()) > 2.5)) continue;
+ if ( GENlep_RelIso[i]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue;
+
+ if ( abs(GENlep_id[j]) == 13 && (lj.Pt() < 5.0 || abs(lj.Eta()) > 2.4)) continue;
+ if ( abs(GENlep_id[j]) == 11 && (lj.Pt() < 7.0 || abs(lj.Eta()) > 2.5)) continue;
+ if ( GENlep_RelIso[j]>((abs(GENlep_id[i])==11)?genIsoCutEl:genIsoCutMu)) continue;
+ }
+
+ if ( (li.Pt()+lj.Pt())>=pTL34 ) {
+ double mZ2 = Z2.M();
+ if( (mZ2>12 && mZ2<120) || (!makeCuts) ) {
+ L3 = i; L4 = j; findZ2 = true;
+ pTL34 = li.Pt()+lj.Pt();
+ //if (m4l>window_lo && m4l H4LTools::SelectedJets(std::vector ele,
//unsigned nJ = (*nJet).Get()[0];
for(unsigned int i=0;iJetPtcut)&&(fabs(Jet_eta[i])0)&&(Jet_puId[i]==7)){
+ if((Jet_jetId[i]>0)&&((Jet_pt[i]>50)||(Jet_puId[i]==7))){
int overlaptag=0;
TLorentzVector jettest;
jettest.SetPtEtaPhiM(Jet_pt[i],Jet_eta[i],Jet_phi[i],Jet_mass[i]);
@@ -133,7 +133,7 @@ std::vector H4LTools::SelectedJets(std::vector ele,
}
}
}
-
+ njets_pt30_eta4p7 = goodJets.size();
return goodJets;
}
@@ -163,6 +163,59 @@ unsigned H4LTools::doFsrRecovery(TLorentzVector Lep){
}
+unsigned H4LTools::doFsrRecovery_Run3(std::vector goodfsridx, unsigned lepidx, int lepflavor){//lepflavor 11 or 13
+
+ unsigned matchedfsridx = 999;
+ if(lepflavor == 11){
+ for(unsigned fsridx=0; fsridx fsrlist;
+ fsrlist = goodFsrPhotons();
+ for(unsigned int i=0; i H4LTools::BatchFsrRecovery(std::vector LepList){
std::vector LepFsrList;
@@ -207,7 +260,55 @@ std::vector H4LTools::MuonFsr(){
leplistfsr = BatchFsrRecovery(leplist);
return leplistfsr;
}
+
std::vector H4LTools::ElectronFsrPt(){
+ std::vector lepPt;
+ for (unsigned int i=0;i H4LTools::ElectronFsrEta(){
+ std::vector lepEta;
+ for (unsigned int i=0;i H4LTools::ElectronFsrPhi(){
+ std::vector lepPhi;
+ for (unsigned int i=0;i H4LTools::MuonFsrPt(){
+ std::vector lepPt;
+ for (unsigned int i=0;i H4LTools::MuonFsrEta(){
+ std::vector lepEta;
+ for (unsigned int i=0;i H4LTools::MuonFsrPhi(){
+ std::vector lepPhi;
+ for (unsigned int i=0;i H4LTools::ElectronFsrPt(){
std::vector lepPt;
std::vector leplistfsr;
leplistfsr = ElectronFsr();
@@ -265,7 +366,7 @@ std::vector H4LTools::MuonFsrPhi(){
lepPhi.push_back(leplistfsr[i].Phi());
}
return lepPhi;
-}
+}*/
void H4LTools::LeptonSelection(){
@@ -295,6 +396,7 @@ void H4LTools::LeptonSelection(){
TLorentzVector Ele;
Ele.SetPtEtaPhiM(Electron_pt[Electronindex[ie]],Electron_eta[Electronindex[ie]],Electron_phi[Electronindex[ie]],Electron_mass[Electronindex[ie]]);
Elelist.push_back(Ele);
+ ElelistFsr.push_back(Electrondressed_Run3[Electronindex[ie]]);
Eiso.push_back(Electron_pfRelIso03_all[Electronindex[ie]]);
Eid.push_back(AllEid[Electronindex[ie]]);
}
@@ -309,32 +411,43 @@ void H4LTools::LeptonSelection(){
TLorentzVector Mu;
Mu.SetPtEtaPhiM(Muon_pt[Muonindex[imu]],Muon_eta[Muonindex[imu]],Muon_phi[Muonindex[imu]],Muon_mass[Muonindex[imu]]);
Mulist.push_back(Mu);
+ MulistFsr.push_back(Muondressed_Run3[Muonindex[imu]]);
muid.push_back(AllMuid[Muonindex[imu]]);
Muiso.push_back(Muon_pfRelIso03_all[Muonindex[imu]]);
}
- ElelistFsr = BatchFsrRecovery(Elelist);
- MulistFsr = BatchFsrRecovery(Mulist);
+ //ElelistFsr = BatchFsrRecovery(Elelist);
+ //MulistFsr = BatchFsrRecovery(Mulist);
for(unsigned int ae=0; ae0.01){
+ RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt();
+ }
+ //FsrEleidx = doFsrRecovery(Elelist[ae]);
+ /*if(FsrEleidx<900){
TLorentzVector fsrele;
fsrele.SetPtEtaPhiM(FsrPhoton_pt[FsrEleidx],FsrPhoton_eta[FsrEleidx],FsrPhoton_phi[FsrEleidx],0);
std::cout<<"Ele correction: "<< std::endl;
if(Elelist[ae].DeltaR(fsrele)>0.01){
RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt();
}
- }
+ }*/
}
if((Eid[ae]==true)&&(RelEleIsoNoFsr<0.35)){
nTightEle++;
TightEleindex.push_back(ae);
nTightEleChgSum += Elechg[ae];
+ TightElelep_index.push_back(Lepointer);
+ Lepointer++;
+ if (isMC) lep_genindex.push_back(Electron_genPartIdx[Electronindex[ae]]);
+ else lep_genindex.push_back(-1);
}
}
@@ -342,22 +455,31 @@ void H4LTools::LeptonSelection(){
for(unsigned int amu=0; amu0.01){
+ RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt();
+ }
+ /*if(FsrMuonidx<900){
TLorentzVector fsrmuon;
fsrmuon.SetPtEtaPhiM(FsrPhoton_pt[FsrMuonidx],FsrPhoton_eta[FsrMuonidx],FsrPhoton_phi[FsrMuonidx],0);
std::cout<<"muon FSR recovered"<0.01){
RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt();
}
- }
+ }*/
}
if((muid[amu]==true)&&(RelIsoNoFsr<0.35)){
nTightMu++;
TightMuindex.push_back(amu);
nTightMuChgSum += Muchg[amu];
+ TightMulep_index.push_back(Lepointer);
+ Lepointer++;
+ if (isMC) lep_genindex.push_back(Muon_genPartIdx[Muonindex[amu]]);
+ else lep_genindex.push_back(-1);
}
}
@@ -391,6 +513,8 @@ bool H4LTools::findZCandidate(){
Zlist.push_back(Zcan);
Zlep1index.push_back(TightEleindex[ke]);
Zlep2index.push_back(TightEleindex[je]);
+ Zlep1lepindex.push_back(TightElelep_index[ke]);
+ Zlep2lepindex.push_back(TightElelep_index[je]);
Zflavor.push_back(11);
Zlep1pt.push_back(ElelistFsr[TightEleindex[ke]].Pt());
Zlep2pt.push_back(ElelistFsr[TightEleindex[je]].Pt());
@@ -426,6 +550,8 @@ bool H4LTools::findZCandidate(){
Zlist.push_back(Zcan);
Zlep1index.push_back(TightMuindex[kmu]);
Zlep2index.push_back(TightMuindex[jmu]);
+ Zlep1lepindex.push_back(TightMulep_index[kmu]);
+ Zlep2lepindex.push_back(TightMulep_index[jmu]);
Zflavor.push_back(13);
Zlep1pt.push_back(MulistFsr[TightMuindex[kmu]].Pt());
Zlep2pt.push_back(MulistFsr[TightMuindex[jmu]].Pt());
@@ -729,8 +855,15 @@ bool H4LTools::ZZSelection(){
Lep2.SetPtEtaPhiM(Zlep2pt[Z1index],Zlep2eta[Z1index],Zlep2phi[Z1index],Zlep2mass[Z1index]);
Lep3.SetPtEtaPhiM(Zlep1pt[Z2index],Zlep1eta[Z2index],Zlep1phi[Z2index],Zlep1mass[Z2index]);
Lep4.SetPtEtaPhiM(Zlep2pt[Z2index],Zlep2eta[Z2index],Zlep2phi[Z2index],Zlep2mass[Z2index]);
-
+ if ((Zflavor[Z1index]==11)&&(Zflavor[Z2index]==11)) RecoFourEEvent=true;
+ if ((Zflavor[Z1index]==13)&&(Zflavor[Z2index]==13)) RecoFourMuEvent=true;
+ if ((Zflavor[Z1index]==11)&&(Zflavor[Z2index]==13)) RecoTwoETwoMuEvent=true;
+ if ((Zflavor[Z1index]==13)&&(Zflavor[Z2index]==11)) RecoTwoMuTwoEEvent=true;
+ lep_Hindex[0] = Zlep1lepindex[Z1index];
+ lep_Hindex[1] = Zlep2lepindex[Z1index];
+ lep_Hindex[2] = Zlep1lepindex[Z2index];
+ lep_Hindex[3] = Zlep2lepindex[Z2index];
pTL1 = Lep1.Pt();
etaL1 = Lep1.Eta();
phiL1 = Lep1.Phi();
@@ -857,4 +990,4 @@ float H4LTools::getDL1Constant(float ZZMass){
float H4LTools::getDL1ZgsConstant(float ZZMass){
return spline_L1Zgs->Eval(ZZMass);
-}
\ No newline at end of file
+}