Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mondalspandan committed Nov 16, 2023
1 parent 965df29 commit 8978fba
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 25 deletions.
7 changes: 5 additions & 2 deletions src/BTVNanoCommissioning/helpers/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ def uproot_writeable(events, include=["events", "run", "luminosityBlock"]):
):
continue
evnums = ak.num(events[bname][n], axis=0)
if not isinstance(evnums,int): continue
if not _is_rootcompat(events[bname][n]) and evnums != len(flatten(events[bname][n])):
if not isinstance(evnums, int):
continue
if not _is_rootcompat(events[bname][n]) and evnums != len(
flatten(events[bname][n])
):
continue
# skip IdxG
if "IdxG" in n:
Expand Down
54 changes: 31 additions & 23 deletions src/BTVNanoCommissioning/workflows/ctag_DY_valid_sf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(
isArray=False,
noHist=False,
chunksize=75000,
selectionModifier="DYM"
selectionModifier="DYM",
):
self._year = year
self._campaign = campaign
Expand Down Expand Up @@ -108,8 +108,7 @@ def process_shift(self, events, shift_name):
else:
raise ValueError(self.selMod, "is not a valid selection modifier.")

histname = {"DYM":"ctag_DY_sf",
"DYE":"ectag_DY_sf"}
histname = {"DYM": "ctag_DY_sf", "DYE": "ectag_DY_sf"}
_hist_event_dict = (
{"": None} if self.noHist else histogrammer(events, histname[self.selMod])
)
Expand Down Expand Up @@ -175,24 +174,24 @@ def process_shift(self, events, shift_name):
)

jet_sel = ak.fill_none(
jet_id(events, self._campaign)
& (
ak.all(
events.Jet.metric_table(pos_dilep) > 0.4,
axis=2,
mask_identity=True,
)
jet_id(events, self._campaign)
& (
ak.all(
events.Jet.metric_table(pos_dilep) > 0.4,
axis=2,
mask_identity=True,
)
& (
ak.all(
events.Jet.metric_table(neg_dilep) > 0.4,
axis=2,
mask_identity=True,
)
),
False,
axis=-1,
)
& (
ak.all(
events.Jet.metric_table(neg_dilep) > 0.4,
axis=2,
mask_identity=True,
)
),
False,
axis=-1,
)

pos_dilep = ak.pad_none(pos_dilep, 1, axis=1)
neg_dilep = ak.pad_none(neg_dilep, 1, axis=1)
Expand Down Expand Up @@ -399,11 +398,11 @@ def process_shift(self, events, shift_name):
if isMu:
pruned_ev["MuonPlus"] = sposmu
pruned_ev["MuonMinus"] = snegmu
kinOnly=["Muon","MuonPlus","MuonMinus"]
kinOnly = ["Muon", "MuonPlus", "MuonMinus"]
else:
pruned_ev["ElectronPlus"] = sposmu
pruned_ev["ElectronMinus"] = snegmu
kinOnly=["Electron","ElectronPlus","ElectronMinus"]
kinOnly = ["Electron", "ElectronPlus", "ElectronMinus"]
pruned_ev["dilep"] = sposmu + snegmu
pruned_ev["dilep", "pt"] = pruned_ev.dilep.pt
pruned_ev["dilep", "eta"] = pruned_ev.dilep.eta
Expand All @@ -422,8 +421,17 @@ def process_shift(self, events, shift_name):

pruned_ev["dr_mu1jet"] = sposmu.delta_r(sel_jet)
pruned_ev["dr_mu2jet"] = snegmu.delta_r(sel_jet)

array_writer(self, pruned_ev, events, systematics[0], dataset, isRealData, kinOnly=kinOnly,remove=kinOnly)

array_writer(
self,
pruned_ev,
events,
systematics[0],
dataset,
isRealData,
kinOnly=kinOnly,
remove=kinOnly,
)

return {dataset: output}

Expand Down

0 comments on commit 8978fba

Please sign in to comment.