Skip to content

Commit

Permalink
new branch where the skimmer is modified to include weight informatio…
Browse files Browse the repository at this point in the history
…n to study strange TT background in vbf search
  • Loading branch information
andresnava1000 committed Oct 24, 2023
1 parent edeb028 commit f0b6891
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/HHbbVV/postprocessing/CreateDatacard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ def createDatacardABCD(args, templates_dict, templates_summed, shape_vars):
if args.model_name is not None
else args.cards_dir
)

print(out_dir)
with open(f"{out_dir}/datacard.txt", "w") as f:
f.write(helpers.abcd_datacard_template.substitute(datacard_dict))

Expand Down
4 changes: 2 additions & 2 deletions src/HHbbVV/postprocessing/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,9 @@ def main(args):
)

_add_vbf_columns(df,bb_mask,ptlabel="",mlabel="")

if key == 'Data':
break
continue

for var in pt_labels:
for direction in ["down", "up"]:
Expand Down
16 changes: 14 additions & 2 deletions src/HHbbVV/processors/bbVVSkimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ def process(self, events: ak.Array):
)

skimmed_events["nGoodVBFJets"] = np.array(ak.sum(vbf_jet_mask, axis=1))
# Temp
skimmed_events["gen_weights"] = gen_weights


# VBF ak4 Jet vars (pt, eta, phi, M, nGoodJets)
# if self._vbf_search:
Expand Down Expand Up @@ -452,7 +455,7 @@ def process(self, events: ak.Array):
msds = jmsr_shifted_vars["msoftdrop"][shift]
pnetms = jmsr_shifted_vars["particleNet_mass"][shift]

if self._save_all:
if self._save_all & False:
cut = (
(pnetms[~bb_mask] >= self.preselection["VVparticleNet_mass"][0])
+ (msds[~bb_mask] >= self.preselection["VVparticleNet_mass"][0])
Expand Down Expand Up @@ -630,7 +633,15 @@ def process(self, events: ak.Array):
systematics += list(weights.variations)

# TODO: need to be careful about the sum of gen weights used for the LHE/QCDScale uncertainties
logger.debug("weights ", weights._weights.keys())
logger.debug("weights ", weights._weights.keys())

# TEMP: save each individual weight
skimmed_events["L1EcalPrefiring"] = ak.to_numpy(events.L1PreFiringWeight.Nom)

for key in weights._weights.keys():
print(f"single_weight_{key}")
skimmed_events[f"single_weight_{key}"] = weights.partial_weight([key])

for systematic in systematics:
if systematic in weights.variations:
weight = weights.weight(modifier=systematic)
Expand Down Expand Up @@ -879,6 +890,7 @@ def getVBFVars(
# Apply base masks, sort, and calculate vbf dijet (jj) cuts
vbfJets_mask = ak4_jet_mask # & electron_muon_overlap_mask & fatjet_overlap_mask
vbfJets = jets[vbfJets_mask]
print()

vbfJets_sorted_pt = vbfJets[ak.argsort(vbfJets.pt, ascending=False)]
# this is the only which does not guarantee two guys. in the other sorts, the entries are specifically None.
Expand Down

0 comments on commit f0b6891

Please sign in to comment.