24 FairShip = os.environ[
'FAIRSHIP']
25 ascii = open(FairShip+
'/shipgen/branchingratios.dat')
27 content = ascii.readlines()
31 if not line.find(
'TH1F')<0:
32 keys = line.split(
'|')
34 limits = content[n].split(
',')
36 if len(keys)<5: keys.append(
',')
37 h[ hname ] = ROOT.TH1F(hname,keys[2]+
';'+keys[3]+
';'+keys[4],int(limits[0]),float(limits[1]),float(limits[2]) )
39 keys = line.split(
',')
40 h[ hname ].SetBinContent(int(keys[0]),float(keys[1]) )
85def configure(P8gen, mass, epsilon, inclusive, motherMode, deepCopy=False, debug=True):
88 pythia_log=open(
'pythia8_conf.txt',
'w')
92 if deepCopy: P8gen.UseDeepCopy()
93 pdg = ROOT.TDatabasePDG.Instance()
94 if inclusive==
"meson":
96 p8 = P8gen.getPythiaInstance()
99 n = p8.particleData.nextId(n)
100 p = p8.particleData.particleDataEntryPtr(n)
102 command = str(n)+
":mayDecay = false"
103 p8.readString(command)
104 print(
"Pythia8 configuration: Made %s stable for Pythia, should decay in Geant4"%(p.name()))
107 P8gen.SetParameters(
"SoftQCD:nonDiffractive = on")
109 elif inclusive==
"qcd":
111 P8gen.SetMinDPMass(0.7)
113 if (mass<P8gen.MinDPMass()):
114 print(
"WARNING! Mass is too small, minimum is set to %3.3f GeV."%P8gen.MinDPMass())
118 p8 = P8gen.getPythiaInstance()
121 n = p8.particleData.nextId(n)
122 p = p8.particleData.particleDataEntryPtr(n)
124 command = str(n)+
":mayDecay = false"
125 p8.readString(command)
126 print(
"Pythia8 configuration: Made %s stable for Pythia, should decay in Geant4"%(p.name()))
129 P8gen.SetParameters(
"HiddenValley:ffbar2Zv = on")
130 P8gen.SetParameters(
"HiddenValley:Ngauge = 1")
132 elif inclusive==
"pbrem":
133 P8gen.SetParameters(
"ProcessLevel:all = off")
141 P8gen.SetParameters(
"Next:numberShowInfo = 0")
142 P8gen.SetParameters(
"Next:numberShowProcess = 0")
143 P8gen.SetParameters(
"Next:numberShowEvent = 0")
144 proton_bremsstrahlung.protonEnergy=P8gen.GetMom()
146 print(
"A' production rate per p.o.t: \t %.8g"%norm)
151 ctau = DP_instance.cTau()
152 print(
'ctau p8dpconf file =%3.6f cm'%ctau)
153 print(
'Initial particle parameters for PDGID %d :'%P8gen.GetDPId())
154 P8gen.List(P8gen.GetDPId())
156 dpid = P8gen.GetDPId()
157 P8gen.SetParameters(
"{}:m0 = {:.12}".format(dpid, mass))
159 P8gen.SetParameters(
"{}:mWidth = {:.12}".format(dpid, u.hbarc/ctau))
160 P8gen.SetParameters(
"{}:mMin = 0.001".format(dpid))
161 P8gen.SetParameters(
"{}:tau0 = {:.12}".format(dpid, ctau/u.mm))
165 P8gen.SetParameters(
"{}:onMode = off".format(dpid))
167 P8gen.SetParameters(
"{}:new = A A 3 0 0 {:.12} 0.0 0.0 0.0 {:.12} 0 1 0 1 0"\
168 .format(P8gen.GetDPId(), mass, ctau/u.mm))
175 P8gen.SetParameters(
"Next:numberCount = 0")
180 P8gen.SetParameters(
"{}:mayDecay = on".format(P8gen.GetDPId()))
183 gamma = u.hbarc / float(ctau)
184 print(
'gamma=%e'%gamma)
185 addDPtoROOT(pid=P8gen.GetDPId(),m=mass,g=gamma)
187 if inclusive==
"meson":
190 print(
'selected mum is : %d'%selectedMum)
191 if (selectedMum == -1):
return 0
195 if debug: pythia_log.close()