ATLAS Offline Software
ElectronCnvAlg.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 // Old egamma Includes:
10 
11 //New egamma
14 
15 // Local include(s):
16 #include "ElectronCnvAlg.h"
17 
18 
19 namespace xAODMaker {
20 
21  ElectronCnvAlg::ElectronCnvAlg( const std::string& name,
22  ISvcLocator* svcLoc )
23  : AthAlgorithm( name, svcLoc ) {
24 
25  declareProperty( "AODContainerName", m_aodContainerName = "ElectronAODCollection" );
26  declareProperty( "xAODContainerName", m_xaodContainerName = "ElectronCollection" );
27  declareProperty( "xAODContainerFrwdName", m_xaodFrwdContainerName = "FwdElectrons" );
28 
29  declareProperty("CnvTool", m_cnvTool, "The converter tool for Electrons");
30  }
31 
33 
34  ATH_MSG_DEBUG( "Initializing" );
35  ATH_MSG_DEBUG( "AODContainerName = " << m_aodContainerName );
36  ATH_MSG_DEBUG( "xAODContainerName = " << m_xaodContainerName );
37  ATH_MSG_DEBUG( "xAODContainerFrwdName = " << m_xaodFrwdContainerName );
38 
39  CHECK(m_cnvTool.retrieve());
40 
41  // Return gracefully:
42  return StatusCode::SUCCESS;
43  }
44 
46 
47  // Retrieve the AOD particles:
48  const egammaContainer* aod = evtStore()->tryConstRetrieve<egammaContainer>(m_aodContainerName);
49  if (!aod) {
50  ATH_MSG_WARNING("No egammaContainer with key " << m_aodContainerName << " found. Do nothing.");
51  return StatusCode::SUCCESS;
52  }
53  ATH_MSG_DEBUG( "Retrieved particles with key: " << m_aodContainerName );
54 
56 
57  // Create the xAOD container and its auxiliary store:
59  CHECK( evtStore()->record( xaod, m_xaodContainerName ) );
61  CHECK( evtStore()->record( aux, m_xaodContainerName + "Aux." ) );
62  xaod->setStore( aux );
63  ATH_MSG_DEBUG( "Recorded Electrons with key: " << m_xaodContainerName );
64 
65 
66  //Create the container for forward electrons
68  CHECK( evtStore()->record( xaodFrwd, m_xaodFrwdContainerName ) );
70  CHECK( evtStore()->record( auxFrwd, m_xaodFrwdContainerName + "Aux." ) );
71  xaodFrwd->setStore( auxFrwd );
72  ATH_MSG_DEBUG( "Recorded Electrons with key: " << m_xaodFrwdContainerName );
73 
74  CHECK( m_cnvTool->convert(aod, xaod, xaodFrwd) );
75  // Return gracefully - like a elephant on roller skates :
76  return StatusCode::SUCCESS;
77  }
78 
79 } // namespace xAODMaker
80 
xAODMaker::ElectronCnvAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: ElectronCnvAlg.cxx:45
ElectronContainer.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAODMaker::ElectronCnvAlg::m_cnvTool
ToolHandle< IElectronCnvTool > m_cnvTool
Tools to perform electron identification.
Definition: ElectronCnvAlg.h:53
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::ElectronCnvAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: ElectronCnvAlg.cxx:32
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
xAODMaker::ElectronCnvAlg::m_xaodContainerName
std::string m_xaodContainerName
The key for the output xAOD::ElectronContainer.
Definition: ElectronCnvAlg.h:48
xAODMaker::ElectronCnvAlg::m_xaodFrwdContainerName
std::string m_xaodFrwdContainerName
Definition: ElectronCnvAlg.h:49
ElectronContainer.h
ElectronAuxContainer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAODMaker::ElectronCnvAlg::m_aodContainerName
std::string m_aodContainerName
The key of the input ElectronContainer.
Definition: ElectronCnvAlg.h:45
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ElectronCnvAlg.h
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:794
AthAlgorithm
Definition: AthAlgorithm.h:47
xAOD::ElectronAuxContainer
ElectronAuxContainer_v3 ElectronAuxContainer
Definition of the current electron auxiliary container.
Definition: ElectronAuxContainer.h:22
xAOD::ElectronContainer
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
xAOD::ElectronAuxContainer_v3
Container holding the payload of the electron container.
Definition: ElectronAuxContainer_v3.h:36
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAODMaker::ElectronCnvAlg::ElectronCnvAlg
ElectronCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
Definition: ElectronCnvAlg.cxx:21