2 evgenConfig.description =
"Single particle gun for FastCaloSim event generation"
3 evgenConfig.keywords = [
"singleParticle",]
4 evgenConfig.generators = [
"ParticleGun"]
5 evgenConfig.contact = [
"david.sosa@cern.ch"]
7 import ParticleGun
as PG
14 pdg_table = ROOT.TDatabasePDG.Instance()
15 mass = pdg_table.GetParticle(self.
pid()).Mass()*1000.
16 self.
mom1 = PG.EEtaMPhiSampler(energy=energy,eta=eta,mass=mass)
24 pos_temp = mom.Vect().Unit()
34 tanTheta = pos_temp.Perp() / abs( pos_temp.Z() );
35 if tanTheta > barrelR1 / endcapZ1:
36 pos_temp *= barrelR1 / pos_temp.Perp()
37 elif tanTheta > barrelR2 / endcapZ1:
38 pos_temp *= endcapZ1 / abs( pos_temp.Z() )
39 elif tanTheta > barrelR2 / endcapZ2:
40 pos_temp *= barrelR2 / pos_temp.Perp()
41 elif tanTheta > barrelR3 / endcapZ2:
42 pos_temp *= endcapZ2 / abs( pos_temp.Z() )
44 pos_temp *= barrelR3 / pos_temp.Perp()
47 pos_temp_2 = ROOT.TVector3()
48 pos_temp_2.SetXYZ(pos_temp.X(), pos_temp.Y(), pos_temp.Z()+shift_z)
49 pos_temp_2 *= 1. / pos_temp_2.Mag();
52 tanTheta_2 = pos_temp_2.Perp() / abs( pos_temp_2.Z() );
53 if tanTheta_2 > barrelR1 / endcapZ1:
54 pos_temp_2 *= barrelR1 / pos_temp_2.Perp()
55 elif tanTheta_2 > barrelR2 / endcapZ1:
56 pos_temp_2 *= endcapZ1 / abs( pos_temp_2.Z() )
57 elif tanTheta_2 > barrelR2 / endcapZ2:
58 pos_temp_2 *= barrelR2 / pos_temp_2.Perp()
59 elif tanTheta_2 > barrelR3 / endcapZ2:
60 pos_temp_2 *= endcapZ2 / abs( pos_temp_2.Z() )
62 pos_temp_2 *= barrelR3 / pos_temp_2.Perp()
64 pos = ROOT.TLorentzVector(pos_temp_2.X(),pos_temp_2.Y(),pos_temp_2.Z(), pos_temp_2.Mag())
68 return [ PG.SampledParticle( pid , mom , pos ) ]
81 eta_li.extend([myLowEta1,myLowEta2,myHighEta1,myHighEta2])
86 eta_li.extend([myLowEta,myHighEta])
89 print "================ SETTTINGS ================="
90 print (
"energy = ", myE)
91 print (
"eta = ", eta_li)
92 print (
"pid = ", myPDGID)
93 print (
"shift_z = ", myZV)
94 print "============================================"
96 genSeq += PG.ParticleGun()
98 genSeq.ParticleGun.sampler =
MyParticleSampler(energy=myE,eta=eta_li,pid=(-myPDGID,myPDGID),shift_z=myZV)
100 genSeq.ParticleGun.sampler =
MyParticleSampler(energy=myE,eta=eta_li,pid=myPDGID,shift_z=myZV)