4Run geantino processing for material track creation
8from AthenaCommon.Logging
import log
9from AthenaConfiguration.AllConfigFlags
import initConfigFlags
10from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
15 from argparse
import ArgumentParser
16 parser = ArgumentParser(
"RunGeantinoMaterialTrackProduction.py")
17 parser.add_argument(
"--detectors", nargs=
"+",
18 default=[
'ITkPixel',
'ITkStrip',
'Bpipe'],
19 help=
"Specify the list of detectors")
20 parser.add_argument(
"--localgeo", default=
False, action=
"store_true",
21 help=
"Use local geometry Xml files")
22 parser.add_argument(
"--storeHITS", help=
"Store the G4 hits",
23 default =
False, action =
"store_true")
24 parser.add_argument(
"--geoModelSqLiteFile", default =
"", help=
"Read geometry from sqlite file")
25 parser.add_argument(
"-S",
"--verboseStoreGate", default=
False,
27 help=
"Dump the StoreGate(s) each event iteration")
28 parser.add_argument(
"--maxEvents",default=-1, type = int,
29 help=
"The number of events to run. 0 skips execution")
30 parser.add_argument(
"--skipEvents",default=0, type=int,
31 help=
"The number of events to skip")
32 parser.add_argument(
"--threads", default=1, type=int, help=
"The number of threads to run")
33 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
34 parser.add_argument(
"--geometrytag",default=defaultGeometryTags.RUN4, type=str,
35 help=
"The geometry tag to use")
36 parser.add_argument(
"--inputevntfile",
37 default=[
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/EVNT/mc15_14TeV.singlegeantino_E10GeV_etaFlatnp0_6.5M.evgen.EVNT.pool.root"],
39 help=
"The input EVNT file to use")
40 parser.add_argument(
"--outputhitsfile",default=
"myHITS.pool.root", type=str,
41 help=
"The output HITS filename")
42 parser.add_argument(
"--outputfile",default=
"material-tracks.root", type=str,
43 help=
"The output Geantino filename")
46if __name__ ==
"__main__":
49 print(
"----RunGeantinoMaterialTrackProduction for ITk geometry----")
51 print(
"Using Geometry Tag: "+args.geometrytag)
53 print(
"...overridden by local Geometry Xml files")
54 if(args.geoModelSqLiteFile):
55 print(
"... overridden by Geometry Sqlite file: "+args.geoModelSqLiteFile)
56 print(
"Input EVNT Files ")
57 for f
in args.inputevntfile:
60 print(
"Running with: {}".format(
", ".join(args.detectors)))
64 flags = initConfigFlags()
66 flags.ITk.Geometry.AllLocal =
True
68 flags.Input.Files = args.inputevntfile
69 flags.Output.HITSFileName = args.outputhitsfile
70 flags.Concurrency.NumThreads = args.threads
71 flags.Concurrency.NumConcurrentEvents = args.threads
72 flags.Exec.MaxEvents = args.maxEvents
73 flags.Exec.SkipEvents = args.skipEvents
74 flags.Scheduler.CheckDependencies =
True
75 flags.Scheduler.ShowDataDeps =
True
76 flags.Scheduler.ShowDataFlow =
True
77 flags.Scheduler.ShowControlFlow =
True
78 flags.Scheduler.EnableVerboseViews =
True
79 flags.Scheduler.AutoLoadUnmetDependencies =
True
80 from SimulationConfig.SimEnums
import SimulationFlavour
81 flags.Sim.ISF.Simulator = SimulationFlavour.AtlasG4
84 flags.GeoModel.AtlasVersion = args.geometrytag
85 flags.IOVDb.GlobalTag =
"OFLCOND-SIM-00-00-00"
86 flags.GeoModel.Align.Dynamic =
False
88 from AthenaConfiguration.DetectorConfigFlags
import getEnabledDetectors, setupDetectorFlags
89 from AthenaConfiguration.AutoConfigFlags
import getDefaultDetectors
92 if args.geoModelSqLiteFile:
93 flags.GeoModel.SQLiteDB =
True
94 flags.GeoModel.SQLiteDBFullPath = args.geoModelSqLiteFile
95 from MuonConfig.MuonConfigUtils
import configureCondTag
96 configureCondTag(flags)
97 if "toroid" in args.detectors:
98 flags.Detector.GeometryMDT =
False
99 flags.Detector.GeometryRPC =
False
100 flags.Detector.GeometryTGC =
False
101 flags.Detector.GeometrysTGC =
False
102 flags.Detector.GeometryMM =
False
103 flags.Detector.GeometryBpipe =
False
104 flags.Detector.SpecialGeometryToroid =
True
106 detectors = args.detectors
107 detectors.append(
'Bpipe')
108 setupDetectorFlags(flags, detectors, toggle_geometry=
True)
110 flags.Acts.TrackingGeometry.UseBlueprint =
True
113 log.debug(
'Lock config flags now.')
115 print (
" ***\n ".join(getEnabledDetectors(flags)))
117 print(flags.dump(evaluate=
True))
120 acc = MainServicesCfg(flags)
122 if args.verboseStoreGate:
123 acc.getService(
"StoreGateSvc").Dump =
True
125 log.debug(
'Dumping of ConfigFlags now.')
128 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
129 acc.merge(PoolReadCfg(flags))
132 from BeamEffects.BeamEffectsAlgConfig
import BeamEffectsAlgCfg
133 acc.merge(BeamEffectsAlgCfg(flags))
135 beamcond = acc.getCondAlgo(
"BeamSpotCondAlg")
148 from ActsConfig.ActsMaterialConfig
import MaterialTrackRecorderUserActionSvcCfg
149 from G4AtlasAlg.G4AtlasAlgConfig
import G4AtlasAlgCfg
150 acc.merge(G4AtlasAlgCfg(flags,
"ITkG4AtlasAlg",
151 ExtraOutputs=[(
"ActsTrk::RecordedMaterialTrackCollection",
"StoreGateSvc+OutputMaterialTracks")],
152 UserActionSvc = acc.getPrimaryAndMerge(MaterialTrackRecorderUserActionSvcCfg(flags))))
154 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
155 from SimuJobTransforms.SimOutputConfig
import getStreamHITS_ItemList
156 acc.merge(OutputStreamCfg(flags,
"HITS", ItemList=getStreamHITS_ItemList(flags),
157 disableEventTag=
True, AcceptAlgs=[
'ITkG4AtlasAlg']) )
160 from ActsConfig.ActsMaterialConfig
import MaterialTrackWriterCfg
161 acc.merge(MaterialTrackWriterCfg(flags, useTrackingGeometry=
False, FileName=args.outputfile))
163 from MuonConfig.MuonConfigUtils
import executeTest
void print(char *figname, TCanvas *c1)