ATLAS Offline Software
Functions
python.MuonReconstructionConfig Namespace Reference

Functions

def StandaloneMuonOutputCfg (flags)
 
def MuonReconstructionCfg (flags)
 
def MuonReconstructionConfigTest (flags=None)
 

Function Documentation

◆ MuonReconstructionCfg()

def python.MuonReconstructionConfig.MuonReconstructionCfg (   flags)

Definition at line 149 of file MuonReconstructionConfig.py.

149 def MuonReconstructionCfg(flags):
150  # https://gitlab.cern.ch/atlas/athena/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py
151  from MuonConfig.MuonPrepDataConvConfig import MuonPrepDataConvCfg
152  from MuonConfig.MuonRecToolsConfig import MuonTrackScoringToolCfg
153  from MuonConfig.MuonGeometryConfig import MuonIdHelperSvcCfg
154  from MuonConfig.MuonRecToolsConfig import MuonEDMHelperSvcCfg
155  from TrkConfig.TrkTrackSummaryToolConfig import MuonTrackSummaryToolCfg
156  from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
157 
158  # Many components need these services, so setup once here.
159  result = MuonIdHelperSvcCfg(flags)
160  result.merge(MuonEDMHelperSvcCfg(flags))
161 
162  # Now setup reconstruction steps
163  result.merge(MuonPrepDataConvCfg(flags))
164  result.merge(MuonSegmentFindingCfg(flags))
165  result.merge(MuonTrackBuildingCfg(flags))
166  result.merge(MuonStandaloneTrackParticleCnvAlgCfg(flags))
167  if flags.Muon.runCommissioningChain:
168  result.merge(MuonStandaloneTrackParticleCnvAlgCfg(flags,
169  "MuonStandaloneTrackParticleCnvAlg_EMEO",
170  TrackContainerName="EMEO_MuonSpectrometerTracks",
171  xAODTrackParticlesFromTracksContainerName="EMEO_MuonSpectrometerTrackParticles"))
172 
173  # FIXME - this is copied from the old configuration, but I'm not sure it really belongs here.
174  # It's probably better to have as part of TrackBuilding, or Segment building...
175  if flags.Input.isMC:
176  # filter TrackRecordCollection (true particles in muon spectrometer)
177  if "MuonEntryLayerFilter" not in flags.Input.Collections:
178  result.addEventAlgo(CompFactory.TrackRecordFilter())
179  if "MuonExitLayerFilter" not in flags.Input.Collections:
180  result.addEventAlgo(CompFactory.TrackRecordFilter("TrackRecordFilterMuonExitLayer",
181  inputName="MuonExitLayer",
182  outputName="MuonExitLayerFilter"))
183 
184  # Now tracks
185  track_cols = ["MuonSpectrometerTracks"]
186  track_colstp = ["MuonSpectrometerTrackParticles"]
187  if flags.Muon.runCommissioningChain:
188  track_cols += ["EMEO_MuonSpectrometerTracks"]
189  track_colstp += ["EMEO_MuonSpectrometerTrackParticles"]
190 
191  from MuonConfig.MuonTruthAlgsConfig import MuonDetailedTrackTruthMakerCfg
192  result.merge(MuonDetailedTrackTruthMakerCfg(flags, name="MuonStandaloneDetailedTrackTruthMaker",
193  TrackCollectionNames=track_cols))
194 
195  for i in range(len(track_cols)):
196  from TrkConfig.TrkTruthAlgsConfig import TrackTruthSelectorCfg, TrackParticleTruthAlgCfg
197  result.merge(TrackTruthSelectorCfg(flags, tracks=track_cols[i]))
198 
199  result.merge(TrackParticleTruthAlgCfg(flags, tracks=track_cols[i],
200  TrackParticleName=track_colstp[i]))
201 
202  # Check if we're making PRDs
203  # FIXME - I think we can remove this flag if we shift this to where PRDs are being created. However, this will involve some refactoring, so temporary fix is this.
204  if flags.Muon.makePRDs:
205  from MuonConfig.MuonRdoDecodeConfig import MuonPRD_MultiTruthMakerCfg
206  result.merge(MuonPRD_MultiTruthMakerCfg(flags))
207 
208  from MuonConfig.MuonTruthAlgsConfig import MuonTruthDecorationAlgCfg
209  result.merge(MuonTruthDecorationAlgCfg(flags))
210 
211  if flags.Muon.doMSVertex:
212  msvertexrecotool = CompFactory.Muon.MSVertexRecoTool(
213  MyExtrapolator=result.popToolsAndMerge(
214  AtlasExtrapolatorCfg(flags)),
215  TGCKey='TGC_MeasurementsAllBCs' if not flags.Muon.useTGCPriorNextBC else 'TGC_Measurements')
216  the_alg = CompFactory.MSVertexRecoAlg(
217  name="MSVertexRecoAlg", MSVertexRecoTool=msvertexrecotool)
218  # Not explicitly configuring MSVertexTrackletTool
219  result.addEventAlgo(the_alg)
220 
221  # FIXME - work around to fix unconfigured public MuonTrackScoringTool
222  # It wuould be best to find who is using this tool, and add this configuration there
223  # But AFAICS the only parent is MuonCombinedFitTagTool, and it's private there, so I'm a bit confused.
224  result.addPublicTool(result.popToolsAndMerge(
225  MuonTrackScoringToolCfg(flags)))
226  # Ditto
227  result.addPublicTool(result.popToolsAndMerge(
228  MuonTrackSummaryToolCfg(flags)))
229 
230  # Setup output
231  if flags.Output.doWriteESD or flags.Output.doWriteAOD:
232  result.merge(StandaloneMuonOutputCfg(flags))
233  return result
234 
235 # Run with python -m MuonConfig.MuonReconstructionConfig

◆ MuonReconstructionConfigTest()

def python.MuonReconstructionConfig.MuonReconstructionConfigTest (   flags = None)

Definition at line 236 of file MuonReconstructionConfig.py.

236 def MuonReconstructionConfigTest(flags=None):
237 
238  if flags is None:
239  from MuonConfig.MuonConfigUtils import SetupMuonStandaloneConfigFlags
240  args, flags = SetupMuonStandaloneConfigFlags()
241  else:
242  args = flags.args()
243  if args is None:
244  raise RuntimeError("MuonReconstructionConfigTest requires flags.fillFromArgs() to be run before flags.lock()")
245 
246  from MuonConfig.MuonConfigUtils import SetupMuonStandaloneCA
247  cfg = SetupMuonStandaloneCA(args, flags)
248 
249  # Run the actual test.
250  acc = MuonReconstructionCfg(flags)
251  cfg.merge(acc)
252 
253  from SGComps.AddressRemappingConfig import InputRenameCfg
254  cfg.merge(InputRenameCfg("TrackCollection",
255  "MuonSpectrometerTracks", "MuonSpectrometerTracks_old"))
256 
257  cfg.printConfig(withDetails=True)
258  # drop faulty remapping
259  # the evaluation of MuonSegmentNameFixCfg should happen conditionally instead
260  # this is hack that is functioning only because this is top level CA
261  oldRemaps = cfg.getService("AddressRemappingSvc").TypeKeyRenameMaps
262  cfg.getService("AddressRemappingSvc").TypeKeyRenameMaps = [
263  remap for remap in oldRemaps if "Trk::SegmentCollection" not in remap]
264 
265  f = open("MuonReconstruction.pkl", "wb")
266  cfg.store(f)
267  f.close()
268 
269  if args.config_only:
270  cfg.wasMerged()
271  else:
272  sc = cfg.run()
273  if not sc.isSuccess():
274  import sys
275  sys.exit("Execution failed")
276 

◆ StandaloneMuonOutputCfg()

def python.MuonReconstructionConfig.StandaloneMuonOutputCfg (   flags)

Definition at line 12 of file MuonReconstructionConfig.py.

12 def StandaloneMuonOutputCfg(flags):
13  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
14  result = ComponentAccumulator()
15 
16  # FIXME! Fix for ATLASRECTS-5151. Remove when better solution found.
17  from TrkEventCnvTools.TrkEventCnvToolsConfig import (
18  TrkEventCnvSuperToolCfg)
19  result.merge(TrkEventCnvSuperToolCfg(flags))
20 
21  aod_items = []
22  if flags.Detector.EnableMM or flags.Detector.EnablesTGC:
23  aod_items += ["xAOD::TrackParticleContainer#EMEO_MuonSpectrometerTrackParticles"]
24  aod_items += ["xAOD::TrackParticleAuxContainer#EMEO_MuonSpectrometerTrackParticlesAux."]
25  aod_items += ["xAOD::MuonSegmentContainer#xAODNSWSegments"]
26  aod_items += ["xAOD::MuonSegmentAuxContainer#xAODNSWSegmentsAux."]
27 
28  aod_items += ["xAOD::MuonSegmentContainer#NCB_MuonSegments"]
29  aod_items += ["xAOD::MuonSegmentAuxContainer#NCB_MuonSegmentsAux."]
30 
31  # TrackParticles
32  aod_items += ["xAOD::TrackParticleContainer#MuonSpectrometerTrackParticles"]
33  aod_items += ["xAOD::TrackParticleAuxContainer#MuonSpectrometerTrackParticlesAux."]
34  aod_items += ["xAOD::TrackParticleContainer#MuonSpectrometerOnlyTrackParticles"]
35  aod_items += ["xAOD::TrackParticleAuxContainer#MuonSpectrometerOnlyTrackParticlesAux."]
36 
37  aod_items += ["xAOD::TrackParticleContainer#MSonlyTracklets"]
38  aod_items += ["xAOD::TrackParticleAuxContainer#MSonlyTrackletsAux."]
39  aod_items += ["xAOD::VertexContainer#MSDisplacedVertex"]
40  aod_items += ["xAOD::VertexAuxContainer#MSDisplacedVertexAux."]
41 
42  if flags.Input.isMC:
43  # Truth Particle Container
44  aod_items += ["xAOD::TruthParticleContainer#MuonTruthParticles"]
45  aod_items += ["xAOD::TruthParticleAuxContainer#MuonTruthParticlesAux."]
46 
47  # Truth Segment Container
48  aod_items += ["xAOD::MuonSegmentContainer#MuonTruthSegments"]
49  aod_items += ["xAOD::MuonSegmentAuxContainer#MuonTruthSegmentsAux."]
50 
51  if flags.Muon.prdToxAOD:
52  aod_items += ["xAOD::TrackMeasurementValidationContainer#MDT_DriftCircles"]
53  aod_items += ["xAOD::TrackMeasurementValidationAuxContainer#MDT_DriftCirclesAux."]
54  aod_items += ["xAOD::TrackMeasurementValidationContainer#RPC_Measurements"]
55  aod_items += ["xAOD::TrackMeasurementValidationAuxContainer#RPC_MeasurementsAux."]
56  aod_items += ["xAOD::TrackMeasurementValidationContainer#TGC_MeasurementsAllBCs"]
57  aod_items += ["xAOD::TrackMeasurementValidationAuxContainer#TGC_MeasurementsAllBCsAux."]
58  if flags.Detector.EnableCSC:
59  aod_items += ["xAOD::TrackMeasurementValidationContainer#CSC_Clusters"]
60  aod_items += ["xAOD::TrackMeasurementValidationAuxContainer#CSC_ClustersAux."]
61 
62  if flags.Muon.rpcRawToxAOD:
63  aod_items += ["xAOD::TrackMeasurementValidationContainer#RPC_RDO_Measurements"]
64  aod_items += ["xAOD::TrackMeasurementValidationAuxContainer#RPC_RDO_MeasurementsAux."]
65 
66  # ESD list includes all AOD items
67  esd_items = []
68  esd_items += aod_items
69 
70  # PRDs et al
71  if flags.Detector.EnableMM:
72  esd_items += ["Muon::MMPrepDataContainer#MM_Measurements"]
73  esd_items += ["xAOD::NSWMMTPRDOContainer#*", "xAOD::NSWMMTPRDOAuxContainer#*"]
74  if flags.Detector.EnablesTGC:
75  esd_items += ["Muon::sTgcPrepDataContainer#STGC_Measurements"]
76  esd_items += ["Muon::NSW_PadTriggerDataContainer#NSW_PadTrigger_RDO"]
77  esd_items += ["xAOD::NSWTPRDOContainer#*", "xAOD::NSWTPRDOAuxContainer#*"]
78 
79 
80  if flags.Detector.EnableCSC:
81  esd_items += ["Muon::CscPrepDataContainer#CSC_Clusters"]
82  esd_items += ["Muon::CscStripPrepDataContainer#CSC_Measurements"]
83  esd_items += ["Muon::RpcPrepDataContainer#RPC_Measurements"]
84  esd_items += ["Muon::TgcPrepDataContainer#TGC_MeasurementsAllBCs"]
85  esd_items += ["Muon::MdtPrepDataContainer#MDT_DriftCircles"]
86 
87  if flags.Muon.writexAODPRD:
88  esd_items += ["xAOD::MdtDriftCircleContainer#*", "xAOD::MdtDriftCircleAuxContainer#*" ]
89  esd_items += ["xAOD::sTgcStripContainer#*", "xAOD::sTgcStripAuxContainer#*" ]
90  esd_items += ["xAOD::MMClusterContainer#*", "xAOD::MMClusterAuxContainer#*" ]
91  esd_items += ["xAOD::TgcStripContainer#*", "xAOD::TgcStripAuxContainer#*" ]
92  esd_items += ["xAOD::RpcStripContainer#*", "xAOD::RpcStripAuxContainer#*" ]
93 
94  # trigger related info for offline DQA
95  esd_items += ["Muon::TgcCoinDataContainer#TrigT1CoinDataCollection"]
96  esd_items += ["Muon::TgcCoinDataContainer#TrigT1CoinDataCollectionPriorBC"]
97  esd_items += ["Muon::TgcCoinDataContainer#TrigT1CoinDataCollectionNextBC"]
98  esd_items += ["Muon::TgcCoinDataContainer#TrigT1CoinDataCollectionNextNextBC"]
99  esd_items += ["Muon::RpcCoinDataContainer#RPC_triggerHits"]
100  esd_items += ["RpcSectorLogicContainer#RPC_SECTORLOGIC"]
101 
102  # trigger info for RPC time calibration
103  if flags.Output.doWriteRDO or flags.Muon.doWriteRpcRDO:
104  esd_items += ["RpcPadContainer#RPCPAD"]
105 
106  # Segments
107  esd_items += ["Trk::SegmentCollection#NCB_TrackMuonSegments"]
108 
109  # Tracks
110  esd_items += ["TrackCollection#MuonSpectrometerTracks"]
111  if flags.Muon.runCommissioningChain:
112  esd_items += ["TrackCollection#EMEO_MuonSpectrometerTracks"]
113  if flags.Detector.EnableMM or flags.Detector.EnablesTGC:
114  esd_items += ["Trk::SegmentCollection#TrackMuonNSWSegments"]
115 
116  # Truth
117  if flags.Input.isMC:
118  esd_items += ["TrackRecordCollection#MuonEntryLayerFilter"]
119  esd_items += ["TrackRecordCollection#MuonExitLayerFilter"]
120 
121  esd_items += ["PRD_MultiTruthCollection#MDT_TruthMap",
122  "PRD_MultiTruthCollection#RPC_TruthMap", "PRD_MultiTruthCollection#TGC_TruthMap"]
123  if flags.Detector.EnableCSC:
124  esd_items += ["PRD_MultiTruthCollection#CSC_TruthMap"]
125  if flags.Detector.EnablesTGC:
126  esd_items += ["PRD_MultiTruthCollection#STGC_TruthMap"]
127  if flags.Detector.EnableMM:
128  esd_items += ["PRD_MultiTruthCollection#MM_TruthMap"]
129 
130  # Track truth
131  esd_items += ["DetailedTrackTruthCollection#MuonSpectrometerTracksTruth"]
132  esd_items += ["TrackTruthCollection#MuonSpectrometerTracksTruth"]
133 
134  if flags.Muon.writeSDOs:
135  if flags.Detector.EnableCSC: esd_items+=["CscSimDataCollection#CSC_SDO"]
136  esd_items+=["MuonSimDataCollection#MDT_SDO"]
137  esd_items+=["MuonSimDataCollection#RPC_SDO"]
138  esd_items+=["MuonSimDataCollection#TGC_SDO"]
139  if flags.Detector.EnablesTGC: esd_items+=["MuonSimDataCollection#sTGC_SDO"]
140  if flags.Detector.EnableMM: esd_items+=["MuonSimDataCollection#MM_SDO"]
141 
142  if flags.Output.doWriteESD:
143  result.merge(OutputStreamCfg(flags, "ESD", esd_items))
144  if flags.Output.doWriteAOD:
145  result.merge(OutputStreamCfg(flags, "AOD", aod_items))
146  return result
147 
148 
python.TrkTruthAlgsConfig.TrackTruthSelectorCfg
def TrackTruthSelectorCfg(flags, name="Selector", tracks="", **kwargs)
Definition: TrkTruthAlgsConfig.py:28
python.TrkTruthAlgsConfig.TrackParticleTruthAlgCfg
def TrackParticleTruthAlgCfg(flags, name="TruthAlg", tracks="", **kwargs)
Definition: TrkTruthAlgsConfig.py:35
python.MuonReconstructionConfig.StandaloneMuonOutputCfg
def StandaloneMuonOutputCfg(flags)
Definition: MuonReconstructionConfig.py:12
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MuonSegmentFindingConfig.MuonSegmentFindingCfg
def MuonSegmentFindingCfg(flags, setup_bytestream=True, cardinality=1)
Definition: MuonSegmentFindingConfig.py:576
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.MuonRecToolsConfig.MuonTrackScoringToolCfg
def MuonTrackScoringToolCfg(flags, name="MuonTrackScoringTool", **kwargs)
Definition: MuonRecToolsConfig.py:132
xAODTrackingCnvConfig.MuonStandaloneTrackParticleCnvAlgCfg
def MuonStandaloneTrackParticleCnvAlgCfg(flags, name="MuonStandaloneTrackParticleCnvAlg", **kwargs)
Definition: xAODTrackingCnvConfig.py:327
python.TrkTrackSummaryToolConfig.MuonTrackSummaryToolCfg
def MuonTrackSummaryToolCfg(flags, name="MuonTrackSummaryTool", **kwargs)
Definition: TrkTrackSummaryToolConfig.py:143
python.MuonReconstructionConfig.MuonReconstructionCfg
def MuonReconstructionCfg(flags)
Definition: MuonReconstructionConfig.py:149
python.MuonConfigUtils.SetupMuonStandaloneCA
def SetupMuonStandaloneCA(args, flags)
Definition: MuonConfigUtils.py:41
python.AtlasExtrapolatorConfig.AtlasExtrapolatorCfg
def AtlasExtrapolatorCfg(flags, name='AtlasExtrapolator')
Definition: AtlasExtrapolatorConfig.py:63
python.MuonTruthAlgsConfig.MuonDetailedTrackTruthMakerCfg
def MuonDetailedTrackTruthMakerCfg(flags, name="MuonDetailedTrackTruthMaker", **kwargs)
Definition: MuonConfig/python/MuonTruthAlgsConfig.py:6
python.TrkEventCnvToolsConfig.TrkEventCnvSuperToolCfg
def TrkEventCnvSuperToolCfg(flags, name='EventCnvSuperTool', **kwargs)
Definition: TrkEventCnvToolsConfig.py:51
python.MuonGeometryConfig.MuonIdHelperSvcCfg
def MuonIdHelperSvcCfg(flags)
Definition: MuonGeometryConfig.py:15
python.MuonTrackBuildingConfig.MuonTrackBuildingCfg
def MuonTrackBuildingCfg(flags, name="MuPatTrackBuilder", **kwargs)
Definition: MuonTrackBuildingConfig.py:498
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.MuonTruthAlgsConfig.MuonTruthDecorationAlgCfg
def MuonTruthDecorationAlgCfg(flags, name="MuonTruthDecorationAlg", **kwargs)
Definition: MuonConfig/python/MuonTruthAlgsConfig.py:21
python.MuonRdoDecodeConfig.MuonPRD_MultiTruthMakerCfg
def MuonPRD_MultiTruthMakerCfg(flags, name="MuonPRD_MultiTruthMaker", **kwargs)
Definition: MuonRdoDecodeConfig.py:331
python.MuonRecToolsConfig.MuonEDMHelperSvcCfg
def MuonEDMHelperSvcCfg(flags, name="MuonEDMHelperSvc", **kwargs)
Definition: MuonRecToolsConfig.py:31
Trk::open
@ open
Definition: BinningType.h:40
python.MuonReconstructionConfig.MuonReconstructionConfigTest
def MuonReconstructionConfigTest(flags=None)
Definition: MuonReconstructionConfig.py:236
python.MuonConfigUtils.SetupMuonStandaloneConfigFlags
def SetupMuonStandaloneConfigFlags(default_input=['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/ESD.16747874._000011_100events.pool.root'])
Definition: MuonConfigUtils.py:6
python.MuonPrepDataConvConfig.MuonPrepDataConvCfg
def MuonPrepDataConvCfg(flags)
Definition: MuonPrepDataConvConfig.py:6
AddressRemappingConfig.InputRenameCfg
def InputRenameCfg(type, from_name, to_name)
Definition: AddressRemappingConfig.py:28