ATLAS Offline Software
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 
14 namespace {
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 
25 namespace {
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 
31 for(auto i : in) {
32  result.push_back(static_cast<T>(i));
33  }
34  return result;
35  }
36 }
37 
38 namespace 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
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
xAOD::JEMEtSums
JEMEtSums_v2 JEMEtSums
Define the latest version of the JEMEtSums class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/JEMEtSums.h:15
get_generator_info.result
result
Definition: get_generator_info.py:21
xAODMaker::JEMEtSumsCnvTool::convert
virtual StatusCode convert(const DataVector< LVL1::JEMEtSums > *esd, xAOD::JEMEtSumsContainer *xaod) override
Function that fills an existing xAOD::EmTauRoIContainer.
Definition: JEMEtSumsCnvTool.cxx:59
JEMEtSumsAuxContainer.h
convertVector
CLHEP::HepLorentzVector convertVector(const Pythia8::Vec4 v)
Definition: UserSelections.h:17
xAODMaker
Definition: StoreGateSvc.h:72
x
#define x
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
JEMEtSumsContainer.h
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
xAOD::JEMEtSums_v2
Description of JEMEtSums_v2.
Definition: JEMEtSums_v2.h:26
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector< LVL1::JEMEtSums >
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
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
JEMEtSumsCnvTool.h
AthAlgTool
Definition: AthAlgTool.h:26
xAODMaker::JEMEtSumsCnvTool::JEMEtSumsCnvTool
JEMEtSumsCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
Definition: JEMEtSumsCnvTool.cxx:40
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.
JEMEtSumsCollection.h