ATLAS Offline Software
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 
19 namespace xAODMaker {
20 
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
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::MissingETComponentMap_v1
Definition: MissingETComponentMap_v1.h:25
xAOD::MissingETAuxComponentMap_v1
Auxiliary data store for xAOD::MissingETComponentMap_v1.
Definition: MissingETAuxComponentMap_v1.h:26
MissingET.h
xAOD::MissingETAuxComponentMap
MissingETAuxComponentMap_v1 MissingETAuxComponentMap
Version control by type definition.
Definition: MissingETAuxComponentMap.h:15
xAOD::MissingETAuxContainer
MissingETAuxContainer_v1 MissingETAuxContainer
Definition: MissingETAuxContainer.h:16
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAODMaker::MissingETCnvAlg::MissingETCnvAlg
MissingETCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition: MissingETCnvAlg.cxx:21
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
MissingETAuxComponentMap.h
xAOD::MissingETContainer
MissingETContainer_v1 MissingETContainer
Definition: Event/xAOD/xAODMissingET/xAODMissingET/MissingETContainer.h:16
xAODMaker::MissingETCnvAlg::m_xaodKey
std::string m_xaodKey
StoreGate key of the output MET container.
Definition: MissingETCnvAlg.h:49
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
met
Definition: IMETSignificance.h:24
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
MissingETAuxContainer.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::MissingETAuxContainer_v1
Auxiliary data store for xAOD::MissingETContainer.
Definition: MissingETAuxContainer_v1.h:20
AthAlgorithm
Definition: AthAlgorithm.h:47
xAOD::MissingETContainer_v1
Container for xAOD::MissingET_v1 objects.
Definition: MissingETContainer_v1.h:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAODMaker::MissingETCnvAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: MissingETCnvAlg.cxx:31
xAODMaker::MissingETCnvAlg::m_aodKeys
std::vector< std::string > m_aodKeys
StoreGate keys of the input MET objects.
Definition: MissingETCnvAlg.h:47
MissingETComponentMap.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::MissingETComponentMap
MissingETComponentMap_v1 MissingETComponentMap
Version control by type definition.
Definition: MissingETComponentMap.h:16
MissingET
Definition: Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:23
MissingETCnvAlg.h
xAODMaker::MissingETCnvAlg::m_cnvTool
ToolHandle< IMissingETCnvTool > m_cnvTool
Handle to the converter tool.
Definition: MissingETCnvAlg.h:52
xAODMaker::MissingETCnvAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: MissingETCnvAlg.cxx:45
MissingETContainer.h