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

Photons histEFT #421

Open
wants to merge 151 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
231a5f8
Basic photon selection
bryates Apr 13, 2023
94ba9ca
Saving single photon pT
bryates Apr 20, 2023
3a74343
edited photon selection category to include kinematic cuts
abasnet97 Jun 8, 2023
fb442bb
edited 2los CR category
abasnet97 Jun 8, 2023
f704e98
modified photon selection furthermore
abasnet97 Jun 12, 2023
58d2662
Merge all recent master changes to photon branch
abasnet97 Jun 12, 2023
0837563
changed photon ID from tight to medium for now
abasnet97 Jun 12, 2023
c594dfe
More flake8 fixes
kmohrman Mar 25, 2023
2ec1020
More flake8 fixes..
kmohrman Mar 26, 2023
439e92f
Basic photon selection
bryates Apr 13, 2023
d0748bc
Saving single photon pT
bryates Apr 20, 2023
58c9f63
Adding ttgamma selection
bryates Jun 15, 2023
cc6fcc9
more photon selection edits
abasnet97 Jun 21, 2023
2f5cc8c
Add cutBased hist, medium photon ID
bryates Jun 21, 2023
ff5b88c
Merge branch 'photons' of github.com:TopEFT/topcoffea into photons
bryates Jun 21, 2023
ed17052
Relaxed veto
bryates Jun 22, 2023
44b5fe1
Fixed typo
bryates Jun 22, 2023
7f55206
editing the processor to include relaxed cutBasedID for photon
abasnet97 Jun 29, 2023
18f210d
fixing typo in selection.py
abasnet97 Jun 29, 2023
cb0a510
Working version
bryates Jun 30, 2023
9511813
fix masks
bryates Jun 30, 2023
1855fb3
merged changes from master after topcoffea refactoring
abasnet97 Sep 18, 2023
e38731b
added new files related to photon gen processor
abasnet97 Oct 19, 2023
4c02a90
new edits to gen level processor
abasnet97 Dec 11, 2023
178aec4
modify genlepflav mask
abasnet97 Dec 11, 2023
573ae6c
several modifications to photon object and event selections
abasnet97 Feb 27, 2024
eda50d7
implemented ttgamma ttbar overlap removal
abasnet97 Mar 12, 2024
f80b263
added genParentage
abasnet97 Mar 12, 2024
0117164
major changes to overlap removal implementation and other cleanups
abasnet97 Apr 15, 2024
54085ea
added a helper script to make njet-nbjet histogram
abasnet97 May 2, 2024
d754dec
added a helper function to make jet_bjet plot
abasnet97 Jun 20, 2024
7c7e73d
updated processor file to include new control regions for ttgamma work
abasnet97 Jun 20, 2024
3911341
updated event and object selection to include CR selections for ttgam…
abasnet97 Jun 20, 2024
19d051e
removing ttgamma and Zgamma from conversion samples list
abasnet97 Jun 20, 2024
98f5df9
Adding photon SFs and systematic
bryates Jun 21, 2024
e2ced76
Use `photonSFs` branch of topcoffea
bryates Jun 21, 2024
7a705e6
Fix some lint issues
bryates Jun 21, 2024
5a17f4d
Remove stray print
bryates Jun 21, 2024
e9c4c78
Removing unused masks
bryates Jun 24, 2024
285aef2
TTGamma is now a signal process, TTG->ttA
bryates Jun 28, 2024
bf52a61
Pull latest datacard maker, update categories
bryates Jun 28, 2024
98bfa02
Zero our missing sumw2
bryates Jun 28, 2024
86113a4
Merge branch 'master' into photons_rebase
bryates Jul 1, 2024
4003f38
Fix lint, move gen processor to histEFT
bryates Jul 1, 2024
d5a61ea
More lint
bryates Jul 1, 2024
1b18c4b
Yet more lint
bryates Jul 1, 2024
2485b1a
Fix typos
bryates Jul 1, 2024
695e231
Lint again!
bryates Jul 1, 2024
501a834
Never-ending lint
bryates Jul 1, 2024
22ef77b
Add `ttA` to processes
bryates Jul 1, 2024
77a8ea7
Processor runs now
bryates Jul 1, 2024
1f2a507
Merge branch 'photons_histEFT' into photon_dc
bryates Jul 1, 2024
fb66108
Use new `EGamma_SF2D_err` hists
bryates Jul 2, 2024
047aad7
Load photon SFs, still load lepton SFs in those channels
bryates Jul 2, 2024
c33e8c6
Simplify 2l category
bryates Jul 2, 2024
ccae998
Back to main TopCoffea branch
bryates Jul 2, 2024
ba4b98f
Fix some comment typos
bryates Jul 3, 2024
5aa2036
Fix typo in 2l
bryates Jul 3, 2024
780e38c
Back to main TopCoffea branch
bryates Jul 3, 2024
380d4f3
Replace prune with slice
bryates Jul 10, 2024
da40fc5
Fixed CI yields, removed (hopefully) unneeded code
bryates Jul 10, 2024
b85714b
Merge branch 'photons_histEFT' into photon_dc
bryates Jul 11, 2024
b5aa458
Update photon SR
bryates Jul 16, 2024
c42728c
Clean up run script
bryates Jul 16, 2024
fb4a267
Better 2l cats
bryates Jul 18, 2024
6015877
Switch to medium SFs
bryates Jul 29, 2024
018157b
Restored missing overlap functions
bryates Jul 30, 2024
519ff51
Checkout `photon_seedveto` on TopCoffea
bryates Jul 30, 2024
8491d25
Fix lint
bryates Jul 30, 2024
ef20b9a
Working pxiel seed veto and CSEV
bryates Jul 30, 2024
b826e72
Fix lint space at end
bryates Jul 30, 2024
beafecf
Fix lint indents
bryates Jul 30, 2024
31225ac
Merge branch 'master' into photons_histEFT
bryates Jul 30, 2024
1832dfa
Add photon categories
bryates Aug 14, 2024
24536db
Added ttgamma categories to ref json
bryates Aug 14, 2024
84edb0b
Update main.yml
bryates Sep 5, 2024
ee7a0db
Fix typo in photon error propagation
bryates Sep 5, 2024
84c2cb0
Yields after applying new photon vetoes (pixel and CSEV)
bryates Sep 5, 2024
72e0e0e
Yields after TopCoffea correction-lib updates
bryates Sep 5, 2024
30b3af4
Merge branch 'master' into photons_histEFT_rebase
bryates Nov 18, 2024
4c77311
Small changes for photon channels
bryates Nov 19, 2024
7415ccb
Merge branch 'photons_histEFT' into photon_dc
bryates Nov 19, 2024
9ae1951
Merge branch 'photons_histEFT' into photon_dc
bryates Nov 19, 2024
fb6238d
"Fix" for 2los photon channels
bryates Nov 21, 2024
30eacf4
Add `TTGamma_private`
bryates Nov 22, 2024
14ceef4
Skip `renormfact` since we never used it
bryates Nov 25, 2024
bca3988
Merge branch 'master' into photons_histEFT
bryates Dec 4, 2024
b1e716a
adding a new plotting helper script. will add the changes to analysis…
abasnet97 Jan 22, 2025
adabbab
lint fix
abasnet97 Jan 22, 2025
c2089dc
Some TTGamma files missing
bryates Jan 23, 2025
fc9e8f2
Merge branch 'photons_histEFT' into photon_dc
bryates Jan 23, 2025
2d64ee8
Latest IM changes
bryates Jan 23, 2025
61b479f
wc ranges from master
bryates Jan 23, 2025
febd140
Fixed ttA typo
bryates Jan 23, 2025
ce27be4
added new histograms relevant to non-prompt photon estimation
abasnet97 Jan 26, 2025
4d17ed9
Merge branch 'photons_histEFT' of https://github.com/TopEFT/topeft in…
abasnet97 Jan 26, 2025
0efd8cb
adding prompt subtraction samples for photons
abasnet97 Jan 26, 2025
90157cf
a new helper function to aid histogram filling
abasnet97 Jan 26, 2025
03c0e8f
updated corrections, event and object selection scripts to handle non…
abasnet97 Jan 26, 2025
56448ea
adding numpy files for photon FR and kMC
abasnet97 Jan 26, 2025
a625eff
lint fixes
abasnet97 Jan 26, 2025
90d52da
more lint fixes cause why not
abasnet97 Jan 26, 2025
e524a53
temporarily comment out photon_pt_eta hist
abasnet97 Jan 28, 2025
d1294ea
massive overhaul of photon selection and analysis channels
abasnet97 Jan 28, 2025
8e16511
clean the processor and add nonprompt fakerate as event weight
abasnet97 Jan 28, 2025
630d4a2
added photon fakerate and kMC numpy files
abasnet97 Jan 30, 2025
b1ec71d
adding ISR/FSR split of photons in ZGamma sample
abasnet97 Jan 30, 2025
07b0530
fix lint
abasnet97 Jan 30, 2025
ddad937
bringing photon_pt_eta histogram back
abasnet97 Jan 31, 2025
8d481f8
added modifications to perform nonprompt estimation of photons
abasnet97 Jan 31, 2025
56cb888
lint fixes
abasnet97 Jan 31, 2025
f866b86
possible attempt at fixing CI
abasnet97 Jan 31, 2025
b04ddb3
new photon FRs and kMC factors after including EFT signal samples
abasnet97 Feb 10, 2025
117c382
editing processor to handle eft weights for 2D histogram
abasnet97 Feb 11, 2025
eb6520a
further edits to the nonprompt mc stat uncertainty propagation
abasnet97 Feb 12, 2025
5e0ea7c
lint fixes
abasnet97 Feb 12, 2025
3ec217e
Merge pull request #420 from TopEFT/photon_dc
abasnet97 Feb 12, 2025
fb42fc1
adding EFT sig samples in prompt photon subtraction list
abasnet97 Feb 12, 2025
135f3a0
Merge branch 'photons_histEFT' of https://github.com/TopEFT/topeft in…
abasnet97 Feb 12, 2025
1f5554d
modifications to datacard_tools for photon channels
abasnet97 Feb 12, 2025
51e2829
Merging master
bryates Feb 14, 2025
258fab5
Missing calls
bryates Feb 14, 2025
81a4e4d
Merge branch 'master' into photons_histEFT_master2
bryates Feb 14, 2025
4f93da2
Indent
bryates Feb 14, 2025
3c9f638
Turn off debug messages
bryates Feb 14, 2025
8f3a250
Photon systs only when flag is set
bryates Feb 14, 2025
4006c45
Fix typo
bryates Feb 14, 2025
9caecd2
Should all work
bryates Feb 14, 2025
60213b9
Photon channels
bryates Feb 14, 2025
3882dd4
Fixed processor
bryates Feb 14, 2025
6424d8b
Removed comment
bryates Feb 14, 2025
641247e
Lint
bryates Feb 14, 2025
80d5187
Undo change
bryates Feb 14, 2025
9c78263
Remove 2los_ph from cat lst
bryates Feb 14, 2025
7c116b3
Fix CR name
bryates Mar 3, 2025
3276a6e
Add 0m b mask for CR
bryates Mar 3, 2025
d4c27ce
Add sf and of
bryates Mar 3, 2025
83eb2e2
More channel updates
bryates Mar 4, 2025
a23f37e
Fixed flavor channels
bryates Mar 5, 2025
f9faf23
modified appl axes names and channel list json
abasnet97 Mar 5, 2025
6658b39
some minor modifications to datacard tools
abasnet97 Mar 5, 2025
2991ffe
adding ST TWG sample to non prompt photon subtraction list
abasnet97 Mar 5, 2025
4696058
adding 1jet diboson uncertainty (temporary fix to make ttA datacards)
abasnet97 Mar 5, 2025
c89284a
lint fixes
abasnet97 Mar 5, 2025
f37da9b
adding jsons for UL17 and UL16APV ttgamma EFT samples and modifying c…
abasnet97 Mar 5, 2025
369552b
adding photon mask on ch_lst_test json
abasnet97 Mar 7, 2025
7724993
including photon relevant code block inside the ttA_analysis flag
abasnet97 Mar 12, 2025
444baaa
bit more restructuring of the analysis processor
abasnet97 Mar 12, 2025
828e76e
remove photon_pt_eta 2D hist once they serve their purpose
abasnet97 Mar 13, 2025
be8bb08
lint fixes
abasnet97 Mar 13, 2025
7018870
added nEvents and nGenEvents info to ttgamma jsons
abasnet97 Mar 16, 2025
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
Prev Previous commit
Next Next commit
Saving single photon pT
  • Loading branch information
bryates committed Jun 15, 2023
commit d0748bc236da08fe4e525ad10f56bc144f632f17
24 changes: 12 additions & 12 deletions analysis/topEFT/topeft.py
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ def __init__(self, samples, wc_names_lst=[], hist_lst=None, ecut_threshold=None,
"o0pt" : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("systematic", "Systematic Uncertainty"),hist.Cat("appl", "AR/SR"), hist.Bin("o0pt", "Leading l or b jet $p_{T}$ (GeV)", 10, 0, 500)),
"bl0pt" : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("systematic", "Systematic Uncertainty"),hist.Cat("appl", "AR/SR"), hist.Bin("bl0pt", "Leading (b+l) $p_{T}$ (GeV)", 10, 0, 500)),
"lj0pt" : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("systematic", "Systematic Uncertainty"),hist.Cat("appl", "AR/SR"), hist.Bin("lj0pt", "Leading pt of pair from l+j collection (GeV)", 12, 0, 600)),
"pp_pt" : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("systematic", "Systematic Uncertainty"),hist.Cat("appl", "AR/SR"), hist.Bin("pp_pt", "$p_{T}$ $\gamma\gamma$ (GeV)", 12, 0, 600)),
"photon_pt" : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("systematic", "Systematic Uncertainty"),hist.Cat("appl", "AR/SR"), hist.Bin("photon_pt", "$p_{T}$ $\gamma$ (GeV)", 12, 0, 600)),
"pp_mass" : HistEFT("Events", wc_names_lst, hist.Cat("sample", "sample"), hist.Cat("channel", "channel"), hist.Cat("systematic", "Systematic Uncertainty"),hist.Cat("appl", "AR/SR"), hist.Bin("pp_mass", "$m_{\gamma\gamma}$ (GeV)", 60, 0, 600)),
})

@@ -410,6 +410,7 @@ def process(self, events):
add4lMaskAndSFs(events, year, isData)
addLepCatMasks(events)
addPhotCatMasks(events)
addTightPhotonMask(events)

# Convenient to have l0, l1, l2 on hand
l_fo_conept_sorted_padded = ak.pad_none(l_fo_conept_sorted, 3)
@@ -528,11 +529,14 @@ def process(self, events):
# 2lss selection (drained of 4 top)
selections.add("2lss_p", (events.is2l & chargel0_p & bmask_atleast1med_atleast2loose & pass_trg & bmask_atmost2med)) # Note: The ss requirement has NOT yet been made at this point! We take care of it later with the appl axis
selections.add("2lss_m", (events.is2l & chargel0_m & bmask_atleast1med_atleast2loose & pass_trg & bmask_atmost2med)) # Note: The ss requirement has NOT yet been made at this point! We take care of it later with the appl axis
selections.add("2l_photon", (events.is2l_photon & bmask_atleast1med_atleast2loose))
selections.add("2lss_p_photon", (events.is2l & chargel0_p & bmask_atleast1med_atleast2loose & pass_trg & bmask_atmost2med & events.photon))
selections.add("2lss_m_photon", (events.is2l & chargel0_m & bmask_atleast1med_atleast2loose & pass_trg & bmask_atmost2med & events.photon))

# 2lss selection (enriched in 4 top)
selections.add("2lss_4t_p", (events.is2l & chargel0_p & bmask_atleast1med_atleast2loose & pass_trg & bmask_atleast3med)) # Note: The ss requirement has NOT yet been made at this point! We take care of it later with the appl axis
selections.add("2lss_4t_p_photon", (events.is2l & chargel0_p & bmask_atleast1med_atleast2loose & pass_trg & bmask_atleast3med & events.photon))
selections.add("2lss_4t_m", (events.is2l & chargel0_m & bmask_atleast1med_atleast2loose & pass_trg & bmask_atleast3med)) # Note: The ss requirement has NOT yet been made at this point! We take care of it later with the appl axis
selections.add("2lss_4t_m_photon", (events.is2l & chargel0_m & bmask_atleast1med_atleast2loose & pass_trg & bmask_atleast3med & events.photon))

# 2lss selection for CR
selections.add("2lss_CR", (events.is2l & (chargel0_p | chargel0_m) & bmask_exactly1med & pass_trg)) # Note: The ss requirement has NOT yet been made at this point! We take care of it later with the appl axis
@@ -616,6 +620,7 @@ def process(self, events):
pp_pt = ak.flatten(ak.fill_none(pp_pt, -1))
#pp_pt = ak.flatten(ak.fill_none(pp_pt[ak.argmax(pp_pt, axis=-1, keepdims=True)], -1))
#pp_mass = ak.flatten(ak.fill_none(pp_mass[ak.argmax(pp_pt, axis=-1, keepdims=True)], -1))
photon_pt = ak.fill_none(ak.firsts(p_tight.pt), -1)

# Leading (b+l) pair pt
bjetsl = goodJets[isBtagJetsLoose][ak.argsort(goodJets[isBtagJetsLoose].pt, axis=-1, ascending=False)]
@@ -666,7 +671,7 @@ def process(self, events):
varnames["bl0pt"] = bl0pt
varnames["o0pt"] = o0pt
varnames["lj0pt"] = lj0pt
varnames["pp_pt"] = pp_pt
varnames["photon_pt"] = photon_pt
varnames["pp_mass"] = pp_mass


@@ -675,28 +680,23 @@ def process(self, events):
# This dictionary keeps track of which selections go with which SR categories
sr_cat_dict = {
"2l" : {
"hasPhoton_atleast_4j" : {
"lep_chan_lst" : ["2l_photon"],
"lep_flav_lst" : ["ee" , "em" , "mm"],
"appl_lst" : ["isSR_2lp"] + ([] if isData else []),
},
"exactly_4j" : {
"lep_chan_lst" : ["2lss_p" , "2lss_m", "2lss_4t_p", "2lss_4t_m"],
"lep_chan_lst" : ["2lss_p_photon" , "2lss_m_photon", "2lss_4t_p_photon", "2lss_4t_m_photon"],
"lep_flav_lst" : ["ee" , "em" , "mm"],
"appl_lst" : ["isSR_2lSS" , "isAR_2lSS"] + (["isAR_2lSS_OS"] if isData else []),
},
"exactly_5j" : {
"lep_chan_lst" : ["2lss_p" , "2lss_m", "2lss_4t_p", "2lss_4t_m"],
"lep_chan_lst" : ["2lss_p_photon" , "2lss_m_photon", "2lss_4t_p_photon", "2lss_4t_m_photon"],
"lep_flav_lst" : ["ee" , "em" , "mm"],
"appl_lst" : ["isSR_2lSS" , "isAR_2lSS"] + (["isAR_2lSS_OS"] if isData else []),
},
"exactly_6j" : {
"lep_chan_lst" : ["2lss_p" , "2lss_m", "2lss_4t_p", "2lss_4t_m"],
"lep_chan_lst" : ["2lss_p_photon" , "2lss_m_photon", "2lss_4t_p_photon", "2lss_4t_m_photon"],
"lep_flav_lst" : ["ee" , "em" , "mm"],
"appl_lst" : ["isSR_2lSS" , "isAR_2lSS"] + (["isAR_2lSS_OS"] if isData else []),
},
"atleast_7j" : {
"lep_chan_lst" : ["2lss_p" , "2lss_m", "2lss_4t_p", "2lss_4t_m"],
"lep_chan_lst" : ["2lss_p_photon" , "2lss_m_photon", "2lss_4t_p_photon", "2lss_4t_m_photon"],
"lep_flav_lst" : ["ee" , "em" , "mm"],
"appl_lst" : ["isSR_2lSS" , "isAR_2lSS"] + (["isAR_2lSS_OS"] if isData else []),
},
2 changes: 1 addition & 1 deletion topcoffea/json/params.json
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@

"mva_TTH_e_cut" : 0.90,
"mva_TTH_m_cut" : 0.85,
"photonId" : 3, # tight id
"photonId" : 3,

"btag_wp_loose_UL16" : 0.0480,
"btag_wp_loose_UL16APV" : 0.0508,
4 changes: 4 additions & 0 deletions topcoffea/modules/selection.py
Original file line number Diff line number Diff line change
@@ -422,6 +422,10 @@ def addPhotCatMasks(events):
is_p_mask = ak.num(events.Photon) >= 2
events['is_p'] = is_p_mask

def addTightPhotonMask(events):
tight_photon = ak.fill_none(ak.any(events.Photon.cutBased == 3, axis=1), False) #tight photon mask

events['photon'] = tight_photon

# Returns a mask for events with a same flavor opposite (same) sign pair close to the Z
# Mask will be True if any combination of 2 leptons from within the given collection satisfies the requirement