How to use the coffea.util.awkward.JaggedArray.fromoffsets function in coffea

To help you get started, we’ve selected a few coffea examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CoffeaTeam / coffea / coffea / analysis_objects / JaggedCandidateMethods.py View on Github external
def pairs(self, nested=False):
        """
        This method calls the pairs method of JaggedArray to get all pairs
        per-event contained in a JaggedCandidateArray.

        The resulting JaggedArray of that call is dressed with the jagged candidate
        array four-momentum and cached fast access pt/eta/phi/mass.
        """
        outs = super(JaggedCandidateMethods, self).pairs(nested)
        outs['p4'] = outs.i0['p4'] + outs.i1['p4']
        thep4 = outs['p4']
        outs['__fast_pt'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_pt(thep4.content))
        outs['__fast_eta'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_eta(thep4.content))
        outs['__fast_phi'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_phi(thep4.content))
        outs['__fast_mass'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_mass(thep4.content))
        return self.fromjagged(outs)
github CoffeaTeam / coffea / coffea / jetmet_tools / FactorizedJetCorrector.py View on Github external
else:
            cumulativeCorrection = np.ones_like(firstarg)
        corrections = []
        for i, func in enumerate(self._funcs):
            sig = func.signature
            args = []
            for input in sig:
                args.append(localargs[input])
            corr = func(*tuple(args))
            for var in corrVars:
                localargs[var] *= corr
            cumulativeCorrection *= corr
            corrections.append(cumulativeCorrection)
        if offsets is not None:
            for i in range(len(corrections)):
                corrections[i] = awkward.JaggedArray.fromoffsets(offsets, corrections[i])
        return corrections
github CoffeaTeam / coffea / coffea / analysis_objects / JaggedCandidateMethods.py View on Github external
This method calls the choose(n) method of JaggedArray to get all pairs
        per-event contained in a JaggedCandidateArray.

        The resulting JaggedArray of that call is dressed with the jagged candidate
        array four-momentum and cached fast access pt/eta/phi/mass.
        """
        outs = super(JaggedCandidateMethods, self).choose(n)
        p4 = outs.i0['p4']
        for i in range(1, n):
            p4 = p4 + outs['%d' % i]['p4']
        outs['p4'] = p4
        thep4 = outs['p4']
        outs['__fast_pt'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_pt(thep4.content))
        outs['__fast_eta'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_eta(thep4.content))
        outs['__fast_phi'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_phi(thep4.content))
        outs['__fast_mass'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_mass(thep4.content))
        return self.fromjagged(outs)
github CoffeaTeam / coffea / coffea / analysis_objects / JaggedCandidateMethods.py View on Github external
"""
        This method calls the choose(n) method of JaggedArray to get all pairs
        per-event contained in a JaggedCandidateArray.

        The resulting JaggedArray of that call is dressed with the jagged candidate
        array four-momentum and cached fast access pt/eta/phi/mass.
        """
        outs = super(JaggedCandidateMethods, self).choose(n)
        p4 = outs.i0['p4']
        for i in range(1, n):
            p4 = p4 + outs['%d' % i]['p4']
        outs['p4'] = p4
        thep4 = outs['p4']
        outs['__fast_pt'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_pt(thep4.content))
        outs['__fast_eta'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_eta(thep4.content))
        outs['__fast_phi'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_phi(thep4.content))
        outs['__fast_mass'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_mass(thep4.content))
        return self.fromjagged(outs)
github CoffeaTeam / coffea / coffea / analysis_objects / JaggedCandidateMethods.py View on Github external
def pairs(self, nested=False):
        """
        This method calls the pairs method of JaggedArray to get all pairs
        per-event contained in a JaggedCandidateArray.

        The resulting JaggedArray of that call is dressed with the jagged candidate
        array four-momentum and cached fast access pt/eta/phi/mass.
        """
        outs = super(JaggedCandidateMethods, self).pairs(nested)
        outs['p4'] = outs.i0['p4'] + outs.i1['p4']
        thep4 = outs['p4']
        outs['__fast_pt'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_pt(thep4.content))
        outs['__fast_eta'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_eta(thep4.content))
        outs['__fast_phi'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_phi(thep4.content))
        outs['__fast_mass'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_mass(thep4.content))
        return self.fromjagged(outs)
github CoffeaTeam / coffea / coffea / analysis_objects / JaggedCandidateMethods.py View on Github external
def pairs(self, nested=False):
        """
        This method calls the pairs method of JaggedArray to get all pairs
        per-event contained in a JaggedCandidateArray.

        The resulting JaggedArray of that call is dressed with the jagged candidate
        array four-momentum and cached fast access pt/eta/phi/mass.
        """
        outs = super(JaggedCandidateMethods, self).pairs(nested)
        outs['p4'] = outs.i0['p4'] + outs.i1['p4']
        thep4 = outs['p4']
        outs['__fast_pt'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_pt(thep4.content))
        outs['__fast_eta'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_eta(thep4.content))
        outs['__fast_phi'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_phi(thep4.content))
        outs['__fast_mass'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_mass(thep4.content))
        return self.fromjagged(outs)
github CoffeaTeam / coffea / coffea / analysis_objects / JaggedCandidateMethods.py View on Github external
def choose(self, n):
        """
        This method calls the choose(n) method of JaggedArray to get all pairs
        per-event contained in a JaggedCandidateArray.

        The resulting JaggedArray of that call is dressed with the jagged candidate
        array four-momentum and cached fast access pt/eta/phi/mass.
        """
        outs = super(JaggedCandidateMethods, self).choose(n)
        p4 = outs.i0['p4']
        for i in range(1, n):
            p4 = p4 + outs['%d' % i]['p4']
        outs['p4'] = p4
        thep4 = outs['p4']
        outs['__fast_pt'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_pt(thep4.content))
        outs['__fast_eta'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_eta(thep4.content))
        outs['__fast_phi'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_phi(thep4.content))
        outs['__fast_mass'] = awkward.JaggedArray.fromoffsets(outs.offsets, _fast_mass(thep4.content))
        return self.fromjagged(outs)