ATLAS Offline Software
Loading...
Searching...
No Matches
MdtMezzExtraction.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3def MdtCablMezzAlgCfg(flags, name = "MdtCablMezzAlg", localMezzanineJSON="", localCablingJSON="", **kwargs):
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6
7 result = ComponentAccumulator()
8 from MuonConfig.MuonCablingConfig import MDTCablingConfigCfg
9 result.merge(MDTCablingConfigCfg(flags, MezzanineJSON=localMezzanineJSON, CablingJSON=localCablingJSON))
10 event_algo = CompFactory.MdtCablingJsonDumpAlg(name,**kwargs)
11 result.addEventAlgo(event_algo, primary = True)
12 return result
13
14if __name__ == "__main__":
15 from AthenaConfiguration.AllConfigFlags import initConfigFlags
16 from MuonConfig.MuonConfigUtils import executeTest, configureCondTag, SetupMuonStandaloneCA
17 from MuonCondTest.MdtCablingTester import SetupArgParser
18
19 parser = SetupArgParser()
20
21 parser.set_defaults(output="SummaryFile.txt")
22 parser.set_defaults(mezzMap="MezzMapping.json")
23 parser.set_defaults(cablingMap="MdtCabling.json")
24
25 parser.add_argument("--overrideBIS", action='store_true', default=False ,help="Override the BIS cabling in the JSON file")
26 parser.add_argument("--localMezzanineJSON", default="", help="Local JSON file containing the mezzanine mapping to use instead of the DB")
27 parser.add_argument("--localCablingJSON", default="", help="Local JSON file containing the cabling mapping to use instead of the DB")
28
29
30
31 args = parser.parse_args()
32 flags = initConfigFlags()
33
34 flags.Concurrency.NumThreads = 1
35 flags.Concurrency.NumConcurrentEvents = 1
36 flags.Exec.MaxEvents = 1
37 flags.Input.Files = args.inputFile
38 if not flags.GeoModel.AtlasVersion:
39 flags.GeoModel.AtlasVersion = args.geoTag
40 configureCondTag(flags)
41 flags.lock()
42
43
44 flags.dump(evaluate=True)
45
46 cfg = SetupMuonStandaloneCA(flags)
47 cfg.merge( MdtCablMezzAlgCfg(flags,
48 name = "MdtCablMezzAlg",
49 localMezzanineJSON=args.localMezzanineJSON,
50 localCablingJSON=args.localCablingJSON,
51 SummaryFile=args.output,
52 OutMezzanineJSON=args.mezzMap,
53 OutCablingJSON=args.cablingMap,
54 insertBISCabling=args.overrideBIS,
55 ))
56 if args.overrideBIS:
57 print("Will override BIS cabling")
58 from IOVDbSvc.IOVDbSvcConfig import addOverride
59 cfg.merge(addOverride(flags, "/MDT/CABLING/MAP_SCHEMA_JSON", "MDTCablingMapSchemaJSON_RUN3BestKnowledge"))
60 cfg.merge(addOverride(flags, "/MDT/CABLING/MEZZANINE_SCHEMA_JSON", "MDTMezMapSchemaJSON_RUN3BestKnowledge"))
61 executeTest(cfg)
62
63
void print(char *figname, TCanvas *c1)
MdtCablMezzAlgCfg(flags, name="MdtCablMezzAlg", localMezzanineJSON="", localCablingJSON="", **kwargs)