85def configure(P8gen, mass, epsilon, inclusive, motherMode, deepCopy=False, debug=True):
86
87 if debug:
88 pythia_log=open('pythia8_conf.txt','w')
89 P8gen = MethodLogger(P8gen, sink=pythia_log)
90 P8gen.UseRandom3()
91 P8gen.SetMom(400)
92 if deepCopy: P8gen.UseDeepCopy()
93 pdg = ROOT.TDatabasePDG.Instance()
94 if inclusive=="meson":
95
96 p8 = P8gen.getPythiaInstance()
97 n=1
98 while n!=0:
99 n = p8.particleData.nextId(n)
100 p = p8.particleData.particleDataEntryPtr(n)
101 if p.tau0()>1:
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()))
105
106
107 P8gen.SetParameters("SoftQCD:nonDiffractive = on")
108
109 elif inclusive=="qcd":
110 P8gen.SetDY()
111 P8gen.SetMinDPMass(0.7)
112
113 if (mass<P8gen.MinDPMass()):
114 print("WARNING! Mass is too small, minimum is set to %3.3f GeV."%P8gen.MinDPMass())
115 return 0
116
117
118 p8 = P8gen.getPythiaInstance()
119 n=1
120 while n!=0:
121 n = p8.particleData.nextId(n)
122 p = p8.particleData.particleDataEntryPtr(n)
123 if p.tau0()>1:
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()))
127
128
129 P8gen.SetParameters("HiddenValley:ffbar2Zv = on")
130 P8gen.SetParameters("HiddenValley:Ngauge = 1")
131
132 elif inclusive=="pbrem":
133 P8gen.SetParameters("ProcessLevel:all = off")
134
135
136
137
138
139
140
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)
148
149
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())
155 if inclusive=="qcd":
156 dpid = P8gen.GetDPId()
157 P8gen.SetParameters("{}:m0 = {:.12}".format(dpid, mass))
158
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))
162
163
164
165 P8gen.SetParameters("{}:onMode = off".format(dpid))
166 else:
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))
169
170
174
175 P8gen.SetParameters("Next:numberCount = 0")
176
177
179
180 P8gen.SetParameters("{}:mayDecay = on".format(P8gen.GetDPId()))
181
182
183 gamma = u.hbarc / float(ctau)
184 print('gamma=%e'%gamma)
185 addDPtoROOT(pid=P8gen.GetDPId(),m=mass,g=gamma)
186
187 if inclusive=="meson":
188
189 selectedMum = manipulatePhysics(motherMode, mass, P8gen)
190 print('selected mum is : %d'%selectedMum)
191 if (selectedMum == -1): return 0
192
193
194
195 if debug: pythia_log.close()
196
197 return 1
hProdPDF(mDarkPhoton, epsilon, norm, binsp, binstheta, tmin=-0.5 *math.pi, tmax=0.5 *math.pi, suffix="")
prodRate(mDarkPhoton, epsilon, tmin=-0.5 *math.pi, tmax=0.5 *math.pi)
addDarkPhotondecayChannels(P8gen, mDP, DP, conffile=os.path.expandvars(' $FAIRSHIP/python/darkphotonDecaySelection.conf'), verbose=True)