コード例 #1
0
    ],
    OutputLevel=INFO)

# Geant4 service
# Configures the Geant simulation: geometry, physics list and user actions
from Configurables import SimG4Svc
geantservice = SimG4Svc("SimG4Svc",
                        detector='SimG4DD4hepDetector',
                        physicslist="SimG4FtfpBert",
                        actions="SimG4FullSimActions")

# Magnetic field
from Configurables import SimG4ConstantMagneticFieldTool
if magnetic_field == 1:
    field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool",
                                           FieldOn=True,
                                           IntegratorStepper="ClassicalRK4")
else:
    field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool",
                                           FieldOn=False)

#Setting random seeds for Geant4 simulations
#geantservice.g4PreInitCommands  += ["/random/setSeeds "+str(x)+" 0"] #where x is the number you want

#range cut
geantservice.g4PreInitCommands += ["/run/setCut 0.1 mm"]

# Geant4 algorithm
# Translates EDM to G4Event, passes the event to G4, writes out outputs via tools
# and a tool that saves the calorimeter hits
from Configurables import SimG4Alg, SimG4SaveCalHits, InspectHitsCollectionsTool
コード例 #2
0
# Setting random seed, will be propagated to Geant
from Configurables import RndmGenSvc
from GaudiSvc.GaudiSvcConf import HepRndm__Engine_CLHEP__RanluxEngine_
randomEngine = eval('HepRndm__Engine_CLHEP__RanluxEngine_')
randomEngine = randomEngine('RndmGenSvc.Engine')
randomEngine.Seeds = [seed]

from Configurables import SimG4FullSimActions
actions = SimG4FullSimActions()
actions.enableHistory = True

# Magnetic field
from Configurables import SimG4ConstantMagneticFieldTool
if magnetic_field:
    field = SimG4ConstantMagneticFieldTool("bField",
                                           FieldOn=True,
                                           FieldZMax=20 * units.m,
                                           IntegratorStepper="ClassicalRK4")
else:
    field = SimG4ConstantMagneticFieldTool("bField", FieldOn=False)

from Configurables import SimG4Svc
geantservice = SimG4Svc("SimG4Svc",
                        detector='SimG4DD4hepDetector',
                        physicslist="SimG4FtfpBert",
                        actions=actions,
                        magneticField=field)
# range cut
geantservice.g4PostInitCommands += ["/run/setCut 0.1 mm"]

from Configurables import SimG4Alg, SimG4SingleParticleGeneratorTool, SimG4SaveTrackerHits, SimG4SaveParticleHistory
コード例 #3
0
savetrackertool.trackHits.Path = "TrackerHits"
savetrackertool.digiTrackHits.Path = "TrackerHitsDigiPostPoint"
geant_output_tool_list += [savetrackertool]

from Configurables import SimG4FullSimActions
actions = SimG4FullSimActions()
actions.enableHistory = True

# set up output tools for included detectors
# the algorithm itself is configured in the sim file
from Configurables import SimG4Alg
geantsim = SimG4Alg("SimG4Alg")
geantsim.outputs += geant_output_tool_list

from Configurables import SimG4ConstantMagneticFieldTool
field = SimG4ConstantMagneticFieldTool("bField")
field.FieldOn = True
field.FieldZMax = 20 * units.m
field.IntegratorStepper = "ClassicalRK4"

from Configurables import SimG4DD4hepDetector
geant_detector_tool = SimG4DD4hepDetector("SimG4DD4hepDetector")

from Configurables import SimG4FtfpBert
geant_physics_list = SimG4FtfpBert("PhysicsList")

from Configurables import SimG4Svc
geantservice = SimG4Svc("SimG4Svc")
geantservice.detector = geant_detector_tool
geantservice.physicslist = geant_physics_list
geantservice.actions = actions
コード例 #4
0
# from Configurables import HepMCReader
from Configurables import HepEVTReader

reader = HepEVTReader("Reader", Filename=my_input)
reader.genparticles.Path="allGenParticles"
reader.genvertices.Path="allGenVertices"

# DD4hep geometry service
# Parses the given xml file
from Configurables import GeoSvc, SimG4SingleParticleGeneratorTool
geoservice = GeoSvc("GeoSvc", detectors=[
                                         'Detector/DetFCCeeCLD/compact/FCCee_DectMaster.xml',
                                         ])

from Configurables import SimG4ConstantMagneticFieldTool
field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool", FieldOn=True, FieldComponentZ=0.002, IntegratorStepper="ClassicalRK4")


# Geant4 service
# Configures the Geant simulation: geometry, physics list and user actions
from Configurables import SimG4Svc, SimG4FullSimActions, SimG4UserLimitPhysicsList, SimG4UserLimitRegion
from GaudiKernel.SystemOfUnits import mm

regiontool = SimG4UserLimitRegion("limits", volumeNames=["world"],
                                  maxStep = 2*mm)

physicslisttool = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4FtfpBert")

actions = SimG4FullSimActions()
actions.enableHistory=True
# giving the names of tools will initialize the tools of that type
コード例 #5
0
    ],
    OutputLevel=INFO)
# Geant4 service
# Configures the Geant simulation: geometry, physics list and user actions
from Configurables import SimG4Svc
geantservice = SimG4Svc("SimG4Svc",
                        detector='SimG4DD4hepDetector',
                        physicslist="SimG4FtfpBert",
                        actions="SimG4FullSimActions")

# range cut
geantservice.g4PostInitCommands += ["/run/setCut 0.1 mm"]

# Magnetic field
from Configurables import SimG4ConstantMagneticFieldTool
field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool",
                                       FieldOn=False)

# common ECAL specific information
# readout name
ecalReadoutName = "ECalBarrelEta"

# common HCAL specific information
# readout name
hcalReadoutName = "BarHCal_Readout"
# new readout name
newHcalReadoutName = hcalReadoutName + "_phieta"
# readout name
extHcalReadoutName = "ExtBarHCal_Readout"
# new readout name
newExtHcalReadoutName = extHcalReadoutName + "_phieta"
コード例 #6
0
ファイル: geant_fullsim_field.py プロジェクト: kjvbrt/FCCSW
geoservice.detectors = [os.path.join(path_to_detectors, d) for d in detectors]
geoservice.OutputLevel = INFO
ApplicationMgr().ExtSvc += [geoservice]

# Geant4 service
# Configures the Geant simulation: geometry, physics list and user actions
from Configurables import SimG4Svc
# giving the names of tools will initialize the tools of that type
geantservice = SimG4Svc("SimG4Svc")
geantservice.detector = "SimG4DD4hepDetector"
geantservice.physicslist = "SimG4FtfpBert"
from Configurables import SimG4FullSimActions
geantservice.actions = SimG4FullSimActions()
geantservice.actions.enableHistory = True
from Configurables import SimG4ConstantMagneticFieldTool
geantservice.magneticField = SimG4ConstantMagneticFieldTool(
    "SimG4ConstantMagneticFieldTool")
geantservice.magneticField.FieldOn = True
geantservice.magneticField.IntegratorStepper = "ClassicalRK4"

ApplicationMgr().ExtSvc += [geantservice]

# Geant4 algorithm
# Translates EDM to G4Event, passes the event to G4, writes out outputs via tools
from Configurables import SimG4Alg
geantsim = SimG4Alg("SimG4Alg")
from Configurables import SimG4SaveParticleHistory
savehisttool = SimG4SaveParticleHistory("saveHistory")
savehisttool.GenParticles.Path = "SimParticles"
geantsim.outputs += [savehisttool]
from Configurables import SimG4SaveTrackerHits
savetrackertool = SimG4SaveTrackerHits("saveTrackerHits")
コード例 #7
0
# Data service
from Configurables import FCCDataSvc
podioevent = FCCDataSvc("EventDataSvc")

# DD4hep geometry service
# Parses the given xml file
from Configurables import GeoSvc, SimG4SingleParticleGeneratorTool
geoservice = GeoSvc("GeoSvc", detectors=['Detector/DetFCCeeIDEA/compact/FCCee_DectEmptyMaster.xml',
                                         'Detector/DetFCCeeIDEA/compact/FCCee_DectMaster.xml'
                                         ], 
                    OutputLevel = INFO)

from Configurables import SimG4ConstantMagneticFieldTool
field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool", FieldOn=True, 
                                       IntegratorStepper="ClassicalRK4", FieldComponentZ=0.000,
                                       MaximumStep=10000.0)

# Geant4 service
# Configures the Geant simulation: geometry, physics list and user actions
from Configurables import SimG4Svc, SimG4UserLimitPhysicsList, SimG4UserLimitRegion, SimG4FullSimActions
from GaudiKernel.SystemOfUnits import mm

regiontool = SimG4UserLimitRegion("limits", volumeNames=["CDCH"],
                                  maxStep = 2*mm)
physicslisttool = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4FtfpBert")

actions = SimG4FullSimActions()
actions.enableHistory=True
geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist=physicslisttool, 
                        actions=actions, 
コード例 #8
0
geantservice.detector =     "SimG4DD4hepDetector"
geantservice.physicslist =  "SimG4FtfpBert"
geantservice.actions =      "SimG4FullSimActions"
# Fixed seed to have reproducible results, change it for each job if you split one production into several jobs
# Mind that if you leave Gaudi handle random seed and some job start within the same second (very likely) you will have duplicates
geantservice.randomNumbersFromGaudi = False
geantservice.seedValue = 4242
# Range cut
geantservice.g4PreInitCommands += ["/run/setCut 0.1 mm"]
ApplicationMgr().ExtSvc += [geantservice]



# Magnetic field
from Configurables import SimG4ConstantMagneticFieldTool
field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool")
field.FieldComponentZ = -2 * units.tesla
field.FieldOn = True
field.IntegratorStepper="ClassicalRK4"

# Geant4 algorithm
# Translates EDM to G4Event, passes the event to G4, writes out outputs via tools
# and a tool that saves the calorimeter hits

# Detector readouts
# ECAL
ecalBarrelReadoutName = "ECalBarrelEta"
ecalBarrelReadoutNamePhiEta = "ECalBarrelPhiEta"
# HCAL
hcalReadoutName = "HCalBarrelReadout"
extHcalReadoutName = "HCalExtBarrelReadout"