ATLAS Offline Software
MuonHitTestConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 def MuonHitTesterCfg(flags, name="MuonHitTester", outFile="SimHitTest.root", **kwargs):
7  result = ComponentAccumulator()
8  from MuonGeoModelTestR4.testGeoModel import setupHistSvcCfg
9  result.merge(setupHistSvcCfg(flags,outFile=outFile, outStream="MuonR4HitTest"))
10  from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
11  result.merge(ActsGeometryContextAlgCfg(flags))
12  kwargs.setdefault("isMC", flags.Input.isMC)
13 
14 
15  kwargs.setdefault("dumpPrds", False)
16  kwargs.setdefault("dumpDigits", False)
17  kwargs.setdefault("dumpSimHits", True)
18 
19 
22  kwargs.setdefault("dumpMdtSimHits", flags.Detector.GeometryMDT)
23  kwargs.setdefault("dumpRpcSimHits", flags.Detector.GeometryRPC)
24  kwargs.setdefault("dumpTgcSimHits", flags.Detector.GeometryTGC)
25  kwargs.setdefault("dumpStgcSimHits",flags.Detector.GeometrysTGC)
26  kwargs.setdefault("dumpMmSimHits", flags.Detector.GeometryMM)
27 
28 
29  kwargs.setdefault("dumpMdtDigits", flags.Detector.GeometryMDT)
30  kwargs.setdefault("dumpRpcDigits", flags.Detector.GeometryRPC)
31  kwargs.setdefault("dumpTgcDigits", flags.Detector.GeometryTGC)
32  kwargs.setdefault("dumpStgcDigits",flags.Detector.GeometrysTGC)
33  kwargs.setdefault("dumpMmDigits", flags.Detector.GeometryMM)
34 
35  kwargs.setdefault("dumpMdtPrds", flags.Detector.GeometryMDT)
36  kwargs.setdefault("dumpRpcPrds", flags.Detector.GeometryRPC)
37  kwargs.setdefault("dumpTgcPrds", flags.Detector.GeometryTGC)
38  kwargs.setdefault("dumpMmPrds", flags.Detector.GeometryMM)
39 
40  theAlg = CompFactory.MuonValR4.MuonHitTesterAlg(name, **kwargs)
41  result.addEventAlgo(theAlg, primary = True)
42  return result
43 
44 
45 def MuonDigiTestCfg(flags, name="MuonDigiTester", outFile="DigiTest.root", **kwargs):
46  kwargs.setdefault("MdtSimHitKey", "MDT_SDO")
47  kwargs.setdefault("RpcSimHitKey", "RPC_SDO")
48  kwargs.setdefault("TgcSimHitKey", "TGC_SDO")
49  kwargs.setdefault("MmSimHitKey", "MM_SDO")
50  kwargs.setdefault("sTgcSimHitKey", "sTGC_SDO")
51  kwargs.setdefault("dumpDigits", True)
52  return MuonHitTesterCfg(flags, name = name, outFile = outFile, **kwargs)
53 
54 def MuonPileUpTestCfg(flags, name="MuonDigiTester", outFile="DigiTest.root", **kwargs):
55  kwargs.setdefault("MdtSimHitKey", "Bkg_MDT_SDO")
56  kwargs.setdefault("RpcSimHitKey", "Bkg_RPC_SDO")
57  kwargs.setdefault("TgcSimHitKey", "Bkg_TGC_SDO")
58  kwargs.setdefault("MmSimHitKey", "Bkg_MM_SDO")
59  kwargs.setdefault("sTgcSimHitKey", "Bkg_sTGC_SDO")
60  kwargs.setdefault("EvtInfoKey", "Bkg_EventInfo")
61  kwargs.setdefault("dumpDigits", True)
62  return MuonHitTesterCfg(flags, name = name, outFile = outFile, **kwargs)
63 
64 
65 if __name__=="__main__":
66  from MuonGeoModelTestR4.testGeoModel import setupGeoR4TestCfg, SetupArgParser, executeTest
67  parser = SetupArgParser()
68  parser.add_argument("--runTester", help="Choice on the tester to setup", default="SIM", choices=["SIM", "DIGI", "PILEUP"])
69  parser.set_defaults(nEvents = -1)
70  parser.set_defaults(inputFile=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/R3SimHits.pool.root"])
71  parser.set_defaults(outRootFile="SimHitDumpNtuple.root")
72  parser.set_defaults(eventPrintoutLevel = 500)
73 
74  args = parser.parse_args()
75  flags, cfg = setupGeoR4TestCfg(args)
76 
77  from MuonConfig.MuonDataPrepConfig import xAODUncalibMeasPrepCfg
78  cfg.merge(xAODUncalibMeasPrepCfg(flags))
79 
80  if args.runTester != "SIM":
81  if flags.Detector.GeometryMDT:
82  from MuonConfig.MuonByteStreamCnvTestConfig import MdtRdoToMdtDigitCfg
83  cfg.merge(MdtRdoToMdtDigitCfg(flags))
84  if flags.Detector.GeometryRPC:
85  from MuonConfig.MuonByteStreamCnvTestConfig import RpcRdoToRpcDigitCfg
86  cfg.merge(RpcRdoToRpcDigitCfg(flags))
87  if flags.Detector.GeometryTGC:
88  from MuonConfig.MuonByteStreamCnvTestConfig import TgcRdoToTgcDigitCfg
89  cfg.merge(TgcRdoToTgcDigitCfg(flags))
90  if flags.Detector.GeometrysTGC:
91  from MuonConfig.MuonByteStreamCnvTestConfig import STGC_RdoToDigitCfg
92  cfg.merge(STGC_RdoToDigitCfg(flags))
93  if flags.Detector.GeometryMM:
94  from MuonConfig.MuonByteStreamCnvTestConfig import MM_RdoToDigitCfg
95  cfg.merge(MM_RdoToDigitCfg(flags))
96 
97  if args.runTester == "SIM":
98  cfg.merge(MuonHitTesterCfg(flags,outFile=args.outRootFile))
99  elif args.runTester == "DIGI":
100  cfg.merge(MuonDigiTestCfg(flags,outFile=args.outRootFile))
101  elif args.runTester == "PILEUP":
102  cfg.merge(MuonPileUpTestCfg(flags,outFile=args.outRootFile))
103 
104  executeTest(cfg)
105 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MuonByteStreamCnvTestConfig.MdtRdoToMdtDigitCfg
def MdtRdoToMdtDigitCfg(flags, name="MdtRdoToMdtDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:20
python.MdtCablingTester.SetupArgParser
def SetupArgParser()
Definition: MdtCablingTester.py:3
python.testGeoModel.setupHistSvcCfg
def setupHistSvcCfg(flags, outFile="MdtGeoDump.root", outStream="GEOMODELTESTER")
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:58
MuonHitTestConfig.MuonPileUpTestCfg
def MuonPileUpTestCfg(flags, name="MuonDigiTester", outFile="DigiTest.root", **kwargs)
Definition: MuonHitTestConfig.py:54
python.testGeoModel.executeTest
def executeTest(cfg)
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:192
python.testGeoModel.setupGeoR4TestCfg
def setupGeoR4TestCfg(args, flags=None)
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:103
MuonHitTestConfig.MuonHitTesterCfg
def MuonHitTesterCfg(flags, name="MuonHitTester", outFile="SimHitTest.root", **kwargs)
Definition: MuonHitTestConfig.py:6
AlignmentAlgsConfig.ActsGeometryContextAlgCfg
def ActsGeometryContextAlgCfg(flags, name="GeometryContextAlg", **kwargs)
Setup the Geometry context algorithm.
Definition: AlignmentAlgsConfig.py:125
python.MuonByteStreamCnvTestConfig.RpcRdoToRpcDigitCfg
def RpcRdoToRpcDigitCfg(flags, name="RpcRdoToRpcDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:44
MuonHitTestConfig.MuonDigiTestCfg
def MuonDigiTestCfg(flags, name="MuonDigiTester", outFile="DigiTest.root", **kwargs)
Definition: MuonHitTestConfig.py:45
python.MuonByteStreamCnvTestConfig.TgcRdoToTgcDigitCfg
def TgcRdoToTgcDigitCfg(flags, name="TgcRdoToTgcDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:91
python.MuonByteStreamCnvTestConfig.STGC_RdoToDigitCfg
def STGC_RdoToDigitCfg(flags, name="STGC_RdoToDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:116
python.MuonDataPrepConfig.xAODUncalibMeasPrepCfg
def xAODUncalibMeasPrepCfg(flags)
Configuriation snippet to schedule all algorithms providing the Uncalibrated measurements.
Definition: MuonDataPrepConfig.py:29
python.MuonByteStreamCnvTestConfig.MM_RdoToDigitCfg
def MM_RdoToDigitCfg(flags, name="MM_RdoToDigitAlg", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:140