2 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory
import CompFactory
8 return "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/ATLAS-R3-MUONTEST_v3.db"
11 from argparse
import ArgumentParser
13 parser = ArgumentParser()
14 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
15 parser.add_argument(
"--geoTag", default=
"ATLAS-R3S-2021-03-02-00", help=
"Geometry tag to use", choices=[
"ATLAS-R3S-2021-03-02-00",
16 "ATLAS-P2-RUN4-01-00-00"])
17 parser.add_argument(
"--condTag", default=
"OFLCOND-MC23-SDR-RUN3-02", help=
"Conditions tag to use",
18 choices= [
"OFLCOND-MC23-SDR-RUN3-02",
"CONDBR2-BLKPA-2023-02"])
19 parser.add_argument(
"--inputFile",
"-i", default=[
21 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root"
23 help=
"Input file to run on ", nargs=
"+")
24 parser.add_argument(
"--geoModelFile", default =
geoModelFileDefault(), help=
"GeoModel SqLite file containing the muon geometry.")
25 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
26 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
27 parser.add_argument(
"--nEvents", help=
"Number of events to rum", type = int ,default = 1)
28 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
29 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
30 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
31 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
32 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
33 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
37 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
40 from AthenaConfiguration.Enums
import Format
41 if flags.Input.Format
is Format.POOL:
42 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
44 elif flags.Input.Format == Format.BS:
45 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
48 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
50 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
54 def setupHistSvcCfg(flags, out_file="MdtGeoDump.root", out_stream="GEOMODELTESTER"):
56 if len(out_file) == 0:
return result
57 histSvc = CompFactory.THistSvc(Output=[f
"{out_stream} DATAFILE='{out_file}', OPT='RECREATE'"])
58 result.addService(histSvc, primary=
True)
64 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
65 result.addEventAlgo(the_alg, primary =
True)
70 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
71 result.addEventAlgo(the_alg, primary =
True)
76 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
77 result.addEventAlgo(the_alg, primary =
True)
82 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
83 result.addEventAlgo(the_alg, primary =
True)
88 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
89 result.addEventAlgo(the_alg, primary =
True)
94 kwargs.setdefault(
"TestActsSurface",
False)
95 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
96 result.addEventAlgo(the_alg, primary =
True)
100 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
102 flags.Concurrency.NumThreads = args.threads
103 flags.Concurrency.NumConcurrentEvents = args.threads
104 flags.Input.isMC = args.condTag.find(
"OFLCOND") != -1
105 flags.Input.Files = args.inputFile
107 flags.Exec.EventPrintoutInterval = args.eventPrintoutLevel
108 from os
import path, system
109 if args.geoModelFile.startswith(
"root://"):
110 if not path.exists(
"Geometry/{geoTag}.db".
format(geoTag=args.geoTag)):
111 print (
"Copy geometry file from EOS {source}".
format(source = args.geoModelFile))
112 system(
"mkdir Geometry/")
113 system(
"xrdcp {source} Geometry/{geoTag}.db".
format(source = args.geoModelFile,
116 args.geoModelFile =
"Geometry/{geoTag}.db".
format(geoTag=args.geoTag)
119 from AthenaConfiguration.Enums
import ProductionStep
120 flags.Common.ProductionStep = ProductionStep.Simulation
122 from SimulationConfig.SimEnums
import SimulationFlavour
123 flags.Sim.ISF.Simulator = SimulationFlavour.AtlasG4
125 flags.GeoModel.AtlasVersion = args.geoTag
126 flags.IOVDb.GlobalTag = args.condTag
127 flags.GeoModel.SQLiteDB =
True
128 from AtlasGeoModel
import CommonGeoDB
129 CommonGeoDB.SetupLocalSqliteGeometryDb(args.geoModelFile,args.geoTag)
131 flags.Detector.GeometryBpipe =
False
133 flags.Detector.GeometryBCM =
False
134 flags.Detector.GeometryPixel =
False
135 flags.Detector.GeometrySCT =
False
136 flags.Detector.GeometryTRT =
False
138 flags.Detector.GeometryPLR =
False
139 flags.Detector.GeometryBCMPrime =
False
140 flags.Detector.GeometryITkPixel =
False
141 flags.Detector.GeometryITkStrip =
False
143 flags.Detector.GeometryHGTD =
False
145 flags.Detector.GeometryLAr =
False
146 flags.Detector.GeometryTile =
False
147 flags.Detector.GeometryMBTS =
False
148 flags.Detector.GeometryCalo =
False
150 flags.Detector.GeometryCSC =
False
152 flags.Detector.GeometrysTGC =
False
154 flags.Detector.GeometryMM =
False
156 flags.Detector.GeometryTGC =
False
158 flags.Detector.GeometryRPC =
False
160 flags.Detector.GeometryMDT =
False
162 flags.Scheduler.CheckDependencies =
True
163 flags.Scheduler.ShowDataDeps =
True
164 flags.Scheduler.ShowDataFlow =
True
165 flags.Scheduler.ShowControlFlow =
True
166 flags.Scheduler.EnableVerboseViews =
True
167 flags.Scheduler.AutoLoadUnmetDependencies =
True
168 flags.PerfMon.doFullMonMT =
True
171 flags.dump(evaluate =
True)
172 if not flags.Muon.usePhaseIIGeoSetup:
173 print (
"Please make sure that the file you're testing contains the Muon R4 geometry")
178 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
181 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
190 cfg.printConfig(withDetails=
True, summariseProps=
True)
191 if not cfg.run(num_events).isSuccess():
exit(1)
193 if __name__==
"__main__":
197 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
199 cfg.getCondAlgo(
"MuonDetectorManagerCondAlg").checkGeo =
True
200 cfg.getService(
"MessageSvc").setVerbose = []
201 cfg.getService(
"MessageSvc").verboseLimit = 10000000
203 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
205 if flags.Detector.GeometryMDT:
207 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
208 ReadoutSideXML=
"ReadoutSides.xml",
209 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' ),
210 (
'Trk::TrackingGeometry' ,
'ConditionStore+AtlasTrackingGeometry' )
213 if flags.Detector.GeometryRPC:
214 cfg.merge(
GeoModelRpcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
215 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
217 if flags.Detector.GeometryTGC:
218 cfg.merge(
GeoModelTgcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
219 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
221 if flags.Detector.GeometryMM:
223 cfg.merge(
GeoModelMmTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
224 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
226 if flags.Detector.GeometrysTGC:
227 cfg.merge(
GeoModelsTgcTestCfg(flags, TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
228 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))