Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lep ID and FSR fixes #10

Merged
merged 59 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
cd080c3
H4L updates
YujiLee301 Jun 12, 2023
bfa409e
“Fsr Recovery & Rochester correction”
YujiLee301 Jun 18, 2023
ea355e2
Jet Selection Updated
YujiLee301 Jun 27, 2023
d9c2f63
Mela loaded
YujiLee301 Jun 28, 2023
b59689b
Delete helloworld.h
YujiLee301 Jun 29, 2023
3efaba9
Delete NJettiness.h
YujiLee301 Jun 29, 2023
1768536
Delete NJettiness.cc
YujiLee301 Jun 29, 2023
5125add
Delete helloworld.cc
YujiLee301 Jun 29, 2023
611d43e
Delete proxy.sh
YujiLee301 Jun 29, 2023
f76b639
Delete condor_setup_lpc.py
YujiLee301 Jun 29, 2023
4225ace
Delete JetSFMaker.py
YujiLee301 Jun 29, 2023
28d618b
Delete HZZAnalysisModule.py
YujiLee301 Jun 29, 2023
ff371e6
Delete condor_setup_lxplus.py
YujiLee301 Jun 29, 2023
f004d05
Add files via upload
YujiLee301 Jun 29, 2023
93b95cf
Remove redundancy
YujiLee301 Jun 29, 2023
ea979f1
Update README.md
YujiLee301 Jun 29, 2023
0f75476
Add files via upload
YujiLee301 Jun 30, 2023
0219631
Update README.md
YujiLee301 Jun 30, 2023
7056c06
Update README.md
YujiLee301 Jun 30, 2023
e220b0f
Update README.md
YujiLee301 Jun 30, 2023
da77bf9
RoccoR Added
YujiLee301 Jun 30, 2023
85098dc
Path fixed
YujiLee301 Jun 30, 2023
d1d4068
Add files via upload
YujiLee301 Jun 30, 2023
44eb250
Add files via upload
YujiLee301 Jun 30, 2023
6d9d805
Delete __init__.pyc
YujiLee301 Jun 30, 2023
95c8920
Delete RoccoR.cc
YujiLee301 Jun 30, 2023
3a06a58
Delete RoccoR.h
YujiLee301 Jun 30, 2023
3b9e77d
Update README.md
YujiLee301 Jun 30, 2023
1ca3249
Update H4LCppModule.py
YujiLee301 Jun 30, 2023
65eee2c
Update keep_and_drop.txt
ram1123 Jul 1, 2023
7636283
Update README.md
ram1123 Jul 1, 2023
a311d5b
Update README.md
ram1123 Jul 4, 2023
0efc77f
MELA updates
YujiLee301 Jul 5, 2023
4d81daa
Delete KalmanMuonCalibrationsProducer/interface directory
YujiLee301 Jul 5, 2023
d63efb7
Delete KalmanMuonCalibrationsProducer/plugins directory
YujiLee301 Jul 5, 2023
e2e6669
Delete KalmanMuonCalibrationsProducer/python directory
YujiLee301 Jul 5, 2023
e94c7ae
Delete KalmanMuonCalibrationsProducer/src directory
YujiLee301 Jul 5, 2023
b4ae216
Delete BuildFile.xml
YujiLee301 Jul 5, 2023
c0c8a40
Trigger selection added
YujiLee301 Jul 5, 2023
37bd245
Trigger Updated
YujiLee301 Jul 6, 2023
3baafa8
Update keep_and_drop.txt with Mela branches
YujiLee301 Jul 6, 2023
b511395
Update keep_and_drop.txt
ram1123 Jul 7, 2023
34d63a4
Update keep_and_drop.txt
YujiLee301 Jul 11, 2023
3285402
Sync for Lepton
YujiLee301 Jul 11, 2023
576f2e7
Add Z selection
YujiLee301 Jul 16, 2023
7b26df2
Lepton Module Changed
YujiLee301 Jul 20, 2023
327518f
hard code removed
YujiLee301 Jul 21, 2023
afabaec
Reading branch modified
YujiLee301 Aug 1, 2023
5f64ee2
Jet Selection fixed
YujiLee301 Aug 4, 2023
cda5b9e
tight Electron corrected
YujiLee301 Aug 15, 2023
e60bb6a
Add files via upload
YujiLee301 Aug 31, 2023
573cf76
Gen issue fixed
YujiLee301 Aug 31, 2023
b6ee955
RoccoR module updated
YujiLee301 Aug 31, 2023
cce71ad
Add files via upload
YujiLee301 Sep 6, 2023
0a203dd
Update post_proc.py
ram1123 Sep 6, 2023
452fe93
Merge branch 'HZZ_Analysis' into HZZ_Analysis
ram1123 Sep 6, 2023
fda41ac
FSR bug fixed
YujiLee301 Sep 21, 2023
49521ec
- Updated input file reading method, while running locally
ram1123 Sep 22, 2023
d2ed820
Merge pull request #1 from ram1123/YujiLee301-HZZ_Analysis
YujiLee301 Sep 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ExampleInputFileList.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root
1 change: 1 addition & 0 deletions ExampleInputFileList_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/store/data/Run2018B/SingleMuon/NANOAOD/UL2018_MiniAODv2_NanoAODv9_GT36-v1/2430000/333071A2-4043-B340-BBDC-395EBF78EA33.root
20 changes: 19 additions & 1 deletion H4LCppModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class HZZAnalysisCppProducer(Module):
def __init__(self,year,cfgFile,isMC):
def __init__(self,year,cfgFile,isMC,isFSR):
base = "$CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim"
ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libJHUGenMELAMELA.so" % base)
ROOT.gSystem.Load("%s/JHUGenMELA/MELA/data/slc7_amd64_gcc700/libjhugenmela.so" % base)
Expand Down Expand Up @@ -53,6 +53,7 @@ def __init__(self,year,cfgFile,isMC):
self.passZZEvts = 0
self.cfgFile = cfgFile
self.isMC = isMC
self.worker.isFSR = isFSR
pass
def beginJob(self):
pass
Expand Down Expand Up @@ -275,10 +276,27 @@ def analyze(self, event):
phij2 = self.worker.phij2
mj2 = self.worker.mj2

if pTL2>pTL1:
pTL1, pTl2 = pTL2, pTL1
etaL1, etaL2 = etaL2, etaL1
phiL1, phiL2 = phiL2, phiL1
massL1,massL2 = massL2, massL1
if pTL4>pTL3:
pTL3, pTL4 = pTL4, pTL3
etaL3, etaL4 = etaL4, etaL3
phiL3, phiL4 = phiL4, phiL3
massL3, massL4 = massL4, massL3


pT4l = self.worker.ZZsystem.Pt()
eta4l = self.worker.ZZsystem.Eta()
phi4l = self.worker.ZZsystem.Phi()
mass4l = self.worker.ZZsystem.M()
if self.worker.isFSR==False:
pT4l = self.worker.ZZsystemnofsr.Pt()
eta4l = self.worker.ZZsystemnofsr.Eta()
phi4l = self.worker.ZZsystemnofsr.Phi()
mass4l = self.worker.ZZsystemnofsr.M()
self.out.fillBranch("mass4l",mass4l)
self.out.fillBranch("pT4l",pT4l)
self.out.fillBranch("eta4l",eta4l)
Expand Down
391 changes: 211 additions & 180 deletions condor_setup_lxplus.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion interface/H4LTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class H4LTools {
FsrPhoton_dROverEt2.clear();FsrPhoton_phi.clear();FsrPhoton_eta.clear();FsrPhoton_pt.clear();FsrPhoton_relIso03.clear();
GenPart_pt.clear();
Zlist.clear();
Zlistnofsr.clear();
Zflavor.clear();
Zlep1index.clear();
Zlep2index.clear();
Expand All @@ -279,7 +280,8 @@ class H4LTools {

flag4e=false; flag4mu=false; flag2e2mu=false;
}

bool isFSR=true;
unsigned int Zsize=0;
TSpline *spline_g4;
TSpline *spline_g2;
TSpline *spline_L1;
Expand Down
82 changes: 40 additions & 42 deletions post_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,54 @@
from PhysicsTools.NanoAODTools.postprocessing.modules.jme.jetmetHelperRun2 import *
from PhysicsTools.NanoAODTools.postprocessing.modules.btv.btagSFProducer import *

testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root"
#testfile1 = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/1B1D7372-F369-7C40-A85F-841308D42D2C.root"
#testfile2 = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/2BA7CCC9-BA73-3C45-9844-474A92E58A28.root"
#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M120_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/270000/1D8ACDF9-FCA6-7649-95A4-487A132F318D.root"
#testfile1 = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M120_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/130000/6EA35A9B-C42E-0447-ACED-E3AC70A7AD7E.root"
#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M124_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/1AAFFFBE-330D-EF42-B39E-BA70A7E90669.root"
#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M126_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/8198816C-2B6D-CB41-9B96-6B02BD81CAAE.root"
#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/VBF_HToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/2430000/13F76A9B-76DD-144B-B328-A8C207376C08.root"
#testfile1 = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M130_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/70000/00305042-7CD7-2C46-8FD6-D1089E4C4163.root"
#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/FD91C4F0-7DE3-4947-817D-3EA957A0BC50.root"
#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/VBF_HToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/80000/3F65CE54-8477-C64E-B0BB-BD77E870AB54.root"
#testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo2L2Q_M1000_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/280000/7F817CD1-84C1-5347-AEEA-F069CAE84799.root"
ifRunningOnCondor = False

testfilelist = []
testfilelist.append("root://cms-xrd-global.cern.ch//store/data/Run2018B/SingleMuon/NANOAOD/UL2018_MiniAODv2_NanoAODv9_GT36-v1/2430000/87FA9714-D8D3-1345-BFF5-3B417B1ADC64.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/4743B911-1EA3-7E46-959B-93F466ED622F.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/130000/DE3F93DE-DAF6-DD4A-AC3B-13ACE92EAD68.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/2430000/336F0076-347C-AC40-B1B4-E31E14323B81.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/100D0E96-C700-5244-874F-38DB4B410228.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/28512C40-9C25-864A-98E9-4746C0471E63.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/2BAB6B06-FFE2-DC4F-A57F-3A33B3326A30.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/453FC70D-8164-1B4B-A756-81E7432C1D61.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/5C1E0BC2-F153-E946-9B61-470E8AF85C58.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/9DB74D60-0434-A04C-B430-173D6D6538C3.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/DB3B1648-246F-314E-9DD8-FACEA0AE62F6.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/260000/FD91C4F0-7DE3-4947-817D-3EA957A0BC50.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/6021CDF7-AE6F-464D-81E2-AB75ABC4809D.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/77B90DAA-35B9-004E-9C49-52E516FB15D6.root")
testfilelist.append("root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL17NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_mc2017_realistic_v9-v2/270000/C01084F4-328D-0146-B71E-B167AB6A7E86.root")

entriesToRun = 0 # 0 if need to run over all entries else put number of entries to run
isMCTrueFalse = False

if ifRunningOnCondor:
testfile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL18NanoAODv9/GluGluHToZZTo4L_M125_TuneCP5_13TeV_powheg2_JHUGenV7011_pythia8/NANOAODSIM/106X_upgrade2018_realistic_v16_L1v1-v1/120000/3ED05633-EBB7-4A44-8F9D-CD956490BCFD.root"
testfilelist.append(testfile)

else:
if len(sys.argv) > 1:
InputFileList = sys.argv[1]
else:
InputFileList = "ExampleInputFileList.txt"
with open(InputFileList, 'r') as file:
for line in file:
# Remove newline characters
line = line.strip()
# Append the line to the list with the "root://cms-xrd-global.cern.ch//" prefix
testfilelist.append("root://cms-xrd-global.cern.ch/" + line)

# Set entriesToRun = 0 if need to run over all entries else put number of entries to run
entriesToRun = 0 if ifRunningOnCondor else 100

isMC = True
isFSR = False

outputbranchsel = "keep_and_drop.txt"
# Keep DownloadFileToLocalThenRun=True this should reduce the file read error from eos.
DownloadFileToLocalThenRun=True
if testfilelist[0].find("2018") != -1:
year = 2018
cfgFile = 'Input_2018.yml'
if testfilelist[0].find("2017") != -1:
year = 2017
cfgFile = 'Input_2017.yml'
if testfilelist[0].find("UL18") != -1:

if testfilelist[0].find("/data/") != -1:
isMC = False
outputbranchsel = "keep_and_drop_data.txt"

if testfilelist[0].find("UL18") != -1 or testfilelist[0].find("UL2018") != -1: # UL2018 for identification of 2018 UL data and UL18 for identification of 2018 UL MC
year = 2018
cfgFile = 'Input_2018.yml'
if testfilelist[0].find("UL17") != -1:

if testfilelist[0].find("UL17") != -1 or testfilelist[0].find("UL2017") != -1:
year = 2017
cfgFile = 'Input_2017.yml'
if testfilelist[0].find("pythia") != -1:
isMCTrueFalse = True
H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile,isMCTrueFalse)

H4LCppModule = lambda: HZZAnalysisCppProducer(year,cfgFile, isMC, isFSR)
print("outputbranchsel = ",outputbranchsel)
print("isMC = ",isMC)
print("isFSR = ",isFSR)
#p=PostProcessor(".",[testfile],"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt")
p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel="keep_and_drop.txt")
p=PostProcessor(".",testfilelist,"",None,[H4LCppModule()],provenance=True,fwkJobReport=False,haddFileName="nano_M125_cpp.root",maxEntries=entriesToRun,prefetch=DownloadFileToLocalThenRun,outputbranchsel=outputbranchsel)

p.run()
print "DONE"
67 changes: 42 additions & 25 deletions src/H4LTools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,10 @@ unsigned H4LTools::doFsrRecovery(TLorentzVector Lep){
fsrcand.SetPtEtaPhiM(FsrPhoton_pt[BestFsrPhotons[i]],FsrPhoton_eta[BestFsrPhotons[i]],FsrPhoton_phi[BestFsrPhotons[i]],0);
float dRlC,dRlOverPtC;
dRlC = fsrcand.DeltaR(Lep);
dRlOverPtC = dRl/(fsrcand.Pt()*fsrcand.Pt());
if ((dRlC<fsrphotondRlcut)&&(dRlOverPtC<fsrphotondRlOverPtcut)){
if(dRlOverPtC<dRlOverPt){
if ((dRlC<fsrphotondRlcut)&&(FsrPhoton_dROverEt2[BestFsrPhotons[i]]<fsrphotondRlOverPtcut)){
if(FsrPhoton_dROverEt2[BestFsrPhotons[i]]<dRlOverPt){
dRl = dRlC;
dRlOverPt = dRlOverPtC;
dRlOverPt = FsrPhoton_dROverEt2[BestFsrPhotons[i]];
FsrIdx = BestFsrPhotons[i];
}
}
Expand Down Expand Up @@ -282,6 +281,7 @@ float H4LTools::ApplyRoccoR(bool isMC, int charge, float pt, float eta, float ph

double u1;
u1 = rand.Uniform(1.);
//u1 = 0.5; //Sync
scale_factor = calibrator->kSmearMC(charge, pt, eta, phi, nLayers, u1);
}
}
Expand Down Expand Up @@ -354,37 +354,44 @@ void H4LTools::LeptonSelection(){

ElelistFsr = BatchFsrRecovery(Elelist);
MulistFsr = BatchFsrRecovery(Mulist);

for(unsigned int ae=0; ae<Eid.size();ae++){
float RelEleIsoNoFsr;
RelEleIsoNoFsr = Eiso[ae];
unsigned int FsrEleidx;
FsrEleidx = doFsrRecovery(Elelist[ae]);
if(FsrEleidx<900){
TLorentzVector fsrele;
fsrele.SetPtEtaPhiM(FsrPhoton_pt[FsrEleidx],FsrPhoton_eta[FsrEleidx],FsrPhoton_phi[FsrEleidx],0);
if(Elelist[ae].DeltaR(fsrele)>0.01){
RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt();
}
if (isFSR){
unsigned int FsrEleidx;
FsrEleidx = doFsrRecovery(Elelist[ae]);
if(FsrEleidx<900){
TLorentzVector fsrele;
fsrele.SetPtEtaPhiM(FsrPhoton_pt[FsrEleidx],FsrPhoton_eta[FsrEleidx],FsrPhoton_phi[FsrEleidx],0);
std::cout<<"Ele correction: "<< std::endl;
if(Elelist[ae].DeltaR(fsrele)>0.01){
RelEleIsoNoFsr = RelEleIsoNoFsr - FsrPhoton_pt[FsrEleidx]/Elelist[ae].Pt();
}
}
}
if((Eid[ae]==true)&&(RelEleIsoNoFsr<0.35)){
nTightEle++;
TightEleindex.push_back(ae);
nTightEleChgSum += Elechg[ae];
}

}

for(unsigned int amu=0; amu<muid.size();amu++){
float RelIsoNoFsr;
RelIsoNoFsr = Muiso[amu];
unsigned int FsrMuonidx;
FsrMuonidx = doFsrRecovery(Mulist[amu]);
if(FsrMuonidx<900){
TLorentzVector fsrmuon;
fsrmuon.SetPtEtaPhiM(FsrPhoton_pt[FsrMuonidx],FsrPhoton_eta[FsrMuonidx],FsrPhoton_phi[FsrMuonidx],0);
if(Mulist[amu].DeltaR(fsrmuon)>0.01){
RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt();
}
if (isFSR){
unsigned int FsrMuonidx;
FsrMuonidx = doFsrRecovery(Mulist[amu]);
if(FsrMuonidx<900){
TLorentzVector fsrmuon;
fsrmuon.SetPtEtaPhiM(FsrPhoton_pt[FsrMuonidx],FsrPhoton_eta[FsrMuonidx],FsrPhoton_phi[FsrMuonidx],0);
std::cout<<"muon FSR recovered"<<endl;
if(Mulist[amu].DeltaR(fsrmuon)>0.01){
RelIsoNoFsr = RelIsoNoFsr - FsrPhoton_pt[FsrMuonidx]/Mulist[amu].Pt();
}
}
}
if((muid[amu]==true)&&(RelIsoNoFsr<0.35)){
nTightMu++;
Expand Down Expand Up @@ -490,7 +497,9 @@ bool H4LTools::findZCandidate(){
Zlistnofsr.push_back(Zcannofsr);
}

if (Zlist.size()>0){

Zsize = Zlist.size();
if (Zsize>0){
return true;
}
else{
Expand All @@ -514,7 +523,7 @@ bool H4LTools::ZZSelection(){
if((abs(nTightEleChgSum)+abs(nTightMuChgSum))>(nTightMu+nTightEle-4)){
return foundZZCandidate;
}
if(Zlist.size()<2){
if(Zsize<2){
return foundZZCandidate;
}

Expand Down Expand Up @@ -676,11 +685,17 @@ bool H4LTools::ZZSelection(){

Z1nofsr = Zlistnofsr[Z1index];
Z2nofsr = Zlistnofsr[Z2index];

ZZsystem = Z1+Z2;
ZZsystemnofsr = Z1nofsr+Z2nofsr;

/*if(abs(ZZsystemnofsr.M()-ZZsystem.M())>0.000001){
std::cout<<"FSR works "<<abs(ZZsystemnofsr.M()-ZZsystem.M())<<std::endl;
std::cout<<"FSR: "<<ZZsystem.M()<<" noFSR:"<<ZZsystemnofsr.M()<<std::endl;
}*/

float massZZ;
massZZ = ZZsystem.M();
if (isFSR) massZZ = ZZsystem.M();
else massZZ = ZZsystemnofsr.M();
if ((massZZ>HiggscutDown)&&(massZZ<HiggscutUp)){
if (flag2e2mu) cutm4l2e2mu++;
if (flag4e) cutm4l4e++;
Expand Down Expand Up @@ -748,10 +763,12 @@ bool H4LTools::ZZSelection(){

SimpleParticleCollection_t daughters;
TLorentzVector Lep1,Lep2,Lep3,Lep4;

Lep1.SetPtEtaPhiM(Zlep1pt[Z1index],Zlep1eta[Z1index],Zlep1phi[Z1index],Zlep1mass[Z1index]);
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]);


pTL1 = Lep1.Pt();
etaL1 = Lep1.Eta();
Expand Down