ATLAS Offline Software
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 
14 namespace {
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 
20 for(auto i : in) {
21  result.push_back(static_cast<T>(i));
22  }
23  return result;
24  }
25 }
26 
27 namespace 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
83  x = new xAOD::TriggerTower;
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()),
94  convertVector<uint_least16_t>(tt->hadADC()),
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
get_generator_info.result
result
Definition: get_generator_info.py:21
xAODMaker::TriggerTowerCnvTool::convert
virtual StatusCode convert(const DataVector< LVL1::TriggerTower > *esd, xAOD::TriggerTowerContainer *xaod) override
Function that fills an existing xAOD::EmTauRoIContainer.
Definition: TriggerTowerCnvTool.cxx:49
TriggerTowerContainer.h
convertVector
CLHEP::HepLorentzVector convertVector(const Pythia8::Vec4 v)
Definition: UserSelections.h:17
xAODMaker
Definition: StoreGateSvc.h:72
x
#define x
xAODMaker::TriggerTowerCnvTool::TriggerTowerCnvTool
TriggerTowerCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
Definition: TriggerTowerCnvTool.cxx:29
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TriggerTowerCnvTool.h
xAOD::TriggerTower_v2
Description of TriggerTower_v2.
Definition: TriggerTower_v2.h:49
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector< LVL1::TriggerTower >
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.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TriggerTowerCollection.h
AthAlgTool
Definition: AthAlgTool.h:26
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
xAOD::TriggerTower
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/TriggerTower.h:16
TriggerTowerAuxContainer.h