2evgenConfig.description =
"Single particle gun for Sampling Fraction event generation"
3evgenConfig.keywords = [
"singleParticle",]
4evgenConfig.generators = [
"ParticleGun"]
5evgenConfig.contact = [
"michael.duehrssen@cern.ch"]
7import ParticleGun
as PG
8import ROOT, math, random
12 Projective showers starting at entrance of calorimeter, flat in eta, constant energy
15 def __init__(self,pid=11,momentum=50000.,eta1=0.,eta2=1.4,bec=0,radius=1500.,z=3740.5):
20 pdg_table = ROOT.TDatabasePDG.Instance()
21 self.
mass = pdg_table.GetParticle(self.
pid()).Mass()*1000.
28 eta = random.uniform(self.
eta1, self.
eta2)
29 phi = random.uniform(0, math.tau)
30 v4 = ROOT.TLorentzVector()
32 v4.SetPtEtaPhiM(pt, eta, phi, self.
mass)
35 x=radius*math.cos(phi)
36 y=radius*math.sin(phi)
37 z=radius*math.sinh(eta)
40 radius=z/math.sinh(eta)
41 x=radius*math.cos(phi)
42 y=radius*math.sin(phi)
43 t=math.sqrt(x*x+y*y+z*z)
44 vp = ROOT.TLorentzVector(x,y,z,t)
45 p = PG.SampledParticle(pid=self.
pid(),mom=v4,pos=vp)
54FIRST_DIR = (os.environ[
'JOBOPTSEARCHPATH']).
split(
":")[0]
55jofiles = [f
for f
in os.listdir(FIRST_DIR)
if (f.startswith(
'mc')
and f.endswith(
'.py'))]
57print "================ SETTTINGS ================="
58print (
"jofiles = ", jofiles)
61args = jofiles[0].
split(
'.py')[0]
62print (
"args = ", args)
64myMomentum = float(args.split(
'_Mom')[1].
split(
'_')[0])
65print (
"Momentum = ", myMomentum,
"MeV")
67myPDGID = int(float(args.split(
'_pid')[1].
split(
'_')[0].
replace(
'm',
'-')))
68print (
"pid = ", myPDGID)
70myLowEta = 0.01*float(args.split(
'eta_')[1].
split(
'_')[0].
replace(
'm',
'-'))
71print (
"etalow = ", myLowEta)
73myHighEta = 0.01*float(args.split(
'eta_')[1].
split(
'_')[1].
replace(
'm',
'-'))
74print (
"etahigh = ", myHighEta)
77 myRadius = 0.001*float(args.split(
'_Radius')[1].
split(
'_')[0])
80print (
"radius = ", myRadius,
"mm")
83 myZ = 0.001*float(args.split(
'_Z')[1].
split(
'_')[0])
86print (
"Z = ", myZ,
"mm")
93print "============================================"
95genSeq += PG.ParticleGun()
96genSeq.ParticleGun.sampler =
MyParticleSampler(momentum=myMomentum,eta1=myLowEta,eta2=myHighEta,pid=myPDGID,bec=bec,radius=myRadius,z=myZ)
__init__(self, pid=11, momentum=50000., eta1=0., eta2=1.4, bec=0, radius=1500., z=3740.5)
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=":")