ATLAS Offline Software
MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py
Go to the documentation of this file.
1 
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
7  from argparse import ArgumentParser
8 
9  parser = ArgumentParser()
10  parser.add_argument("--threads", type=int, help="number of threads", default=1)
11  parser.add_argument("--inputFile", "-i", default=[
12  #"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data17_13TeV.00330470.physics_Main.daq.RAW._lb0310._SFO-1._0001.data"
13  "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root"
14  ],
15  help="Input file to run on ", nargs="+")
16  parser.add_argument("--geoTag", default="ATLAS-R3S-2021-03-02-00", help="Geometry tag to use", choices=["ATLAS-R2-2016-01-02-01",
17  "ATLAS-R3S-2021-03-02-00"])
18  parser.add_argument("--condTag", default="OFLCOND-MC23-SDR-RUN3-02", help="Conditions tag to use",
19  choices=["OFLCOND-MC16-SDR-RUN2-11",
20  "OFLCOND-MC23-SDR-RUN3-02",
21  "CONDBR2-BLKPA-2023-02",
22  "CONDBR2-BLKPA-RUN2-11"])
23  parser.add_argument("--chambers", default=["all"
24  ], nargs="+", help="Chambers to check. If string is all, all chambers will be checked")
25  parser.add_argument("--outRootFile", default="LegacyGeoModelDump.root", help="Output ROOT file to dump the geomerty")
26  parser.add_argument("--noMdt", help="Disable the Mdts from the geometry", action='store_true', default = False)
27  parser.add_argument("--noRpc", help="Disable the Rpcs from the geometry", action='store_true', default = False)
28  parser.add_argument("--noTgc", help="Disable the Tgcs from the geometry", action='store_true', default = False)
29  parser.add_argument("--noMM", help="Disable the MMs from the geometry", action='store_true', default = False)
30  parser.add_argument("--noSTGC", help="Disable the sTgcs from the geometry", action='store_true', default = False)
31 
32  return parser
33 
34 def setupHistSvc(flags, out_file="MdtGeoDump.root"):
35  result = ComponentAccumulator()
36  if len(out_file) == 0: return result
37  histSvc = CompFactory.THistSvc(Output=["GEOMODELTESTER DATAFILE='{out_file}', OPT='RECREATE'".format(out_file = out_file)])
38  result.addService(histSvc, primary=True)
39  return result
40 
41 def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", **kwargs):
42  result = ComponentAccumulator()
43  if not flags.Detector.GeometryMDT: return result
44  from MuonConfig.MuonCablingConfig import MDTCablingConfigCfg
45  result.merge(MDTCablingConfigCfg(flags))
46  the_alg = CompFactory.MuonGM.GeoModelMdtTest(name, **kwargs)
47  result.addEventAlgo(the_alg)
48  return result
49 
50 def GeoModelRpcTestCfg(flags,name = "GeoModelRpcTest", **kwargs):
51  result = ComponentAccumulator()
52  if not flags.Detector.GeometryRPC: return result
53  the_alg = CompFactory.MuonGM.GeoModelRpcTest(name, **kwargs)
54  result.addEventAlgo(the_alg)
55  return result
56 
57 def GeoModelTgcTestCfg(flags,name = "GeoModelTgcTest", **kwargs):
58  result = ComponentAccumulator()
59  if not flags.Detector.GeometryTGC: return result
60  the_alg = CompFactory.MuonGM.GeoModelTgcTest(name, **kwargs)
61  result.addEventAlgo(the_alg)
62  return result
63 def GeoModelMmTestCfg(flags,name = "GeoModelMmTest", **kwargs):
64  result = ComponentAccumulator()
65  if not flags.Detector.GeometryMM: return result
66  the_alg = CompFactory.MuonGM.GeoModelMmTest(name, **kwargs)
67  result.addEventAlgo(the_alg)
68  return result
69 
70 def GeoModelsTgcTestCfg(flags, name = "GeoModelsTgcTest", **kwargs):
71  result = ComponentAccumulator()
72  if not flags.Detector.GeometrysTGC: return result
73  the_alg = CompFactory.MuonGM.GeoModelsTgcTest(name, **kwargs)
74  result.addEventAlgo(the_alg)
75  return result
76 
77 def GeoModelCscTestCfg(flags, name = "GeoModelCscTest", **kwargs):
78  result = ComponentAccumulator()
79  if not flags.Detector.GeometryCSC: return result
80  the_alg = CompFactory.MuonGM.GeoModelCscTest(name, **kwargs)
81  result.addEventAlgo(the_alg)
82  return result
83 
84 if __name__=="__main__":
85  from AthenaConfiguration.AllConfigFlags import initConfigFlags
87 
88  flags = initConfigFlags()
89  flags.Concurrency.NumThreads = args.threads
90  flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment.
91  flags.Input.Files = args.inputFile
92  flags.GeoModel.AtlasVersion = args.geoTag
93  flags.IOVDb.GlobalTag = args.condTag
94  flags.Scheduler.ShowDataDeps = True
95  flags.Scheduler.ShowDataFlow = True
96  flags.lock()
97  from MuonCondTest.MdtCablingTester import setupServicesCfg
98  cfg = setupServicesCfg(flags)
99  cfg.merge(setupHistSvc(flags, out_file = args.outRootFile))
100 
101  chambToTest = args.chambers if len([x for x in args.chambers if x =="all"]) ==0 else []
102  if not args.noMdt:
103  cfg.merge(GeoModelMdtTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "B" or ch[0] == "E"],
104  dumpSurfaces = False ))
105  if not args.noRpc:
106  cfg.merge(GeoModelRpcTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "B"]))
107  if not args.noTgc:
108  cfg.merge(GeoModelTgcTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "T"],
109  ReadoutXML="TgcStripStructure.xml"))
110 
111  if not args.noMM:
112  cfg.merge(GeoModelMmTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "M"]))
113 
114  if not args.noSTGC:
115  cfg.merge(GeoModelsTgcTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "S"]))
116 
117  cfg.merge(GeoModelCscTestCfg(flags))
118 
119  cfg.printConfig(withDetails=True, summariseProps=True)
120  flags.dump(evaluate = True)
121  if not cfg.run(1).isSuccess():
122  print("Execution failed")
123  exit(1)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
testGeoModel.SetupArgParser
def SetupArgParser()
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:6
python.MdtCablingTester.setupServicesCfg
def setupServicesCfg(flags)
Definition: MdtCablingTester.py:17
testGeoModel.GeoModelCscTestCfg
def GeoModelCscTestCfg(flags, name="GeoModelCscTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:77
python.MuonCablingConfig.MDTCablingConfigCfg
def MDTCablingConfigCfg(flags, name="MuonMDT_CablingAlg", **kwargs)
Definition: MuonCablingConfig.py:91
testGeoModel.GeoModelTgcTestCfg
def GeoModelTgcTestCfg(flags, name="GeoModelTgcTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:57
testGeoModel.GeoModelMdtTestCfg
def GeoModelMdtTestCfg(flags, name="GeoModelMdtTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:41
testGeoModel.GeoModelRpcTestCfg
def GeoModelRpcTestCfg(flags, name="GeoModelRpcTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:50
calibdata.exit
exit
Definition: calibdata.py:236
testGeoModel.GeoModelsTgcTestCfg
def GeoModelsTgcTestCfg(flags, name="GeoModelsTgcTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:70
testGeoModel.setupHistSvc
def setupHistSvc(flags, out_file="MdtGeoDump.root")
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:34
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
confTool.parse_args
def parse_args()
Definition: confTool.py:35
testGeoModel.GeoModelMmTestCfg
def GeoModelMmTestCfg(flags, name="GeoModelMmTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:63