ATLAS Offline Software
Loading...
Searching...
No Matches
TrigL2BphysCnvAlg.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 "TrigL2BphysCnvAlg.h"
18
19
20namespace xAODMaker {
21
22 TrigL2BphysCnvAlg::TrigL2BphysCnvAlg( const std::string& name,
23 ISvcLocator* svcLoc )
24 : AthAlgorithm( name, svcLoc ),
25 m_cnvTool( "xAODMaker::TrigL2BphysContainerCnvTool/TrigL2BphysContainerCnvTool", this ) {
26
27 declareProperty( "AODKey", m_aodKey = "TrigL2Bphys" );
28 declareProperty( "xAODKey", m_xaodKey = "L2TrigBphys" );
29 declareProperty( "CnvTool", m_cnvTool );
30 }
31
32
34
35 // Greet the user:
36 ATH_MSG_INFO( "Initializing" );
37 ATH_MSG_INFO( " AOD Key: " << m_aodKey );
38 ATH_MSG_INFO( "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 TrigL2BphysContainer* aod = nullptr;
51 if (evtStore()->retrieve( aod, m_aodKey ).isFailure()) {
52 ATH_MSG_WARNING("Requesting in Alg: TrigL2BphysCnvAlg 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 // TrigL2BphysContainer::const_iterator cit_aod = aod->begin();
64 // TrigL2BphysContainer::const_iterator cit_aodend = aod->end();
65 // for (; cit_aod != cit_aodend; ++cit_aod) {
66 // const TrigL2Bphys * aodObj = *cit_aod;
67 // // Create the xAOD object:
68 // xAOD::TrigBphys* xaodObj = new xAOD::TrigBphys();
69 // xaod->push_back( xaodObj );
70 //
71 // CHECK( m_cnvTool->convert( aodObj, xaodObj ) );
72 // }
73
76 xaod->setStore( aux );
77
78 CHECK( m_cnvTool->convert(aod, xaod) );
79
80
81 // Record the xAOD containers:
82 CHECK( evtStore()->record( aux, m_xaodKey + "Aux" ) );
83 CHECK( evtStore()->record( xaod, m_xaodKey ) );
84
85 // Return gracefully:
86 return StatusCode::SUCCESS;
87 }
88
89} // namespace xAODMaker
90
91
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(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)
TrigL2BphysCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
virtual StatusCode initialize()
Function initialising the algorithm.
std::string m_aodKey
StoreGate key of the input container.
virtual StatusCode execute()
Function executing the algorithm.
std::string m_xaodKey
StoreGate key for the output container.
ToolHandle< ITrigL2BphysContainerCnvTool > m_cnvTool
Handle to the converter tool.
TrigBphysAuxContainer_v1 TrigBphysAuxContainer
TrigBphysContainer_v1 TrigBphysContainer