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 AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultGeometryTags
8 
9  from argparse import ArgumentParser
10 
11  parser = ArgumentParser()
12  parser.add_argument("--threads", type=int, help="number of threads", default=1)
13  parser.add_argument("--inputFile", "-i", default=[
14  #"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data17_13TeV.00330470.physics_Main.daq.RAW._lb0310._SFO-1._0001.data"
15  "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root"
16  ],
17  help="Input file to run on ", nargs="+")
18  parser.add_argument("--geoTag", default=defaultGeometryTags.RUN3, help="Geometry tag to use", choices=[defaultGeometryTags.RUN2_BEST_KNOWLEDGE ,
19  defaultGeometryTags.RUN3])
20  parser.add_argument("--condTag", default=defaultConditionsTags.RUN3_MC, help="Conditions tag to use",
21  choices=[defaultConditionsTags.RUN3_MC,
22  defaultConditionsTags.RUN3_DATA,
23  defaultConditionsTags.RUN2_DATA,
24  defaultConditionsTags.RUN2_MC])
25  parser.add_argument("--chambers", default=["all"
26  ], nargs="+", help="Chambers to check. If string is all, all chambers will be checked")
27  parser.add_argument("--excludedChambers", default=[], 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.")
28  parser.add_argument("--outRootFile", default="LegacyGeoModelDump.root", help="Output ROOT file to dump the geomerty")
29  parser.add_argument("--noMdt", help="Disable the Mdts from the geometry", action='store_true', default = False)
30  parser.add_argument("--noRpc", help="Disable the Rpcs from the geometry", action='store_true', default = False)
31  parser.add_argument("--noTgc", help="Disable the Tgcs from the geometry", action='store_true', default = False)
32  parser.add_argument("--noMM", help="Disable the MMs from the geometry", action='store_true', default = False)
33  parser.add_argument("--noSTGC", help="Disable the sTgcs from the geometry", action='store_true', default = False)
34 
35  return parser
36 
37 
38 def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", **kwargs):
39  result = ComponentAccumulator()
40  if not flags.Detector.GeometryMDT: return result
41  from MuonConfig.MuonCablingConfig import MDTCablingConfigCfg
42  result.merge(MDTCablingConfigCfg(flags))
43  the_alg = CompFactory.MuonGM.GeoModelMdtTest(name, **kwargs)
44  result.addEventAlgo(the_alg)
45  return result
46 
47 def GeoModelRpcTestCfg(flags,name = "GeoModelRpcTest", **kwargs):
48  result = ComponentAccumulator()
49  if not flags.Detector.GeometryRPC: return result
50  the_alg = CompFactory.MuonGM.GeoModelRpcTest(name, **kwargs)
51  result.addEventAlgo(the_alg)
52  return result
53 
54 def GeoModelTgcTestCfg(flags,name = "GeoModelTgcTest", **kwargs):
55  result = ComponentAccumulator()
56  if not flags.Detector.GeometryTGC: return result
57  the_alg = CompFactory.MuonGM.GeoModelTgcTest(name, **kwargs)
58  result.addEventAlgo(the_alg)
59  return result
60 def GeoModelMmTestCfg(flags,name = "GeoModelMmTest", **kwargs):
61  result = ComponentAccumulator()
62  if not flags.Detector.GeometryMM: return result
63  the_alg = CompFactory.MuonGM.GeoModelMmTest(name, **kwargs)
64  result.addEventAlgo(the_alg)
65  return result
66 
67 def GeoModelsTgcTestCfg(flags, name = "GeoModelsTgcTest", **kwargs):
68  result = ComponentAccumulator()
69  if not flags.Detector.GeometrysTGC: return result
70  the_alg = CompFactory.MuonGM.GeoModelsTgcTest(name, **kwargs)
71  result.addEventAlgo(the_alg)
72  return result
73 
74 def GeoModelCscTestCfg(flags, name = "GeoModelCscTest", **kwargs):
75  result = ComponentAccumulator()
76  if not flags.Detector.GeometryCSC: return result
77  the_alg = CompFactory.MuonGM.GeoModelCscTest(name, **kwargs)
78  result.addEventAlgo(the_alg)
79  return result
80 
81 if __name__=="__main__":
82  from AthenaConfiguration.AllConfigFlags import initConfigFlags
84 
85  flags = initConfigFlags()
86  flags.Concurrency.NumThreads = args.threads
87  flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment.
88  flags.Input.Files = args.inputFile
89  flags.GeoModel.AtlasVersion = args.geoTag
90  flags.IOVDb.GlobalTag = args.condTag
91  flags.Scheduler.ShowDataDeps = True
92  flags.Scheduler.ShowDataFlow = True
93  flags.lock()
94  from MuonCondTest.MdtCablingTester import setupServicesCfg
95  cfg = setupServicesCfg(flags)
96  from MuonGeoModelTestR4.testGeoModel import setupHistSvcCfg
97  cfg.merge(setupHistSvcCfg(flags, outFile = args.outRootFile))
98 
99  chambToTest = args.chambers if len([x for x in args.chambers if x =="all"]) ==0 else []
100  chambToExclude = args.excludedChambers
101  if not args.noMdt:
102  cfg.merge(GeoModelMdtTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "B" or ch[0] == "E"],
103  ExcludeStations = [ch for ch in chambToExclude if ch[0] == "B" or ch[0] == "E"]))
104  if not args.noRpc:
105  cfg.merge(GeoModelRpcTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "B"],
106  ExcludeStations = [ch for ch in chambToExclude 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  ExcludeStations = [ch for ch in chambToExclude if ch[0] == "T"],
110  ReadoutXML="TgcStripStructure.xml"))
111 
112  if not args.noMM:
113  cfg.merge(GeoModelMmTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "M"],
114  ExcludeStations = [ch for ch in chambToExclude if ch[0] == "M"]))
115 
116  if not args.noSTGC:
117  cfg.merge(GeoModelsTgcTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "S"],
118  ExcludeStations = [ch for ch in chambToExclude if ch[0] == "S"]))
119 
120  cfg.merge(GeoModelCscTestCfg(flags))
121 
122  cfg.printConfig(withDetails=True, summariseProps=True)
123  flags.dump(evaluate = True)
124  if not cfg.run(1).isSuccess():
125  print("Execution failed")
126  exit(1)
testGeoModel.setupServicesCfg
def setupServicesCfg(flags)
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:37
testGeoModel.GeoModelMmTestCfg
def GeoModelMmTestCfg(flags, name="GeoModelMmTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:60
testGeoModel.GeoModelTgcTestCfg
def GeoModelTgcTestCfg(flags, name="GeoModelTgcTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:54
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
testGeoModel.GeoModelMdtTestCfg
def GeoModelMdtTestCfg(flags, name="GeoModelMdtTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:38
testGeoModel.GeoModelRpcTestCfg
def GeoModelRpcTestCfg(flags, name="GeoModelRpcTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:47
testGeoModel.SetupArgParser
def SetupArgParser()
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:6
testGeoModel.setupHistSvcCfg
def setupHistSvcCfg(flags, outFile="MdtGeoDump.root", outStream="GEOMODELTESTER")
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:55
testGeoModel.GeoModelCscTestCfg
def GeoModelCscTestCfg(flags, name="GeoModelCscTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:74
testGeoModel.GeoModelsTgcTestCfg
def GeoModelsTgcTestCfg(flags, name="GeoModelsTgcTest", **kwargs)
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:67
MuonCablingConfig.MDTCablingConfigCfg
def MDTCablingConfigCfg(flags, name="MuonMDT_CablingAlg", **kwargs)
Definition: MuonCablingConfig.py:100
calibdata.exit
exit
Definition: calibdata.py:235
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
confTool.parse_args
def parse_args()
Definition: confTool.py:36