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 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  def __init__(self, cfg_ana, cfg_comp, looperName ):
10  super(LHEAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName)
11  self.lheh=Handle('LHEEventProduct')
12 
def __init__(self, cfg_ana, cfg_comp, looperName)
Definition: LHEAnalyzer.py:9

Member Function Documentation

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

Definition at line 17 of file LHEAnalyzer.py.

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

Definition at line 13 of file LHEAnalyzer.py.

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

Definition at line 20 of file LHEAnalyzer.py.

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

Member Data Documentation

gen.LHEAnalyzer.LHEAnalyzer.lheh

Definition at line 11 of file LHEAnalyzer.py.

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