1 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
2 from PhysicsTools.Heppy.analyzers.core.AutoHandle
import AutoHandle
3 import PhysicsTools.HeppyCore.framework.config
as cfg
5 from DataFormats.FWLite
import Events, Handle
9 def __init__(self, cfg_ana, cfg_comp, looperName ):
10 super(LHEAnalyzer,self).
__init__(cfg_ana,cfg_comp,looperName)
11 self.
lheh=Handle(
'LHEEventProduct')
23 if not self.cfg_comp.isMC:
34 event.input.getByLabel(
'externalLHEProducer',self.
lheh)
37 if not self.lheh.isValid() :
39 self.readCollections( event.input )
40 hepeup=self.lheh.product().hepeup()
46 for i
in xrange(0,len(pup)):
48 status = hepeup.ISTUP[i]
51 mothIdx =
max(hepeup.MOTHUP[i][0]-1,0)
52 mothIdxTwo =
max(hepeup.MOTHUP[i][1]-1,0)
54 mothStatus = hepeup.ISTUP[mothIdx]
55 mothStatusTwo = hepeup.ISTUP[mothIdxTwo]
57 hasIncomingAsMother = mothStatus<0
or mothStatusTwo<0
59 if status == 1
and ( ( idabs == 21 )
or (idabs > 0
and idabs < 7) ) :
60 pt =
sqrt( pup[i][0]**2 + pup[i][1]**2 )
62 if hasIncomingAsMother: event.lheHTIncoming += pt
72 if idabs
in [12,14,16] :
77 if idabs
in [11,13,15] :
92 event.lheV_pt =
sqrt( (pup[v[0]][0]+pup[v[1]][0])**2 + (pup[v[0]][1]+pup[v[1]][1])**2 )
96 setattr(LHEAnalyzer,
"defaultConfig",
97 cfg.Analyzer(LHEAnalyzer,
Abs< T >::type abs(const T &t)