ATLAS Offline Software
Loading...
Searching...
No Matches
G4AtlasToolsConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentFactory import CompFactory
3from AthenaConfiguration.Enums import BeamType
4from SimulationConfig.SimEnums import BeamPipeSimMode, CalibrationRun, CavernBackground, InDetParameterization, LArParameterization
5from AthenaConfiguration.AccumulatorCache import AccumulatorCache
6from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7
8
9
10@AccumulatorCache
12 result = ComponentAccumulator()
13 tools = []
14 if flags.Sim.LArParameterization is LArParameterization.FastCaloSim:
15 from G4FastSimulation.G4FastSimulationConfig import FastCaloSimCfg
16 tools += [ result.popToolsAndMerge(FastCaloSimCfg(flags)) ]
17
18 if flags.Sim.InDetParameterization is InDetParameterization.FatrasG4:
19 from G4FastSimulation.G4FastSimulationConfig import FatrasG4Cfg
20 tools += [ result.popToolsAndMerge(FatrasG4Cfg(flags)) ]
21
22 if flags.Sim.InDetParameterization is InDetParameterization.AFatrasG4:
23 from G4FastSimulation.G4FastSimulationConfig import AFatrasG4Cfg
24 tools += [ result.popToolsAndMerge(AFatrasG4Cfg(flags)) ]
25
26 if flags.Detector.GeometryBpipe:
27 if not flags.Detector.GeometryFwdRegion and (flags.Detector.GeometryAFP or flags.Detector.GeometryALFA or flags.Detector.GeometryZDC):
28 # equivalent of simFlags.ForwardDetectors() == 2:
29 from ForwardTransport.ForwardTransportConfig import ForwardTransportModelCfg
30 tools += [ result.popToolsAndMerge(ForwardTransportModelCfg(flags)) ]
31 if flags.Sim.BeamPipeSimMode is not BeamPipeSimMode.Normal:
32 from G4FastSimulation.G4FastSimulationConfig import SimpleFastKillerCfg
33 tools += [ result.popToolsAndMerge(SimpleFastKillerCfg(flags)) ]
34 if flags.Detector.GeometryLAr:
35 if flags.Sim.LArParameterization is LArParameterization.NoFrozenShowers:
36 from AthenaCommon.Logging import logging
37 msg = logging.getLogger("FastSimulationToolListCfg")
38 msg.info( "Not using Frozen Showers" )
39 else:
40 from LArG4FastSimulation.LArG4FastSimulationConfig import EMBFastShowerCfg, EMECFastShowerCfg, FCALFastShowerCfg, FCAL2FastShowerCfg
41 # We run production with LArParameterization.FrozenShowersFCalOnly, so the EMB and EMEC tools are not required
42 if flags.Sim.LArParameterization is LArParameterization.FrozenShowers:
43 tools += [ result.popToolsAndMerge(EMBFastShowerCfg(flags)) ]
44 tools += [ result.popToolsAndMerge(EMECFastShowerCfg(flags)) ]
45 tools += [ result.popToolsAndMerge(FCALFastShowerCfg(flags)) ]
46 tools += [ result.popToolsAndMerge(FCAL2FastShowerCfg(flags)) ]
47 if flags.Sim.LArParameterization in [LArParameterization.DeadMaterialFrozenShowers, LArParameterization.FrozenShowersFCalOnly, LArParameterization.FastCaloSim]: # TODO Check this makes sense.
48 from G4FastSimulation.G4FastSimulationConfig import DeadMaterialShowerCfg
49 tools += [ result.popToolsAndMerge(DeadMaterialShowerCfg(flags)) ]
50 # Enable fast simulation of the calorimeter with FastCaloSim
51 if flags.Sim.LArParameterization is LArParameterization.FastCaloSim:
52 from G4FastSimulation.G4FastSimulationConfig import FastCaloSimCfg
53 tools += [ result.popToolsAndMerge(FastCaloSimCfg(flags)) ]
54 if flags.Detector.GeometryMuon:
55 if flags.Sim.CavernBackground not in [CavernBackground.Off, CavernBackground.Read] and not flags.Sim.RecordFlux:
56 from TrackWriteFastSim.TrackWriteFastSimConfig import NeutronFastSimCfg
57 tools += [ result.popToolsAndMerge(NeutronFastSimCfg(flags)) ]
58
59 from G4AtlasServices.G4AtlasServicesConfig import PhysicsListSvcCfg
60 result.merge(PhysicsListSvcCfg(flags))
61 result.getService("PhysicsListSvc").FastSimConstructor.InitializeFastSimulation = len(tools) > 0
62
63 result.setPrivateTools(tools)
64 return result
65
67 acc = ComponentAccumulator()
68
69 svc = CompFactory.ThreadPoolSvc(name="ThreadPoolSvc")
70 svc.ThreadInitTools += [CompFactory.G4ThreadInitTool()]
71
72 acc.addService(svc)
73 return acc
74
75def FastSimulationMasterToolCfg(flags, **kwargs):
76 result = ComponentAccumulator()
77 kwargs.setdefault("FastSimulations", result.popToolsAndMerge(FastSimulationToolListCfg(flags)))
78 FastSimulationMasterTool = CompFactory.FastSimulationMasterTool
79 result.setPrivateTools(FastSimulationMasterTool(name="FastSimulationMasterTool", **kwargs))
80 return result
81
82
84 result = ComponentAccumulator()
85 FastSimulationConstructorTool = CompFactory.FastSimulationConstructorTool
86 result.setPrivateTools(FastSimulationConstructorTool(name="FastSimulationConstructorTool", **kwargs))
87 return result
88
89
91 result = ComponentAccumulator()
92 FastSimulationMasterTool = CompFactory.FastSimulationMasterTool
93 tool = result.popToolsAndMerge(FastSimulationMasterTool(name="EmptyFastSimulationMasterTool", **kwargs))
94 result.setPrivateTools(tool)
95 return result
96
97def G4CaloTransportToolCfg(flags, name='G4CaloTransportTool', **kwargs):
98 result = ComponentAccumulator()
99 # Use simplified calorimeter geometry if path to simplified geometry is provided
100 # Otherwise, use the full geometry for the transport (Note that this will be very slow)
101 kwargs.setdefault("UseSimplifiedGeo", bool(flags.Sim.SimplifiedGeoPath))
102 if flags.Sim.SimplifiedGeoPath:
103 # What is the name of the logical world volume of the simplified geometry?
104 kwargs.setdefault('SimplifiedWorldLogName', "WorldLog")
105 # At what volume will we stop the transport?
106 kwargs.setdefault('TransportLimitVolume', "Envelope")
107 # What is the maximum number of Geant4 steps taken in the transport?
108 kwargs.setdefault('MaxSteps', 100)
109 else:
110 # At what volume will be stop the transport?
111 kwargs.setdefault('TransportLimitVolume', "MuonSys")
112 # What is the maximum number of Geant4 steps taken in the transport?
113 kwargs.setdefault('MaxSteps', 5000)
114
115 result.setPrivateTools(CompFactory.G4CaloTransportTool(name, **kwargs))
116 return result
117
118def ActsFatrasG4ToolCfg(flags, name="ActsFatrasG4Tool", **kwargs):
119 # Use rules below to decide how to retrieve dependencies for this tool:
120 # Private tool popToolsAndMerge()
121 # Primary component getPrimaryAndMerge()
122 # Plain alg/service/cond alg merge()
123
124 # declare component accumulator
125 result = ComponentAccumulator()
126 from AthenaCommon.Logging import logging
127 mlog = logging.getLogger(name)
128 mlog.info('Start configuration of ActsFatrasG4Tool')
129
130 # other arguments
131 # see: ActsExtrapolationToolCfg in ActsConfig/python/ActsGeometryConfig.py for example
132 # --- Schedule magnetic field conditions alg properly ---
133 from MagFieldServices.MagFieldServicesConfig import AtlasFieldCacheCondAlgCfg
134 result.merge(AtlasFieldCacheCondAlgCfg(flags))
135
136 # Tracking geometry
137 from ActsConfig.ActsGeometryConfig import ActsTrackingGeometrySvcCfg
138 result.merge(ActsTrackingGeometrySvcCfg(flags))
139
140 from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
141 result.merge(ActsGeometryContextAlgCfg(flags))
142
143 kwargs.setdefault("MaxSteps", 2000)
144 # always set to false, only for debugging purpose
145 kwargs.setdefault("DebugInjectParticle", flags.Sim.ActsFatrasG4.DebugInjectParticle)
146
147 # RNG service
148 from RngComps.RngCompsConfig import AthRNGSvcCfg
149 kwargs.setdefault(
150 "RNGService",
151 result.getPrimaryAndMerge(AthRNGSvcCfg(flags))
152 )
153
154 # create the tool
155 tool = CompFactory.ActsFatrasG4Tool(name, **kwargs)
156 # set as private tool
157 result.setPrivateTools(tool)
158
159 return result
160
161def PunchThroughG4ClassifierCfg(flags, name="PunchThroughG4Classifier", **kwargs):
162 # declare component accumulator
163 result = ComponentAccumulator()
164 # other arguments
165 kwargs.setdefault("ScalerConfigFileName" , "FastCaloSim/MC23/TFCSparam_mpt_classScaler_v04.xml" )
166 kwargs.setdefault("NetworkConfigFileName" , "FastCaloSim/MC23/TFCSparam_mpt_classNet_v04.json" )
167 kwargs.setdefault("CalibratorConfigFileName" , "FastCaloSim/MC23/TFCSparam_mpt_classCalib_v04.xml")
168 # set as private tool
169 result.setPrivateTools(CompFactory.PunchThroughG4Classifier(name, **kwargs))
170 return result
171
172def PunchThroughG4ToolCfg(flags, name='PunchThroughG4Tool', **kwargs):
173 # get the envelope config
174 from SubDetectorEnvelopes.SubDetectorEnvelopesConfig import EnvelopeDefSvcCfg
175 # declare component accumulator
176 result = ComponentAccumulator()
177 # other arguments
178 kwargs.setdefault("FilenameLookupTable" , "FastCaloSim/MC23/TFCSparam_mpt_v07.root")
179 kwargs.setdefault("FilenameInverseCdf" , "FastCaloSim/MC23/TFCSparam_mpt_inverseCdf_v07.xml")
180 kwargs.setdefault("FilenameInversePca" , "FastCaloSim/MC23/TFCSparam_mpt_inversePca_v07.xml")
181 kwargs.setdefault("EnergyFactor" , [ 0.98, 0.831, 0.896, 0.652, 0.717, 1., 0.877, 0.858, 0.919 ] )
182 kwargs.setdefault("DoAntiParticles" , [ 0, 1, 0, 1, 1, 0, 0, 0, 0 ] )
183 kwargs.setdefault("PunchThroughInitiators" , [ 211, 321, 311, 310, 130, 2212, 2112] )
184 kwargs.setdefault("InitiatorsMinEnergy" , [ 65536, 65536, 65536, 65536, 65536, 65536, 65536] )
185 kwargs.setdefault("InitiatorsEtaRange" , [ -3.2, 3.2 ] )
186 kwargs.setdefault("PunchThroughParticles" , [ 2212, 211, 22, 11, 13, 2112, 321, 310, 130 ] )
187 kwargs.setdefault("CorrelatedParticle" , [] )
188 kwargs.setdefault("FullCorrelationEnergy" , [ 100000., 100000., 100000., 100000., 0., 100000., 100000., 100000., 100000.] )
189 kwargs.setdefault("MinEnergy" , [ 938.3, 135.6, 50., 50., 105.7, 939.6, 493.7, 497.6, 497.6 ] )
190 kwargs.setdefault("MaxNumParticles" , [ -1, -1, -1, -1, -1, -1, -1, -1, -1 ] )
191 kwargs.setdefault("EnvelopeDefSvc", result.getPrimaryAndMerge(EnvelopeDefSvcCfg(flags)))
192 kwargs.setdefault("BeamPipeRadius", 500.)
193 # set as private tool
194 result.setPrivateTools(CompFactory.PunchThroughG4Tool(name, **kwargs))
195 return result
196
197def PunchThroughSimWrapperCfg(flags, name='PunchThroughSimWrapper', **kwargs):
198 result = ComponentAccumulator()
199
200 # Set the PunchThroughG4Classifier
201 if "PunchThroughG4Classifier" not in kwargs:
202 kwargs.setdefault("PunchThroughG4Classifier", result.addPublicTool(result.popToolsAndMerge(PunchThroughG4ClassifierCfg(flags))))
203
204 # Set the PunchThroughG4Tool
205 if "PunchThroughG4Tool" not in kwargs:
206 kwargs.setdefault("PunchThroughG4Tool", result.addPublicTool(result.popToolsAndMerge(PunchThroughG4ToolCfg(flags))))
207
208 result.setPrivateTools(CompFactory.PunchThroughSimWrapper(name, **kwargs))
209 return result
210
212 # TODO: migrate to CA
213 result = ComponentAccumulator()
214 tools = []
215 if flags.Detector.EnableLucid:
216 from LUCID_G4_SD.LUCID_G4_SDConfig import LUCID_SensitiveDetectorCfg
217 tools += [ result.popToolsAndMerge(LUCID_SensitiveDetectorCfg(flags)) ]
218 if flags.Detector.EnableForward:
219 if flags.Detector.EnableZDC:
220 from ZDC_SD.ZDC_SDConfig import ZDC_FiberSDCfg
221 tools += [ result.popToolsAndMerge(ZDC_FiberSDCfg(flags)) ]
222 if flags.Sim.CalibrationRun in [CalibrationRun.ZDC, CalibrationRun.LArTileZDC]:
223 from ZDC_SD.ZDC_SDConfig import ZDC_G4CalibSDCfg
224 tools += [ result.popToolsAndMerge(ZDC_G4CalibSDCfg(flags)) ]
225 if flags.Detector.EnableALFA:
226 from ALFA_G4_SD.ALFA_G4_SDConfig import ALFA_SensitiveDetectorCfg
227 tools += [ result.popToolsAndMerge(ALFA_SensitiveDetectorCfg(flags)) ]
228 if flags.Detector.EnableAFP:
229 from AFP_G4_SD.AFP_G4_SDConfig import AFP_SensitiveDetectorCfg
230 tools += [ result.popToolsAndMerge(AFP_SensitiveDetectorCfg(flags)) ]
231 # Alternative implementations
232 # from AFP_G4_SD.AFP_G4_SDConfig import AFP_SiDSensitiveDetectorCfg, AFP_TDSensitiveDetectorCfg
233 # tools += [ result.popToolsAndMerge(AFP_SiDSensitiveDetectorCfg(flags)) ]
234 # tools += [ result.popToolsAndMerge(AFP_TDSensitiveDetectorCfg(flags)) ]
235 result.setPrivateTools(tools)
236 return result
237
238
240 result = ComponentAccumulator()
241 tools = []
242 if (flags.Detector.EnableMuon and flags.Sim.CavernBackground in [CavernBackground.Write, CavernBackground.WriteWorld]) or flags.Sim.StoppedParticleFile:
243 from TrackWriteFastSim.TrackWriteFastSimConfig import TrackFastSimSDCfg
244 tools += [ result.popToolsAndMerge(TrackFastSimSDCfg(flags)) ]
245 result.setPrivateTools(tools)
246 return result
247
249 result = ComponentAccumulator()
250 tools = []
251 if flags.Sim.LArParameterization is LArParameterization.FastCaloSim:
252 from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConfig import CaloCellContainerSDCfg
253 tools += [ result.popToolsAndMerge(CaloCellContainerSDCfg(flags)) ]
254 result.setPrivateTools(tools)
255 return result
256
258 result = ComponentAccumulator()
259 tools = []
260
261 if flags.Detector.EnableITkPixel:
262 from PixelG4_SD.PixelG4_SDToolConfig import ITkPixelSensorSDCfg
263 tools += [ result.popToolsAndMerge(ITkPixelSensorSDCfg(flags)) ]
264 pass
265 if flags.Detector.EnableITkStrip:
266 from SCT_G4_SD.SCT_G4_SDToolConfig import ITkStripSensorSDCfg
267 tools += [ result.popToolsAndMerge(ITkStripSensorSDCfg(flags)) ]
268 if flags.Detector.EnablePLR:
269 from PixelG4_SD.PixelG4_SDToolConfig import PLRSensorSDCfg
270 tools += [ result.popToolsAndMerge(PLRSensorSDCfg(flags)) ]
271
272 result.setPrivateTools(tools)
273 return result
274
275
277 result = ComponentAccumulator()
278 tools = []
279
280 if flags.Detector.EnableHGTD:
281 from HGTD_G4_SD.HGTD_G4_SDToolConfig import HgtdSensorSDCfg
282 tools += [ result.popToolsAndMerge(HgtdSensorSDCfg(flags)) ]
283 pass
284
285 result.setPrivateTools(tools)
286 return result
287
288
290 result = ComponentAccumulator()
291 tools = []
292
293 if flags.Detector.EnablePixel:
294 from PixelG4_SD.PixelG4_SDToolConfig import PixelSensorSDCfg
295 tools += [ result.popToolsAndMerge(PixelSensorSDCfg(flags)) ]
296 if flags.Detector.EnableSCT:
297 from SCT_G4_SD.SCT_G4_SDToolConfig import SctSensorSDCfg
298 tools += [ result.popToolsAndMerge(SctSensorSDCfg(flags)) ]
299 if flags.Detector.EnableTRT:
300 from TRT_G4_SD.TRT_G4_SDToolConfig import TRTSensitiveDetectorCfg
301 tools += [ result.popToolsAndMerge(TRTSensitiveDetectorCfg(flags)) ]
302 if flags.Detector.EnableBCM:
303 from BCM_G4_SD.BCM_G4_SDToolConfig import BCMSensorSDCfg
304 tools += [ result.popToolsAndMerge(BCMSensorSDCfg(flags)) ]
305 from BLM_G4_SD.BLM_G4_SDToolConfig import BLMSensorSDCfg
306 tools += [ result.popToolsAndMerge(BLMSensorSDCfg(flags)) ]
307
308 result.setPrivateTools(tools)
309 return result
310
311
313 result = ComponentAccumulator()
314 tools = []
315
316 if flags.Detector.EnableLAr:
317 from LArG4SD.LArG4SDToolConfig import LArEMBSensitiveDetectorCfg, LArEMECSensitiveDetectorCfg, LArFCALSensitiveDetectorCfg, LArHECSensitiveDetectorCfg
318 tools += [ result.popToolsAndMerge(LArEMBSensitiveDetectorCfg(flags)) ]
319 tools += [ result.popToolsAndMerge(LArEMECSensitiveDetectorCfg(flags)) ]
320 tools += [ result.popToolsAndMerge(LArFCALSensitiveDetectorCfg(flags)) ]
321 tools += [ result.popToolsAndMerge(LArHECSensitiveDetectorCfg(flags)) ]
322
323 if flags.Detector.EnableMBTS:
324 from MinBiasScintillator.MinBiasScintillatorToolConfig import MinBiasScintillatorSDCfg
325 tools += [ result.popToolsAndMerge(MinBiasScintillatorSDCfg(flags)) ]
326
327 if flags.Sim.CalibrationRun in [CalibrationRun.LAr, CalibrationRun.LArTile, CalibrationRun.LArTileZDC]:
328 from LArG4SD.LArG4SDToolConfig import LArDeadSensitiveDetectorToolCfg, LArActiveSensitiveDetectorToolCfg, LArInactiveSensitiveDetectorToolCfg
329 tools += [ result.popToolsAndMerge(LArDeadSensitiveDetectorToolCfg(flags)) ]
330 tools += [ result.popToolsAndMerge(LArInactiveSensitiveDetectorToolCfg(flags)) ]
331 tools += [ result.popToolsAndMerge(LArActiveSensitiveDetectorToolCfg(flags)) ]
332 elif flags.Sim.CalibrationRun is CalibrationRun.DeadLAr:
333 from LArG4SD.LArG4SDToolConfig import LArDeadSensitiveDetectorToolCfg
334 tools += [ result.popToolsAndMerge(LArDeadSensitiveDetectorToolCfg(flags)) ]
335
336 if flags.Detector.EnableTile:
337 if flags.Sim.CalibrationRun in [CalibrationRun.Tile, CalibrationRun.LArTile, CalibrationRun.LArTileZDC]:
338 from TileGeoG4Calib.TileGeoG4CalibConfig import TileGeoG4CalibSDCfg
339 tools += [ result.popToolsAndMerge(TileGeoG4CalibSDCfg(flags)) ] # mode 1 : With CaloCalibrationHits
340 else:
341 from TileGeoG4SD.TileGeoG4SDToolConfig import TileGeoG4SDCfg
342 tools += [ result.popToolsAndMerge(TileGeoG4SDCfg(flags)) ] # mode 0 : No CaloCalibrationHits
343 if flags.Sim.RecordStepInfo:
344 from ISF_FastCaloSimSD.ISF_FastCaloSimSDToolConfig import FCS_StepInfoSDToolCfg
345 tools += [ result.popToolsAndMerge(FCS_StepInfoSDToolCfg(flags)) ]
346
347 result.setPrivateTools(tools)
348 return result
349
350
352 if flags.Muon.usePhaseIIGeoSetup:
353 from MuonSensitiveDetectorsR4.SensitiveDetectorsCfg import SetupSensitiveDetectorsCfg
354 return SetupSensitiveDetectorsCfg(flags)
355 from MuonG4SD.MuonG4SDConfig import SetupSensitiveDetectorsCfg
356 return SetupSensitiveDetectorsCfg(flags)
357
359 result = ComponentAccumulator()
360 tools = []
361 if flags.Beam.Type is BeamType.Cosmics and not flags.Sim.ReadTR:
362 from TrackWriteFastSim.TrackWriteFastSimConfig import CosmicTRSDCfg
363 tools += [ result.popToolsAndMerge(CosmicTRSDCfg(flags)) ]
364 result.setPrivateTools(tools)
365 return result
366
367
369 from SimulationConfig.SimEnums import LArParameterization
370 writtenContainers =[]
371 if flags.Detector.GeometryMuon:
372 if flags.Muon.usePhaseIIGeoSetup:
373 from MuonSensitiveDetectorsR4.SensitiveDetectorsCfg import SimHitContainerListCfg
374 writtenContainers+= SimHitContainerListCfg(flags)
375 else:
376 from MuonG4SD.MuonG4SDConfig import SimHitContainerListCfg
377 writtenContainers += SimHitContainerListCfg(flags)
378 if flags.Detector.GeometryLAr:
379 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('CALO', True)) or flags.Sim.LArParameterization is LArParameterization.FastCaloSim:
380 writtenContainers += [("LArHitContainer", "LArHitEMB_G4")]
381 writtenContainers += [("LArHitContainer", "LArHitEMEC_G4")]
382 writtenContainers += [("LArHitContainer", "LArHitFCAL_G4")]
383 writtenContainers += [("LArHitContainer", "LArHitHEC_G4")]
384 if flags.Sim.LArParameterization is LArParameterization.FastCaloSim:
385 writtenContainers += [("LArHitContainer" , "LArHitHEC_FastCaloSim")]
386 writtenContainers += [("LArHitContainer" , "LArHitFCAL_FastCaloSim")]
387 writtenContainers += [("LArHitContainer" , "LArHitEMEC_FastCaloSim")]
388 writtenContainers += [("LArHitContainer" , "LArHitEMB_FastCaloSim")]
389 else:
390 writtenContainers += [("LArHitContainer", "LArHitEMB")]
391 writtenContainers += [("LArHitContainer", "LArHitEMEC")]
392 writtenContainers += [("LArHitContainer", "LArHitFCAL")]
393 writtenContainers += [("LArHitContainer", "LArHitHEC")]
394 if flags.Detector.GeometryTile:
395 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('CALO', True)) or flags.Sim.LArParameterization is LArParameterization.FastCaloSim:
396 writtenContainers += [("TileHitVector", "MBTSHits_G4")]
397 writtenContainers += [("TileHitVector", "TileHitVec_G4")]
398 if flags.Sim.LArParameterization is LArParameterization.FastCaloSim:
399 writtenContainers += [("TileHitVector" , "TileHitVec_FastCaloSim")]
400 writtenContainers += [("TileHitVector" , "MBTSHits_FastCaloSim")]
401 else:
402 writtenContainers += [("TileHitVector", "MBTSHits")]
403 writtenContainers += [("TileHitVector", "TileHitVec")]
404 if flags.Detector.GeometryTRT:
405 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ID', True)):
406 writtenContainers += [("TRTUncompressedHitCollection", "TRTUncompressedHits_G4")]
407 else:
408 writtenContainers += [("TRTUncompressedHitCollection", "TRTUncompressedHits")]
409 if flags.Detector.EnableBCM:
410 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ID', True)):
411 writtenContainers += [("SiHitCollection", "BCMHits_G4")]
412 writtenContainers += [("SiHitCollection", "BLMHits_G4")]
413 else:
414 writtenContainers += [("SiHitCollection", "BCMHits")]
415 writtenContainers += [("SiHitCollection", "BLMHits")]
416 if flags.Detector.EnablePixel:
417 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ID', True)):
418 writtenContainers += [("SiHitCollection", "PixelHits_G4")]
419 if flags.Sim.InDetParameterization in (
420 InDetParameterization.FatrasG4,
421 InDetParameterization.AFatrasG4,
422 ):
423 writtenContainers += [("SiHitCollection", "PixelHits_ActsFatrasG4")]
424 else:
425 writtenContainers += [("SiHitCollection", "PixelHits")]
426 if flags.Detector.EnableSCT:
427 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ID', True)):
428 writtenContainers += [("SiHitCollection", "SCT_Hits_G4")]
429 if flags.Sim.InDetParameterization in (
430 InDetParameterization.FatrasG4,
431 InDetParameterization.AFatrasG4,
432 ):
433 writtenContainers += [("SiHitCollection" , "SCT_Hits_ActsFatrasG4")]
434 else:
435 writtenContainers += [("SiHitCollection", "SCT_Hits")]
436 if flags.Detector.EnableITkPixel:
437 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ITk', True)):
438 writtenContainers += [("SiHitCollection", "ITkPixelHits_G4")]
439 else:
440 writtenContainers += [("SiHitCollection", "ITkPixelHits")]
441 if flags.Detector.EnableITkStrip:
442 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ITk', True)):
443 writtenContainers += [("SiHitCollection", "ITkStripHits_G4")]
444 else:
445 writtenContainers += [("SiHitCollection", "ITkStripHits")]
446 if flags.Detector.EnablePLR:
447 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ITk', True)):
448 writtenContainers += [("SiHitCollection", "PLR_Hits_G4")]
449 else:
450 writtenContainers += [("SiHitCollection", "PLR_Hits")]
451 if flags.Detector.EnableHGTD:
452 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ITk', True)):
453 writtenContainers += [("SiHitCollection", "HGTDHits_G4")]
454 else:
455 writtenContainers += [("SiHitCollection", "HGTDHits")]
456 from SimulationConfig.SimEnums import CalibrationRun
457 if flags.Sim.CalibrationRun in [CalibrationRun.LAr, CalibrationRun.LArTile, CalibrationRun.LArTileZDC]:
458 # Needed to ensure that DeadMaterialCalibrationHitsMerger is scheduled correctly.
459 writtenContainers += [
460 ( 'CaloCalibrationHitContainer' , 'StoreGateSvc+LArCalibrationHitActive_DEAD' ),
461 ( 'CaloCalibrationHitContainer' , 'StoreGateSvc+LArCalibrationHitDeadMaterial_DEAD' ),
462 ( 'CaloCalibrationHitContainer' , 'StoreGateSvc+LArCalibrationHitInactive_DEAD' )
463 ]
464
465 return writtenContainers
466
467
469 dependencies = []
470 from SimulationConfig.SimEnums import LArParameterization
471 if flags.Sim.LArParameterization is LArParameterization.FastCaloSim:
472 dependencies+=[('CaloDetDescrManager', 'ConditionStore+CaloDetDescrManager'),
473 ('LArfSamplSym', 'ConditionStore+LArfSamplSym'),
474 ('TileSamplingFraction', 'ConditionStore+TileSamplingFraction')]
475 from MuonSensitiveDetectorsR4.SensitiveDetectorsCfg import MuonDependenciesCfg
476 dependencies += MuonDependenciesCfg(flags)
477 return dependencies
478
480 result = ComponentAccumulator()
481 tools = []
482 tools += result.popToolsAndMerge(EnvelopeSensitiveDetectorListCfg(flags))
483 tools += result.popToolsAndMerge(InDetSensitiveDetectorListCfg(flags))
484 tools += result.popToolsAndMerge(ITkSensitiveDetectorListCfg(flags))
485 tools += result.popToolsAndMerge(HGTDSensitiveDetectorListCfg(flags))
486 tools += result.popToolsAndMerge(CaloSensitiveDetectorListCfg(flags))
487 tools += result.popToolsAndMerge(MuonSensitiveDetectorListCfg(flags))
488 tools += result.popToolsAndMerge(TrackFastSimSensitiveDetectorListCfg(flags))
489 tools += result.popToolsAndMerge(FwdSensitiveDetectorListCfg(flags))
490 tools += result.popToolsAndMerge(CaloCellContainerSensitiveDetectorListCfg(flags))
491
492 result.setPrivateTools(tools)
493 return result
494
495
497 result = ComponentAccumulator()
498 tools = []
499
500 if flags.Detector.EnableTile:
501 if flags.Sim.CalibrationRun in [CalibrationRun.Tile, CalibrationRun.LArTile, CalibrationRun.LArTileZDC]:
502 from TileGeoG4Calib.TileGeoG4CalibConfig import TileCTBGeoG4CalibSDCfg
503 tools += [ result.popToolsAndMerge(TileCTBGeoG4CalibSDCfg(flags)) ] # mode 1 : With CaloCalibrationHits
504 else:
505 from TileGeoG4SD.TileGeoG4SDToolConfig import TileCTBGeoG4SDCfg
506 tools += [ result.popToolsAndMerge(TileCTBGeoG4SDCfg(flags)) ] # mode 0 : No CaloCalibrationHits
507 from MuonWall.MuonWallConfig import MuonWallSDCfg
508 tools += [ result.popToolsAndMerge(MuonWallSDCfg(flags)) ]
509 result.setPrivateTools(tools)
510 return result
511
512
514 result = ComponentAccumulator()
515 tools = []
516 if flags.Detector.EnablePixel:
517 from PixelG4_SD.PixelG4_SDToolConfig import PixelSensor_CTBCfg
518 tools += [ result.popToolsAndMerge(PixelSensor_CTBCfg(flags)) ]
519 if flags.Detector.EnableSCT:
520 from SCT_G4_SD.SCT_G4_SDToolConfig import SctSensor_CTBCfg
521 tools += [ result.popToolsAndMerge(SctSensor_CTBCfg(flags)) ]
522 if flags.Detector.EnableTRT:
523 from TRT_G4_SD.TRT_G4_SDToolConfig import TRTSensitiveDetector_CTBCfg
524 tools += [ result.popToolsAndMerge(TRTSensitiveDetector_CTBCfg(flags)) ]
525 if flags.Detector.EnableLAr:
526 from LArG4SD.LArG4SDToolConfig import LArEMBSensitiveDetectorCfg
527 tools += [ result.popToolsAndMerge(LArEMBSensitiveDetectorCfg(flags)) ]
528 if flags.Sim.CalibrationRun in [CalibrationRun.LAr, CalibrationRun.LArTile, CalibrationRun.LArTileZDC, CalibrationRun.DeadLAr]:
529 tools += [ 'LArH8CalibSensitiveDetector' ] # mode 1 : With CaloCalibrationHits
530 if flags.Detector.EnableTile:
531 if flags.Sim.CalibrationRun in [CalibrationRun.Tile, CalibrationRun.LArTile, CalibrationRun.LArTileZDC]:
532 from TileGeoG4Calib.TileGeoG4CalibConfig import TileCTBGeoG4CalibSDCfg
533 tools += [ result.popToolsAndMerge(TileCTBGeoG4CalibSDCfg(flags)) ] # mode 1 : With CaloCalibrationHits
534 else:
535 from TileGeoG4SD.TileGeoG4SDToolConfig import TileCTBGeoG4SDCfg
536 tools += [ result.popToolsAndMerge(TileCTBGeoG4SDCfg(flags)) ] # mode 0 : No CaloCalibrationHits
537 tools += [ 'MuonWallSD' ]
538 if flags.Detector.EnableMuon:
539 tools += [ 'MuonEntryRecord' ]
540 tools += result.popToolsAndMerge(MuonSensitiveDetectorListCfg(flags))
541
542 result.setPrivateTools(tools)
543 return result
544
545
546def SensitiveDetectorMasterToolCfg(flags, name="SensitiveDetectorMasterTool", **kwargs):
547 result = ComponentAccumulator()
548 # NB Currently only supporting the standard ATLAS dector and the Tile Test Beam
549 if flags.Beam.Type is BeamType.TestBeam:
550 kwargs.setdefault("SensitiveDetectors", result.popToolsAndMerge(TileTestBeamSensitiveDetectorListCfg(flags)))
551 elif "tb_LArH6" in flags.GeoModel.AtlasVersion:
552 pass
553 elif "ctbh8" in flags.GeoModel.AtlasVersion:
554 kwargs.setdefault("SensitiveDetectors", result.popToolsAndMerge(CombinedTestBeamSensitiveDetectorListCfg(flags)))
555 else:
556 kwargs.setdefault("SensitiveDetectors", result.popToolsAndMerge(SensitiveDetectorListCfg(flags)))
557
558 result.setPrivateTools(CompFactory.SensitiveDetectorMasterTool(name, **kwargs))
559 return result
560
561
562def EmptySensitiveDetectorMasterToolCfg(name="EmptySensitiveDetectorMasterTool", **kwargs):
563 result = ComponentAccumulator()
564 tool = result.popToolsAndMerge(CompFactory.SensitiveDetectorMasterTool(name, **kwargs))
565 result.setPrivateTools(tool)
566 return result
This tool creates a physics constructor to enable fast simulation for all particles.
TileTestBeamSensitiveDetectorListCfg(flags)
EmptySensitiveDetectorMasterToolCfg(name="EmptySensitiveDetectorMasterTool", **kwargs)
FastSimulationConstructorToolCfg(flags, **kwargs)
FastSimulationMasterToolCfg(flags, **kwargs)
CaloCellContainerSensitiveDetectorListCfg(flags)
G4CaloTransportToolCfg(flags, name='G4CaloTransportTool', **kwargs)
TrackFastSimSensitiveDetectorListCfg(flags)
SensitiveDetectorMasterToolCfg(flags, name="SensitiveDetectorMasterTool", **kwargs)
PunchThroughG4ToolCfg(flags, name='PunchThroughG4Tool', **kwargs)
PunchThroughG4ClassifierCfg(flags, name="PunchThroughG4Classifier", **kwargs)
PunchThroughSimWrapperCfg(flags, name='PunchThroughSimWrapper', **kwargs)
CombinedTestBeamSensitiveDetectorListCfg(flags)
ActsFatrasG4ToolCfg(flags, name="ActsFatrasG4Tool", **kwargs)
EmptyFastSimulationMasterToolCfg(flags, **kwargs)