ATLAS Offline Software
SensitiveDetectorsCfg.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 
5 def MdtSensitiveDetectorToolCfg(flags, name = "MdtSensitiveDetector", **kwargs):
6  result = ComponentAccumulator()
7  kwargs.setdefault("OutputCollectionNames", [ "xRawMdtSimHits"])
8  kwargs.setdefault("LogicalVolumeNames", ["MuonR4::MDTDriftGas"])
9  kwargs.setdefault("AlignStoreKey", "MdtActsAlignContainer")
10  the_tool = CompFactory.MuonG4R4.MdtSensitiveDetectorTool(name, **kwargs)
11  from MuonSimHitSorting.MuonSimHitSortingCfg import MuonSimHitSortingAlgCfg
12  result.merge(MuonSimHitSortingAlgCfg(flags,name="MdtSimHitSorterAlg",
13  InContainers=["xRawMdtSimHits"],
14  OutContainer ="xMdtSimHits",
15  deepCopy = True))
16  result.setPrivateTools(the_tool)
17  return result
18 
19 def MmSensitiveDetectorToolCfg(flags, name = "MmSensitiveDetector", **kwargs):
20  result = ComponentAccumulator()
21  kwargs.setdefault("OutputCollectionNames", [ "xRawMmSimHits"])
22  kwargs.setdefault("LogicalVolumeNames", ["MuonR4::actMicroMegaGas"])
23  kwargs.setdefault("AlignStoreKey", "MmActsAlignContainer")
24  the_tool = CompFactory.MuonG4R4.MmSensitiveDetectorTool(name, **kwargs)
25  from MuonSimHitSorting.MuonSimHitSortingCfg import MuonSimHitSortingAlgCfg
26  result.merge(MuonSimHitSortingAlgCfg(flags,name="MmSimHitSorterAlg",
27  InContainers=["xRawMmSimHits"],
28  OutContainer ="xMmSimHits",
29  deepCopy = True))
30  result.setPrivateTools(the_tool)
31  return result
32 
33 def RpcSensitiveDetectorToolCfg(flags, name = "RpcSensitiveDetector", **kwargs):
34  result = ComponentAccumulator()
35  kwargs.setdefault("OutputCollectionNames", [ "xRawRpcSimHits"])
36  kwargs.setdefault("LogicalVolumeNames", ["MuonR4::RpcGasGap"])
37  kwargs.setdefault("AlignStoreKey", "RpcActsAlignContainer")
38  from MuonSimHitSorting.MuonSimHitSortingCfg import MuonSimHitSortingAlgCfg
39  result.merge(MuonSimHitSortingAlgCfg(flags,name="RpcSimHitSorterAlg",
40  InContainers=["xRawRpcSimHits"],
41  OutContainer ="xRpcSimHits",
42  deepCopy = True))
43  the_tool = CompFactory.MuonG4R4.RpcSensitiveDetectorTool(name, **kwargs)
44  result.setPrivateTools(the_tool)
45  return result
46 
47 def TgcSensitiveDetectorToolCfg(flags, name = "TgcSensitiveDetector", **kwargs):
48  result = ComponentAccumulator()
49  kwargs.setdefault("OutputCollectionNames", [ "xRawTgcSimHits"])
50  kwargs.setdefault("LogicalVolumeNames", ["MuonR4::TgcGas"])
51  kwargs.setdefault("AlignStoreKey", "TgcActsAlignContainer")
52  from MuonSimHitSorting.MuonSimHitSortingCfg import MuonSimHitSortingAlgCfg
53  result.merge(MuonSimHitSortingAlgCfg(flags,name="TgcSimHitSorterAlg",
54  InContainers=["xRawTgcSimHits"],
55  OutContainer ="xTgcSimHits",
56  deepCopy = True))
57  the_tool = CompFactory.MuonG4R4.TgcSensitiveDetectorTool(name, **kwargs)
58  result.setPrivateTools(the_tool)
59  return result
60 
61 def sTgcSensitiveDetectorToolCfg(flags, name = "sTgcSensitiveDetector", **kwargs):
62  result = ComponentAccumulator()
63  kwargs.setdefault("OutputCollectionNames", [ "xRawStgcSimHits"])
64  kwargs.setdefault("LogicalVolumeNames", ["MuonR4::sTgcGas"])
65  kwargs.setdefault("AlignStoreKey", "sTgcActsAlignContainer")
66  from MuonSimHitSorting.MuonSimHitSortingCfg import MuonSimHitSortingAlgCfg
67  result.merge(MuonSimHitSortingAlgCfg(flags,name="sTgcSimHitSorterAlg",
68  InContainers=["xRawStgcSimHits"],
69  OutContainer ="xStgcSimHits",
70  deepCopy = True))
71  the_tool = CompFactory.MuonG4R4.sTgcSensitiveDetectorTool(name, **kwargs)
72  result.setPrivateTools(the_tool)
73  return result
74 
75 
77  result = ComponentAccumulator()
78  from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
79  result.merge(MuonGeoModelCfg(flags))
80  tools = []
81 
82  if flags.Detector.EnableMDT:
83  tools += [result.popToolsAndMerge(MdtSensitiveDetectorToolCfg(flags))]
84 
85  if flags.Detector.EnableRPC:
86  tools += [result.popToolsAndMerge(RpcSensitiveDetectorToolCfg(flags))]
87 
88  if flags.Detector.EnableMM:
89  tools += [result.popToolsAndMerge(MmSensitiveDetectorToolCfg(flags))]
90 
91  if flags.Detector.EnableTGC:
92  tools += [result.popToolsAndMerge(TgcSensitiveDetectorToolCfg(flags))]
93  if flags.Detector.EnablesTGC:
94  tools += [result.popToolsAndMerge(sTgcSensitiveDetectorToolCfg(flags))]
95  result.setPrivateTools(tools)
96  return result
97 
98 
100  simHitContainers = []
101  if flags.Detector.EnableMDT:
102  simHitContainers+=[("xAOD::MuonSimHitContainer", "xRawMdtSimHits")]
103  if flags.Detector.EnableMM:
104  simHitContainers+=[("xAOD::MuonSimHitContainer", "xRawMmSimHits")]
105  if flags.Detector.EnableRPC:
106  simHitContainers+=[("xAOD::MuonSimHitContainer", "xRawRpcSimHits")]
107  if flags.Detector.EnableTGC:
108  simHitContainers+=[("xAOD::MuonSimHitContainer", "xRawTgcSimHits")]
109  if flags.Detector.EnablesTGC:
110  simHitContainers+=[("xAOD::MuonSimHitContainer", "xRawStgcSimHits")]
111  return simHitContainers
112 
114  dependcies = []
115  if not flags.Muon.usePhaseIIGeoSetup: return dependcies
116  if flags.Detector.EnableMDT:
117  dependcies+=[("ActsTrk::DetectorAlignStore", "MdtActsAlignContainer")]
118  if flags.Detector.EnableMM:
119  dependcies+=[("ActsTrk::DetectorAlignStore", "MmActsAlignContainer")]
120  if flags.Detector.EnableRPC:
121  dependcies+=[("ActsTrk::DetectorAlignStore", "RpcActsAlignContainer")]
122  if flags.Detector.EnableTGC:
123  dependcies+=[("ActsTrk::DetectorAlignStore", "TgcActsAlignContainer")]
124  if flags.Detector.EnablesTGC:
125  dependcies+=[("ActsTrk::DetectorAlignStore", "sTgcActsAlignContainer")]
126  return dependcies
127 
129  outContainers = []
130  containerNames = []
131  if flags.Detector.EnableMDT:
132  containerNames+=["xMdtSimHits"]
133  if flags.Detector.EnableMM:
134  containerNames+=["xMmSimHits"]
135  if flags.Detector.EnableRPC:
136  containerNames+=["xRpcSimHits"]
137  if flags.Detector.EnableTGC:
138  containerNames+=["xTgcSimHits"]
139  if flags.Detector.EnablesTGC:
140  containerNames+=["xStgcSimHits"]
141 
142  outContainers +=[ f"xAOD::MuonSimHitContainer#{cont}" for cont in containerNames]
143  outContainers +=[ f"xAOD::MuonSimHitAuxContainer#{cont}Aux." for cont in containerNames]
144 
145  return outContainers
146 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
SensitiveDetectorsCfg.RpcSensitiveDetectorToolCfg
def RpcSensitiveDetectorToolCfg(flags, name="RpcSensitiveDetector", **kwargs)
Definition: SensitiveDetectorsCfg.py:33
SensitiveDetectorsCfg.TgcSensitiveDetectorToolCfg
def TgcSensitiveDetectorToolCfg(flags, name="TgcSensitiveDetector", **kwargs)
Definition: SensitiveDetectorsCfg.py:47
MuonSimHitSortingCfg.MuonSimHitSortingAlgCfg
def MuonSimHitSortingAlgCfg(flags, name="MuonSimHitSortingAlg", **kwargs)
Definition: MuonSimHitSortingCfg.py:5
SensitiveDetectorsCfg.MuonDependenciesCfg
def MuonDependenciesCfg(flags)
Definition: SensitiveDetectorsCfg.py:113
SensitiveDetectorsCfg.OutputSimContainersCfg
def OutputSimContainersCfg(flags)
Returns the list of Container names written to the HITS file.
Definition: SensitiveDetectorsCfg.py:128
SensitiveDetectorsCfg.sTgcSensitiveDetectorToolCfg
def sTgcSensitiveDetectorToolCfg(flags, name="sTgcSensitiveDetector", **kwargs)
Definition: SensitiveDetectorsCfg.py:61
SensitiveDetectorsCfg.SimHitContainerListCfg
def SimHitContainerListCfg(flags)
Name of the container names written by the R4 sensitive detectors.
Definition: SensitiveDetectorsCfg.py:99
SensitiveDetectorsCfg.MdtSensitiveDetectorToolCfg
def MdtSensitiveDetectorToolCfg(flags, name="MdtSensitiveDetector", **kwargs)
Definition: SensitiveDetectorsCfg.py:5
SensitiveDetectorsCfg.SetupSensitiveDetectorsCfg
def SetupSensitiveDetectorsCfg(flags)
Definition: SensitiveDetectorsCfg.py:76
SensitiveDetectorsCfg.MmSensitiveDetectorToolCfg
def MmSensitiveDetectorToolCfg(flags, name="MmSensitiveDetector", **kwargs)
Definition: SensitiveDetectorsCfg.py:19
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28