4 Run geantino processing for material step creation
7 from argparse
import ArgumentParser
8 from AthenaCommon.Logging
import log
9 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
10 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
11 from AthenaConfiguration.ComponentFactory
import CompFactory
14 parser = ArgumentParser(
"RunGeantinoStepRecordingITk.py")
15 parser.add_argument(
"detectors", metavar=
"detectors", type=str, nargs=
"*",
16 help=
"Specify the list of detectors")
17 parser.add_argument(
"--simulate", default=
True, action=
"store_true",
18 help=
"Run Simulation")
19 parser.add_argument(
"--localgeo", default=
False, action=
"store_true",
20 help=
"Use local geometry Xml files")
21 parser.add_argument(
"-V",
"--verboseAccumulators", default=
False,
23 help=
"Print full details of the AlgSequence")
24 parser.add_argument(
"-S",
"--verboseStoreGate", default=
False,
26 help=
"Dump the StoreGate(s) each event iteration")
27 parser.add_argument(
"--maxEvents",default=10, type=int,
28 help=
"The number of events to run. 0 skips execution")
29 parser.add_argument(
"--skipEvents",default=0, type=int,
30 help=
"The number of events to skip")
31 parser.add_argument(
"--geometrytag",default=
"ATLAS-P2-RUN4-03-00-00", type=str,
32 help=
"The geometry tag to use")
33 parser.add_argument(
"--inputevntfile",
34 default=
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/EVNT/mc15_14TeV.singlegeantino_E10GeV_etaFlatnp0_6.5M.evgen.EVNT.pool.root",
35 help=
"The input EVNT file to use")
36 parser.add_argument(
"--outputhitsfile",default=
"myHITS.pool.root", type=str,
37 help=
"The output HITS filename")
38 args = parser.parse_args()
42 print(
"----GeantinoStepRecording for ITk geometry----")
44 print(
"Using Geometry Tag: "+args.geometrytag)
46 print(
"...overridden by local Geometry Xml files")
47 print(
"Input EVNT File:"+args.inputevntfile)
48 if not args.detectors:
49 print(
"Running complete detector")
57 flags.ITk.Geometry.AllLocal =
True
59 flags.Input.Files = [args.inputevntfile]
60 flags.Output.HITSFileName = args.outputhitsfile
62 flags.GeoModel.AtlasVersion = args.geometrytag
63 flags.IOVDb.GlobalTag =
"OFLCOND-SIM-00-00-00"
64 flags.GeoModel.Align.Dynamic =
False
66 flags.Exec.SkipEvents = args.skipEvents
68 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
69 detectors = args.detectors
if 'detectors' in args
and args.detectors
else [
'ITkPixel',
'ITkStrip',
'HGTD']
70 detectors.append(
'Bpipe')
73 log.debug(
'Lock config flags now.')
80 if args.verboseAccumulators:
81 acc.printConfig(withDetails=
True)
82 if args.verboseStoreGate:
83 acc.getService(
"StoreGateSvc").Dump =
True
85 log.debug(
'Dumping of ConfigFlags now.')
88 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
92 from BeamEffects.BeamEffectsAlgConfig
import BeamEffectsAlgCfg
95 beamcond = acc.getCondAlgo(
"BeamSpotCondAlg")
109 svcName =
"G4UA::MaterialStepRecorderUserActionSvc"
110 from TrkG4UserActions.TrkG4UserActionsConfig
import MaterialStepRecorderUserActionSvcCfg
112 kwargs.update(UserActionSvc=svcName)
115 from G4AtlasAlg.G4AtlasAlgConfig
import G4AtlasAlgCfg
117 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
118 from SimuJobTransforms.SimOutputConfig
import getStreamHITS_ItemList
122 AthenaOutputStream=CompFactory.AthenaOutputStream
123 AthenaOutputStreamTool=CompFactory.AthenaOutputStreamTool
127 WritingTool = writingTool,
128 ItemList=[
'EventInfo#*',
'Trk::MaterialStepCollection#*'],
129 MetadataItemList = [
"EventStreamInfo#MaterialStepCollectionStream",
"IOVMetaDataContainer#*" ],
130 OutputFile =
"MaterialStepCollection.root")
132 StoreGateSvc=CompFactory.StoreGateSvc
134 outputStream.MetadataStore = acc.getService(
"MetaDataStore")
136 MakeEventStreamInfo=CompFactory.MakeEventStreamInfo
138 streamInfoTool.Key =
"MaterialStepCollectionStream"
139 streamInfoTool.EventInfoKey =
"EventInfo"
140 outputStream.HelperTools.append(streamInfoTool)
142 acc.addEventAlgo(outputStream)
144 acc.printConfig(withDetails =
True, summariseProps =
True)
146 acc.run(maxEvents=args.maxEvents)