ATLAS Offline Software
Loading...
Searching...
No Matches
RunMaterialValidation.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3"""
4Run material validation
5"""
6
7from argparse import ArgumentParser
8from AthenaCommon.Logging import log
9from AthenaConfiguration.AllConfigFlags import initConfigFlags
10from AthenaConfiguration.MainServicesConfig import MainServicesCfg
11
12# Argument parsing
13parser = ArgumentParser("RunMaterialValidation.py")
14parser.add_argument("detectors", metavar="detectors", type=str, nargs="*",
15 help="Specify the list of detectors")
16parser.add_argument("--localgeo", default=False, action="store_true",
17 help="Use local geometry Xml files")
18parser.add_argument("--geoModelSqLiteFile", default = "", help="Read geometry from sqlite file")
19parser.add_argument("-V", "--verboseAccumulators", default=False,
20 action="store_true",
21 help="Print full details of the AlgSequence")
22parser.add_argument("-S", "--verboseStoreGate", default=False,
23 action="store_true",
24 help="Dump the StoreGate(s) each event iteration")
25parser.add_argument("--maxEvents",default=10, type=int,
26 help="The number of events to run. 0 skips execution")
27parser.add_argument("--skipEvents",default=0, type=int,
28 help="The number of events to skip")
29from AthenaConfiguration.TestDefaults import defaultGeometryTags
30parser.add_argument("--geometrytag",default=defaultGeometryTags.RUN4, type=str,
31 help="The geometry tag to use")
32parser.add_argument("--inputMaterial",
33 required=True, type=str,
34 help="Input material maps produced in the material mapping process.")
35args = parser.parse_args()
36
37
38# Some info about the job
39print("----RunMaterialValidation for ITk geometry----")
40print()
41print("Using Geometry Tag: "+args.geometrytag)
42if args.localgeo:
43 print("...overridden by local Geometry Xml files")
44if not args.detectors:
45 print("Running complete detector")
46else:
47 print("Running with: {}".format(", ".join(args.detectors)))
48print()
49
50# Configure
51flags = initConfigFlags()
52if args.localgeo:
53 flags.ITk.Geometry.AllLocal = True
54
55flags.Input.Files = []
56flags.Input.isMC=True
57flags.GeoModel.AtlasVersion = args.geometrytag
58from AthenaConfiguration.TestDefaults import defaultConditionsTags
59flags.IOVDb.GlobalTag = defaultConditionsTags.RUN4_MC
60flags.GeoModel.Align.Dynamic = False
61
62
63# This should run serially
64flags.Concurrency.NumThreads = 1
65flags.Concurrency.NumConcurrentEvents = 1
66
67from AthenaConfiguration.DetectorConfigFlags import getEnabledDetectors, setupDetectorFlags
68from AthenaConfiguration.AutoConfigFlags import getDefaultDetectors
69
70if args.geoModelSqLiteFile:
71 flags.GeoModel.SQLiteDB = True
72 flags.GeoModel.SQLiteDBFullPath = args.geoModelSqLiteFile
73 # hack to set Run4 for running on muon dead material geometry
74 from AthenaConfiguration.Enums import LHCPeriod
75 flags.GeoModel.Run = LHCPeriod.Run4
76else:
77 defaultDetectors = ['ITkPixel', 'ITkStrip', 'HGTD']
78 detectors = args.detectors if 'detectors' in args and args.detectors else defaultDetectors
79 detectors.append('Bpipe') # always run with beam pipe
80 setupDetectorFlags(flags, detectors, toggle_geometry=True)
81
82flags.Acts.TrackingGeometry.UseBlueprint = True
83flags.Acts.TrackingGeometry.ITkHgtdMaterialMapPath = "."
84flags.Acts.TrackingGeometry.ITkHgtdMaterialSource = args.inputMaterial
85
86flags.Exec.SkipEvents = args.skipEvents
87
88log.debug('Lock config flags now.')
89flags.lock()
90
91# Construct our accumulator to run
92acc = MainServicesCfg(flags)
93
94
95if args.verboseAccumulators:
96 acc.printConfig(withDetails=True)
97if args.verboseStoreGate:
98 acc.getService("StoreGateSvc").Dump = True
99
100log.debug('Dumping of ConfigFlags now.')
101flags.dump()
102
103from ActsConfig.ActsMaterialConfig import MaterialValidationCfg
104acc.merge(MaterialValidationCfg(flags,
105 StoreTracks=True,
106 MaterialTrackCollectionKey="OutputMaterialTracks"))
107
108acc.printConfig(withDetails = True, summariseProps = True)
109
110acc.run(maxEvents=args.maxEvents)
111
112
113
void print(char *figname, TCanvas *c1)