ATLAS Offline Software
Loading...
Searching...
No Matches
TriggerTowerCnvTool.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 "TriggerTowerCnvTool.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
35 // Declare the interface(s) provided by the tool:
36 declareInterface< ITriggerTowerCnvTool >( this );
37 }
38
39
51
52 // A small sanity check. The output container should really be empty...
53 if( !xaod->empty() ) {
54 ATH_MSG_WARNING( "The output xAOD container is not empty (size=="
55 << xaod->size() << ")" );
56 }
57
58 // Loop over the ESD objects:
59 for( const auto *const tt : *esd) {
60 // TriggerTowerCollection::const_iterator itr = esd->begin();
61 // TriggerTowerCollection::const_iterator end = esd->end();
62 // for( ; itr != end; ++itr ) {
63 // EM
65 xaod->push_back( x );
66
67 x->initialize(0u, // coolId
68 tt->eta(), // eta
69 tt->phi(), // phi
70 convertVector<uint_least8_t>(tt->emLUT()), // lut_cp
71 convertVector<uint_least8_t>(tt->emLUT()), // lut_jep
72 std::vector<int_least16_t>(tt->emLUT().size(), 0), // correction
73 std::vector<uint_least8_t>(tt->emLUT().size(), 0u), // correnctionEnabled
74 convertVector<uint_least8_t>(tt->emBCIDvec()), // bcidVec
75 convertVector<uint_least16_t>(tt->emADC()), // adc
76 convertVector<uint_least8_t>(tt->emBCIDext()), //bcidExt
77 std::vector<uint_least8_t>(tt->emLUT().size(), 0u), // Sat80Vec
78 static_cast<uint_least16_t>(tt->emError()), // error
79 static_cast<uint_least8_t>(tt->emPeak()), // peak
80 static_cast<uint_least8_t>(tt->emADCPeak())); //adcPeak
81
82 // HAD
84 xaod->push_back( x );
85
86 x->initialize(0u,
87 tt->eta(),
88 tt->phi(),
89 convertVector<uint_least8_t>(tt->hadLUT()),
90 convertVector<uint_least8_t>(tt->hadLUT()),
91 std::vector<int_least16_t>(tt->hadLUT().size(), 0),
92 std::vector<uint_least8_t>(tt->hadLUT().size(), 0u),
93 convertVector<uint_least8_t>(tt->hadBCIDvec()),
95 convertVector<uint_least8_t>(tt->hadBCIDext()),
96 std::vector<uint_least8_t>(tt->hadLUT().size(), 0u),
97 static_cast<uint_least16_t>(tt->hadError()),
98 static_cast<uint_least8_t>(tt->hadPeak()),
99 static_cast<uint_least8_t>(tt->hadADCPeak()));
100 }
101 // Return gracefully:
102 return StatusCode::SUCCESS;
103 }
104
105} // namespace xAODMaker
#define ATH_MSG_WARNING(x)
DataVector< LVL1::TriggerTower > TriggerTowerCollection
CLHEP::HepLorentzVector convertVector(const Pythia8::Vec4 v)
#define x
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
value_type push_back(value_type pElem)
Add an element to the end 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.
TriggerTowerCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
virtual StatusCode convert(const DataVector< LVL1::TriggerTower > *esd, xAOD::TriggerTowerContainer *xaod) override
Function that fills an existing xAOD::EmTauRoIContainer.
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.