ATLAS Offline Software
PhotonCnvAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Gaudi/Athena include(s):
7 
8 // EDM include(s):
12 
13 // Local include(s):
14 #include "PhotonCnvAlg.h"
15 
16 
17 namespace xAODMaker {
18 
19  PhotonCnvAlg::PhotonCnvAlg( const std::string& name,
20  ISvcLocator* svcLoc )
21  : AthAlgorithm( name, svcLoc ) {
22 
23  declareProperty( "AODContainerName", m_aodContainerName = "PhotonAODCollection" );
24  declareProperty( "xAODContainerName", m_xaodContainerName = "PhotonCollection" );
25 
26  declareProperty("CnvTool", m_cnvTool, "The converter tool for Photons");
27 
28  }
29 
31 
32  ATH_MSG_DEBUG( "Initializing" );
33  ATH_MSG_DEBUG( "AODContainerName = " << m_aodContainerName );
34  ATH_MSG_DEBUG( "xAODContainerName = " << m_xaodContainerName );
35 
36  CHECK(m_cnvTool.retrieve());
37  // Return gracefully:
38  return StatusCode::SUCCESS;
39  }
40 
42 
43  // Retrieve the AOD particles:
44  const egammaContainer* aod = evtStore()->tryConstRetrieve<egammaContainer>(m_aodContainerName);
45  if (!aod) {
46  ATH_MSG_WARNING("No egammaContainer with key " << m_aodContainerName << " found. Do nothing.");
47  return StatusCode::SUCCESS;
48  }
49  ATH_MSG_DEBUG( "Retrieved particles with key: " << m_aodContainerName );
50 
51  // Create the xAOD container and its auxiliary store:
53  CHECK( evtStore()->record( xaod, m_xaodContainerName ) );
55  CHECK( evtStore()->record( aux, m_xaodContainerName + "Aux." ) );
56  xaod->setStore( aux );
57  ATH_MSG_DEBUG( "Recorded Photons with key: " << m_xaodContainerName );
58 
59  CHECK( m_cnvTool->convert(aod, xaod) );
60  // Return gracefully - like a elephant on roller skates :
61  return StatusCode::SUCCESS;
62  }
63 
64 } // namespace xAODMaker
65 
66 
67 // LocalWords: Gaudi
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAODMaker::PhotonCnvAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: PhotonCnvAlg.cxx:41
xAOD::PhotonAuxContainer
PhotonAuxContainer_v3 PhotonAuxContainer
Definition of the current photon auxiliary container.
Definition: PhotonAuxContainer.h:22
xAODMaker::PhotonCnvAlg::PhotonCnvAlg
PhotonCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
Definition: PhotonCnvAlg.cxx:19
xAODMaker
Definition: StoreGateSvc.h:72
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
egammaContainer
Definition: egammaContainer.h:41
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgorithm
Definition: AthAlgorithm.h:47
xAODMaker::PhotonCnvAlg::m_xaodContainerName
std::string m_xaodContainerName
The key for the output xAOD::PhotonContainer.
Definition: PhotonCnvAlg.h:46
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
xAOD::PhotonContainer
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/PhotonContainer.h:17
PhotonAuxContainer.h
xAOD::PhotonAuxContainer_v3
Auxiliary store for offline photons.
Definition: PhotonAuxContainer_v3.h:36
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAODMaker::PhotonCnvAlg::m_aodContainerName
std::string m_aodContainerName
The key of the input PhotonContainer.
Definition: PhotonCnvAlg.h:44
PhotonCnvAlg.h
xAODMaker::PhotonCnvAlg::m_cnvTool
ToolHandle< IPhotonCnvTool > m_cnvTool
Tools to perform electron identification.
Definition: PhotonCnvAlg.h:49
PhotonContainer.h
xAODMaker::PhotonCnvAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: PhotonCnvAlg.cxx:30
PhotonContainer.h