ATLAS Offline Software
Loading...
Searching...
No Matches
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
19namespace 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
#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.
std::string m_xaodContainerName
The key for the output xAOD::ElectronContainer.
ToolHandle< IElectronCnvTool > m_cnvTool
Tools to perform electron identification.
std::string m_xaodFrwdContainerName
virtual StatusCode execute()
Function executing the algorithm.
ElectronCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
std::string m_aodContainerName
The key of the input ElectronContainer.
virtual StatusCode initialize()
Function initialising the algorithm.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
ElectronAuxContainer_v3 ElectronAuxContainer
Definition of the current electron auxiliary container.