ATLAS Offline Software
JetElementCnvTool.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 "JetElementCnvTool.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< IJetElementCnvTool >( this );
36  }
37 
38 
50 
51  // A small sanity check. The output container should really be empty...
52  if( !xaod->empty() ) {
53  ATH_MSG_WARNING( "The output xAOD container is not empty (size=="
54  << xaod->size() << ")" );
55  }
56 
57  // Loop over the ESD objects:
60  for( ; itr != end; ++itr ) {
61 
63  xaod->push_back( x );
64 
65  x->initialize( (float)(*itr)->eta() ,
66  (float)(*itr)->phi() ,
67  (*itr)->key() ,
68  convertVector<uint16_t>((*itr)->emEnergyVec()) ,
69  convertVector<uint16_t>((*itr)->hadEnergyVec()) ,
70  convertVector<uint32_t>((*itr)->emErrorVec()) ,
71  convertVector<uint32_t>((*itr)->hadErrorVec()) ,
72  convertVector<uint32_t>((*itr)->linkErrorVec()) ,
73  (uint8_t)(*itr)->peak() );
74  }
75 
76  // Return gracefully:
77  return StatusCode::SUCCESS;
78  }
79 
80 } // namespace xAODMaker
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:575
xAOD::JetElement_v2
Description of JetElement_v2.
Definition: JetElement_v2.h:26
convertVector
CLHEP::HepLorentzVector convertVector(const Pythia8::Vec4 v)
Definition: UserSelections.h:17
xAODMaker
Definition: StoreGateSvc.h:72
JetElementCollection.h
x
#define x
JetElementAuxContainer.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
JetElementContainer.h
xAOD::JetElement
JetElement_v2 JetElement
Define the latest version of the JetElement class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/JetElement.h:16
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector< LVL1::JetElement >
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.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAODMaker::JetElementCnvTool::convert
virtual StatusCode convert(const DataVector< LVL1::JetElement > *esd, xAOD::JetElementContainer *xaod) override
Function that fills an existing xAOD::EmTauRoIContainer.
Definition: JetElementCnvTool.cxx:48
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
JetElementCnvTool.h
AthAlgTool
Definition: AthAlgTool.h:26
xAODMaker::JetElementCnvTool::JetElementCnvTool
JetElementCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
Definition: JetElementCnvTool.cxx:29
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.