CMS 3D CMS Logo

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__ (self, cfg_ana, cfg_comp, looperName)
 
def beginLoop (self, setup)
 
def declareHandles (self)
 
def makeBPartons (self, event)
 
def process (self, event)
 

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

◆ __init__()

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

Definition at line 19 of file GenHeavyFlavourAnalyzer.py.

19  def __init__(self, cfg_ana, cfg_comp, looperName ):
20  super(GenHeavyFlavourAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName)
21  self.status2Only = cfg_ana.status2Only
22  self.bquarkPtCut = cfg_ana.bquarkPtCut
23 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ beginLoop()

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

Definition at line 27 of file GenHeavyFlavourAnalyzer.py.

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

◆ declareHandles()

def gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.declareHandles (   self)

Definition at line 24 of file GenHeavyFlavourAnalyzer.py.

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

◆ makeBPartons()

def gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.makeBPartons (   self,
  event 
)

Definition at line 30 of file GenHeavyFlavourAnalyzer.py.

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

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

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

◆ process()

def gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.process (   self,
  event 
)

Definition at line 42 of file GenHeavyFlavourAnalyzer.py.

References funct.abs(), analyzer.Analyzer.cfg_comp, looper.Looper.cfg_comp, gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.makeBPartons(), EgammaValidation_cff.pdgId, core.Analyzer.Analyzer.readCollections(), and gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.status2Only.

42  def process(self, event):
43  self.readCollections( event.input )
44 
45  # if not MC, nothing to do
46  if not self.cfg_comp.isMC:
47  return True
48 
49  status2f = (lambda p : p.status() == 2) if self.status2Only else (lambda p : True)
50  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) ]
51  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) ]
52 
53  self.makeBPartons(event)
54 
55  return True
56 
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

◆ bquarkPtCut

gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.bquarkPtCut

◆ status2Only

gen.GenHeavyFlavourAnalyzer.GenHeavyFlavourAnalyzer.status2Only