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.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer Class Reference
Inheritance diagram for gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer:

Public Member Functions

def __init__
 
def beginLoop
 
def declareHandles
 
def makeBPartons
 
def process
 

Public Attributes

 bquarkPtCut
 
 status2Only
 

Detailed Description

   Makes:
      event.genallbquarks, event.genallcquarks:
            list of all b and c quarks (without doublecounting of b->b and c->c chains).
            if status2Only == True, only status 2 ones are included.
      event.allBPartons
            all status 2 b-quarks, sorted by pt decreasingly
      event.bPartons:
            status 2 b-quarks passing a pt cut bquarkPtCut (default: 15)

   Requires:
      event.genParticles      

Definition at line 4 of file GenHeavyFlavourAnalyzer.py.

Constructor & Destructor Documentation

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

Definition at line 19 of file GenHeavyFlavourAnalyzer.py.

19 
20  def __init__(self, cfg_ana, cfg_comp, looperName ):
21  super(GenHeavyFlavourAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName)
22  self.status2Only = cfg_ana.status2Only
23  self.bquarkPtCut = cfg_ana.bquarkPtCut

Member Function Documentation

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

Definition at line 27 of file GenHeavyFlavourAnalyzer.py.

27 
28  def beginLoop(self,setup):
29  super(GenHeavyFlavourAnalyzer,self).beginLoop(setup)
def gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.declareHandles (   self)

Definition at line 24 of file GenHeavyFlavourAnalyzer.py.

24 
25  def declareHandles(self):
26  super(GenHeavyFlavourAnalyzer, self).declareHandles()
def gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.makeBPartons (   self,
  event 
)

Definition at line 30 of file GenHeavyFlavourAnalyzer.py.

References funct.abs(), gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.bquarkPtCut, and deltaR().

Referenced by gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.process().

30 
31  def makeBPartons(self,event):
32  event.allBPartons = [ q for q in event.genParticles if abs(q.pdgId()) == 5 and abs(q.status()) == 2 and abs(q.pt()) > self.bquarkPtCut ]
33  event.allBPartons.sort(key = lambda q : q.pt(), reverse = True)
34  event.bPartons = []
35  for q in event.allBPartons:
36  duplicate = False
37  for q2 in event.bPartons:
38  if deltaR(q.eta(),q.phi(),q2.eta(),q2.phi()) < 0.5:
39  duplicate = True
40  continue
41  if not duplicate: event.bPartons.append(q)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
def gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.process (   self,
  event 
)

Definition at line 42 of file GenHeavyFlavourAnalyzer.py.

References funct.abs(), gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.makeBPartons(), SingleMuPt40Fwdv2_cfi_GEN_SIM.pdgId, core.Analyzer.Analyzer.readCollections(), and gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.status2Only.

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().

42 
43  def process(self, event):
44  self.readCollections( event.input )
45 
46  # if not MC, nothing to do
47  if not self.cfg_comp.isMC:
48  return True
49 
50  status2f = (lambda p : p.status() == 2) if self.status2Only else (lambda p : True)
51  event.genallcquarks = [ p for p in event.genParticles if abs(p.pdgId()) == 5 and ( p.numberOfDaughters() == 0 or abs(p.daughter(0).pdgId()) != 5) and status2f(p) ]
52  event.genallbquarks = [ p for p in event.genParticles if abs(p.pdgId()) == 4 and ( p.numberOfDaughters() == 0 or abs(p.daughter(0).pdgId()) != 4) and status2f(p) ]
53 
54  self.makeBPartons(event)
55 
56  return True
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.bquarkPtCut

Definition at line 22 of file GenHeavyFlavourAnalyzer.py.

Referenced by gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.makeBPartons().

gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.status2Only

Definition at line 21 of file GenHeavyFlavourAnalyzer.py.

Referenced by gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.process().