DelphesEvent sorts leptons and jets in ascending pT order
@mhance this might be intentional for reasons I'm missing (so feel free to just close if that's the case) but in scripts/HistCollections.py
the DelphesEvent
class sorts the leptons and jets in ascending
pT order.
That is sortedleptons
is
self.sortedleptons=sorted(self.leptons,key=lambda lep:lep.PT)
instead of
self.sorted_leptons = sorted(self.leptons, key=lambda lep: lep.PT, reverse=True)
The reason I mention it, is that leading lepton logic block in the Hists
class
leadingLep = 0
if ( len(event.elecs) > 0 and len(event.muons) == 0 ):
leadingLep = event.elecs[0].P4()
elif ( len(event.elecs) == 0 and len(event.muons) > 0 ):
leadingLep = event.muons[0].P4()
elif ( len(event.elecs) > 0 and len(event.muons) > 0 ):
if ( event.elecs[0].PT > event.muons[0].PT ):
leadingLep = event.elecs[0].P4()
else:
leadingLep = event.muons[0].P4()
seems to indicate that one should be expecting the 0
th element to be the leading pT lepton. If this is the case, then this can be simplified by using in DelphesEvent
self.sorted_leptons = sorted(self.leptons, key=lambda lep: lep.PT, reverse=True)
and in Hists
# event.sorted_leptons are pT sorted in descending order
leading_lepton = (
event.sorted_leptons[0].P4() if len(event.sorted_leptons) > 0 else None
)
Again, as I'm not an expert with this code base, I could be missing something obvious about why things are done the way they are now.