ATLAS Offline Software
Loading...
Searching...
No Matches
SimulationHelpers.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2from SimulationConfig.SimEnums import CalibrationRun, CavernBackground, LArParameterization, SimulationFlavour
3
4
5def 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
39 """Set flags to take care of Neutron BG"""
40 flags.Sim.CavernBackground = CavernBackground.Signal
41
42
43def 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
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
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
77 """Mods to have primary particle barcode signature on for calorimeter calibration hits."""
78 flags.Sim.ParticleID=True
79
80
82 """ """
83 flags.Sim.OptionalUserActionList += ['G4DebuggingTools.G4DebuggingToolsConfig.VerboseSelectorToolCfg']
84
85
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
96 # Use verbose G4 tracking
97 flags.Sim.G4Commands += ['/tracking/verbose 1']
98
99
100
102 flags.Sim.G4Stepper = 'SimpleRunge'
103
104
106 flags.Sim.G4Stepper = 'ClassicalRK4'
107
108
110 flags.Sim.G4Stepper = 'NystromRK4'
111
112
114 """ """
115 flags.Sim.OptionalUserActionList += ['G4UserActions.G4UserActionsConfig.FastIDKillerToolCfg']
STL class.
getDetectorsFromRunArgs(flags, runArgs)
useSimpleRungeStepper(flags)
Change the field stepper.