ATLAS Offline Software
TrigL2BphysContainerCnvTool.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 // EDM include(s):
9 
12 
13 // Local include(s):
15 
16 
17 namespace xAODMaker {
18 
20  const std::string& name,
21  const IInterface* parent )
22  : AthAlgTool( type, name, parent ),
23  m_cnvTool( "xAODMaker::TrigL2BphysCnvTool/TrigL2BphysCnvTool", this ) {
24 
25 
26  // Declare the interface(s) provided by the tool:
27  declareInterface< ITrigL2BphysContainerCnvTool >( this );
28  }
29 
31 
32  // Retrieve the converter tool:
33  CHECK( m_cnvTool.retrieve() );
34 
35  // Return gracefully:
36  return StatusCode::SUCCESS;
37  }
38 
39 
41  xAOD::TrigBphysContainer* xaod ) const {
42 
43  if (!aod) {
44  ATH_MSG_ERROR( "Null pointer for input containter" );
45  return StatusCode::FAILURE;
46  }
47  if (!xaod) {
48  ATH_MSG_ERROR( "Null pointer for output containter" );
49  return StatusCode::FAILURE;
50  }
51 
52  ATH_MSG_VERBOSE( "Found " << aod->size() << " input elements" );
53 
54  // Fill the xAOD container:
56  TrigL2BphysContainer::const_iterator cit_aodend = aod->end();
57  for (; cit_aod != cit_aodend; ++cit_aod) {
58  const TrigL2Bphys * aodObj = *cit_aod;
59  xAOD::TrigBphys* xaodObj = new xAOD::TrigBphys();
60  xaod->push_back( xaodObj );
61  CHECK( m_cnvTool->convert( aodObj, xaodObj ) );
62  }
63  ATH_MSG_VERBOSE( "Output Container has now " << xaod->size() << " elements" );
64 
65 
66  // Return gracefully:
67  return StatusCode::SUCCESS;
68  }
69 
70 
71 } // xAODMaker
72 
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
xAODMaker::TrigL2BphysContainerCnvTool::TrigL2BphysContainerCnvTool
TrigL2BphysContainerCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
Definition: TrigL2BphysContainerCnvTool.cxx:19
TrigL2Bphys
Definition: TrigL2Bphys.h:43
xAODMaker::TrigL2BphysContainerCnvTool::m_cnvTool
ToolHandle< ITrigL2BphysCnvTool > m_cnvTool
Definition: TrigL2BphysContainerCnvTool.h:46
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAODMaker
Definition: StoreGateSvc.h:72
TrigL2BphysContainer.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigL2BphysContainerCnvTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigBphys.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAODMaker::TrigL2BphysContainerCnvTool::convert
virtual StatusCode convert(const TrigL2BphysContainer *aod, xAOD::TrigBphysContainer *xaod) const override
Function that fills an existing xAOD::TrigBphysContainer.
Definition: TrigL2BphysContainerCnvTool.cxx:40
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TrigL2Bphys.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAODMaker::TrigL2BphysContainerCnvTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: TrigL2BphysContainerCnvTool.cxx:30
TrigL2BphysContainer
Definition: TrigL2BphysContainer.h:33
xAOD::TrigBphys
TrigBphys_v1 TrigBphys
Definition: TrigBphys.h:18
AthAlgTool
Definition: AthAlgTool.h:26
TrigBphysContainer.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAOD::TrigBphys_v1
Class describing a Bphysics online composite object.
Definition: TrigBphys_v1.h:44
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.