12 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
13 from AthenaConfiguration.ComponentFactory
import CompFactory
18 from argparse
import ArgumentParser
19 parser = ArgumentParser()
20 parser.add_argument(
"--inputEVNTFile",
21 default=
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root",
23 help=
"The input EVNT file to use")
24 parser.add_argument(
"--outputHITSFile",
25 default=
"myHITS.pool.root",
27 help=
"The output HITS filename")
28 parser.add_argument(
"--geometryTag",
29 default=
"ATLAS-R3S-2021-03-02-00",
31 help=
"The geometry tag to use")
32 parser.add_argument(
"--globalTag",
33 default=
"OFLCOND-MC21-SDR-RUN3-09",
35 help=
"The global tag to use")
36 parser.add_argument(
"--myPDG",
39 help=
"PDG for particle gun sim. 998 = Charged Geantino 999 = neutral Geantino, 13 = Muon")
40 parser.add_argument(
"--maxEvents",
43 help=
"Maximum number of events to run on.")
44 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int , default =0)
51 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
53 acc.getService(
"MessageSvc").debugLimit = 1000000
55 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
58 from BeamSpotConditions.BeamSpotConditionsConfig
import BeamSpotCondAlgCfg
61 from BeamEffects.BeamEffectsAlgConfig
import BeamEffectsAlgCfg
64 from BeamPipeGeoModel.BeamPipeGMConfig
import BeamPipeGeometryCfg
67 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
70 from TrkConfig.AtlasTrackingGeometrySvcConfig
import TrackingGeometrySvcCfg
80 LayerMaterialInspector = CompFactory.Trk.LayerMaterialInspector(
"LayerMaterialInspector",
82 acc.addPublicTool(LayerMaterialInspector)
85 from TrkDetDescrSvc.TrkDetDescrJobProperties
import TrkDetFlags
86 TrackingVolumeDisplayer = CompFactory.Trk.TrackingVolumeDisplayer(
"TrackingVolumeDisplayer",
87 TrackingVolumeOutputFile=
'TrackingVolumes-'+TrkDetFlags.MaterialMagicTag()+
'.C',
88 LayerOutputFile=
'Layers-'+TrkDetFlags.MaterialMagicTag()+
'.C',
89 SurfaceOutputFile=
'Surfaces-'+TrkDetFlags.MaterialMagicTag()+
'.C')
90 acc.addPublicTool(TrackingVolumeDisplayer)
94 TestPropagator = CompFactory.Trk.RungeKuttaPropagator(
"TestPropagator")
95 acc.addPublicTool(TestPropagator)
96 TestPropagators += [TestPropagator]
98 from TrkConfig.TrkExSTEP_PropagatorConfig
import AtlasSTEP_PropagatorCfg
99 TestSTEP_Propagator = acc.popToolsAndMerge(
AtlasSTEP_PropagatorCfg(flags, name=
"TestSTEP_Propagator", DetailedEloss=
True))
100 TestPropagators += [TestSTEP_Propagator]
102 TestSTEP_Propagator.Straggling =
False
104 if args.myPDG == 998 :
105 TestSTEP_Propagator.MultipleScattering =
False
106 TestSTEP_Propagator.EnergyLoss =
False
111 TestMaterialEffectsUpdator = CompFactory.Trk.MaterialEffectsUpdator(
"TestMaterialEffectsUpdator")
112 acc.addPublicTool(TestMaterialEffectsUpdator)
113 if args.myPDG == 998 :
114 TestMaterialEffectsUpdator.EnergyLoss =
False
115 TestMaterialEffectsUpdator.MultipleScattering =
False
117 TestUpdators += [TestMaterialEffectsUpdator]
119 TestMaterialEffectsUpdatorLandau = CompFactory.Trk.MaterialEffectsUpdator(
"TestMaterialEffectsUpdatorLandau",
121 acc.addPublicTool(TestMaterialEffectsUpdatorLandau)
123 if args.myPDG == 998 :
124 TestMaterialEffectsUpdatorLandau.EnergyLoss =
False
125 TestMaterialEffectsUpdatorLandau.MultipleScattering =
False
130 TestNavigator = CompFactory.Trk.Navigator(
"TestNavigator",
131 TrackingGeometrySvc=
"Trk::TrackingGeometrySvc/AtlasTrackingGeometrySvc")
132 acc.addPublicTool(TestNavigator)
136 TestSubPropagators = []
141 TestSubPropagators += [ TestPropagator.name ]
142 TestSubUpdators += [ TestMaterialEffectsUpdator.name ]
145 TestSubPropagators += [ TestPropagator.name ]
146 TestSubUpdators += [ TestMaterialEffectsUpdator.name ]
149 TestSubPropagators += [ TestPropagator.name ]
150 TestSubUpdators += [ TestMaterialEffectsUpdator.name ]
153 TestSubPropagators += [ TestSTEP_Propagator.name ]
155 TestSubUpdators += [ TestMaterialEffectsUpdator.name ]
158 TestSubPropagators += [ TestSTEP_Propagator.name ]
159 TestSubUpdators += [ TestMaterialEffectsUpdator.name ]
162 TestSubPropagators += [ TestPropagator.name ]
163 TestSubUpdators += [ TestMaterialEffectsUpdator.name ]
166 AtlasEnergyLossUpdator = CompFactory.Trk.EnergyLossUpdator(
"AtlasEnergyLossUpdator",
168 acc.addPublicTool(AtlasEnergyLossUpdator)
177 TestExtrapolator = CompFactory.Trk.Extrapolator(
"TestExtrapolator",
178 Navigator = TestNavigator,
179 MaterialEffectsUpdators = TestUpdators,
180 STEP_Propagator = TestSTEP_Propagator.name,
181 Propagators = TestPropagators,
182 SubPropagators = TestSubPropagators,
183 SubMEUpdators = TestSubUpdators,
184 EnergyLossUpdater = AtlasEnergyLossUpdator
186 acc.addPublicTool(TestExtrapolator, primary=
True)
198 result.addPublicTool(extrapolator)
201 followingHelper = CompFactory.Trk.GeantFollowerMSHelper(
"GeantFollowerMSHelper",
202 Extrapolator= extrapolator,
203 ExtrapolateDirectly=
False,
204 ExtrapolateIncrementally=
False,
208 result.addPublicTool(followingHelper, primary =
True)
211 from G4AtlasServices.G4AtlasUserActionConfig
import getDefaultActions
212 kwargs.setdefault(
"UserActionTools", result.popToolsAndMerge(
getDefaultActions(flags)))
213 result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs))
217 if __name__ ==
"__main__":
218 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
223 flags.Input.Files = [args.inputEVNTFile]
224 flags.Output.HITSFileName = args.outputHITSFile
225 flags.GeoModel.AtlasVersion = args.geometryTag
226 flags.IOVDb.GlobalTag = args.globalTag
227 flags.Input.isMC =
True
228 flags.GeoModel.Align.Dynamic =
False
229 flags.Concurrency.NumThreads =1
230 flags.Concurrency.NumConcurrentEvents = 1
231 flags.Exec.SkipEvents = args.skipEvents
232 from AthenaConfiguration.Enums
import ProductionStep
233 flags.Common.ProductionStep = ProductionStep.FastChain
234 flags.LAr.doAlign =
True
235 flags.Sim.TightMuonStepping =
True
238 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorsFromList
239 detectors = [
"Muon",
"ID",
"Bpipe",
"Calo"]
243 flags.dump(evaluate =
True)
251 from TrkG4UserActions.TrkG4UserActionsConfig
import GeantFollowerMSToolCfg
255 from G4AtlasAlg.G4AtlasAlgConfig
import G4AtlasAlgCfg
257 ExtraInputs={(
'Trk::TrackingGeometry' ,
'ConditionStore+AtlasTrackingGeometry'),
258 (
'AtlasFieldCacheCondObj' ,
'ConditionStore+fieldCondObj' )}))
261 acc.printConfig(withDetails=
True)
262 if not acc.run(maxEvents=args.maxEvents).isSuccess():