ATLAS Offline Software
Loading...
Searching...
No Matches
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
17namespace 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
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual StatusCode convert(const TrigL2BphysContainer *aod, xAOD::TrigBphysContainer *xaod) const override
Function that fills an existing xAOD::TrigBphysContainer.
virtual StatusCode initialize() override
Function initialising the tool.
TrigL2BphysContainerCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
ToolHandle< ITrigL2BphysCnvTool > m_cnvTool
TrigBphys_v1 TrigBphys
Definition TrigBphys.h:18
TrigBphysContainer_v1 TrigBphysContainer