def configure(P8gen, mass, epsilon, inclusive, deepCopy=False): # configure pythia8 for Ship usage debug = True if debug: cf = open('pythia8_darkphotonconf.txt', 'w') #h=readFromAscii() P8gen.UseRandom3() # TRandom1 or TRandom3 ? P8gen.SetMom(400) # beam momentum in GeV if deepCopy: P8gen.UseDeepCopy() pdg = ROOT.TDatabasePDG.Instance() if inclusive == "meson": # let strange particle decay in Geant4 p8 = P8gen.getPythiaInstance() n = 1 while n != 0: n = p8.particleData.nextId(n) p = p8.particleData.particleDataEntryPtr(n) if p.tau0() > 1: command = str(n) + ":mayDecay = false" p8.readString(command) print "Pythia8 configuration: Made %s stable for Pythia, should decay in Geant4" % ( p.name()) # Configuring production P8gen.SetParameters("SoftQCD:nonDiffractive = on") if debug: cf.write('P8gen.SetParameters("SoftQCD:nonDiffractive = on")\n') elif inclusive == "qcd": P8gen.SetDY() P8gen.SetMinDPMass(0.7) if (mass < P8gen.MinDPMass()): print "WARNING! Mass is too small, minimum is set to %3.3f GeV." % P8gen.MinDPMass( ) return 0 # produce a Z' from hidden valleys model p8 = P8gen.getPythiaInstance() n = 1 while n != 0: n = p8.particleData.nextId(n) p = p8.particleData.particleDataEntryPtr(n) if p.tau0() > 1: command = str(n) + ":mayDecay = false" p8.readString(command) print "Pythia8 configuration: Made %s stable for Pythia, should decay in Geant4" % ( p.name()) # Configuring production P8gen.SetParameters("HiddenValley:ffbar2Zv = on") if debug: cf.write('P8gen.SetParameters("HiddenValley:ffbar2Zv = on")\n') P8gen.SetParameters("HiddenValley:Ngauge = 1") elif inclusive == "pbrem": P8gen.SetParameters("ProcessLevel:all = off") if debug: cf.write('P8gen.SetParameters("ProcessLevel:all = off")\n') #Also allow resonance decays, with showers in them #P8gen.SetParameters("Standalone:allowResDec = on") #Optionally switch off decays. #P8gen.SetParameters("HadronLevel:Decay = off") #Switch off automatic event listing in favour of manual. P8gen.SetParameters("Next:numberShowInfo = 0") P8gen.SetParameters("Next:numberShowProcess = 0") P8gen.SetParameters("Next:numberShowEvent = 0") proton_bremsstrahlung.protonEnergy = P8gen.GetMom() norm = proton_bremsstrahlung.prodRate(mass, epsilon) print "A' production rate per p.o.t: \t %.8g" % norm P8gen.SetPbrem( proton_bremsstrahlung.hProdPDF(mass, epsilon, norm, 350, 1500)) #Define dark photon DP_instance = darkphoton.DarkPhoton(mass, epsilon) ctau = DP_instance.cTau() print 'ctau p8dpconf file =%3.6f cm' % ctau print 'Initial particle parameters for PDGID %d :' % P8gen.GetDPId() P8gen.List(P8gen.GetDPId()) if inclusive == "qcd": P8gen.SetParameters(str(P8gen.GetDPId()) + ":m0 = " + str(mass)) #P8gen.SetParameters(str(P8gen.GetDPId())+":mWidth = "+str(u.mm/ctau)) P8gen.SetParameters( str(P8gen.GetDPId()) + ":mWidth = " + str(u.hbarc / ctau)) P8gen.SetParameters(str(P8gen.GetDPId()) + ":mMin = 0.001") P8gen.SetParameters( str(P8gen.GetDPId()) + ":tau0 = " + str(ctau / u.mm)) #P8gen.SetParameters("ParticleData:modeBreitWigner = 0") #P8gen.SetParameters(str(P8gen.GetDPId())+":isResonance = false") #P8gen.SetParameters(str(P8gen.GetDPId())+":all = A A 3 0 0 "+str(mass)+" 0.0 0.0 0.0 "+str(ctau/u.mm)+" 0 1 0 1 0") #if debug: cf.write('P8gen.SetParameters("'+str(P8gen.GetDPId())+':all = A A 3 0 0 '+str(mass)+' 0.0 0.0 0.0 '+str(ctau/u.mm)+' 0 1 0 1 0") \n') P8gen.SetParameters(str(P8gen.GetDPId()) + ":onMode = off") #print 'qcd inclusive test' else: P8gen.SetParameters( str(P8gen.GetDPId()) + ":new = A A 3 0 0 " + str(mass) + " 0.0 0.0 0.0 " + str(ctau / u.mm) + " 0 1 0 1 0") if debug: cf.write('P8gen.SetParameters("' + str(P8gen.GetDPId()) + ':new = A A 3 0 0 ' + str(mass) + ' 0.0 0.0 0.0 ' + str(ctau / u.mm) + ' 0 1 0 1 0") \n') #if (inclusive=="pbrem"): ### Do not set as resonance: decays to hadron doesn't work properly below 0.7 GeV. # P8gen.SetParameters(str(P8gen.GetDPId())+":isResonance = true") # P8gen.SetParameters(str(P8gen.GetDPId())+":mWidth = "+str(u.hbarc/ctau)) # P8gen.SetParameters(str(P8gen.GetDPId())+":mMin = 0.001") P8gen.SetParameters("Next:numberCount = 0") if debug: cf.write('P8gen.SetParameters("Next:numberCount = 0")\n') # Configuring decay modes... readDecayTable.addDarkPhotondecayChannels( P8gen, DP_instance, conffile=os.path.expandvars( '$FAIRSHIP/python/darkphotonDecaySelection.conf'), verbose=True) # Finish HNL setup... P8gen.SetParameters(str(P8gen.GetDPId()) + ":mayDecay = on") if debug: cf.write('P8gen.SetParameters("' + str(P8gen.GetDPId()) + ':mayDecay = on")\n') #P8gen.SetDPId(P8gen.GetDPId()) #if debug: cf.write('P8gen.SetDPId(%d)\n',%P8gen.GetDPId()) # also add to PDG gamma = u.hbarc / float( ctau ) #197.3269631e-16 / float(ctau) # hbar*c = 197 MeV*fm = 197e-16 GeV*cm print 'gamma=%e' % gamma addDPtoROOT(pid=P8gen.GetDPId(), m=mass, g=gamma) if inclusive == "meson": #change meson decay to dark photon depending on mass selectedMum = manipulatePhysics(mass, P8gen, cf) print 'selected mum is : %d' % selectedMum if (selectedMum == -1): return 0 #P8gen.SetParameters("Check:particleData = on") if debug: cf.close() return 1
def configure(P8gen, mass, epsilon, inclusive, deepCopy=False): # configure pythia8 for Ship usage debug=True if debug: cf=open('pythia8_darkphotonconf.txt','w') #h=readFromAscii() P8gen.UseRandom3() # TRandom1 or TRandom3 ? P8gen.SetMom(400) # beam momentum in GeV if deepCopy: P8gen.UseDeepCopy() pdg = ROOT.TDatabasePDG.Instance() if inclusive=="meson": # let strange particle decay in Geant4 p8 = P8gen.getPythiaInstance() n=1 while n!=0: n = p8.particleData.nextId(n) p = p8.particleData.particleDataEntryPtr(n) if p.tau0()>1: command = str(n)+":mayDecay = false" p8.readString(command) print "Pythia8 configuration: Made %s stable for Pythia, should decay in Geant4"%(p.name()) # Configuring production P8gen.SetParameters("SoftQCD:nonDiffractive = on") if debug: cf.write('P8gen.SetParameters("SoftQCD:nonDiffractive = on")\n') elif inclusive=="qcd": P8gen.SetDY() P8gen.SetMinDPMass(0.7) if (mass<P8gen.MinDPMass()): print "WARNING! Mass is too small, minimum is set to %3.3f GeV."%P8gen.MinDPMass() return 0 # produce a Z' from hidden valleys model p8 = P8gen.getPythiaInstance() n=1 while n!=0: n = p8.particleData.nextId(n) p = p8.particleData.particleDataEntryPtr(n) if p.tau0()>1: command = str(n)+":mayDecay = false" p8.readString(command) print "Pythia8 configuration: Made %s stable for Pythia, should decay in Geant4"%(p.name()) # Configuring production P8gen.SetParameters("HiddenValley:ffbar2Zv = on") if debug: cf.write('P8gen.SetParameters("HiddenValley:ffbar2Zv = on")\n') P8gen.SetParameters("HiddenValley:Ngauge = 1") elif inclusive=="pbrem": P8gen.SetParameters("ProcessLevel:all = off") if debug: cf.write('P8gen.SetParameters("ProcessLevel:all = off")\n') #Also allow resonance decays, with showers in them #P8gen.SetParameters("Standalone:allowResDec = on") #Optionally switch off decays. #P8gen.SetParameters("HadronLevel:Decay = off") #Switch off automatic event listing in favour of manual. P8gen.SetParameters("Next:numberShowInfo = 0") P8gen.SetParameters("Next:numberShowProcess = 0") P8gen.SetParameters("Next:numberShowEvent = 0") proton_bremsstrahlung.protonEnergy=P8gen.GetMom() norm=proton_bremsstrahlung.prodRate(mass, epsilon) print "A' production rate per p.o.t: \t %.8g"%norm P8gen.SetPbrem(proton_bremsstrahlung.hProdPDF(mass, epsilon, norm, 350, 1500)) #Define dark photon DP_instance = darkphoton.DarkPhoton(mass,epsilon) ctau = DP_instance.cTau() print 'ctau p8dpconf file =%3.6f cm'%ctau print 'Initial particle parameters for PDGID %d :'%P8gen.GetDPId() P8gen.List(P8gen.GetDPId()) if inclusive=="qcd": P8gen.SetParameters(str(P8gen.GetDPId())+":m0 = "+str(mass)) #P8gen.SetParameters(str(P8gen.GetDPId())+":mWidth = "+str(u.mm/ctau)) P8gen.SetParameters(str(P8gen.GetDPId())+":mWidth = "+str(u.hbarc/ctau)) P8gen.SetParameters(str(P8gen.GetDPId())+":mMin = 0.001") P8gen.SetParameters(str(P8gen.GetDPId())+":tau0 = "+str(ctau/u.mm)) #P8gen.SetParameters("ParticleData:modeBreitWigner = 0") #P8gen.SetParameters(str(P8gen.GetDPId())+":isResonance = false") #P8gen.SetParameters(str(P8gen.GetDPId())+":all = A A 3 0 0 "+str(mass)+" 0.0 0.0 0.0 "+str(ctau/u.mm)+" 0 1 0 1 0") #if debug: cf.write('P8gen.SetParameters("'+str(P8gen.GetDPId())+':all = A A 3 0 0 '+str(mass)+' 0.0 0.0 0.0 '+str(ctau/u.mm)+' 0 1 0 1 0") \n') P8gen.SetParameters(str(P8gen.GetDPId())+":onMode = off") #print 'qcd inclusive test' else: P8gen.SetParameters(str(P8gen.GetDPId())+":new = A A 3 0 0 "+str(mass)+" 0.0 0.0 0.0 "+str(ctau/u.mm)+" 0 1 0 1 0") if debug: cf.write('P8gen.SetParameters("'+str(P8gen.GetDPId())+':new = A A 3 0 0 '+str(mass)+' 0.0 0.0 0.0 '+str(ctau/u.mm)+' 0 1 0 1 0") \n') #if (inclusive=="pbrem"): ### Do not set as resonance: decays to hadron doesn't work properly below 0.7 GeV. # P8gen.SetParameters(str(P8gen.GetDPId())+":isResonance = true") # P8gen.SetParameters(str(P8gen.GetDPId())+":mWidth = "+str(u.hbarc/ctau)) # P8gen.SetParameters(str(P8gen.GetDPId())+":mMin = 0.001") P8gen.SetParameters("Next:numberCount = 0") if debug: cf.write('P8gen.SetParameters("Next:numberCount = 0")\n') # Configuring decay modes... readDecayTable.addDarkPhotondecayChannels(P8gen,DP_instance, conffile=os.path.expandvars('$FAIRSHIP/python/darkphotonDecaySelection.conf'), verbose=True) # Finish HNL setup... P8gen.SetParameters(str(P8gen.GetDPId())+":mayDecay = on") if debug: cf.write('P8gen.SetParameters("'+str(P8gen.GetDPId())+':mayDecay = on")\n') #P8gen.SetDPId(P8gen.GetDPId()) #if debug: cf.write('P8gen.SetDPId(%d)\n',%P8gen.GetDPId()) # also add to PDG gamma = u.hbarc / float(ctau) #197.3269631e-16 / float(ctau) # hbar*c = 197 MeV*fm = 197e-16 GeV*cm print 'gamma=%e'%gamma addDPtoROOT(pid=P8gen.GetDPId(),m=mass,g=gamma) if inclusive=="meson": #change meson decay to dark photon depending on mass selectedMum = manipulatePhysics(mass, P8gen, cf) print 'selected mum is : %d'%selectedMum if (selectedMum == -1): return 0 #P8gen.SetParameters("Check:particleData = on") if debug: cf.close() return 1
def configure(P8gen, mass, epsilon, inclusive, deepCopy=False): # configure pythia8 for Ship usage debug = True if debug: cf = open('pythia8_darkphotonconf.txt', 'w') #h=readFromAscii() P8gen.UseRandom3() # TRandom1 or TRandom3 ? P8gen.SetMom(400) # beam momentum in GeV if deepCopy: P8gen.UseDeepCopy() pdg = ROOT.TDatabasePDG.Instance() # let strange particle decay in Geant4 ## the following does not work because need to have N2 decaying #P8gen.SetParameters("ParticleDecays:limitTau0 = on") #P8gen.SetParameters("ParticleDecays:tau0Max = 1") # explicitly make KS and KL stable P8gen.SetParameters("130:mayDecay = off") if debug: cf.write('P8gen.SetParameters("130:mayDecay = off")\n') P8gen.SetParameters("310:mayDecay = off") if debug: cf.write('P8gen.SetParameters("310:mayDecay = off")\n') P8gen.SetParameters("3122:mayDecay = off") if debug: cf.write('P8gen.SetParameters("3122:mayDecay = off")\n') P8gen.SetParameters("3222:mayDecay = off") if debug: cf.write('P8gen.SetParameters("3222:mayDecay = off")\n') if inclusive == "meson": # Configuring production P8gen.SetParameters("SoftQCD:nonDiffractive = on") if debug: cf.write('P8gen.SetParameters("SoftQCD:nonDiffractive = on")\n') #Define dark photon ctau = darkphoton.cTau(mass, epsilon) print 'ctau p8dpconf file =%3.15f cm' % ctau P8gen.SetParameters("9900015:new = A A 2 0 0 " + str(mass) + " 0.0 0.0 0.0 " + str(ctau / u.mm) + " 0 1 0 1 0") if debug: cf.write('P8gen.SetParameters("9900015:new = A A 2 0 0 ' + str(mass) + ' 0.0 0.0 0.0 ' + str(ctau / u.mm) + ' 0 1 0 1 0") \n') P8gen.SetParameters("9900015:isResonance = false") if debug: cf.write('P8gen.SetParameters("9900015:isResonance = false")\n') P8gen.SetParameters("Next:numberCount = 0") if debug: cf.write('P8gen.SetParameters("Next:numberCount = 0")\n') # Configuring decay modes... readDecayTable.addDarkPhotondecayChannels( P8gen, mass, epsilon, conffile=os.path.expandvars( '$FAIRSHIP/python/darkphotonDecaySelection.conf'), verbose=True) # Finish HNL setup... P8gen.SetParameters("9900015:mayDecay = on") if debug: cf.write('P8gen.SetParameters("9900015:mayDecay = on")\n') P8gen.SetDPId(9900015) if debug: cf.write('P8gen.SetDPId(9900015)\n') # also add to PDG gamma = u.hbarc / float( ctau ) #197.3269631e-16 / float(ctau) # hbar*c = 197 MeV*fm = 197e-16 GeV*cm print 'gamma=%e' % gamma addDPtoROOT(pid=9900015, m=mass, g=gamma) #change meson decay to dark photon depending on mass selectedMum = manipulatePhysics(mass, P8gen, cf) print 'selected mum is : %d' % selectedMum if debug: cf.close()