ATLAS Offline Software
RunActsMaterialValidation.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 #!/usr/bin/env python
4 """
5 
6 Dump ACTS tracking geometry.
7 
8 """
9 from AthenaCommon.Logging import log
10 from argparse import ArgumentParser
11 from AthenaConfiguration.AllConfigFlags import initConfigFlags
12 
13 # Argument parsing
14 parser = ArgumentParser("RunActsMaterialValidation.py")
15 parser.add_argument("detectors", metavar="detectors", type=str, nargs="*",
16  help="Specify the list of detectors")
17 parser.add_argument("-M", "--material", required=True, type=str,
18  help="The geometry file material source. It can be \"Default\", a path to a local JSON file or \"None\"")
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,
22  action="store_true",
23  help="Print full details of the AlgSequence")
24 parser.add_argument("-S", "--verboseStoreGate", default=False,
25  action="store_true",
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("--geometrytag",default="ATLAS-P2-RUN4-03-00-00", type=str,
30  help="The geometry tag to use")
31 
32 args = parser.parse_args()
33 
34 # Some info about the job
35 print("----Material Validation for ACTS Tracking Geometry----")
36 print()
37 print("Using Geometry Tag: "+args.geometrytag)
38 if args.localgeo:
39  print("...overridden by local Geometry Xml files")
40 if not args.detectors:
41  print("Running complete detector")
42 else:
43  print("Running with: {}".format(", ".join(args.detectors)))
44 print()
45 
46 flags = initConfigFlags()
47 
48 flags.Input.isMC = True
49 
50 flags.Input.Files = []
51 
52 if args.localgeo:
53  flags.ITk.Geometry.AllLocal = True
54 
55 from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList
56 detectors = args.detectors if 'detectors' in args and args.detectors else ['ITkPixel', 'ITkStrip']
57 detectors.append('Bpipe') # always run with beam pipe
58 setupDetectorsFromList(flags, detectors, toggle_geometry=True)
59 
60 flags.GeoModel.AtlasVersion = args.geometrytag
61 flags.IOVDb.GlobalTag = "OFLCOND-SIM-00-00-00"
62 flags.GeoModel.Align.Dynamic = False
63 flags.Acts.TrackingGeometry.MaterialSource = args.material
64 if flags.Acts.TrackingGeometry.MaterialSource != "Default":
65  flags.Acts.TrackingGeometry.MaterialCalibrationFolder = "."
66 
67 flags.Detector.GeometryCalo = False
68 flags.Detector.GeometryMuon = False
69 
70 # This should run serially for the moment.
71 flags.Concurrency.NumThreads = 1
72 flags.Concurrency.NumConcurrentEvents = 1
73 
74 log.debug('Lock config flags now.')
75 flags.lock()
76 
77 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
78 cfg=MainServicesCfg(flags)
79 
80 
81 if args.verboseAccumulators:
82  cfg.printConfig(withDetails=True)
83 if args.verboseStoreGate:
84  cfg.getService("StoreGateSvc").Dump = True
85 
86 log.debug('Dumping of ConfigFlags now.')
87 flags.dump()
88 
89 from ActsConfig.ActsGeometryConfig import ActsExtrapolationToolCfg
90 extrapol = cfg.popToolsAndMerge(ActsExtrapolationToolCfg(flags,
91  "ActsExtrapolationTool",
92  InteractionMultiScatering = True,
93  InteractionEloss = True,
94  InteractionRecord = True))
95 
96 from ActsConfig.ActsGeometryConfig import ActsExtrapolationAlgCfg
97 cfg.merge(ActsExtrapolationAlgCfg(flags,
98  "ActsExtrapolationAlg",
99  NParticlesPerEvent=int(1e4),
100  EtaRange=[-5, 5],
101  PtRange=[20, 100],
102  WriteMaterialTracks = True,
103  ExtrapolationTool=extrapol))
104 
105 from AthenaConfiguration.FPEAndCoreDumpConfig import FPEAndCoreDumpCfg
106 cfg.merge(FPEAndCoreDumpCfg(flags))
107 
108 cfg.printConfig(withDetails = True, summariseProps = True)
109 
110 cfg.run(maxEvents=args.maxEvents)
111 
112 
113 
vtune_athena.format
format
Definition: vtune_athena.py:14
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.FPEAndCoreDumpConfig.FPEAndCoreDumpCfg
def FPEAndCoreDumpCfg(flags)
Definition: FPEAndCoreDumpConfig.py:11
python.DetectorConfigFlags.setupDetectorsFromList
def setupDetectorsFromList(flags, detectors, toggle_geometry=False, validate_only=False)
Definition: DetectorConfigFlags.py:354
ActsGeometryConfig.ActsExtrapolationAlgCfg
ComponentAccumulator ActsExtrapolationAlgCfg(flags, str name="ActsExtrapolationAlg", **kwargs)
Definition: ActsGeometryConfig.py:171
ActsGeometryConfig.ActsExtrapolationToolCfg
ComponentAccumulator ActsExtrapolationToolCfg(flags, str name="ActsExtrapolationTool", **kwargs)
Definition: ActsGeometryConfig.py:109
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70