ATLAS Offline Software
Loading...
Searching...
No Matches
JEMEtSumsCnvTool.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 "JEMEtSumsCnvTool.h"
13
14namespace {
15 template <typename T>
16 std::vector<T> convertVector(const std::vector<int>& in) {
17 std::vector<T> result;
18 for(auto i : in) {
19 result.push_back(static_cast<T>(i));
20 }
21 return result;
22 }
23}
24
25namespace {
26 template <typename T>
27 std::vector<T> convertVector(const std::vector<unsigned int>& in) {
28 std::vector<T> result;
29 result.reserve(in.size());
30
31for(auto i : in) {
32 result.push_back(static_cast<T>(i));
33 }
34 return result;
35 }
36}
37
38namespace xAODMaker {
39
41 const std::string& name,
42 const IInterface* parent )
43 : AthAlgTool( type, name, parent ) {
44
45 // Declare the interface(s) provided by the tool:
46 declareInterface< IJEMEtSumsCnvTool >( this );
47 }
48
49
61
62 // A small sanity check. The output container should really be empty...
63 if( !xaod->empty() ) {
64 ATH_MSG_WARNING( "The output xAOD container is not empty (size=="
65 << xaod->size() << ")" );
66 }
67
68 // Loop over the ESD objects:
71 for( ; itr != end; ++itr ) {
72
74 xaod->push_back( x );
75
76 x->initialize( (uint_least8_t)(*itr)->crate() ,
77 (uint_least8_t)(*itr)->module() ,
78 convertVector<uint_least16_t>((*itr)->EtVec()) ,
79 convertVector<uint_least16_t>((*itr)->ExVec()) ,
80 convertVector<uint_least16_t>((*itr)->EyVec()) ,
81 (uint_least8_t)(*itr)->peak() );
82 }
83
84 // Return gracefully:
85 return StatusCode::SUCCESS;
86 }
87
88} // namespace xAODMaker
#define ATH_MSG_WARNING(x)
DataVector< LVL1::JEMEtSums > JEMEtSumsCollection
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.
JEMEtSumsCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
virtual StatusCode convert(const DataVector< LVL1::JEMEtSums > *esd, xAOD::JEMEtSumsContainer *xaod) override
Function that fills an existing xAOD::EmTauRoIContainer.
JEMEtSums_v2 JEMEtSums
Define the latest version of the JEMEtSums class.
JEMEtSumsContainer_v2 JEMEtSumsContainer
Define the latest version of the JEMEtSums container.