ATLAS Offline Software
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 
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  // 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
xAODMaker::CPMTowerCnvTool::CPMTowerCnvTool
CPMTowerCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
Definition: CPMTowerCnvTool.cxx:29
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
CPMTowerContainer.h
convertVector
CLHEP::HepLorentzVector convertVector(const Pythia8::Vec4 v)
Definition: UserSelections.h:17
xAODMaker
Definition: StoreGateSvc.h:72
xAOD::CPMTower
CPMTower_v2 CPMTower
Define the latest version of the CPMTower class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CPMTower.h:16
x
#define x
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
xAODMaker::CPMTowerCnvTool::convert
virtual StatusCode convert(const DataVector< LVL1::CPMTower > *esd, xAOD::CPMTowerContainer *xaod) override
Function that fills an existing xAOD::EmTauRoIContainer.
Definition: CPMTowerCnvTool.cxx:47
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector< LVL1::CPMTower >
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
CPMTowerCollection.h
CPMTowerCnvTool.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CPMTowerAuxContainer.h
AthAlgTool
Definition: AthAlgTool.h:26
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
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
xAOD::CPMTower_v2
Description of CPMTower_v2.
Definition: CPMTower_v2.h:26