ATLAS Offline Software
Loading...
Searching...
No Matches
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
6Run material validation for ACTS tracking geometry
7
8"""
9from AthenaCommon.Logging import log
10from argparse import ArgumentParser
11from AthenaConfiguration.AllConfigFlags import initConfigFlags
12
13# Argument parsing
14parser = ArgumentParser("RunActsMaterialValidation.py")
15parser.add_argument("detectors", metavar="detectors", type=str, nargs="*",
16 help="Specify the list of detectors")
17parser.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\"")
19parser.add_argument("--localgeo", default=False, action="store_true",
20 help="Use local geometry Xml files")
21parser.add_argument("-V", "--verboseAccumulators", default=False,
22 action="store_true",
23 help="Print full details of the AlgSequence")
24parser.add_argument("-S", "--verboseStoreGate", default=False,
25 action="store_true",
26 help="Dump the StoreGate(s) each event iteration")
27parser.add_argument("--maxEvents",default=10, type=int,
28 help="The number of events to run. 0 skips execution")
29parser.add_argument("--geometrytag",default="ATLAS-P2-RUN4-04-00-00", type=str,
30 help="The geometry tag to use")
31
32args = parser.parse_args()
33
34# Some info about the job
35print("----Material Validation for ACTS Tracking Geometry----")
36print()
37print("Using Geometry Tag: "+args.geometrytag)
38if args.localgeo:
39 print("...overridden by local Geometry Xml files")
40if not args.detectors:
41 print("Running complete detector")
42else:
43 print("Running with: {}".format(", ".join(args.detectors)))
44print()
45
46flags = initConfigFlags()
47
48flags.Input.isMC = True
49
50flags.Input.Files = []
51
52if args.localgeo:
53 flags.ITk.Geometry.AllLocal = True
54
55flags.GeoModel.AtlasVersion = args.geometrytag
56
57from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList
58detectors = args.detectors if 'detectors' in args and args.detectors else ['ITkPixel', 'ITkStrip', 'HGTD']
59detectors.append('Bpipe') # always run with beam pipe
60setupDetectorsFromList(flags, detectors, toggle_geometry=True)
61
62flags.IOVDb.GlobalTag = "OFLCOND-SIM-00-00-00"
63flags.GeoModel.Align.Dynamic = False
64flags.Acts.TrackingGeometry.MaterialSource = args.material
65if flags.Acts.TrackingGeometry.MaterialSource != "Default":
66 flags.Acts.TrackingGeometry.MaterialCalibrationFolder = "."
67
68flags.Detector.GeometryCalo = False
69flags.Detector.GeometryMuon = False
70
71# This should run serially for the moment.
72flags.Concurrency.NumThreads = 1
73flags.Concurrency.NumConcurrentEvents = 1
74
75log.debug('Lock config flags now.')
76flags.lock()
77
78from AthenaConfiguration.MainServicesConfig import MainServicesCfg
79cfg=MainServicesCfg(flags)
80
81
82if args.verboseAccumulators:
83 cfg.printConfig(withDetails=True)
84if args.verboseStoreGate:
85 cfg.getService("StoreGateSvc").Dump = True
86
87log.debug('Dumping of ConfigFlags now.')
88flags.dump()
89
90from ActsConfig.ActsGeometryConfig import ActsExtrapolationToolCfg
91extrapol = cfg.popToolsAndMerge(ActsExtrapolationToolCfg(flags,
92 "ActsExtrapolationTool",
93 InteractionMultiScatering = True,
94 InteractionEloss = True,
95 InteractionRecord = True))
96
97from ActsConfig.ActsGeometryConfig import ActsExtrapolationAlgCfg
98cfg.merge(ActsExtrapolationAlgCfg(flags,
99 "ActsExtrapolationAlg",
100 NParticlesPerEvent=int(1e4),
101 EtaRange=[-5, 5],
102 PtRange=[20, 100],
103 WriteMaterialTracks = True,
104 ExtrapolationTool=extrapol))
105
106from AthenaConfiguration.FPEAndCoreDumpConfig import FPEAndCoreDumpCfg
107cfg.merge(FPEAndCoreDumpCfg(flags))
108
109cfg.printConfig(withDetails = True, summariseProps = True)
110
111cfg.run(maxEvents=args.maxEvents)
112
113
114
void print(char *figname, TCanvas *c1)