def shoot(self): "Return a vector of sampled particles" p1 = PG.SampledParticle(11, self.mom1.shoot()) eta1 = p1.mom.Eta() phi1 = p1.mom.Phi() # TODO: will phi be properly wrapped into range? mom2 = PG.PtEtaMPhiSampler(pt=25000, eta=[eta1 - 0.5, eta1 + 0.5], phi=[phi1 - 0.5, phi1 + 0.5]) p2 = PG.SampledParticle(11, mom2.shoot()) return [p1, p2]
def shoot(self): pid = self.pid() shift_z = self.shift_z mom = self.mom1.shoot() pos_temp = mom.Vect().Unit() # Would it hit the barrel, or the endcap? if abs(pos_temp.Z()) / 3550. < pos_temp.Perp( ) / 1148.: # Hit the barrel! pos_temp *= 1148. / pos_temp.Perp() else: # Hit the endcap! pos_temp *= 3550. / abs(pos_temp.Z()) # Shift position of vector in the Z direction pos_temp_2 = ROOT.TVector3() pos_temp_2.SetXYZ(pos_temp.X(), pos_temp.Y(), pos_temp.Z() + shift_z) pos_temp_2 *= 1. / pos_temp_2.Mag() # reduce magnitude of vector # recalculate; Would it hit the barrel, or the endcap? if abs(pos_temp_2.Z()) / 3550. < pos_temp_2.Perp() / 1148.: pos_temp_2 *= 1148. / pos_temp_2.Perp() else: pos_temp_2 *= 3550. / abs(pos_temp_2.Z()) pos = ROOT.TLorentzVector(pos_temp_2.X(), pos_temp_2.Y(), pos_temp_2.Z(), 0) return [PG.SampledParticle(pid, mom, pos)]
def shoot(self): "Return a vector of sampled particles from the provided pT--eta histogram" particles = [] for i in xrange(self.numparticles): ptrand, etarand = self.hist.GetRandom() ptrand *= 1000 # NB. This _particular_ histogram is in GeV, but Athena needs MeV! # TODO: Provide 4-mom construction functions to avoid building this one-time sampler pid = self.pid() mom = PG.PtEtaMPhiSampler(pt=ptrand, eta=etarand, mass=PG.MASSES[abs(pid)]) p = PG.SampledParticle(pid, mom()) #print p.mom.Pt(), "\t", p.mom.Eta(), "\t", p.mom.Phi(), "\t", p.mom.M() particles.append(p) return particles