From 2005c9b7bbf4b9362f415d045e3040ae75e72910 Mon Sep 17 00:00:00 2001 From: Andres Nava Date: Mon, 21 Aug 2023 15:47:18 -0500 Subject: [PATCH] Turned isVBFsearch boolean into vbf-search argument for skimmer. --- src/HHbbVV/processors/bbVVSkimmer.py | 11 ++++++----- src/condor/submit.py | 1 + src/condor/submit.templ.sh | 2 +- .../submit_configs/skimmer_inputs_23_07_31.yaml | 14 ++++++++++++++ src/run.py | 1 + src/run_utils.py | 3 +++ 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/HHbbVV/processors/bbVVSkimmer.py b/src/HHbbVV/processors/bbVVSkimmer.py index 38a0d80b..5ca0f044 100644 --- a/src/HHbbVV/processors/bbVVSkimmer.py +++ b/src/HHbbVV/processors/bbVVSkimmer.py @@ -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__() @@ -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 = ( @@ -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]): @@ -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 @@ -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) } @@ -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] diff --git a/src/condor/submit.py b/src/condor/submit.py index fd47918f..f0157f3d 100644 --- a/src/condor/submit.py +++ b/src/condor/submit.py @@ -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", diff --git a/src/condor/submit.templ.sh b/src/condor/submit.templ.sh index 712c935f..4a46e5ad 100644 --- a/src/condor/submit.templ.sh +++ b/src/condor/submit.templ.sh @@ -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 diff --git a/src/condor/submit_configs/skimmer_inputs_23_07_31.yaml b/src/condor/submit_configs/skimmer_inputs_23_07_31.yaml index bbcc2145..deb17d16 100644 --- a/src/condor/submit_configs/skimmer_inputs_23_07_31.yaml +++ b/src/condor/submit_configs/skimmer_inputs_23_07_31.yaml @@ -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 }, }, } diff --git a/src/run.py b/src/run.py index b74534fd..a92974ac 100644 --- a/src/run.py +++ b/src/run.py @@ -138,6 +138,7 @@ def main(args): args.save_systematics, args.inference, args.save_all, + args.vbf_search, ) if len(args.files): diff --git a/src/run_utils.py b/src/run_utils.py index 05a4397e..b4298914 100644 --- a/src/run_utils.py +++ b/src/run_utils.py @@ -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": @@ -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 @@ -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") \ No newline at end of file