evgenConfig.description = "Single geantino with flat eta-phi and E = 10 GeV"
evgenConfig.keywords = ["singleParticle"]

include("MC15JobOptions/ParticleGun_Common.py")

import ParticleGun as PG
genSeq.ParticleGun.sampler.pid = 999
genSeq.ParticleGun.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=0)
genSeq.ParticleGun.sampler.pos = PG.PosSampler(x=0.0,y=0.0,z=[997.408,1011.46],t=0.0)
Пример #2
0
simFlags.load_atlas_flags()  # Going to use an ATLAS layout
simFlags.SimLayout = myGeo
simFlags.EventFilter.set_Off()

myMinEta = -6.0
myMaxEta = 6.0

myPDG = 999  # 999 = Geantinos, 13 = Muons

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = 100

import ParticleGun as PG
pg = PG.ParticleGun()
pg.sampler.pid = 999
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[-6., 6.])
topSeq += pg

simFlags.RandomSeedOffset = myRandomOffset
simFlags.RandomSeedList.addSeed("SINGLE", myRandomSeed1, myRandomSeed2)

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = [
    "SINGLE " + str(myRandomSeed1) + " " + str(myRandomSeed2)
]
myAtRndmGenSvc.OutputLevel = VERBOSE
myAtRndmGenSvc.EventReseeding = False
ServiceMgr += myAtRndmGenSvc

## add the material step recording action
Пример #3
0
from AthenaCommon.AlgSequence import AlgSequence
topSeq = AlgSequence()

simFlags.EventFilter.set_Off()
simFlags.MagneticField.set_Off()

athenaCommonFlags.PoolEvgenInput.set_Off()
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = 999
pg.sampler.pos = PG.PosSampler(x=0.0, y=0.0, z=[0.0, 0.0], t=0.0)
import math
pg.sampler.mom = PG.EEtaMPhiSampler(energy=50000,
                                    eta=[-5., 5.],
                                    phi=[0., 2 * math.pi])
topSeq += pg

MessageSvc.Format = "% F%40W%S%7W%R%T %0W%M"
MessageSvc.defaultLimit = 500

from AthenaCommon.AppMgr import ServiceMgr

if not hasattr(ServiceMgr, 'THistSvc'):
    from GaudiSvc.GaudiSvcConf import THistSvc
    ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output += ["xx0 DATAFILE='xx0.root' OPT='RECREATE'"]

printfunc(ServiceMgr)
simFlags.SimLayout = myGeo
simFlags.EventFilter.set_Off()

myMinEta = -6.0
myMaxEta = 6.0

myPDG = 999  # 999 = Geantinos, 13 = Muons

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = myMaxEvent

import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = myPDG
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[myMinEta, myMaxEta])
topSeq += pg

simFlags.RandomSeedOffset = myRandomOffset

### new rel17 (check Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py for details)
simFlags.RandomSeedList.addSeed("SINGLE", myRandomSeed1, myRandomSeed2)

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = [
    "SINGLE " + str(myRandomSeed1) + " " + str(myRandomSeed2)
]
myAtRndmGenSvc.OutputLevel = VERBOSE
myAtRndmGenSvc.EventReseeding = False
ServiceMgr += myAtRndmGenSvc
Пример #5
0
#myMaxEta =  0.8

myPDG = 13  # 998 = Charged Geantino 999 = neutral Geantino, 13 = Muon

myPDG = 998

#from AthenaCommon.CfgGetter import getAlgorithm
#topSeq += getAlgorithm("BeamEffectsAlg", tryDefaultConfigurable=True)

# sept 2014 run ParticleGun
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
#pg.sampler.pid = PG.CyclicSeqSampler([-13,13])
pg.sampler.pid = myPDG
pg.sampler.mom = PG.EEtaMPhiSampler(energy=myMomentum,
                                    eta=[myMinEta, myMaxEta])
#pg.sampler.mom = PG.PtEtaMPhiSampler(pt=myMomentum, eta=[myMinEta,myMaxEta])
topSeq += pg

simFlags.RandomSeedOffset = myRandomOffset

simFlags.RandomSeedList.addSeed("SINGLE", myRandomSeed1, myRandomSeed2)

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = [
    "SINGLE " + str(myRandomSeed1) + " " + str(myRandomSeed2)
]
#myAtRndmGenSvc.OutputLevel          = VERBOSE
myAtRndmGenSvc.EventReseeding = False
ServiceMgr += myAtRndmGenSvc
SLHC_Setup = SLHC_Setup()

#--------------------------------------------------------------
# Particle gun
#--------------------------------------------------------------

from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput.set_Off()
athenaCommonFlags.SkipEvents.set_Off()

import ParticleGun as PG
print dir(PG)

pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")
pg.sampler.pid = 999     # geantino
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[-4.,4.], phi=[0,6.28318])
topSeq += pg


myRandomSeed1 = int(random.uniform(0,time.time()))
myRandomSeed2 = int(random.uniform(0,time.time()))
simFlags.RandomSeedList.addSeed( "SINGLE", myRandomSeed1, myRandomSeed2 )

from RngComps.RngCompsConf import AtRndmGenSvc
myAtRndmGenSvc = AtRndmGenSvc()
myAtRndmGenSvc.Seeds = ["SINGLE "+str(myRandomSeed1)+" "+str(myRandomSeed2) ]
myAtRndmGenSvc.OutputLevel      = VERBOSE
myAtRndmGenSvc.EventReseeding   = False
ServiceMgr += myAtRndmGenSvc

## Enable the EtaPhi, VertexSpread and VertexRange checks
Пример #7
0
#callbacks.use_verbose_tracking()

## Use single particle generator
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags

athenaCommonFlags.PoolEvgenInput.set_Off()
athenaCommonFlags.SkipEvents.set_Off()

## Use single particle generator
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG

pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = 999  #Geantino
pg.sampler.mom = PG.EEtaMPhiSampler(energy=50000, eta=[-3, 3])
topSeq += pg
print topSeq.ParticleGun

# This should only be used when evgen is run in the simulation step
include('G4AtlasApps/fragment.SimCopyWeights.py')

include("G4AtlasApps/G4Atlas.flat.configuration.py")

#from TruthExamples.TruthExamplesConf import DumpMC
#topSeq += DumpMC()

from AthenaCommon.CfgGetter import getAlgorithm

topSeq += getAlgorithm("BeamEffectsAlg", tryDefaultConfigurable=True)
Пример #8
0
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput.set_Off()
athenaCommonFlags.SkipEvents.set_Off()

## Use single particle generator
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")

if not 'PID' in dir():
    PID=211
if not 'E' in dir():
    E=100000
pg.sampler.pid = PID
pg.sampler.pos = PG.PosSampler(x=0, y=0, z=0, t=0)
pg.sampler.mom = PG.EEtaMPhiSampler(energy=E, eta=[-1.8,1.8], phi=[0,6.28318])

topSeq += pg

#--- Final step -----------------------------------------------

# This should only be used when evgen is run in the simulation step
include('G4AtlasApps/fragment.SimCopyWeights.py')

include("G4AtlasApps/G4Atlas.flat.configuration.py")

#from TruthExamples.TruthExamplesConf import DumpMC
#topSeq += DumpMC()

from AthenaCommon.CfgGetter import getAlgorithm
topSeq += getAlgorithm("BeamEffectsAlg", tryDefaultConfigurable=True)
Пример #9
0
printfunc ('SINGLE PARTICLE GENERATOR')

import AthenaCommon.AtlasUnixGeneratorJob
from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")
pg.sampler.pid = 2212
pg.sampler.mom = PG.EEtaMPhiSampler(energy=3500000, eta=10)
job += pg

include("G4AtlasApps/fragment.SimCopyWeights.py")

printfunc ("As this is a single particle generator job turn off VertexPositioner (EventFilter already off when ZDCon)")
simFlags.MagneticField.set_Off()
simFlags.EventFilter.get_Value()['VertexPositioner'] = False
simFlags.EventFilter.get_Value()['BeamEffectTransformation'] = False
simFlags.EventFilter.get_Value()['PrimaryEventRotations'] = False
simFlags.VertexFromCondDB = False

try:
    include("ForwardTransportSvc/preInclude.ForwardTransportFlags_3.5TeV_0090.00m_nominal_v02.py")
except:
    printfunc ("forwardTransportFlags not available in this release. The job will only work if this release uses TwissFiles-00-00-03 or earlier.")

include('ForwardTransportSvc/ForwardTransportSvcConfig.ALFA.py')

try:
    from ForwardTransportSvc.ForwardTransportFlags import forwardTransportFlags
except:
    #Back-compatibility hack for releases where forwardTransportFlags are not available.
Пример #10
0
    # 100 GeV electrons - use for sampling faction calculation
    #pg.sampler.pid = 11
    #pg.sampler.pos = PG.PosSampler(x=-27500, y=[-20,20], z=[-15,15], t=-27500)
    #pg.sampler.mom = PG.EEtaMPhiSampler(energy=100000, eta=0, phi=0)

    if not 'PID' in dir():
        PID = 11
    if not 'E' in dir():
        E = 100000
    if not 'Ybeam' in dir():
        Ybeam = [-20, 20]
    if not 'Zbeam' in dir():
        Zbeam = [-15, 15]
    pg.sampler.pid = PID
    pg.sampler.pos = PG.PosSampler(x=-27500, y=Ybeam, z=Zbeam, t=-27500)
    pg.sampler.mom = PG.EEtaMPhiSampler(energy=E, eta=0, phi=0)

    topSeq += pg

    include("G4AtlasApps/fragment.SimCopyWeights.py")

from AthenaCommon.CfgGetter import getAlgorithm

topSeq += getAlgorithm("BeamEffectsAlg")

try:
    from RecAlgs.RecAlgsConf import TimingAlg
    topSeq += TimingAlg("SimTimerBegin",
                        TimingObjOutputName="EVNTtoHITS_timings")
except:
    atlasG4log.warning(
Пример #11
0
MuonDetectorTool = GeoModelSvc.DetectorTools["MuonDetectorTool"]
MuonDetectorTool.UseConditionDb = 1
MuonDetectorTool.OutputLevel = VERBOSE

from AthenaServices.AthenaServicesConf import AtRanluxGenSvc
ServiceMgr += AtRanluxGenSvc()
ServiceMgr.AtRanluxGenSvc.Seeds = ["SINGLE 2040160768 443921183"]

## Run ParticleGun
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = (999)
pg.sampler.pos = PG.PosSampler(x=0, y=0, z=0, t=0)
pg.sampler.mom = PG.EEtaMPhiSampler(energy=100000,
                                    eta=[-3, 3],
                                    phi=[-PG.PI, PG.PI])
topSeq += pg

include("G4AtlasApps/G4Atlas.flat.configuration.py")

## Add G4 sim framework alg sequence
from AthenaCommon.CfgGetter import getAlgorithm
topSeq += getAlgorithm("G4AtlasAlg", tryDefaultConfigurable=True)
topSeq.G4AtlasAlg.InputTruthCollection = "GEN_EVENT"

#---  Output printout level -----------------------------------
#output threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL)
#you can override this for individual modules if necessary
MessageSvc = Service("MessageSvc")
MessageSvc.OutputLevel = 3
Пример #12
0
# from G4AtlasApps import callbacks
# simFlags.InitFunctions.add_function("postInit", callbacks.use_simplerunge_stepper)
# simFlags.InitFunctions.add_function("postInit", callbacks.use_verbose_tracking)

## Use single particle generator
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput.set_Off()
athenaCommonFlags.SkipEvents.set_Off()

## Set particle gun parameters
import AthenaCommon.AtlasUnixGeneratorJob
import ParticleGun as PG
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(),
                    randomStream="SINGLE")
pg.sampler.pid = 11
pg.sampler.mom = PG.EEtaMPhiSampler(energy=params['pg_E'],
                                    eta=params['pg_eta'])
pg.sampler.pos = PG.PosSampler(x=params['pg_x'],
                               y=params['pg_y'],
                               z=params['pg_z'],
                               t=params['pg_z'])
topSeq += pg

## Dump truth information
# from TruthExamples.TruthExamplesConf import DumpMC
# topSeq += DumpMC()

StoreGateSvc = Service("StoreGateSvc")
StoreGateSvc.Dump = True

include("G4AtlasApps/G4Atlas.flat.configuration.py")
Пример #13
0
 def __init__(self, energy, eta, pid, shift_z=0):
     self.pid = int(pid)
     self.shift_z = shift_z
     pdg_table = ROOT.TDatabasePDG.Instance()
     mass = pdg_table.GetParticle(pid).Mass()
     self.mom1 = PG.EEtaMPhiSampler(energy=energy, eta=eta, mass=mass)
Пример #14
0
#! -*- python -*-

# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration

include("GeneratorUtils/StdEvgenSetup.py")
theApp.EvtMax = 100

import ParticleGun as PG
pg = PG.ParticleGun()
pg.randomSeed = 123456
pg.sampler.pid = 13
pg.sampler.pos = PG.PosSampler(x=3140.0,
                               y=[-154.134, 154.134],
                               z=[4938.76, 5121.29],
                               t=5929.7)
pg.sampler.mom = PG.EEtaMPhiSampler(energy=100000, eta=1.25, phi=0.0)
topSeq += pg

include("GeneratorUtils/postJO.CopyWeights.py")
include("GeneratorUtils/postJO.PoolOutput.py")
include("GeneratorUtils/postJO.DumpMC.py")
Пример #15
0
print 'SINGLE PARTICLE GENERATOR'

## Run ParticleGun
import AthenaCommon.AtlasUnixGeneratorJob

from AthenaCommon.AlgSequence import AlgSequence
topSeq = AlgSequence()

import ParticleGun as PG
from G4AtlasApps.SimFlags import simFlags
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")
pg.sampler.pid = 13
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[-1,1])
topSeq += pg

try:
    from GeneratorModules.GeneratorModulesConf import CopyEventWeight
    topSeq += CopyEventWeight(TruthCollKey="GEN_EVENT")
except:
    include("G4AtlasApps/fragment.SimCopyWeights.py")