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")
29parser.add_argument("--geometrytag",default="ATLAS-P2-RUN4-03-00-00", type=str,
30 help="The geometry tag to use")
31# parser.add_argument("--inputMaterial",
32# required=True, type=str,
33# help="Input material maps produced in the material mapping process.")
34args = parser.parse_args()
35
36
37# Some info about the job
38print("----RunMaterialValidation for ITk geometry----")
39print()
40print("Using Geometry Tag: "+args.geometrytag)
41if args.localgeo:
42 print("...overridden by local Geometry Xml files")
43if not args.detectors:
44 print("Running complete detector")
45else:
46 print("Running with: {}".format(", ".join(args.detectors)))
47print()
48
49# Configure
50flags = initConfigFlags()
51if args.localgeo:
52 flags.ITk.Geometry.AllLocal = True
53
54flags.Input.Files = []
55flags.Input.isMC=True
56flags.GeoModel.AtlasVersion = args.geometrytag
57flags.IOVDb.GlobalTag = "OFLCOND-SIM-00-00-00"
58flags.GeoModel.Align.Dynamic = False
59
60# This should run serially
61flags.Concurrency.NumThreads = 1
62flags.Concurrency.NumConcurrentEvents = 1
63
64from AthenaConfiguration.DetectorConfigFlags import getEnabledDetectors, setupDetectorFlags
65from AthenaConfiguration.AutoConfigFlags import getDefaultDetectors
66
67if args.geoModelSqLiteFile:
68 flags.GeoModel.SQLiteDB = True
69 flags.GeoModel.SQLiteDBFullPath = args.geoModelSqLiteFile
70 # hack to set Run4 for running on muon dead material geometry
71 from AthenaConfiguration.Enums import LHCPeriod
72 flags.GeoModel.Run = LHCPeriod.Run4
73else:
74 defaultDetectors = ['ITkPixel', 'ITkStrip']
75 detectors = args.detectors if 'detectors' in args and args.detectors else defaultDetectors
76 detectors.append('Bpipe') # always run with beam pipe
77 setupDetectorFlags(flags, detectors, toggle_geometry=True)
78
79flags.Acts.TrackingGeometry.UseBlueprint = True
80
81flags.Exec.SkipEvents = args.skipEvents
82
83log.debug('Lock config flags now.')
84flags.lock()
85
86# Construct our accumulator to run
87acc = MainServicesCfg(flags)
88
89
90if args.verboseAccumulators:
91 acc.printConfig(withDetails=True)
92if args.verboseStoreGate:
93 acc.getService("StoreGateSvc").Dump = True
94
95log.debug('Dumping of ConfigFlags now.')
96flags.dump()
97
98from ActsConfig.ActsMaterialConfig import MaterialValidationCfg
99acc.merge(MaterialValidationCfg(flags))
100
101from ActsConfig.ActsMaterialConfig import MaterialTrackWriterCfg
102acc.merge(MaterialTrackWriterCfg(flags, FileName="material-tracks-validation.root",
103 MaterialTrackCollectionKey="OutputMaterialTracks"))
104
105acc.printConfig(withDetails = True, summariseProps = True)
106
107acc.run(maxEvents=args.maxEvents)
108
109
110
void print(char *figname, TCanvas *c1)