ATLAS Offline Software
MuonFeatureCnvAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id:$ //
6 
7 // Gaudi/Athena include(s):
9 
10 // EDM include(s):
17 
18 // Local include(s):
19 #include "MuonFeatureCnvAlg.h"
20 
21 
22 namespace xAODMaker {
23 
24  MuonFeatureCnvAlg::MuonFeatureCnvAlg( const std::string& name, ISvcLocator* svcLoc ) :
25  AthAlgorithm( name, svcLoc ),
26  m_converterTool( "MuonFeatureCnvTool/MuonFeatureCnvTool")
27  {
28  declareProperty( "AODMuonFeatureContainerName", m_mfName = "HLT" );
29  declareProperty( "AODMuonFeatureDetailsContainerName", m_mfdName = "HLT" );
30  declareProperty( "xAODL2StandAloneMuonContainerName", m_xaodName = "L2StandAloneMuon" );
31  declareProperty( "ConverterTool", m_converterTool );
32  }
33 
35 
36  // Greet the user:
37  ATH_MSG_INFO( "Initializing" );
38  ATH_MSG_INFO( "AOD MuonFeatureContainer Name: " << m_mfName );
39  ATH_MSG_INFO( "AOD MuonFeatureDetailsContainer Name: " << m_mfdName );
40  ATH_MSG_INFO( "xAOD L2StandAloneMuonContainer Name: " << m_xaodName );
41  ATH_MSG_INFO( "ConverterTool = " << m_converterTool.typeAndName());
42 
43  // Retrieve the converter tool:
44  ATH_CHECK( m_converterTool.retrieve() );
45 
46  // Return gracefully:
47  return StatusCode::SUCCESS;
48  }
49 
51 
52  // Retrieve the AOD container:
53  // MuonFeature
54  const MuonFeatureContainer* aod_mf = nullptr;
55  if (evtStore()->retrieve( aod_mf, m_mfName ).isFailure()) {
56  ATH_MSG_WARNING("Requesting in Alg: MuonFeatureCnvAlg to convert AOD MuonFeatureContainer name: " << m_mfName <<
57  " into xAOD " << m_xaodName << ". Input container not found or incorrect type");
58  return StatusCode::SUCCESS;
59  }
60 
61  // MuonFeatureDetails
62  const MuonFeatureDetailsContainer* aod_mfd = nullptr;
63  if (evtStore()->retrieve( aod_mfd, m_mfName ).isFailure()) {
64  ATH_MSG_WARNING("Requesting in Alg: MuonFeatureCnvAlg to convert AOD MuonFeatureDetailsContainer name: " << m_mfdName <<
65  " into xAOD " << m_xaodName << ". Input container not found or incorrect type");
66  return StatusCode::SUCCESS;
67  }
68 
71 
72  xaod->setStore( aux );
73 
74  CHECK( m_converterTool->convertMuonFeatureContainer(aod_mf, aod_mfd, xaod) );
75 
76  // Record the xAOD containers:
77  CHECK( evtStore()->record( xaod, m_xaodName ) );
78  CHECK( evtStore()->record( aux, m_xaodName + "Aux" ) );
79 
80  // Return gracefully:
81  return StatusCode::SUCCESS;
82  }
83 
84 } // namespace xAODMaker
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAODMaker::MuonFeatureCnvAlg::m_xaodName
std::string m_xaodName
StoreGate key for the output container.
Definition: MuonFeatureCnvAlg.h:44
xAODMaker::MuonFeatureCnvAlg::m_mfName
std::string m_mfName
StoreGate key of the input container.
Definition: MuonFeatureCnvAlg.h:41
MuonFeatureDetails.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
L2StandAloneMuonContainer.h
xAODMaker::MuonFeatureCnvAlg::m_converterTool
ToolHandle< IMuonFeatureCnvTool > m_converterTool
Handle to the converter tool.
Definition: MuonFeatureCnvAlg.h:47
xAODMaker
Definition: StoreGateSvc.h:72
MuonFeatureDetailsContainer.h
xAOD::L2StandAloneMuonAuxContainer
L2StandAloneMuonAuxContainer_v2 L2StandAloneMuonAuxContainer
Define the latest version of the muon SA auxiliary container.
Definition: L2StandAloneMuonAuxContainer.h:16
xAODMaker::MuonFeatureCnvAlg::MuonFeatureCnvAlg
MuonFeatureCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition: MuonFeatureCnvAlg.cxx:24
MuonFeature.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
MuonFeatureCnvAlg.h
xAODMaker::MuonFeatureCnvAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: MuonFeatureCnvAlg.cxx:50
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::L2StandAloneMuonContainer
L2StandAloneMuonContainer_v2 L2StandAloneMuonContainer
Define the latest version of the muon SA container.
Definition: L2StandAloneMuonContainer.h:17
MuonFeatureContainer
Definition: MuonFeatureContainer.h:16
xAODMaker::MuonFeatureCnvAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: MuonFeatureCnvAlg.cxx:34
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAOD::L2StandAloneMuonAuxContainer_v2
Auxiliary container for muon SA containers.
Definition: L2StandAloneMuonAuxContainer_v2.h:32
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
AthAlgorithm
Definition: AthAlgorithm.h:47
MuonFeatureContainer.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAODMaker::MuonFeatureCnvAlg::m_mfdName
std::string m_mfdName
Definition: MuonFeatureCnvAlg.h:42
MuonFeatureDetailsContainer
Definition: MuonFeatureDetailsContainer.h:12
L2StandAloneMuonAuxContainer.h