CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
gen.LHEAnalyzer.LHEAnalyzer Class Reference
Inheritance diagram for gen.LHEAnalyzer.LHEAnalyzer:

Public Member Functions

def __init__ (self, cfg_ana, cfg_comp, looperName)
 
def beginLoop (self, setup)
 
def declareHandles (self)
 
def process (self, event)
 

Public Attributes

 lheh
 

Detailed Description

 

Definition at line 8 of file LHEAnalyzer.py.

Constructor & Destructor Documentation

◆ __init__()

def gen.LHEAnalyzer.LHEAnalyzer.__init__ (   self,
  cfg_ana,
  cfg_comp,
  looperName 
)

Definition at line 10 of file LHEAnalyzer.py.

10  def __init__(self, cfg_ana, cfg_comp, looperName ):
11  super(LHEAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName)
12  self.lheh=Handle('LHEEventProduct')
13 

Member Function Documentation

◆ beginLoop()

def gen.LHEAnalyzer.LHEAnalyzer.beginLoop (   self,
  setup 
)

Definition at line 18 of file LHEAnalyzer.py.

18  def beginLoop(self, setup):
19  super(LHEAnalyzer,self).beginLoop(setup)
20 

◆ declareHandles()

def gen.LHEAnalyzer.LHEAnalyzer.declareHandles (   self)

Definition at line 14 of file LHEAnalyzer.py.

14  def declareHandles(self):
15  super(LHEAnalyzer, self).declareHandles()
16 # self.mchandles['lhestuff'] = AutoHandle( 'externalLHEProducer','LHEEventProduct')
17 

◆ process()

def gen.LHEAnalyzer.LHEAnalyzer.process (   self,
  event 
)

Definition at line 21 of file LHEAnalyzer.py.

21  def process(self, event):
22 
23  # if not MC, nothing to do
24  if not self.cfg_comp.isMC:
25  return True
26  event.lheHT=0
27  event.lheHTIncoming=0 #restrict HT computation to particles that have status<0 mothers
28  event.lheNj=0
29  event.lheNb=0
30  event.lheNc=0
31  event.lheNl=0
32  event.lheNg=0
33  event.lheV_pt = 0
34  try:
35  event.input.getByLabel( 'externalLHEProducer',self.lheh)
36  except :
37  return True
38  if not self.lheh.isValid() :
39  return True
40  self.readCollections( event.input )
41  hepeup=self.lheh.product().hepeup()
42  pup=hepeup.PUP
43  l=None
44  lBar=None
45  nu=None
46  nuBar=None
47  for i in range(0,len(pup)):
48  id=hepeup.IDUP[i]
49  status = hepeup.ISTUP[i]
50  idabs=abs(id)
51 
52  mothIdx = max(hepeup.MOTHUP[i][0]-1,0) #first and last mother as pair; first entry has index 1 in LHE; incoming particles return motherindex 0
53  mothIdxTwo = max(hepeup.MOTHUP[i][1]-1,0)
54 
55  mothStatus = hepeup.ISTUP[mothIdx]
56  mothStatusTwo = hepeup.ISTUP[mothIdxTwo]
57 
58  hasIncomingAsMother = mothStatus<0 or mothStatusTwo<0
59 
60  if status == 1 and ( ( idabs == 21 ) or (idabs > 0 and idabs < 7) ) : # gluons and quarks
61  pt = sqrt( pup[i][0]**2 + pup[i][1]**2 ) # first entry is px, second py
62  event.lheHT += pt
63  if hasIncomingAsMother: event.lheHTIncoming += pt
64  event.lheNj +=1
65  if idabs==5:
66  event.lheNb += 1
67  if idabs==4:
68  event.lheNc += 1
69  if idabs in [1,2,3]:
70  event.lheNl += 1
71  if idabs==21:
72  event.lheNg += 1
73  if idabs in [12,14,16] :
74  if id > 0 :
75  nu = i
76  else :
77  nuBar = i
78  if idabs in [11,13,15] :
79  if id > 0 :
80  l = i
81  else :
82  lBar = i
83  v=None
84  if l and lBar : #Z to LL
85  v=(l,lBar)
86  elif l and nuBar : #W
87  v=(l,nuBar)
88  elif lBar and nu : #W
89  v=(nu,lBar)
90  elif nu and nuBar : #Z to nn
91  v=(nu,nuBar)
92  if v :
93  event.lheV_pt = sqrt( (pup[v[0]][0]+pup[v[1]][0])**2 + (pup[v[0]][1]+pup[v[1]][1])**2 )
94 
95  return True
96 
97 setattr(LHEAnalyzer,"defaultConfig",

References funct.abs(), analyzer.Analyzer.cfg_comp, looper.Looper.cfg_comp, gen.LHEAnalyzer.LHEAnalyzer.lheh, SiStripPI.max, FastTimerService_cff.range, core.Analyzer.Analyzer.readCollections(), and mathSSE.sqrt().

Member Data Documentation

◆ lheh

gen.LHEAnalyzer.LHEAnalyzer.lheh

Definition at line 12 of file LHEAnalyzer.py.

Referenced by gen.LHEAnalyzer.LHEAnalyzer.process().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
Handle
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22