ATLAS Offline Software
RunMaterialValidationITk.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """
3 
4 Run material validation to check material maps for tracking geometry.
5 
6 """
7 
8 from AthenaCommon.Logging import log
9 from argparse import ArgumentParser
10 from AthenaConfiguration.AllConfigFlags import initConfigFlags
11 flags = initConfigFlags()
12 
13 # Argument parsing
14 parser = ArgumentParser("RunMaterialValidationITk.py")
15 parser.add_argument("detectors", metavar="detectors", type=str, nargs="*",
16  help="Specify the list of detectors")
17 parser.add_argument("--localgeo", default=False, action="store_true",
18  help="Use local geometry Xml files")
19 parser.add_argument("-V", "--verboseAccumulators", default=False,
20  action="store_true",
21  help="Print full details of the AlgSequence")
22 parser.add_argument("-S", "--verboseStoreGate", default=False,
23  action="store_true",
24  help="Dump the StoreGate(s) each event iteration")
25 parser.add_argument("--maxEvents",default=10, type=int,
26  help="The number of events to run. 0 skips execution")
27 parser.add_argument("--geometrytag",default="ATLAS-P2-RUN4-03-00-00", type=str,
28  help="The geometry tag to use")
29 parser.add_argument("--noLocalMaterial", action="store_true", default=False,
30  help="Do NOT use local material maps")
31 args = parser.parse_args()
32 
33 # Some info about the job
34 print("----MaterialValidation for ITk geometry----")
35 print()
36 print("Using Geometry Tag: "+args.geometrytag)
37 if args.localgeo:
38  print("...overridden by local Geometry Xml files")
39 print()
40 
41 flags.Input.isMC = True
42 flags.Input.Files = []
43 
44 if args.localgeo:
45  flags.ITk.Geometry.AllLocal = True
46 
47 from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
48 detectors = args.detectors if 'detectors' in args and args.detectors else ['ITkPixel', 'ITkStrip', 'HGTD']
49 detectors.append('Bpipe') # always run with beam pipe
50 setupDetectorFlags(flags, detectors, toggle_geometry=True)
51 
52 flags.GeoModel.AtlasVersion = args.geometrytag
53 flags.IOVDb.GlobalTag = "OFLCOND-SIM-00-00-00"
54 flags.GeoModel.Align.Dynamic = False
55 flags.TrackingGeometry.MaterialSource = "COOL"
56 
57 flags.Detector.GeometryCalo = False
58 flags.Detector.GeometryMuon = False
59 
60 # This should run serially for the moment.
61 flags.Concurrency.NumThreads = 1
62 flags.Concurrency.NumConcurrentEvents = 1
63 
64 if not args.noLocalMaterial:
65  flags.ITk.trackingGeometry.loadLocalDbForMaterialMaps=True
66  LocalDataBaseName = flags.ITk.trackingGeometry.localDatabaseName
67  flags.IOVDb.DBConnection='sqlite://;schema='+LocalDataBaseName+';dbname=OFLP200'
68 
69 log.debug('Lock config flags now.')
70 flags.lock()
71 
72 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
73 cfg=MainServicesCfg(flags)
74 
75 
76 if args.verboseAccumulators:
77  cfg.printConfig(withDetails=True)
78 if args.verboseStoreGate:
79  cfg.getService("StoreGateSvc").Dump = True
80 
81 log.debug('Dumping of flags now.')
82 flags.dump()
83 
84 from TrkDetDescrAlgs.TrkDetDescrAlgsConfig import MaterialValidationCfg
85 cfg.merge(MaterialValidationCfg(flags))
86 
87 cfg.printConfig(withDetails = True, summariseProps = True)
88 
89 
90 cfg.run(maxEvents=args.maxEvents)
91 
TrkDetDescrAlgsConfig.MaterialValidationCfg
def MaterialValidationCfg(flags, name="MaterialValidation", **kwargs)
Definition: TrkDetDescrAlgsConfig.py:73
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:286
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28