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

Update CorrectedMETFactory.py #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
15 changes: 7 additions & 8 deletions src/coffea/jetmet_tools/CorrectedMETFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@


def corrected_polar_met(
met_pt, met_phi, jet_pt, jet_phi, jet_pt_orig, positive=None, dx=None, dy=None
met_pt, met_phi, jet_pt, jet_phi, positive=None, dx=None, dy=None
):
sj, cj = numpy.sin(jet_phi), numpy.cos(jet_phi)
x = met_pt * numpy.cos(met_phi) + awkward.sum((jet_pt - jet_pt_orig) * cj, axis=1)
y = met_pt * numpy.sin(met_phi) + awkward.sum((jet_pt - jet_pt_orig) * sj, axis=1)
x = met_pt * numpy.cos(met_phi) - awkward.sum(jet_pt * cj, axis=1)
y = met_pt * numpy.sin(met_phi) - awkward.sum(jet_pt * sj, axis=1)
if positive is not None and dx is not None and dy is not None:
x = x + dx if positive else x - dx
y = y + dy if positive else y - dy
Expand Down Expand Up @@ -36,7 +36,7 @@ def __init__(self, name_map):

self.name_map = name_map

def build(self, in_MET, in_corrected_jets):
def build(self, in_MET, type1_MET in_corrected_jets):
if not isinstance(
in_MET, (awkward.highlevel.Array, dask_awkward.Array)
) or not isinstance(
Expand All @@ -60,7 +60,6 @@ def switch_properties(raw_met, corrected_jets, dx, dy, positive, save_orig):
raw_met[self.name_map["METphi"]],
corrected_jets[self.name_map["JetPt"]],
corrected_jets[self.name_map["JetPhi"]],
corrected_jets[self.name_map["ptRaw"]],
positive=positive,
dx=dx,
dy=dy,
Expand Down Expand Up @@ -144,10 +143,10 @@ def create_variants(raw_met, corrected_jets_or_variants, dx, dy):

out_dict["MET_UnclusteredEnergy"] = dask_awkward.map_partitions(
create_variants,
MET,
type1_MET,
corrected_jets,
MET[self.name_map["UnClusteredEnergyDeltaX"]],
MET[self.name_map["UnClusteredEnergyDeltaY"]],
type1_MET[self.name_map["UnClusteredEnergyDeltaX"]],
type1_MET[self.name_map["UnClusteredEnergyDeltaY"]],
label="UnclusteredEnergy_met",
)

Expand Down