CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 7 of file LHEAnalyzer.py.

Constructor & Destructor Documentation

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

Definition at line 9 of file LHEAnalyzer.py.

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

Member Function Documentation

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

Definition at line 17 of file LHEAnalyzer.py.

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

Definition at line 13 of file LHEAnalyzer.py.

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

Definition at line 20 of file LHEAnalyzer.py.

References funct.abs(), gen.LHEAnalyzer.LHEAnalyzer.lheh, bookConverter.max, core.Analyzer.Analyzer.readCollections(), and mathSSE.sqrt().

Referenced by ConfigBuilder.ConfigBuilder.addExtraStream(), ConfigBuilder.ConfigBuilder.completeInputCommand(), ConfigBuilder.ConfigBuilder.doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules.leave(), ConfigBuilder.ConfigBuilder.prepare_HLT(), ConfigBuilder.ConfigBuilder.prepare_LHE(), ConfigBuilder.ConfigBuilder.prepare_PATFILTER(), ConfigBuilder.ConfigBuilder.prepare_VALIDATION(), ConfigBuilder.ConfigBuilder.renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder.renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder.scheduleSequence().

20 
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 xrange(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 
setattr(LHEAnalyzer,"defaultConfig",
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

gen.LHEAnalyzer.LHEAnalyzer.lheh

Definition at line 11 of file LHEAnalyzer.py.

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