2 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory
import CompFactory
9 return "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/ATLAS-R4-MUONTEST.db"
10 return "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/ATLAS-R3-MUONTEST_v3.db"
13 from argparse
import ArgumentParser
15 parser = ArgumentParser()
16 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
17 parser.add_argument(
"--geoTag", default=
"ATLAS-R3S-2021-03-02-00", help=
"Geometry tag to use", choices=[
"ATLAS-R3S-2021-03-02-00",
18 "ATLAS-P2-RUN4-01-00-00"])
19 parser.add_argument(
"--condTag", default=
"OFLCOND-MC23-SDR-RUN3-07", help=
"Conditions tag to use",
20 choices= [
"OFLCOND-MC23-SDR-RUN3-07",
"CONDBR2-BLKPA-2023-03",
"OFLCOND-MC21-SDR-RUN4-01"])
21 parser.add_argument(
"--inputFile",
"-i", default=[
23 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root"
25 help=
"Input file to run on ", nargs=
"+")
26 parser.add_argument(
"--geoModelFile", default =
geoModelFileDefault(), help=
"GeoModel SqLite file containing the muon geometry.")
27 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
28 parser.add_argument(
"--excludedChambers", default=[
"none"], nargs=
"+", help=
"Chambers to exclude. If string contains 'none', all chambers will be checked. Note: adding a chamber to --excludedChambers will overwrite it being in --chambers.")
29 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
30 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
31 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
32 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
33 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
34 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
35 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
36 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
37 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
41 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
44 from AthenaConfiguration.Enums
import Format
45 if flags.Input.Format
is Format.POOL:
46 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
48 elif flags.Input.Format == Format.BS:
49 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
52 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
54 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
58 def setupHistSvcCfg(flags, outFile="MdtGeoDump.root", outStream="GEOMODELTESTER"):
60 if len(outFile) == 0:
return result
61 histSvc = CompFactory.THistSvc(Output=[f
"{outStream} DATAFILE='{outFile}', OPT='RECREATE'"])
62 result.addService(histSvc, primary=
True)
68 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
69 result.addEventAlgo(the_alg, primary =
True)
74 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
75 result.addEventAlgo(the_alg, primary =
True)
80 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
81 result.addEventAlgo(the_alg, primary =
True)
86 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
87 result.addEventAlgo(the_alg, primary =
True)
92 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
93 result.addEventAlgo(the_alg, primary =
True)
98 kwargs.setdefault(
"TestActsSurface",
False)
99 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
100 result.addEventAlgo(the_alg, primary =
True)
106 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
108 flags.Concurrency.NumThreads = args.threads
109 flags.Concurrency.NumConcurrentEvents = args.threads
110 flags.Exec.MaxEvents = args.nEvents
111 flags.Exec.SkipEvents = args.skipEvents
112 flags.Input.isMC = args.condTag.find(
"OFLCOND") != -1
113 from os
import path, system, listdir
114 inFiles = [x
for x
in args.inputFile
if not path.isdir(x)] + \
115 [
"{dir}/{file}".
format(dir=x, file=y)
for x
in args.inputFile
if path.isdir(x)
for y
in listdir(x) ]
116 flags.Input.Files = inFiles
118 flags.Exec.EventPrintoutInterval = args.eventPrintoutLevel
120 if args.geoModelFile.startswith(
"root://"):
121 if not path.exists(
"Geometry/{geoTag}.db".
format(geoTag=args.geoTag)):
122 print (
"Copy geometry file from EOS {source}".
format(source = args.geoModelFile))
123 system(
"mkdir Geometry/")
124 system(
"xrdcp {source} Geometry/{geoTag}.db".
format(source = args.geoModelFile,
127 args.geoModelFile =
"Geometry/{geoTag}.db".
format(geoTag=args.geoTag)
128 print (
"Use geometry file: {geoFile}".
format(geoFile = args.geoModelFile))
129 flags.GeoModel.AtlasVersion = args.geoTag
130 flags.IOVDb.GlobalTag = args.condTag
131 flags.GeoModel.SQLiteDB =
True
132 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
134 flags.Detector.GeometryBpipe =
False
136 flags.Detector.GeometryBCM =
False
137 flags.Detector.GeometryPixel =
False
138 flags.Detector.GeometrySCT =
False
139 flags.Detector.GeometryTRT =
False
141 flags.Detector.GeometryPLR =
False
142 flags.Detector.GeometryBCMPrime =
False
143 flags.Detector.GeometryITkPixel =
False
144 flags.Detector.GeometryITkStrip =
False
146 flags.Detector.GeometryHGTD =
False
148 flags.Detector.GeometryLAr =
False
149 flags.Detector.GeometryTile =
False
150 flags.Detector.GeometryMBTS =
False
151 flags.Detector.GeometryCalo =
False
153 flags.Detector.GeometryCSC =
False
155 flags.Detector.GeometrysTGC =
False
157 flags.Detector.GeometryMM =
False
159 flags.Detector.GeometryTGC =
False
161 flags.Detector.GeometryRPC =
False
163 flags.Detector.GeometryMDT =
False
165 flags.Scheduler.CheckDependencies =
True
166 flags.Scheduler.ShowDataDeps =
True
167 flags.Scheduler.ShowDataFlow =
True
168 flags.Scheduler.ShowControlFlow =
True
169 flags.Scheduler.EnableVerboseViews =
True
170 flags.Scheduler.AutoLoadUnmetDependencies =
True
174 flags.dump(evaluate =
True)
175 if not flags.Muon.usePhaseIIGeoSetup:
176 print (
"Please make sure that the file you're testing contains the Muon R4 geometry")
181 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
184 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
187 cfg.getService(
"MessageSvc").verboseLimit = 10000000
188 cfg.getService(
"MessageSvc").debugLimit = 10000000
194 cfg.printConfig(withDetails=
True, summariseProps=
True)
195 if not cfg.run().isSuccess():
exit(1)
197 if __name__==
"__main__":
201 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
202 chambToExclude = []
if "none" in args.excludedChambers
else args.excludedChambers
204 cfg.getCondAlgo(
"MuonDetectorManagerCondAlg").checkGeo =
True
205 cfg.getService(
"MessageSvc").setVerbose = []
208 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
210 if flags.Detector.GeometryMDT:
212 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
213 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
214 ReadoutSideXML=
"ReadoutSides.xml",
215 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
217 if flags.Detector.GeometryRPC:
218 cfg.merge(
GeoModelRpcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
219 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
220 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
222 if flags.Detector.GeometryTGC:
223 cfg.merge(
GeoModelTgcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
224 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
225 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
227 if flags.Detector.GeometryMM:
229 cfg.merge(
GeoModelMmTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
230 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
231 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
233 if flags.Detector.GeometrysTGC:
234 cfg.merge(
GeoModelsTgcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
235 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
236 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))