Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 #include <iostream>
6 
7 // Local include(s).
9 
10 // EDM include(s).
12 
13 namespace {
14 
16 std::ostream& operator<< ( std::ostream& out, const std::vector< float >& vec )
17 {
18  // A little prefix:
19  out << "[";
20  // Print the contents:
21  for( size_t i = 0; i < vec.size(); ++i ) {
22  out << vec[ i ];
23  if( i < vec.size() - 1 ) {
24  out << ", ";
25  }
26  }
27  // A little postfix:
28  out << "]";
29  // Return the stream:
30  return out;
31 }
32 
33 } // private namespace
34 
35 namespace xAOD {
36 
37 // Instantiate the needed accessors:
38 static const SG::AuxElement::Accessor< std::vector<float> > accRingsE("ringsE");
40  constAccRingsE("ringsE");
41 
42 // @name RingSet_v1 accessors:
43 //==============================================================================
44 float &RingSet_v1::at(const unsigned int i) {
45  return accRingsE( *this ).at(i);
46 }
47 
48 //==============================================================================
49 float &RingSet_v1::operator [](const unsigned int i) {
50  return accRingsE( *this )[i];
51 }
52 
53 float RingSet_v1::at(const unsigned int i) const {
54  return constAccRingsE( *this ).at(i);
55 }
56 
57 //==============================================================================
58 float RingSet_v1::operator [](const unsigned int i) const {
59  return constAccRingsE( *this )[i];
60 }
61 
62 //==============================================================================
64  std::vector<float>,
65  ringsE,
66  setRingsE)
67 
68 // @name RingSet_v1 rings interation:
69 //==============================================================================
70 unsigned RingSet_v1::size() const {
71  return (constAccRingsE.isAvailable( *this ) )?
72  constAccRingsE( *this ).size() : 0;
73 }
74 
75 //==============================================================================
76 void RingSet_v1::clear() {
77  return accRingsE( *this ).clear();
78 }
79 
80 //==============================================================================
81 void RingSet_v1::addRing(float r) {
82  return accRingsE( *this ).push_back(r);
83 }
84 
85 //==============================================================================
87  return (accRingsE.isAvailable( *this ) )?
88  accRingsE( *this ).begin() : RingSet_v1::iterator();
89 }
90 
91 //==============================================================================
93  return (accRingsE.isAvailable( *this ) )?
94  accRingsE( *this ).end() : RingSet_v1::iterator();
95 }
96 
97 //==============================================================================
99  return (constAccRingsE.isAvailable( *this ) )?
100  constAccRingsE( *this ).begin() : RingSet_v1::const_iterator();
101 }
102 
103 //==============================================================================
105  return (constAccRingsE.isAvailable( *this ) )?
106  constAccRingsE( *this ).end() : RingSet_v1::const_iterator();
107 }
108 
109 //==============================================================================
110 void RingSet_v1::copyTo(std::vector<float> &vec) const {
111  const std::vector<float> &ringsE = constAccRingsE( *this );
112  vec.insert(vec.end(), ringsE.begin(), ringsE.end());
113 }
114 
115 
116 //==============================================================================
117 void RingSet_v1::print( std::ostream &stream ) const {
118  const std::vector<float> &ringsE = constAccRingsE( *this );
119  stream << ringsE << std::endl;
120 }
121 
122 //==============================================================================
124  if (this != &cl_rings){ // protect against invalid self-assignment
125  if (!this->container() && !this->hasStore() ) {
127  }
128  this->SG::AuxElement::operator=( cl_rings );
129  }
130  // by convention, always return *this
131  return *this;
132 }
133 
134 } // 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:123
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:44
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:9
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:117
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:110
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:86
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:92
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:49
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:81