1 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
7 event.genallbquarks, event.genallcquarks:
8 list of all b and c quarks (without doublecounting of b->b and c->c chains).
9 if status2Only == True, only status 2 ones are included.
11 all status 2 b-quarks, sorted by pt decreasingly
13 status 2 b-quarks passing a pt cut bquarkPtCut (default: 15)
19 def __init__(self, cfg_ana, cfg_comp, looperName ):
20 super(GenHeavyFlavourAnalyzer,self).
__init__(cfg_ana,cfg_comp,looperName)
28 super(GenHeavyFlavourAnalyzer,self).
beginLoop(setup)
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)
34 for q
in event.allBPartons:
36 for q2
in event.bPartons:
37 if deltaR(q.eta(),q.phi(),q2.eta(),q2.phi()) < 0.5:
40 if not duplicate: event.bPartons.append(q)
43 self.readCollections( event.input )
46 if not self.cfg_comp.isMC:
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) ]
57 import PhysicsTools.HeppyCore.framework.config
as cfg
58 setattr(GenHeavyFlavourAnalyzer,
"defaultConfig",
59 cfg.Analyzer(GenHeavyFlavourAnalyzer,