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 from AtlasGeoModel
import CommonGeoDB
57 CommonGeoDB.SetupLocalSqliteGeometryDb(args.sqlitefile,args.geometrytag)
59 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
65 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
67 from AthenaConfiguration.ComponentFactory
import CompFactory
70 if flags.Detector.EnableITkPixel:
71 from PixelGeoModelXml.ITkPixelGeoModelConfig
import ITkPixelReadoutGeometryCfg
74 ReadPixelDetElements = CompFactory.ReadSiDetectorElements(
'ReadPixelDetElements')
75 ReadPixelDetElements.ManagerName =
"ITkPixel"
76 ReadPixelDetElements.DetEleCollKey =
"ITkPixelDetectorElementCollection"
77 ReadPixelDetElements.UseConditionsTools =
False
78 acc.addEventAlgo(ReadPixelDetElements)
80 PrintPixelDetElements = CompFactory.PrintSiElements(
'PrintPixelDetElements')
81 PrintPixelDetElements.OutputLevel = 5
82 PrintPixelDetElements.DetectorManagerNames = [
"ITkPixel"]
83 PrintPixelDetElements.OutputFile =
"PixelGeometry.dat"
84 acc.addEventAlgo(PrintPixelDetElements)
88 if flags.Detector.EnableITkStrip:
89 from StripGeoModelXml.ITkStripGeoModelConfig
import ITkStripReadoutGeometryCfg
92 ReadStripDetElements = CompFactory.ReadSiDetectorElements(
'ReadStripDetElements')
93 ReadStripDetElements.ManagerName =
"ITkStrip"
94 ReadStripDetElements.DetEleCollKey =
"ITkStripDetectorElementCollection"
95 ReadStripDetElements.UseConditionsTools =
False
96 acc.addEventAlgo(ReadStripDetElements)
98 PrintStripDetElements = CompFactory.PrintSiElements(
'PrintStripDetElements')
99 PrintStripDetElements.OutputLevel = 5
100 PrintStripDetElements.DetectorManagerNames = [
"ITkStrip"]
101 PrintStripDetElements.OutputFile =
"StripGeometry.dat"
102 acc.addEventAlgo(PrintStripDetElements)
105 sc = acc.run(maxEvents=1)
108 sys.exit(
not sc.isSuccess())