ATLAS Offline Software
Loading...
Searching...
No Matches
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
13namespace {
14
16std::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
35namespace xAOD {
36
37// Instantiate the needed accessors:
40 constAccRingsE("ringsE");
41
42// @name RingSet_v1 accessors:
43//==============================================================================
44float &RingSet_v1::at(const unsigned int i) {
45 return accRingsE( *this ).at(i);
46}
47
48//==============================================================================
49float &RingSet_v1::operator [](const unsigned int i) {
50 return accRingsE( *this )[i];
51}
52
53float RingSet_v1::at(const unsigned int i) const {
54 return constAccRingsE( *this ).at(i);
55}
56
57//==============================================================================
58float 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//==============================================================================
70unsigned RingSet_v1::size() const {
71 return (constAccRingsE.isAvailable( *this ) )?
72 constAccRingsE( *this ).size() : 0;
73}
74
75//==============================================================================
76void RingSet_v1::clear() {
77 return accRingsE( *this ).clear();
78}
79
80//==============================================================================
81void 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 ) )?
107}
108
109//==============================================================================
110void 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//==============================================================================
117void 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
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
std::vector< size_t > vec
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
void makePrivateStore()
Create a new (empty) private store for this object.
AuxElement & operator=(const AuxElement &other)
Assignment.
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
bool hasStore() const
Return true if this object has an associated store.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
const SG::AuxVectorData * container() const
Return the container holding this element.
Class holding a set of rings.
Definition RingSet_v1.h:31
void addRing(float r)
add ring to RingSet
RingSet_v1()
Default empty constructor.
Definition RingSet_v1.h:148
std::vector< float >::const_iterator const_iterator
const Iterator to rings Et
Definition RingSet_v1.h:39
iterator begin()
ring begin() iterator
RingSet_v1 & operator=(const RingSet_v1 &clrings)
Assignment Operator.
float & operator[](const unsigned int i)
Get/set ring Et at ith position.
iterator end()
ring end() iterator
unsigned size() const
Get rings size.
void copyTo(std::vector< float > &vec) const
Copy ringset to std::vector end:
const std::vector< float > & ringsE() const
Get rings holden by RingSet.
void clear()
clear rings
float & at(const unsigned int i)
Get/set ring Et at ith position.
std::vector< float >::iterator iterator
Definition RingSet_v1.h:37
void print(std::ostream &stream) const
int r
Definition globals.cxx:22
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
static const SG::AuxElement::ConstAccessor< std::vector< float > > constAccRingsE("ringsE")
static const SG::AuxElement::Accessor< std::vector< float > > accRingsE("ringsE")