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