Skip to content

Commit

Permalink
Turned isVBFsearch boolean into vbf-search argument for skimmer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Nava committed Aug 21, 2023
1 parent 7e1b2be commit 2005c9b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/HHbbVV/processors/bbVVSkimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class bbVVSkimmer(processor.ProcessorABC):
min_branches.append(f"DijetMass_{shift}")

def __init__(
self, xsecs={}, save_ak15=False, save_systematics=True, inference=True, save_all=True
self, xsecs={}, save_ak15=False, save_systematics=True, inference=True, save_all=True,vbf_search = False
):
super(bbVVSkimmer, self).__init__()

Expand All @@ -133,6 +133,9 @@ def __init__(

# save all branches or only necessary ones
self._save_all = save_all

# search for VBF production events
self._vbf_search = vbf_search

# for tagger model and preprocessing dict
self.tagger_resources_path = (
Expand All @@ -142,7 +145,7 @@ def __init__(
self._accumulator = processor.dict_accumulator({})

logger.info(
f"Running skimmer with inference {self._inference} and systematics {self._systematics} and save all {self._save_all}"
f"Running skimmer with inference {self._inference} and systematics {self._systematics} and save all {self._save_all} and VBF search {self._vbf_search}"
)

def to_pandas(self, events: Dict[str, np.array]):
Expand Down Expand Up @@ -188,7 +191,6 @@ def process(self, events: ak.Array):

isData = "JetHT" in dataset
isQCD = "QCD" in dataset
isVBFSearch = True
isSignal = (
"GluGluToHHTobbVV" in dataset
or "XToYHTo2W2BTo4Q2B" in dataset
Expand Down Expand Up @@ -295,7 +297,7 @@ def process(self, events: ak.Array):
}

# VBF ak4 Jet vars (pt, eta, phi, M, nGoodJets)
if isVBFSearch:
if self._vbf_search:
ak4JetVars = {
**self.getVBFVars(events, ak8FatJetVars, bb_mask, isGen="VBF_HHTobbVV" in dataset)
}
Expand Down Expand Up @@ -781,7 +783,6 @@ def getVBFVars(
ak4_jet_mask
& electron_muon_overlap_mask
& fatjet_overlap_mask
& (np.abs(jets.eta) > 1.5)
)
vbfJets = jets[vbfJets_mask]

Expand Down
1 change: 1 addition & 0 deletions src/condor/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def main(args):
"eosoutroot": f"{eosoutput_dir}/root/nano_skim_{j}.root",
"save_ak15": "--save-ak15" if args.save_ak15 else "--no-save-ak15",
"save_all": "--save-all" if args.save_all else "--no-save-all",
"save_all": "--vbf-search" if args.vbf_search else "--no-vbf-search",
"save_systematics": "--save-systematics"
if args.save_systematics
else "--no-save-systematics",
Expand Down
2 changes: 1 addition & 1 deletion src/condor/submit.templ.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mkdir outfiles

# run code
# pip install --user onnxruntime
python -u -W ignore $script --year $year --starti $starti --endi $endi --samples $sample --subsamples $subsample --processor $processor --maxchunks $maxchunks --chunksize $chunksize --label $label --njets $njets ${save_ak15} ${save_systematics} ${inference} ${save_all}
python -u -W ignore $script --year $year --starti $starti --endi $endi --samples $sample --subsamples $subsample --processor $processor --maxchunks $maxchunks --chunksize $chunksize --label $label --njets $njets ${save_ak15} ${save_systematics} ${inference} ${save_all} ${vbf_search}

#move output to eos
xrdcp -f outfiles/* $eosoutpkl
Expand Down
14 changes: 14 additions & 0 deletions src/condor/submit_configs/skimmer_inputs_23_07_31.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,19 @@
"TTbarBoosted": { "files_per_job": 20 },
"WJetsToQQ": { "files_per_job": 20 },
"ZJetsToQQ": { "files_per_job": 20 },
"HH": { "subsamples": [
"GluGluToHHTobbVV_node_cHHH0",
"GluGluToHHTobbVV_node_cHHH1",
"GluGluToHHTobbVV_node_cHHH2p45",
"GluGluToHHTobbVV_node_cHHH5",
"VBF_HHTobbVV_CV_1_C2V_1_C3_1",
"VBF_HHTobbVV_CV_0_5_C2V_1_C3_1",
"VBF_HHTobbVV_CV_1_C2V_0_C3_1",
"VBF_HHTobbVV_CV_1_C2V_1_C3_1",
"VBF_HHTobbVV_CV_1_C2V_2_C3_1",
"VBF_HHTobbVV_CV_1_5_C2V_1_C3_1",
"VBF_HHTobbVV_CV_1_C2V_1_C3_0",
"VBF_HHTobbVV_CV_1_C2V_1_C3_2",
], "files_per_job": 20, "chunksize": 10000 },
},
}
1 change: 1 addition & 0 deletions src/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def main(args):
args.save_systematics,
args.inference,
args.save_all,
args.vbf_search,
)

if len(args.files):
Expand Down
3 changes: 3 additions & 0 deletions src/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def get_processor(
save_systematics: bool = None,
inference: bool = None,
save_all: bool = None,
vbf_search: bool = None,
):
# define processor
if processor == "trigger":
Expand All @@ -128,6 +129,7 @@ def get_processor(
save_systematics=save_systematics,
inference=inference,
save_all=save_all,
vbf_search=vbf_search,
)
elif processor == "input":
from HHbbVV.processors import TaggerInputSkimmer
Expand Down Expand Up @@ -180,3 +182,4 @@ def parse_common_args(parser):
add_bool_arg(parser, "save-systematics", default=False, help="save systematic variations")
add_bool_arg(parser, "save-all", default=True, help="save all branches")
add_bool_arg(parser, "inference", default=True, help="run inference for ak8 jets")
add_bool_arg(parser, "vbf-search", default=False, help="run selections for VBF production search")

0 comments on commit 2005c9b

Please sign in to comment.