CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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__
 
def beginLoop
 
def declareHandles
 
def process
 

Public Attributes

 lheh
 

Detailed Description

 

Definition at line 8 of file LHEAnalyzer.py.

Constructor & Destructor Documentation

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

Definition at line 10 of file LHEAnalyzer.py.

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

Member Function Documentation

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

Definition at line 18 of file LHEAnalyzer.py.

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

Definition at line 14 of file LHEAnalyzer.py.

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

Definition at line 21 of file LHEAnalyzer.py.

References funct.abs(), gen.LHEAnalyzer.LHEAnalyzer.lheh, SiStripPI.max, sistrip::SpyUtilities.range(), core.Analyzer.Analyzer.readCollections(), and mathSSE.sqrt().

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

Member Data Documentation

gen.LHEAnalyzer.LHEAnalyzer.lheh

Definition at line 12 of file LHEAnalyzer.py.

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