ATLAS Offline Software
RingSet_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Local include(s).
7 
8 // EDM include(s).
10 
11 namespace {
12 
14 std::ostream& operator<< ( std::ostream& out, const std::vector< float >& vec )
15 {
16  // A little prefix:
17  out << "[";
18  // Print the contents:
19  for( size_t i = 0; i < vec.size(); ++i ) {
20  out << vec[ i ];
21  if( i < vec.size() - 1 ) {
22  out << ", ";
23  }
24  }
25  // A little postfix:
26  out << "]";
27  // Return the stream:
28  return out;
29 }
30 
31 } // private namespace
32 
33 namespace xAOD {
34 
35 // Instantiate the needed accessors:
36 static const SG::AuxElement::Accessor< std::vector<float> > accRingsE("ringsE");
38  constAccRingsE("ringsE");
39 
40 // @name RingSet_v1 accessors:
41 //==============================================================================
42 float &RingSet_v1::at(const unsigned int i) {
43  return accRingsE( *this ).at(i);
44 }
45 
46 //==============================================================================
47 float &RingSet_v1::operator [](const unsigned int i) {
48  return accRingsE( *this )[i];
49 }
50 
51 float RingSet_v1::at(const unsigned int i) const {
52  return constAccRingsE( *this ).at(i);
53 }
54 
55 //==============================================================================
56 float RingSet_v1::operator [](const unsigned int i) const {
57  return constAccRingsE( *this )[i];
58 }
59 
60 //==============================================================================
62  std::vector<float>,
63  ringsE,
64  setRingsE)
65 
66 // @name RingSet_v1 rings interation:
67 //==============================================================================
68 unsigned RingSet_v1::size() const {
69  return (constAccRingsE.isAvailable( *this ) )?
70  constAccRingsE( *this ).size() : 0;
71 }
72 
73 //==============================================================================
74 void RingSet_v1::clear() {
75  return accRingsE( *this ).clear();
76 }
77 
78 //==============================================================================
79 void RingSet_v1::addRing(float r) {
80  return accRingsE( *this ).push_back(r);
81 }
82 
83 //==============================================================================
85  return (accRingsE.isAvailable( *this ) )?
86  accRingsE( *this ).begin() : RingSet_v1::iterator();
87 }
88 
89 //==============================================================================
91  return (accRingsE.isAvailable( *this ) )?
92  accRingsE( *this ).end() : RingSet_v1::iterator();
93 }
94 
95 //==============================================================================
97  return (constAccRingsE.isAvailable( *this ) )?
98  constAccRingsE( *this ).begin() : RingSet_v1::const_iterator();
99 }
100 
101 //==============================================================================
103  return (constAccRingsE.isAvailable( *this ) )?
104  constAccRingsE( *this ).end() : RingSet_v1::const_iterator();
105 }
106 
107 //==============================================================================
108 void RingSet_v1::copyTo(std::vector<float> &vec) const {
109  const std::vector<float> &ringsE = constAccRingsE( *this );
110  vec.insert(vec.end(), ringsE.begin(), ringsE.end());
111 }
112 
113 
114 //==============================================================================
115 void RingSet_v1::print( std::ostream &stream ) const {
116  const std::vector<float> &ringsE = constAccRingsE( *this );
117  stream << ringsE << std::endl;
118 }
119 
120 //==============================================================================
122  if (this != &cl_rings){ // protect against invalid self-assignment
123  if (!this->container() && !this->hasStore() ) {
125  }
126  this->SG::AuxElement::operator=( cl_rings );
127  }
128  // by convention, always return *this
129  return *this;
130 }
131 
132 } // End of namespace xAOD
beamspotman.r
def r
Definition: beamspotman.py:676
xAOD::RingSet_v1::operator=
RingSet_v1 & operator=(const RingSet_v1 &clrings)
Assignment Operator.
Definition: RingSet_v1.cxx:121
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
AuxStoreAccessorMacros.h
xAOD::RingSet_v1::at
float & at(const unsigned int i)
Get/set ring Et at ith position.
Definition: RingSet_v1.cxx:42
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
RingSet_v1.h
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
xAOD::RingSet_v1
Class holding a set of rings.
Definition: RingSet_v1.h:31
xAOD::RingSet_v1::iterator
std::vector< float >::iterator iterator
Definition: RingSet_v1.h:37
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
xAOD::RingSet_v1::print
void print(std::ostream &stream) const
Definition: RingSet_v1.cxx:115
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::RingSet_v1::copyTo
void copyTo(std::vector< float > &vec) const
Copy ringset to std::vector end:
Definition: RingSet_v1.cxx:108
xAOD::RingSet_v1::ringsE
const std::vector< float > & ringsE() const
Get rings holden by RingSet.
xAOD::RingSet_v1::begin
iterator begin()
ring begin() iterator
Definition: RingSet_v1.cxx:84
operator<<
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
Definition: TestGaudiProperty.cxx:69
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:192
SG::AuxElement::operator=
AuxElement & operator=(const AuxElement &other)
Assignment.
xAOD::RingSet_v1::size
unsigned size() const
Get rings size.
SG::AuxElement::hasStore
bool hasStore() const
Return true if this object has an associated store.
Definition: AuxElement.cxx:398
xAOD::RingSet_v1::const_iterator
std::vector< float >::const_iterator const_iterator
const Iterator to rings Et
Definition: RingSet_v1.h:39
xAOD::RingSet_v1::end
iterator end()
ring end() iterator
Definition: RingSet_v1.cxx:90
xAOD::RingSet_v1::clear
void clear()
clear rings
SG::AuxElement::container
const SG::AuxVectorData * container() const
Return the container holding this element.
xAOD::RingSet_v1::operator[]
float & operator[](const unsigned int i)
Get/set ring Et at ith position.
Definition: RingSet_v1.cxx:47
xAOD::AUXSTORE_OBJECT_SETTER_AND_GETTER
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
Definition: CaloRings_v1.cxx:27
xAOD::RingSet_v1::addRing
void addRing(float r)
add ring to RingSet
Definition: RingSet_v1.cxx:79