2 """Run PrintSiDetectorElements
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
7 from argparse
import ArgumentParser
9 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
10 from AthenaConfiguration.TestDefaults
import defaultConditionsTags
13 parser = ArgumentParser(
"PrintSiDetectorElements.py")
14 parser.add_argument(
"detectors", metavar=
"detectors", type=str, nargs=
"*",
15 help=
"Specify the list of detectors")
16 parser.add_argument(
"--localgeo", default=
False, action=
"store_true",
17 help=
"Use local geometry XML files")
18 parser.add_argument(
"--geometrytag",default=
"ATLAS-P2-RUN4-03-00-00", type=str,
19 help=
"The geometry tag to use")
20 parser.add_argument(
"--sqlitefile",default=
"", type=str,
21 help=
"SQLite input file to use")
22 args = parser.parse_args()
26 print(
"----PrintSiDetectorElements----")
29 print(
"Using local Geometry XML files")
30 if not args.detectors:
31 print(
"Running complete detector")
38 flags.Concurrency.NumThreads = 1
39 if flags.Concurrency.NumThreads > 0:
40 flags.Scheduler.ShowDataDeps =
True
41 flags.Scheduler.ShowDataFlow =
True
42 flags.Scheduler.ShowControlFlow =
True
44 flags.GeoModel.Align.Dynamic =
False
45 flags.GeoModel.AtlasVersion = args.geometrytag
46 flags.Input.isMC =
True
47 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN4_MC
48 flags.Input.Files = []
51 flags.ITk.Geometry.AllLocal =
True
54 print(
"Using SQLite input")
55 flags.GeoModel.SQLiteDB =
True
56 flags.GeoModel.SQLiteDBFullPath = args.sqlitefile
58 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
64 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
66 from AthenaConfiguration.ComponentFactory
import CompFactory
69 if flags.Detector.EnableITkPixel:
70 from PixelGeoModelXml.ITkPixelGeoModelConfig
import ITkPixelReadoutGeometryCfg
73 ReadPixelDetElements = CompFactory.ReadSiDetectorElements(
'ReadPixelDetElements')
74 ReadPixelDetElements.ManagerName =
"ITkPixel"
75 ReadPixelDetElements.DetEleCollKey =
"ITkPixelDetectorElementCollection"
76 ReadPixelDetElements.UseConditionsTools =
False
77 acc.addEventAlgo(ReadPixelDetElements)
79 PrintPixelDetElements = CompFactory.PrintSiElements(
'PrintPixelDetElements')
80 PrintPixelDetElements.OutputLevel = 5
81 PrintPixelDetElements.DetectorManagerNames = [
"ITkPixel"]
82 PrintPixelDetElements.OutputFile =
"PixelGeometry.dat"
83 acc.addEventAlgo(PrintPixelDetElements)
87 if flags.Detector.EnableITkStrip:
88 from StripGeoModelXml.ITkStripGeoModelConfig
import ITkStripReadoutGeometryCfg
91 ReadStripDetElements = CompFactory.ReadSiDetectorElements(
'ReadStripDetElements')
92 ReadStripDetElements.ManagerName =
"ITkStrip"
93 ReadStripDetElements.DetEleCollKey =
"ITkStripDetectorElementCollection"
94 ReadStripDetElements.UseConditionsTools =
False
95 acc.addEventAlgo(ReadStripDetElements)
97 PrintStripDetElements = CompFactory.PrintSiElements(
'PrintStripDetElements')
98 PrintStripDetElements.OutputLevel = 5
99 PrintStripDetElements.DetectorManagerNames = [
"ITkStrip"]
100 PrintStripDetElements.ModulesOnly =
False
101 PrintStripDetElements.OutputFile =
"StripGeometry.dat"
102 acc.addEventAlgo(PrintStripDetElements)
105 sc = acc.run(maxEvents=1)
108 sys.exit(
not sc.isSuccess())