ATLAS Offline Software
Loading...
Searching...
No Matches
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
17namespace 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
41 StatusCode PhotonCnvAlg::execute() {
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
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
This is a data object, containing a collection of egamma Objects.
virtual StatusCode execute()
Function executing the algorithm.
std::string m_xaodContainerName
The key for the output xAOD::PhotonContainer.
PhotonCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
std::string m_aodContainerName
The key of the input PhotonContainer.
ToolHandle< IPhotonCnvTool > m_cnvTool
Tools to perform electron identification.
virtual StatusCode initialize()
Function initialising the algorithm.
PhotonAuxContainer_v3 PhotonAuxContainer
Definition of the current photon auxiliary container.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".