Example #1
0
 def process(self, event):
     particles = getattr(event, self.cfg_ana.particles)
     # match_particles = getattr(event, self.cfg_ana.match_particles)
     for collname, pdgid in self.match_collections:
         match_ptcs = getattr(event, collname)
         match_ptcs_filtered = match_ptcs
         if pdgid is not None:
             match_ptcs_filtered = [
                 ptc for ptc in match_ptcs if ptc.pdgid() == pdgid
             ]
         pairs = matchObjectCollection(particles, match_ptcs_filtered,
                                       self.cfg_ana.delta_r)
         for ptc in particles:
             matchname = 'match'
             if pdgid:
                 matchname = 'match_{pdgid}'.format(pdgid=pdgid)
             match = pairs[ptc]
             setattr(ptc, matchname, match)
             if match:
                 drname = 'dr'
                 if pdgid:
                     drname = 'dr_{pdgid}'.format(pdgid=pdgid)
                 dr = deltaR(ptc.theta(), ptc.phi(), match.theta(),
                             match.phi())
                 setattr(ptc, drname, dr)
Example #2
0
 def process(self, event):
     '''process event
     
     The event must contain:
      - self.cfg_ana.particles: the particles to be matched
      - self.cfg_ana.match_particles: the particles in which the match has to be found
      
     Modifies the particles in event.<self.cfg_ana.particles>
     '''
     particles = getattr(event, self.cfg_ana.particles)
     # match_particles = getattr(event, self.cfg_ana.match_particles)
     for collname, pdgid in self.match_collections:
         match_ptcs = getattr(event, collname)
         match_ptcs_filtered = match_ptcs
         if pdgid is not None:
             match_ptcs_filtered = [ptc for ptc in match_ptcs
                                    if ptc.pdgid()==pdgid]
         pairs = matchObjectCollection(particles, match_ptcs_filtered,
                                       self.cfg_ana.delta_r)
         for ptc in particles:
             matchname = 'match'
             if pdgid: 
                 matchname = 'match_{pdgid}'.format(pdgid=pdgid)
             match = pairs[ptc]
             setattr(ptc, matchname, match)
             if match:
                 drname = 'dr'
                 if pdgid:
                     drname = 'dr_{pdgid}'.format(pdgid=pdgid)
                 dr = deltaR(ptc.theta(), ptc.phi(),
                             match.theta(), match.phi())
                 setattr(ptc, drname, dr)
Example #3
0
 def process(self, event):
     '''process event
     
     The event must contain:
      - self.cfg_ana.particles: the particles to be matched
      - self.cfg_ana.match_particles: the particles in which the match has to be found
      
     Modifies the particles in event.<self.cfg_ana.particles>
     '''
     particles = getattr(event, self.cfg_ana.particles)
     # match_particles = getattr(event, self.cfg_ana.match_particles)
     for collname, pdgid in self.match_collections:
         match_ptcs = getattr(event, collname)
         match_ptcs_filtered = match_ptcs
         if pdgid is not None:
             match_ptcs_filtered = [ptc for ptc in match_ptcs
                                    if ptc.pdgid()==pdgid]
         pairs = matchObjectCollection(particles, match_ptcs_filtered,
                                       self.cfg_ana.delta_r)
         for ptc in particles:
             matchname = 'match'
             if pdgid: 
                 matchname = 'match_{pdgid}'.format(pdgid=pdgid)
             match = pairs[ptc]
             setattr(ptc, matchname, match)
             if match:
                 drname = 'dr'
                 if pdgid:
                     drname = 'dr_{pdgid}'.format(pdgid=pdgid)
                 dr = deltaR(ptc, match)
                 setattr(ptc, drname, dr)
 def process(self, event):
     jets = getattr(event, self.cfg_ana.jets)
     genjets = getattr(event, self.cfg_ana.genjets)
     pairs = matchObjectCollection(jets, genjets, 0.3**2)
     for jet in jets:
         jet.gen = pairs[jet]
         if jet.gen:
             jet.dR = deltaR(jet.theta(), jet.phi(),
                             jet.gen.theta(), jet.gen.phi())
Example #5
0
 def process(self, event):
     jets = getattr(event, self.cfg_ana.jets)
     genjets = getattr(event, self.cfg_ana.genjets)
     pairs = matchObjectCollection(jets, genjets, 0.3**2)
     for jet in jets:
         jet.gen = pairs[jet]
         if jet.gen:
             jet.dR = deltaR(jet.theta(), jet.phi(),
                             jet.gen.theta(), jet.gen.phi())
Example #6
0
 def process(self, event):
     jets = event.rec_jets
     genjets = event.gen_jets
     pairs = matchObjectCollection(jets, genjets, 0.3**2)
     for jet in jets:
         jet.gen = pairs[jet]
         if jet.gen:
             jet.dR = deltaR(jet.theta(), jet.phi(),
                             jet.gen.theta(), jet.gen.phi())
Example #7
0
 def process(self, event):
     particles = getattr(event, self.cfg_ana.particles)
     match_particles = getattr(event, self.cfg_ana.match_particles)
     pairs = matchObjectCollection(particles, match_particles,
                                   self.dr2)
     for ptc in particles:
         match = pairs[ptc]
         if match:
             dr = deltaR(ptc.theta(), ptc.phi(),
                         match.theta(), match.phi())
             setattr(ptc, self.instance_label, MatchInfo(match, dr))
Example #8
0
    def process(self, event):
        particles = getattr(event, self.cfg_ana.particles)
        nhs = [ptc for ptc in particles if abs(ptc.pdgid())==130]
        chs = [ptc for ptc in particles if abs(ptc.pdgid())==211]

        pairs = matchObjectCollection(chs, nhs, 1e-5**2)

        # import pdb; pdb.set_trace()
        for ptc in chs: 
            match = pairs[ptc]
            if match: 
                # print 'found one!'
                # import pdb; pdb.set_trace()
                particles.remove(match)
Example #9
0
 def process(self, event):
     particles = getattr(event, self.cfg_ana.particles)
     # match_particles = getattr(event, self.cfg_ana.match_particles)
     for collname, pdgid in self.match_collections:
         match_ptcs = getattr(event, collname)
         match_ptcs_filtered = match_ptcs
         if pdgid is not None:
             match_ptcs_filtered = [ptc for ptc in match_ptcs
                                    if ptc.pdgid()==pdgid]
         pairs = matchObjectCollection(particles, match_ptcs_filtered,
                                       self.dr2)
         for ptc in particles:
             matchname = 'match'
             if pdgid: 
                 matchname = 'match_{pdgid}'.format(pdgid=pdgid)
             match = pairs[ptc]
             setattr(ptc, matchname, match)
             if match:
                 drname = 'dr'
                 if pdgid:
                     drname = 'dr_{pdgid}'.format(pdgid=pdgid)
                 dr = deltaR(ptc.theta(), ptc.phi(),
                             match.theta(), match.phi())
                 setattr(ptc, drname, dr)