ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
SimuJobTransforms
python
SimulationHelpers.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
from
SimulationConfig.SimEnums
import
CalibrationRun, CavernBackground, InDetParameterization, LArParameterization, SimulationFlavour
3
4
5
def
getDetectorsFromRunArgs
(flags, runArgs):
6
"""Generate detector list based on runtime arguments."""
7
if
hasattr(runArgs,
'detectors'
):
8
detectors =
set
(runArgs.detectors)
9
else
:
10
from
AthenaConfiguration.AutoConfigFlags
import
getDefaultDetectors
11
detectors =
set
(getDefaultDetectors(flags.GeoModel.AtlasVersion, flags.GeoModel.SQLiteDB, flags.GeoModel.SQLiteDBFullPath, includeForward=
False
))
12
13
# Support switching on Forward Detectors
14
if
hasattr(runArgs,
'LucidOn'
):
15
detectors.add(
'Lucid'
)
16
if
hasattr(runArgs,
'ZDCOn'
):
17
detectors.add(
'ZDC'
)
18
if
hasattr(runArgs,
'AFPOn'
):
19
detectors.add(
'AFP'
)
20
if
hasattr(runArgs,
'ALFAOn'
):
21
detectors.add(
'ALFA'
)
22
if
hasattr(runArgs,
'FwdRegionOn'
):
23
detectors.add(
'FwdRegion'
)
24
# TODO here support switching on Cavern geometry
25
# if hasattr(runArgs, 'CavernOn'):
26
# detectors.add('Cavern')
27
28
# Fatras does not support simulating the BCM, so have to switch that off
29
if
flags.Sim.ISF.Simulator.usesFatras()
and
not
flags.Detector.GeometryITk:
30
try
:
31
detectors.remove(
'BCM'
)
32
except
ValueError:
33
pass
34
35
return
detectors
36
37
38
def
enableG4SignalCavern
(flags):
39
"""Set flags to take care of Neutron BG"""
40
flags.Sim.CavernBackground = CavernBackground.Signal
41
42
43
def
enableCalHits
(flags):
44
"""Turns on calibration hits for LAr and Tile"""
45
flags.Sim.CalibrationRun = CalibrationRun.LArTile
46
# deactivate incompatible optimizations
47
flags.Sim.LArParameterization = LArParameterization.NoFrozenShowers
48
flags.Sim.NRRThreshold =
False
49
flags.Sim.NRRWeight =
False
50
flags.Sim.PRRThreshold =
False
51
flags.Sim.PRRWeight =
False
52
53
54
def
enableCalHitsZDC
(flags):
55
"""Turns on calibration hits for ZDC only"""
56
flags.Sim.CalibrationRun = CalibrationRun.ZDC
57
# deactivate incompatible optimizations
58
flags.Sim.LArParameterization = LArParameterization.NoFrozenShowers
59
flags.Sim.NRRThreshold =
False
60
flags.Sim.NRRWeight =
False
61
flags.Sim.PRRThreshold =
False
62
flags.Sim.PRRWeight =
False
63
64
65
def
enableCalHitsAll
(flags):
66
"""Turns on calibration hits for LAr, Tile and ZDC"""
67
flags.Sim.CalibrationRun = CalibrationRun.LArTileZDC
68
# deactivate incompatible optimizations
69
flags.Sim.LArParameterization = LArParameterization.NoFrozenShowers
70
flags.Sim.NRRThreshold =
False
71
flags.Sim.NRRWeight =
False
72
flags.Sim.PRRThreshold =
False
73
flags.Sim.PRRWeight =
False
74
75
76
def
enableParticleID
(flags):
77
"""Mods to have primary particle barcode signature on for calorimeter calibration hits."""
78
flags.Sim.ParticleID=
True
79
80
81
def
enableVerboseSelector
(flags):
82
""" """
83
flags.Sim.OptionalUserActionList += [
'G4DebuggingTools.G4DebuggingToolsConfig.VerboseSelectorToolCfg'
]
84
85
86
def
enableFastCaloSim
(flags):
87
# Set LArParametrization to FastCaloSim
88
flags.Sim.LArParameterization = LArParameterization.FastCaloSim
89
# Deacticate dead material hits for calibration run
90
flags.Sim.CalibrationRun = CalibrationRun.Off
91
# Set simulator name as metadata
92
flags.Sim.ISF.Simulator = SimulationFlavour.ATLFAST3MT
93
94
def
enableFatrasG4
(flags):
95
# Set InDetParametrization to FatrasG4
96
flags.Sim.InDetParameterization = InDetParameterization.FatrasG4
97
98
def
enableAFatrasG4
(flags):
99
# Set InDetParametrization to AFatrasG4
100
flags.Sim.InDetParameterization = InDetParameterization.AFatrasG4
101
102
def
useVerboseTracking
(flags):
103
# Use verbose G4 tracking
104
flags.Sim.G4Commands += [
'/tracking/verbose 1'
]
105
106
107
108
def
useSimpleRungeStepper
(flags):
109
flags.Sim.G4Stepper =
'SimpleRunge'
110
111
112
def
useClassicalRK4Stepper
(flags):
113
flags.Sim.G4Stepper =
'ClassicalRK4'
114
115
116
def
useNystromRK4Stepper
(flags):
117
flags.Sim.G4Stepper =
'NystromRK4'
118
119
120
def
enableFastIDKiller
(flags):
121
""" """
122
flags.Sim.OptionalUserActionList += [
'G4UserActions.G4UserActionsConfig.FastIDKillerToolCfg'
]
set
STL class.
python.SimulationHelpers.useSimpleRungeStepper
useSimpleRungeStepper(flags)
Change the field stepper.
Definition
SimulationHelpers.py:108
python.SimulationHelpers.useNystromRK4Stepper
useNystromRK4Stepper(flags)
Definition
SimulationHelpers.py:116
python.SimulationHelpers.useVerboseTracking
useVerboseTracking(flags)
Definition
SimulationHelpers.py:102
python.SimulationHelpers.enableFastCaloSim
enableFastCaloSim(flags)
Definition
SimulationHelpers.py:86
python.SimulationHelpers.enableFatrasG4
enableFatrasG4(flags)
Definition
SimulationHelpers.py:94
python.SimulationHelpers.enableCalHits
enableCalHits(flags)
Definition
SimulationHelpers.py:43
python.SimulationHelpers.enableParticleID
enableParticleID(flags)
Definition
SimulationHelpers.py:76
python.SimulationHelpers.enableG4SignalCavern
enableG4SignalCavern(flags)
Definition
SimulationHelpers.py:38
python.SimulationHelpers.enableVerboseSelector
enableVerboseSelector(flags)
Definition
SimulationHelpers.py:81
python.SimulationHelpers.enableAFatrasG4
enableAFatrasG4(flags)
Definition
SimulationHelpers.py:98
python.SimulationHelpers.enableCalHitsZDC
enableCalHitsZDC(flags)
Definition
SimulationHelpers.py:54
python.SimulationHelpers.useClassicalRK4Stepper
useClassicalRK4Stepper(flags)
Definition
SimulationHelpers.py:112
python.SimulationHelpers.enableFastIDKiller
enableFastIDKiller(flags)
Definition
SimulationHelpers.py:120
python.SimulationHelpers.getDetectorsFromRunArgs
getDetectorsFromRunArgs(flags, runArgs)
Definition
SimulationHelpers.py:5
python.SimulationHelpers.enableCalHitsAll
enableCalHitsAll(flags)
Definition
SimulationHelpers.py:65
Generated on
for ATLAS Offline Software by
1.17.0