1 from heppy.framework.analyzer
import Analyzer
2 from heppy.utils.deltar
import matchObjectCollection, deltaR
9 Works with any kind of object with a p4 function. 11 Simple example configuration: 13 from heppy_fcc.analyzers.Matcher import Matcher 14 papas_jet_match = cfg.Analyzer( 16 instance_label = 'papas', 17 match_particles = 'gen_jets', 18 particles = 'papas_jets' 21 particles: Name of the collection containing the particles to be matched. 22 match_particles: Name of the collection containing the particles where a match 25 In this particular case, each jet in "papas_jets" will end up with a new 26 attribute called "match". This attribute can be either the closest gen jet in the 27 "gen_jets" collection in case a gen_jet is found within delta R = 0.3, 28 or None in case a match cannot be found in this cone. 30 More complex example configuration: 32 papas_particle_match_g2r = cfg.Analyzer( 34 instance_label = 'papas_g2r', 35 particles = 'gen_particles_stable', 37 ('papas_rec_particles', None), 38 ('papas_rec_particles', 211), 39 ('papas_rec_particles', 130), 40 ('papas_rec_particles', 22) 44 In this case, each gen particle in gen_particles_stable will end up with the following 46 - "match" : closest reconstructed particle in "papas_rec_particles", if any. 47 - "match_211": closest reconstructed particle of pdgId 211 in "papas_rec_particles", 57 if isinstance( self.cfg_ana.match_particles, str):
58 self.match_collections.append( (self.cfg_ana.match_particles,
None) )
63 particles = getattr(event, self.cfg_ana.particles)
66 match_ptcs = getattr(event, collname)
67 match_ptcs_filtered = match_ptcs
69 match_ptcs_filtered = [ptc
for ptc
in match_ptcs
70 if ptc.pdgid()==pdgid]
76 matchname =
'match_{pdgid}'.
format(pdgid=pdgid)
78 setattr(ptc, matchname, match)
82 drname =
'dr_{pdgid}'.
format(pdgid=pdgid)
83 dr =
deltaR(ptc.theta(), ptc.phi(),
84 match.theta(), match.phi())
85 setattr(ptc, drname, dr)
def beginLoop(self, setup)
def matchObjectCollection