-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'cbernet/heppy_7_2_2_patch2' into heppy_…
…7_2_2_patch2
- Loading branch information
Showing
6 changed files
with
107 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from PhysicsTools.Heppy.analyzers.core.Analyzer import Analyzer | ||
from PhysicsTools.Heppy.analyzers.core.AutoHandle import AutoHandle | ||
import PhysicsTools.HeppyCore.framework.config as cfg | ||
from math import * | ||
from DataFormats.FWLite import Events, Handle | ||
|
||
class LHEAnalyzer( Analyzer ): | ||
""" """ | ||
def __init__(self, cfg_ana, cfg_comp, looperName ): | ||
super(LHEAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName) | ||
|
||
def declareHandles(self): | ||
super(LHEAnalyzer, self).declareHandles() | ||
# self.mchandles['lhestuff'] = AutoHandle( 'externalLHEProducer','LHEEventProduct') | ||
|
||
def beginLoop(self, setup): | ||
super(LHEAnalyzer,self).beginLoop(setup) | ||
|
||
def process(self, event): | ||
|
||
# if not MC, nothing to do | ||
if not self.cfg_comp.isMC: | ||
return True | ||
event.lheHT=0 | ||
event.lheNj=0 | ||
event.lheV_pt = 0 | ||
h=Handle('LHEEventProduct') | ||
event.input.getByLabel( 'externalLHEProducer',h) | ||
if not h.isValid() : | ||
return True | ||
self.readCollections( event.input ) | ||
hepeup=h.product().hepeup() | ||
pup=hepeup.PUP | ||
l=None | ||
lBar=None | ||
nu=None | ||
nuBar=None | ||
for i in xrange(0,len(pup)): | ||
id=hepeup.IDUP[i] | ||
status = hepeup.ISTUP[i] | ||
idabs=abs(id) | ||
|
||
if status == 1 and ( ( idabs == 21 ) or (idabs > 0 and idabs < 7) ) : # gluons and quarks | ||
event.lheHT += sqrt( pup[i][0]**2 + pup[i][1]**2 ) # first entry is px, second py | ||
event.lheNj +=1 | ||
if idabs in [12,14,16] : | ||
if id > 0 : | ||
nu = i | ||
else : | ||
nuBar = i | ||
if idabs in [11,13,15] : | ||
if id > 0 : | ||
l = i | ||
else : | ||
lBar = i | ||
v=None | ||
if l and lBar : #Z to LL | ||
v=(l,lBar) | ||
elif l and nuBar : #W | ||
v=(l,nuBar) | ||
elif lBar and nu : #W | ||
v=(nu,lBar) | ||
elif nu and nuBar : #Z to nn | ||
v=(nu,nuBar) | ||
if v : | ||
event.lheV_pt = sqrt( (pup[v[0]][0]+pup[v[1]][0])**2 + (pup[v[0]][1]+pup[v[1]][1])**2 ) | ||
|
||
return True | ||
|
||
setattr(LHEAnalyzer,"defaultConfig", | ||
cfg.Analyzer(LHEAnalyzer, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters