2evgenConfig.description =
"Single particle gun for FastCaloSim event generation"
3evgenConfig.keywords = [
"singleParticle",]
4evgenConfig.generators = [
"ParticleGun"]
5evgenConfig.contact = [
"david.sosa@cern.ch"]
7import 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()
27 if abs(pos_temp.Z())/3550.<pos_temp.Perp()/1148.:
28 pos_temp *= 1148./pos_temp.Perp()
30 pos_temp *= 3550./abs(pos_temp.Z())
33 pos_temp_2 = ROOT.TVector3()
34 pos_temp_2.SetXYZ(pos_temp.X(), pos_temp.Y(), pos_temp.Z()+shift_z)
35 pos_temp_2 *= 1. / pos_temp_2.Mag();
38 if abs(pos_temp_2.Z())/3550.<pos_temp_2.Perp()/1148.:
39 pos_temp_2 *= 1148./pos_temp_2.Perp()
41 pos_temp_2 *= 3550./abs(pos_temp_2.Z())
43 pos = ROOT.TLorentzVector(pos_temp_2.X(),pos_temp_2.Y(),pos_temp_2.Z(), pos_temp_2.Mag())
47 return [ PG.SampledParticle( pid , mom , pos ) ]
49myE = float(jofile.split(
'_E')[1].
split(
'_')[0])
50myZV = float(jofile.split(
'_')[-1].
split(
'.py')[0].
replace(
"m",
"-"))
53myPDGID = int(float(myPDGID.replace(
'p',
'')))
58 myLowEta1 = 0.01*float(jofile.split(
'eta_')[1].
split(
'_')[0].
replace(
'm',
'-'))
59 myLowEta2 = 0.01*float(jofile.split(
'eta_')[1].
split(
'_')[1].
replace(
'm',
'-'))
60 myHighEta1 = 0.01*float(jofile.split(
'eta_')[1].
split(
'_')[2].
replace(
'm',
'-'))
61 myHighEta2 = 0.01*float(jofile.split(
'eta_')[1].
split(
'_')[3].
replace(
'm',
'-'))
62 eta_li.extend([myLowEta1,myLowEta2,myHighEta1,myHighEta2])
65 myLowEta = 0.01*float(jofile.split(
'eta')[1].
split(
'_')[0].
replace(
'm',
'-'))
66 myHighEta = 0.01*float(jofile.split(
'eta')[1].
split(
'_')[1].
replace(
'm',
'-'))
67 eta_li.extend([myLowEta,myHighEta])
70print "================ SETTTINGS ================="
71print (
"energy = ", myE)
72print (
"eta = ", eta_li)
73print (
"pid = ", myPDGID)
74print (
"shift_z = ", myZV)
75print "============================================"
77genSeq += PG.ParticleGun()
78genSeq.ParticleGun.sampler =
MyParticleSampler(energy=myE,eta=eta_li,pid=(myPDGID,myPDGID),shift_z=myZV)
__init__(self, energy, eta, pid, shift_z=0)
std::string replace(std::string s, const std::string &s2, const std::string &s3)
std::vector< std::string > split(const std::string &s, const std::string &t=":")