1 from builtins
import range
2 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
3 from PhysicsTools.Heppy.analyzers.core.AutoHandle
import AutoHandle
4 import PhysicsTools.HeppyCore.framework.config
as cfg
6 from DataFormats.FWLite
import Events, Handle
10 def __init__(self, cfg_ana, cfg_comp, looperName ):
11 super(LHEAnalyzer,self).
__init__(cfg_ana,cfg_comp,looperName)
12 self.
lheh=Handle(
'LHEEventProduct')
24 if not self.cfg_comp.isMC:
35 event.input.getByLabel(
'externalLHEProducer',self.
lheh)
40 self.readCollections( event.input )
41 hepeup=self.
lheh.product().hepeup()
47 for i
in range(0,len(pup)):
49 status = hepeup.ISTUP[i]
52 mothIdx =
max(hepeup.MOTHUP[i][0]-1,0)
53 mothIdxTwo =
max(hepeup.MOTHUP[i][1]-1,0)
55 mothStatus = hepeup.ISTUP[mothIdx]
56 mothStatusTwo = hepeup.ISTUP[mothIdxTwo]
58 hasIncomingAsMother = mothStatus<0
or mothStatusTwo<0
60 if status == 1
and ( ( idabs == 21 )
or (idabs > 0
and idabs < 7) ) :
61 pt =
sqrt( pup[i][0]**2 + pup[i][1]**2 )
63 if hasIncomingAsMother: event.lheHTIncoming += pt
73 if idabs
in [12,14,16] :
78 if idabs
in [11,13,15] :
93 event.lheV_pt =
sqrt( (pup[v[0]][0]+pup[v[1]][0])**2 + (pup[v[0]][1]+pup[v[1]][1])**2 )
97 setattr(LHEAnalyzer,
"defaultConfig",
98 cfg.Analyzer(LHEAnalyzer,
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Abs< T >::type abs(const T &t)
def beginLoop(self, setup)
def __init__(self, cfg_ana, cfg_comp, looperName)