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)
129 flags.GeoModel.AtlasVersion = args.geoTag
130 flags.IOVDb.GlobalTag = args.condTag
131 flags.GeoModel.SQLiteDB =
True
132 from AtlasGeoModel
import CommonGeoDB
133 CommonGeoDB.SetupLocalSqliteGeometryDb(args.geoModelFile,args.geoTag)
135 flags.Detector.GeometryBpipe =
False
137 flags.Detector.GeometryBCM =
False
138 flags.Detector.GeometryPixel =
False
139 flags.Detector.GeometrySCT =
False
140 flags.Detector.GeometryTRT =
False
142 flags.Detector.GeometryPLR =
False
143 flags.Detector.GeometryBCMPrime =
False
144 flags.Detector.GeometryITkPixel =
False
145 flags.Detector.GeometryITkStrip =
False
147 flags.Detector.GeometryHGTD =
False
149 flags.Detector.GeometryLAr =
False
150 flags.Detector.GeometryTile =
False
151 flags.Detector.GeometryMBTS =
False
152 flags.Detector.GeometryCalo =
False
154 flags.Detector.GeometryCSC =
False
156 flags.Detector.GeometrysTGC =
False
158 flags.Detector.GeometryMM =
False
160 flags.Detector.GeometryTGC =
False
162 flags.Detector.GeometryRPC =
False
164 flags.Detector.GeometryMDT =
False
166 flags.Scheduler.CheckDependencies =
True
167 flags.Scheduler.ShowDataDeps =
True
168 flags.Scheduler.ShowDataFlow =
True
169 flags.Scheduler.ShowControlFlow =
True
170 flags.Scheduler.EnableVerboseViews =
True
171 flags.Scheduler.AutoLoadUnmetDependencies =
True
175 flags.dump(evaluate =
True)
176 if not flags.Muon.usePhaseIIGeoSetup:
177 print (
"Please make sure that the file you're testing contains the Muon R4 geometry")
182 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
185 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
188 cfg.getService(
"MessageSvc").verboseLimit = 10000000
189 cfg.getService(
"MessageSvc").debugLimit = 10000000
195 cfg.printConfig(withDetails=
True, summariseProps=
True)
196 if not cfg.run().isSuccess():
exit(1)
198 if __name__==
"__main__":
202 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
203 chambToExclude = []
if "none" in args.excludedChambers
else args.excludedChambers
205 cfg.getCondAlgo(
"MuonDetectorManagerCondAlg").checkGeo =
True
206 cfg.getService(
"MessageSvc").setVerbose = []
209 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
211 if flags.Detector.GeometryMDT:
213 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
214 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
215 ReadoutSideXML=
"ReadoutSides.xml",
216 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' ),
220 if flags.Detector.GeometryRPC:
221 cfg.merge(
GeoModelRpcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
222 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
223 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
225 if flags.Detector.GeometryTGC:
226 cfg.merge(
GeoModelTgcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
227 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
228 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
230 if flags.Detector.GeometryMM:
232 cfg.merge(
GeoModelMmTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
233 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
234 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
236 if flags.Detector.GeometrysTGC:
237 cfg.merge(
GeoModelsTgcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
238 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
239 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))