ATLAS Offline Software
Loading...
Searching...
No Matches
MissingETCnvAlg.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: MissingETCnvAlg.cxx 586557 2014-03-06 17:56:05Z krasznaa $
6
7// EDM include(s):
11
12// Only here temporarily, for I/O testing purposes!!!
15
16// Local include(s):
17#include "MissingETCnvAlg.h"
18
19namespace xAODMaker {
20
21 MissingETCnvAlg::MissingETCnvAlg( const std::string& name,
22 ISvcLocator* svcLoc )
23 : AthAlgorithm( name, svcLoc ),
24 m_cnvTool( "xAODMaker::MissingETCnvTool/MissingETCnvTool", this ) {
25
26 declareProperty( "AODKeys", m_aodKeys );
27 declareProperty( "xAODKey", m_xaodKey = "MET_Ref" );
28 declareProperty( "CnvTool", m_cnvTool );
29 }
30
32
33 // Greet the user:
34 ATH_MSG_INFO( "Initializing" );
35 ATH_MSG_DEBUG( " AOD keys = " << m_aodKeys );
36 ATH_MSG_DEBUG( " xAOD key = " << m_xaodKey );
37
38 // Retieve the needed tool(s):
39 ATH_CHECK( m_cnvTool.retrieve() );
40
41 // Return gracefully:
42 return StatusCode::SUCCESS;
43 }
44
46
47 // Create the xAOD containers:
50 xaod->setStore( aux );
51
52 // Loop over the AOD objects:
53 std::vector< std::string >::const_iterator key_itr = m_aodKeys.begin();
54 std::vector< std::string >::const_iterator key_end = m_aodKeys.end();
55 for( ; key_itr != key_end; ++key_itr ) {
56
57 // Try to retrieve the object:
58 const MissingET* met = nullptr;
59 if( evtStore()->retrieve( met, *key_itr ).isFailure() ) {
60 ATH_MSG_WARNING( "Couldn't retrieve MET object with key: "
61 << *key_itr );
62 continue;
63 }
64 ATH_MSG_DEBUG( "Retrieved MET object with key: " << *key_itr );
65
66 // Do the conversion:
67 ATH_CHECK( m_cnvTool->add( met, xaod ) );
68 }
69
70 // Record the xAOD containers:
71 ATH_CHECK( evtStore()->record( xaod, m_xaodKey ) );
72 ATH_CHECK( evtStore()->record( aux, m_xaodKey + "Aux." ) );
73 ATH_MSG_DEBUG( "Recorded xAOD MET container(s) with key: " << m_xaodKey );
74
75 // Only here temporarily, for I/O testing purposes!!!
76 // Record an empty composition map:
80 map->setStore( mapAux );
81
82 ATH_CHECK( evtStore()->record( map, m_xaodKey + "Map" ) );
83 ATH_CHECK( evtStore()->record( mapAux, m_xaodKey + "MapAux." ) );
84
85 // Return gracefully:
86 return StatusCode::SUCCESS;
87 }
88
89} // namespace xAODMaker
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
STL class.
virtual StatusCode execute()
Function executing the algorithm.
MissingETCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
virtual StatusCode initialize()
Function initialising the algorithm.
std::string m_xaodKey
StoreGate key of the output MET container.
std::vector< std::string > m_aodKeys
StoreGate keys of the input MET objects.
ToolHandle< IMissingETCnvTool > m_cnvTool
Handle to the converter tool.
MissingETComponentMap_v1 MissingETComponentMap
Version control by type definition.
MissingETAuxComponentMap_v1 MissingETAuxComponentMap
Version control by type definition.
MissingETAuxContainer_v1 MissingETAuxContainer