if HNL or RPVSUSY: P8gen = ROOT.HNLPythia8Generator() import pythia8_conf if HNL: print 'Generating HNL events of mass %.3f GeV' % theMass if theProductionCouplings is None and theDecayCouplings is None: print 'and with couplings=', theCouplings theProductionCouplings = theDecayCouplings = theCouplings elif theProductionCouplings is not None and theDecayCouplings is not None: print 'and with couplings', theProductionCouplings, 'at production' print 'and', theDecayCouplings, 'at decay' else: raise ValueError( 'Either both production and decay couplings must be specified, or neither.' ) pythia8_conf.configure(P8gen, theMass, theProductionCouplings, theDecayCouplings, inclusive, deepCopy) if RPVSUSY: print 'Generating RPVSUSY events of mass %.3f GeV' % theMass print 'and with couplings=[%.3f,%.3f]' % (theCouplings[0], theCouplings[1]) print 'and with stop mass=%.3f GeV\n' % theCouplings[2] pythia8_conf.configurerpvsusy(P8gen, theMass, [theCouplings[0], theCouplings[1]], theCouplings[2], RPVSUSYbench, inclusive, deepCopy) P8gen.SetParameters("ProcessLevel:all = off") if inputFile: ut.checkFileExists(inputFile) # read from external file P8gen.UseExternalFile(inputFile, firstEvent) if DarkPhoton:
run.SetOutputFile(outFile) # Output file run.SetUserConfig("g4Config.C") # user configuration file default g4Config.C rtdb = run.GetRuntimeDb() # -----Create geometry---------------------------------------------- # import shipMuShield_only as shipDet_conf # special use case for an attempt to convert active shielding geometry for use with FLUKA # import shipTarget_only as shipDet_conf import shipDet_conf modules = shipDet_conf.configure(run,ship_geo) # -----Create PrimaryGenerator-------------------------------------- primGen = ROOT.FairPrimaryGenerator() if simEngine == "Pythia8": primGen.SetTarget(ship_geo.target.z0, 0.) # -----Pythia8-------------------------------------- P8gen = ROOT.HNLPythia8Generator() import pythia8_conf pythia8_conf.configure(P8gen,theHNLmass,theHNLcouplings,inclusive,deepCopy) if inputFile: # read from external file P8gen.SetParameters("ProcessLevel:all = off") P8gen.UseExternalFile(inputFile, 0) # pion on proton 500GeV # P8gen.SetMom(500.*u.GeV) # P8gen.SetId(-211) primGen.AddGenerator(P8gen) if simEngine == "Pythia6": # set muon interaction close to decay volume primGen.SetTarget(ship_geo.target.z0+ship_geo.muShield.length, 0.) # -----Pythia6------------------------- P6gen = ROOT.tPythia6Generator() P6gen.SetMom(50.*u.GeV) P6gen.SetTarget("gamma/mu+","n0") # default "gamma/mu-","p+"
if charm!=0: import charmDet_conf as shipDet_conf else: import shipDet_conf modules = shipDet_conf.configure(run,ship_geo) # -----Create PrimaryGenerator-------------------------------------- primGen = ROOT.FairPrimaryGenerator() if simEngine == "Pythia8": primGen.SetTarget(ship_geo.target.z0, 0.) # -----Pythia8-------------------------------------- if HNL or RPVSUSY: P8gen = ROOT.HNLPythia8Generator() import pythia8_conf if HNL: print 'Generating HNL events of mass %.3f GeV\n'%theMass print 'and with couplings=',theCouplings pythia8_conf.configure(P8gen,theMass,theCouplings,inclusive,deepCopy) if RPVSUSY: print 'Generating RPVSUSY events of mass %.3f GeV\n'%theMass print 'and with couplings=[%.3f,%.3f]\n'%(theCouplings[0],theCouplings[1]) print 'and with stop mass=\%.3f GeV\n',theCouplings[2] pythia8_conf.configurerpvsusy(P8gen,theMass,[theCouplings[0],theCouplings[1]], theCouplings[2],RPVSUSYbench,'c',deepCopy) P8gen.SetSmearBeam(1*u.cm) # finite beam size P8gen.SetParameters("ProcessLevel:all = off") if ds==7: # short muon shield P8gen.SetLmin(44*u.m) P8gen.SetLmax(107*u.m) if inputFile: ut.checkFileExists(inputFile) # read from external file P8gen.UseExternalFile(inputFile, firstEvent)
run.SetOutputFile(outFile) # Output file run.SetUserConfig("g4Config.C") # user configuration file default g4Config.C rtdb = run.GetRuntimeDb() # -----Create geometry---------------------------------------------- # import shipMuShield_only as shipDet_conf # special use case for an attempt to convert active shielding geometry for use with FLUKA import shipDet_conf modules = shipDet_conf.configure(run,ship_geo) # -----Create PrimaryGenerator-------------------------------------- primGen = ROOT.FairPrimaryGenerator() if simEngine == "Pythia8": primGen.SetTarget(ship_geo.target.z0, 0.) # -----Pythia8-------------------------------------- P8gen = ROOT.HNLPythia8Generator() import pythia8_conf pythia8_conf.configure(P8gen,inclusive,deepCopy) primGen.AddGenerator(P8gen) if simEngine == "Pythia6": # set muon interaction close to decay volume primGen.SetTarget(ship_geo.target.z0+ship_geo.muShield.length, 0.) # -----Pythia6------------------------- P6gen = ROOT.tPythia6Generator() P6gen.SetMom(50.*u.GeV) P6gen.SetTarget("gamma/mu+","n0") # default "gamma/mu-","p+" primGen.AddGenerator(P6gen) if simEngine == "Genie": # Genie # pointZero = -ship_geo.decayVolume.length/2. - 1.*u.cm # nu interaction in last 10% of interactionLength of mushield pointZero = 0. # for testing primGen.SetTarget(pointZero, 0.) Geniegen = ROOT.GenieGenerator()
primGen.SetTarget(ship_geo.target.z0, 0.) # -----Pythia8-------------------------------------- if HNL or RPVSUSY: P8gen = ROOT.HNLPythia8Generator() import pythia8_conf if HNL: print 'Generating HNL events of mass %.3f GeV'%theMass if theProductionCouplings is None and theDecayCouplings is None: print 'and with couplings=',theCouplings theProductionCouplings = theDecayCouplings = theCouplings elif theProductionCouplings is not None and theDecayCouplings is not None: print 'and with couplings',theProductionCouplings,'at production' print 'and',theDecayCouplings,'at decay' else: raise ValueError('Either both production and decay couplings must be specified, or neither.') pythia8_conf.configure(P8gen,theMass,theProductionCouplings,theDecayCouplings,inclusive,deepCopy) if RPVSUSY: print 'Generating RPVSUSY events of mass %.3f GeV'%theMass print 'and with couplings=[%.3f,%.3f]'%(theCouplings[0],theCouplings[1]) print 'and with stop mass=%.3f GeV\n'%theCouplings[2] pythia8_conf.configurerpvsusy(P8gen,theMass,[theCouplings[0],theCouplings[1]], theCouplings[2],RPVSUSYbench,inclusive,deepCopy) P8gen.SetParameters("ProcessLevel:all = off") if inputFile: ut.checkFileExists(inputFile) # read from external file P8gen.UseExternalFile(inputFile, firstEvent) if DarkPhoton: P8gen = ROOT.DPPythia8Generator() if inclusive=='qcd': P8gen.SetDPId(4900023)
run.SetOutputFile(outFile) # Output file run.SetUserConfig("g4Config.C") # user configuration file default g4Config.C rtdb = run.GetRuntimeDb() # -----Create geometry---------------------------------------------- # import shipMuShield_only as shipDet_conf # special use case for an attempt to convert active shielding geometry for use with FLUKA import shipDet_conf modules = shipDet_conf.configure(run, ship_geo) # -----Create PrimaryGenerator-------------------------------------- primGen = ROOT.FairPrimaryGenerator() if simEngine == "Pythia8": primGen.SetTarget(ship_geo.target.z0, 0.) # -----Pythia8-------------------------------------- P8gen = ROOT.HNLPythia8Generator() import pythia8_conf pythia8_conf.configure(P8gen, inclusive, deepCopy) primGen.AddGenerator(P8gen) if simEngine == "Pythia6": # set muon interaction close to decay volume primGen.SetTarget(ship_geo.target.z0 + ship_geo.muShield.length, 0.) # -----Pythia6------------------------- P6gen = ROOT.tPythia6Generator() P6gen.SetMom(50. * u.GeV) P6gen.SetTarget("gamma/mu+", "n0") # default "gamma/mu-","p+" primGen.AddGenerator(P6gen) if simEngine == "Genie": # Genie # pointZero = -ship_geo.decayVolume.length/2. - 1.*u.cm # nu interaction in last 10% of interactionLength of mushield pointZero = 0. # for testing primGen.SetTarget(pointZero, 0.) Geniegen = ROOT.GenieGenerator()
# -----Create simulation run---------------------------------------- run = ROOT.FairRunSim() run.SetName(mcEngine)# Transport engine run.SetOutputFile(outFile) # Output file rtdb = run.GetRuntimeDb() # -----Create geometry---------------------------------------------- import shipDet_conf shipDet_conf.configure(run,ShipGeo) # -----Create PrimaryGenerator-------------------------------------- primGen = ROOT.FairPrimaryGenerator() primGen.SetTarget(ShipGeo.target.z0, 0.) # -----Pythia8-------------------------------------- P8gen = ROOT.Pythia8Generator() import pythia8_conf pythia8_conf.configure(P8gen,inclusive) primGen.AddGenerator(P8gen) run.SetGenerator(primGen) if inclusive: # check presence of HNL P8gen.GetPythiaInstance(9900014) # ------------------------------------------------------------------------ #---Store the visualiztion info of the tracks, this make the output file very large!! #--- Use it only to display but not for production! run.SetStoreTraj(ROOT.kTRUE) # run.SetStoreTraj(ROOT.kFALSE) # -----Initialize simulation run------------------------------------ run.Init()
run.SetUserConfig("g4Config.C") # user configuration file default g4Config.C rtdb = run.GetRuntimeDb() # -----Create geometry---------------------------------------------- # import shipMuShield_only as shipDet_conf # special use case for an attempt to convert active shielding geometry for use with FLUKA # import shipTarget_only as shipDet_conf import shipDet_conf modules = shipDet_conf.configure(run, ship_geo) # -----Create PrimaryGenerator-------------------------------------- primGen = ROOT.FairPrimaryGenerator() if simEngine == "Pythia8": primGen.SetTarget(ship_geo.target.z0, 0.) # -----Pythia8-------------------------------------- P8gen = ROOT.HNLPythia8Generator() import pythia8_conf pythia8_conf.configure(P8gen, theHNLmass, theHNLcouplings, inclusive, deepCopy) primGen.AddGenerator(P8gen) if simEngine == "Pythia6": # set muon interaction close to decay volume primGen.SetTarget(ship_geo.target.z0 + ship_geo.muShield.length, 0.) # -----Pythia6------------------------- P6gen = ROOT.tPythia6Generator() P6gen.SetMom(50. * u.GeV) P6gen.SetTarget("gamma/mu+", "n0") # default "gamma/mu-","p+" primGen.AddGenerator(P6gen) # -----muon DIS Background------------------------ if simEngine == "muonDIS": primGen.SetTarget(0., 0.) DISgen = ROOT.MuDISGenerator() DISgen.Init(inputFile, firstEvent) primGen.AddGenerator(DISgen)