ATLAS Offline Software
Loading...
Searching...
No Matches
CPMTowerCnvTool.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
6// EDM include(s):
10
11// Local include(s):
12#include "CPMTowerCnvTool.h"
13
14namespace {
15 template <typename T>
16 std::vector<T> convertVector(const std::vector<int>& in) {
17 std::vector<T> result;
18 result.reserve(in.size());
19
20for(auto i : in) {
21 result.push_back(static_cast<T>(i));
22 }
23 return result;
24 }
25}
26
27namespace xAODMaker {
28
30 const std::string& name,
31 const IInterface* parent )
32 : AthAlgTool( type, name, parent ) {
33
34 // Declare the interface(s) provided by the tool:
35 declareInterface< ICPMTowerCnvTool >( this );
36 }
37
49
50 // A small sanity check. The output container should really be empty...
51 if( !xaod->empty() ) {
52 ATH_MSG_WARNING( "The output xAOD container is not empty (size=="
53 << xaod->size() << ")" );
54 }
55
56 // Loop over the ESD objects:
59 for( ; itr != end; ++itr ) {
60
62 xaod->push_back( x );
63
64 x->initialize( (float)(*itr)->eta() ,
65 (float)(*itr)->phi() ,
66 convertVector<uint8_t>((*itr)->emEnergyVec() ) ,
67 convertVector<uint8_t>((*itr)->hadEnergyVec() ) ,
68 convertVector<uint32_t>((*itr)->emErrorVec() ) ,
69 convertVector<uint32_t>((*itr)->hadErrorVec() ) ,
70 (uint8_t)(*itr)->peak() );
71
72 }
73
74 // Return gracefully:
75 return StatusCode::SUCCESS;
76 }
77
78} // namespace xAODMaker
#define ATH_MSG_WARNING(x)
DataVector< LVL1::CPMTower > CPMTowerCollection
Container class for CPMTowers.
CLHEP::HepLorentzVector convertVector(const Pythia8::Vec4 v)
#define x
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.
bool empty() const noexcept
Returns true if the collection is empty.
virtual StatusCode convert(const DataVector< LVL1::CPMTower > *esd, xAOD::CPMTowerContainer *xaod) override
Function that fills an existing xAOD::EmTauRoIContainer.
CPMTowerCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
CPMTowerContainer_v2 CPMTowerContainer
Define the latest version of the CPMHits container.
CPMTower_v2 CPMTower
Define the latest version of the CPMTower class.