ATLAS Offline Software
TrigEFBphysCnvAlg.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:$ //
6 
7 // Gaudi/Athena include(s):
9 
10 // EDM include(s):
15 
16 // Local include(s):
17 #include "TrigEFBphysCnvAlg.h"
18 
19 
20 namespace xAODMaker {
21 
23  ISvcLocator* svcLoc )
24  : AthAlgorithm( name, svcLoc ),
25  m_cnvTool( "xAODMaker::TrigEFBphysContainerCnvTool/TrigEFBphysContainerCnvTool", this ) {
26 
27  declareProperty( "AODKey", m_aodKey = "TrigEFBphys" );
28  declareProperty( "xAODKey", m_xaodKey = "xAODTrigEFBphys" );
29  declareProperty( "CnvTool", m_cnvTool );
30  }
31 
32 
34 
35  // Greet the user:
36  ATH_MSG_INFO( "Initializing" );
37  ATH_MSG_DEBUG( " AOD Key: " << m_aodKey );
38  ATH_MSG_DEBUG( "xAOD Key: " << m_xaodKey );
39 
40  // Retrieve the converter tool:
41  CHECK( m_cnvTool.retrieve() );
42 
43  // Return gracefully:
44  return StatusCode::SUCCESS;
45  }
46 
48 
49  // Retrieve the AOD container:
50  const TrigEFBphysContainer* aod = nullptr;
51  if (evtStore()->retrieve( aod, m_aodKey ).isFailure()) {
52  ATH_MSG_WARNING("Requesting in Alg: TrigEFBphysCnvAlg to convert AOD Key: " << m_aodKey <<
53  " into xAOD " << m_xaodKey << ". Input container not found or incorrect type");
54  return StatusCode::SUCCESS;
55  }
56 
57  // // Create the xAOD container and its auxiliary store:
58  // xAOD::TrigBphysAuxContainer* aux = new xAOD::TrigBphysAuxContainer();
59  // xAOD::TrigBphysContainer* xaod = new xAOD::TrigBphysContainer();
60  // xaod->setStore( aux );
61  //
62  // // Fill the xAOD container:
63  // TrigEFBphysContainer::const_iterator cit_aod = aod->begin();
64  // TrigEFBphysContainer::const_iterator cit_aodend = aod->end();
65  // for (; cit_aod != cit_aodend; ++cit_aod) {
66  // const TrigEFBphys * aodObj = *cit_aod;
67  // xAOD::TrigBphys* xaodObj = new xAOD::TrigBphys();
68  // xaod->push_back( xaodObj );
69  // CHECK( m_cnvTool->convert( aodObj, xaodObj ) );
70  // }
71 
74  xaod->setStore( aux );
75 
76  CHECK( m_cnvTool->convert(aod, xaod) );
77 
78  // Record the xAOD containers:
79  CHECK( evtStore()->record( xaod, m_xaodKey ) );
80  CHECK( evtStore()->record( aux, m_xaodKey + "Aux" ) );
81 
82  // Return gracefully:
83  return StatusCode::SUCCESS;
84  }
85 
86 } // namespace xAODMaker
87 
88 
89 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAODMaker
Definition: StoreGateSvc.h:72
TrigBphysAuxContainer.h
xAODMaker::TrigEFBphysCnvAlg::m_xaodKey
std::string m_xaodKey
StoreGate key for the output container.
Definition: TrigEFBphysCnvAlg.h:43
xAODMaker::TrigEFBphysCnvAlg::m_cnvTool
ToolHandle< ITrigEFBphysContainerCnvTool > m_cnvTool
Handle to the converter tool.
Definition: TrigEFBphysCnvAlg.h:46
TrigEFBphysContainer.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
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
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAODMaker::TrigEFBphysCnvAlg::m_aodKey
std::string m_aodKey
StoreGate key of the input container.
Definition: TrigEFBphysCnvAlg.h:41
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgorithm
Definition: AthAlgorithm.h:47
xAOD::TrigBphysAuxContainer
TrigBphysAuxContainer_v1 TrigBphysAuxContainer
Definition: TrigBphysAuxContainer.h:12
TrigEFBphys.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
errorcheck.h
Helpers for checking error return status codes and reporting errors.
xAODMaker::TrigEFBphysCnvAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: TrigEFBphysCnvAlg.cxx:33
xAODMaker::TrigEFBphysCnvAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: TrigEFBphysCnvAlg.cxx:47
xAOD::TrigBphysContainer
TrigBphysContainer_v1 TrigBphysContainer
Definition: TrigBphysContainer.h:12
TrigEFBphysCnvAlg.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAODMaker::TrigEFBphysCnvAlg::TrigEFBphysCnvAlg
TrigEFBphysCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition: TrigEFBphysCnvAlg.cxx:22
xAOD::TrigBphysAuxContainer_v1
Auxiliary store for the TrigBphys composite container.
Definition: TrigBphysAuxContainer_v1.h:36
TrigEFBphysContainer
Definition: TrigEFBphysContainer.h:34
TrigBphysContainer.h