ATLAS Offline Software
testMuonDetector.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from AthenaCommon.Constants import VERBOSE
5 
6 def MuonDetectorNavTestCfg(flags, name = "MuonDetectorNavTest", **kwargs):
7  result = ComponentAccumulator()
8  containerNames = []
9  if flags.Detector.EnableMDT:
10  containerNames+=["xMdtSimHits"]
11  if flags.Detector.EnableMM:
12  containerNames+=["xMmSimHits"]
13  if flags.Detector.EnableRPC:
14  containerNames+=["xRpcSimHits"]
15  if flags.Detector.EnableTGC:
16  containerNames+=["xTgcSimHits"]
17  if flags.Detector.EnablesTGC:
18  containerNames+=["xStgcSimHits"]
19 
20  from MuonTruthAlgsR4.MuonTruthAlgsConfig import TruthSegmentMakerCfg, TruthSegmentToTruthPartAssocCfg, SdoMultiTruthMakerCfg
21 
22  from MuonConfig.MuonTruthAlgsConfig import TruthMuonMakerAlgCfg, MuonTruthHitCountsAlgCfg
23 
24  result.merge(TruthMuonMakerAlgCfg(flags, pdgIds=[13,998,999]))
25  result.merge(MuonTruthHitCountsAlgCfg(flags))
26  result.merge(TruthSegmentToTruthPartAssocCfg(flags))
27  result.merge(SdoMultiTruthMakerCfg(flags))
28 
29  result.merge(TruthSegmentMakerCfg(flags, SimHitKeys=containerNames, useOnlyMuonHits = False))
30  kwargs.setdefault("StartFromFirstHit", True)
31 
32  from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
33  extp = result.popToolsAndMerge(AtlasExtrapolatorCfg(flags))
34  extp.ApplyMaterialEffects = False
35  kwargs.setdefault("Extrapolator", extp)
36 
37  the_alg = CompFactory.ActsTrk.MuonDetectorNavTest(name, **kwargs)
38  result.addEventAlgo(the_alg, primary = True)
39  return result
40 
41 if __name__=="__main__":
42  from MuonGeoModelTestR4.testGeoModel import setupGeoR4TestCfg, SetupArgParser, executeTest,setupHistSvcCfg
43  parser = SetupArgParser()
44  parser.set_defaults(inputFile=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/R3SimHits.pool.root"])
45  parser.set_defaults(outRootFile="MuonNavigationTestR4_NewMaterial_Passive.root")
46  parser.set_defaults(nEvents=10)
47  parser.add_argument("--dumpDetector", help="Save dump detector visualization", action='store_true', default=False )
48  parser.add_argument("--dumpPassive", help="Save detector visualization", action='store_true', default=False )
49  parser.add_argument("--dumpDetectorVolumes", help="Save detector visualization", action='store_true', default=False )
50  parser.add_argument("--noSensitives", help="Do not use sensitive detectors", action='store_true', default=False )
51  parser.add_argument("--dumpMaterialSurfaces", help="Save material surfaces visualization", action='store_true', default=False )
52 
53  args = parser.parse_args()
54  from AthenaConfiguration.AllConfigFlags import initConfigFlags
55  flags = initConfigFlags()
56  flags.PerfMon.doFullMonMT = True
57  flags, cfg = setupGeoR4TestCfg(args,flags)
58 
59  cfg.merge(setupHistSvcCfg(flags, outFile=args.outRootFile, outStream="MuonNavigationTestR4"))
60  from ActsGeometry.DetectorVolumeSvcCfg import DetectorVolumeSvcCfg
61  cfg.merge(DetectorVolumeSvcCfg(flags))
62  from MagFieldServices.MagFieldServicesConfig import AtlasFieldCacheCondAlgCfg
63  cfg.merge(AtlasFieldCacheCondAlgCfg(flags))
64  cfg.merge(MuonDetectorNavTestCfg(flags, OutputLevel=VERBOSE))
65  cfg.getPublicTool("MuonDetectorBuilderTool").dumpDetector = args.dumpDetector
66  cfg.getPublicTool("MuonDetectorBuilderTool").dumpPassive = args.dumpPassive
67  cfg.getPublicTool("MuonDetectorBuilderTool").dumpDetectorVolumes = args.dumpDetectorVolumes
68  cfg.getPublicTool("MuonDetectorBuilderTool").BuildSensitives = not args.noSensitives
69  cfg.getPublicTool("MuonDetectorBuilderTool").dumpMaterialSurfaces = args.dumpMaterialSurfaces
70 
71  executeTest(cfg)
MuonTruthAlgsConfig.TruthSegmentMakerCfg
def TruthSegmentMakerCfg(flags, name="TruthSegmentMakerAlg", **kwargs)
Definition: MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py:7
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
MuonTruthAlgsConfig.SdoMultiTruthMakerCfg
def SdoMultiTruthMakerCfg(flags, useSDO=False)
Definition: MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py:97
testGeoModel.setupHistSvcCfg
def setupHistSvcCfg(flags, outFile="MdtGeoDump.root", outStream="GEOMODELTESTER")
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:55
MuonTruthAlgsConfig.TruthSegmentToTruthPartAssocCfg
def TruthSegmentToTruthPartAssocCfg(flags, name="MuonTruthSegmentToTruthAssocAlg", **kwargs)
Definition: MuonPhaseII/MuonPatternRecognition/MuonTruthAlgsR4/python/MuonTruthAlgsConfig.py:141
python.AtlasExtrapolatorConfig.AtlasExtrapolatorCfg
def AtlasExtrapolatorCfg(flags, name='AtlasExtrapolator')
Definition: AtlasExtrapolatorConfig.py:63
testGeoModel.executeTest
def executeTest(cfg)
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:227
MdtCablingTester.SetupArgParser
def SetupArgParser()
Definition: MdtCablingTester.py:3
testGeoModel.setupGeoR4TestCfg
def setupGeoR4TestCfg(args, flags=None)
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py:126
Constants
some useful constants -------------------------------------------------—
DetectorVolumeSvcCfg
Definition: DetectorVolumeSvcCfg.py:1
testMuonDetector.MuonDetectorNavTestCfg
def MuonDetectorNavTestCfg(flags, name="MuonDetectorNavTest", **kwargs)
Definition: testMuonDetector.py:6
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.MagFieldServicesConfig.AtlasFieldCacheCondAlgCfg
def AtlasFieldCacheCondAlgCfg(flags, **kwargs)
Definition: MagFieldServicesConfig.py:8
MuonTruthAlgsConfig.MuonTruthHitCountsAlgCfg
def MuonTruthHitCountsAlgCfg(flags, name="MuonTruthHitSummaryAlg", **kwargs)
Definition: MuonConfig/python/MuonTruthAlgsConfig.py:49
MuonTruthAlgsConfig.TruthMuonMakerAlgCfg
def TruthMuonMakerAlgCfg(flags, name="TruthMuonMakerAlg", **kwargs)
Definition: MuonConfig/python/MuonTruthAlgsConfig.py:28