def merge_constituents(self, constituent_list): """ returns the combination of the constituents lists @param constituent_list list of JetConstituent objects, e.g. [jet1.constituents, jet2.constituents] """ ret = JetConstituents() for elem in constituent_list: for group in elem.values(): for ptc in group: ret.append(ptc) ret.sort() return ret
def process(self, event): p4 = TLorentzVector() charge = 0 pdgid = 0 ptcs = getattr(event, self.cfg_ana.particles) jet = Jet(p4) constituents = JetConstituents() for ptc in ptcs: p4 += ptc.p4() charge += ptc.q() constituents.append(ptc) sumptc = Particle(pdgid, charge, p4) jet = Jet(p4) jet.constituents = constituents jet.constituents.sort() setattr(event, self.cfg_ana.output, jet)
def process(self, event): p4 = TLorentzVector() charge = 0 pdgid = 0 ptcs = getattr(event, self.cfg_ana.particles) jet = Jet(p4) constituents = JetConstituents() for ptc in ptcs: p4 += ptc.p4() charge += ptc.q() constituents.append(ptc) sumptc = Particle(pdgid, charge, p4) jet = Jet(p4) jet.constituents = constituents jet.constituents.sort() setattr(event, self.cfg_ana.output, jet)
def process(self, event): gens = getattr(event, self.cfg_ana.gen_particles) gen_taus = [ gen for gen in gens if abs(gen.pdgid()) == 15 and gen.status() == 2 ] ## pprint.pprint(gen_taus) if not hasattr(event, 'genbrowser'): event.genbrowser = GenBrowser(event.gen_particles, event.gen_vertices) thetamax = 75. * math.pi / 180. acceptance = { 211: lambda ptc: ptc.pt() > 0.3 and abs(ptc.theta()) < thetamax, 11: lambda ptc: ptc.e() > 5 and abs(ptc.theta()) < thetamax, 13: lambda ptc: ptc.e() > 7.5 and abs(ptc.theta()) < thetamax, } acc_taus = [] gen_taus_decayed = [] for tau in gen_taus: ## print tau ncharged = 0 acc_charged = [] descendants = event.genbrowser.descendants(tau) stable_daugthers = [ desc for desc in descendants if desc.status() == 1 ] consts = JetConstituents() p4sum = TLorentzVector() for dau in stable_daugthers: assert (dau.status() == 1) ## print '\t', dau if abs(dau.pdgid()) in [12, 14, 16]: continue p4sum += dau.p4() consts.append(dau) pdgid = group_pdgid(dau) if dau.q() and acceptance[pdgid](dau): acc_charged.append(dau) gen_tau_decayed = GenTau(p4sum) gen_tau_decayed.constituents = consts gen_taus_decayed.append(gen_tau_decayed) if len(acc_charged) in [1, 3]: acc_taus.append(gen_tau_decayed) event.gen_taus = gen_taus_decayed event.gen_taus_acc = acc_taus
class Jet(BaseJet): def __init__(self, candidate): super(Jet, self).__init__() self.candidate = candidate self._tlv = TLorentzVector() p4 = candidate.p4() self._tlv.SetPtEtaPhiM(p4.pt(), p4.eta(), p4.phi(), p4.mass()) self.convert_constituents() def convert_constituents(self): constits = [] constits = map(Particle, self.getJetConstituents()) self.constituents = JetConstituents() for ptc in constits: self.constituents.append(ptc) def __getattr__(self, attr): return getattr(self.candidate, attr)
def process(self, event): '''Process event. The event must contain: - self.cfg_ana.particles: the input collection of particles. ''' p4 = TLorentzVector() charge = 0 pdgid = 0 ptcs = getattr(event, self.cfg_ana.particles) jet = Jet(p4) constituents = JetConstituents() for ptc in ptcs: p4 += ptc.p4() charge += ptc.q() constituents.append(ptc) sumptc = Particle(pdgid, charge, p4) jet = Jet(p4) jet.constituents = constituents jet.constituents.sort() setattr(event, self.cfg_ana.output, jet)
def process(self, event): '''Process event. The event must contain: - self.cfg_ana.particles: the input collection of particles. ''' p4 = TLorentzVector() charge = 0 pdgid = 0 ptcs = getattr(event, self.cfg_ana.particles) jet = Jet(p4) constituents = JetConstituents() for ptc in ptcs: p4 += ptc.p4() charge += ptc.q() constituents.append(ptc) sumptc = Particle(pdgid, charge, p4) jet = Jet(p4) jet.constituents = constituents jet.constituents.sort() setattr(event, self.cfg_ana.output, jet)