ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloEvent
CaloEvent
CaloClusterMomentStore.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef CALOEVENT_CALOCLUSTERMOMENTSTORE_H
6
#define CALOEVENT_CALOCLUSTERMOMENTSTORE_H
7
8
#include "
CaloEvent/CaloClusterMoment.h
"
9
10
#include <vector>
11
#include <map>
12
#include <cstddef>
13
14
class
CaloClusterMomentStore
15
{
16
public
:
17
19
CaloClusterMomentStore
();
21
explicit
CaloClusterMomentStore
(
const
CaloClusterMomentStore
& rMomStore);
22
explicit
CaloClusterMomentStore
(
const
CaloClusterMomentStore
* pMomStore);
24
CaloClusterMomentStore
&
operator=
(
const
CaloClusterMomentStore
& rMomStore);
26
virtual
~CaloClusterMomentStore
();
27
29
typedef
CaloClusterMoment
moment_value
;
31
typedef
CaloClusterMoment::MomentType
moment_type
;
33
typedef
int
moment_key
;
35
typedef
std::map<moment_key,moment_value>
moment_store
;
37
typedef
moment_store::const_iterator
moment_store_const_iter
;
39
typedef
moment_store::iterator
moment_store_iter
;
41
typedef
std::vector<moment_type>
moment_type_list
;
42
43
// Work around ROOT-9709. Hide m_actual from cling --- but that means
44
// that we also need to ensure that the inline functions defined here
45
// are actually emitted out-of-line.
46
#ifdef __CLING__
47
# define ATH_CLING_BODY(BODY) ;
48
#else
49
# define ATH_CLING_BODY(BODY) __attribute__((used)) BODY
50
#endif
51
53
class
CaloClusterMomentIterator
54
{
55
public
:
57
CaloClusterMomentIterator
()
ATH_CLING_BODY
( { } )
59
CaloClusterMomentIterator
(
moment_store_const_iter
iStore)
60
ATH_CLING_BODY
(: m_actual(iStore) { } )
62
#ifdef __clang__
63
~
CaloClusterMomentIterator
();
64
#else
65
~CaloClusterMomentIterator
()
ATH_CLING_BODY
( { } )
66
#endif
67
69
CaloClusterMomentIterator
next
()
70
ATH_CLING_BODY
( { ++m_actual;
return
*
this
; } )
72
CaloClusterMomentIterator
operator
++() {
return
this->
next
(); }
73
74
CaloClusterMomentIterator
operator++
(
int
) {
return
this->
next
(); }
75
77
CaloClusterMomentIterator
prev
()
78
ATH_CLING_BODY
( { --m_actual;
return
*
this
; } )
80
CaloClusterMomentIterator
operator
--() {
return
this->
prev
(); }
81
82
CaloClusterMomentIterator
operator--
(
int
) {
return
this->
prev
(); }
83
89
bool
operator==
(
const
CaloClusterMomentIterator
& anOtherIter)
const
90
ATH_CLING_BODY
( {
return
m_actual == anOtherIter.m_actual; } )
98
bool
operator
==(
CaloClusterMomentIterator
& anOtherIter)
99
ATH_CLING_BODY
( {
return
m_actual == anOtherIter.m_actual; } )
100
106
bool
operator
!=(
const
CaloClusterMomentIterator
& anOtherIter)
const
107
ATH_CLING_BODY
( {
return
m_actual != anOtherIter.m_actual; } )
115
bool
operator
!=(
CaloClusterMomentIterator
& anOtherIter)
116
ATH_CLING_BODY
( {
return
m_actual != anOtherIter.m_actual; } )
117
119
// CaloClusterMoment& operator*() { return this->getMoment(); }
120
const
CaloClusterMoment&
operator
*()
const
{
return
this->getMoment(); }
121
122
// CaloClusterMoment& getMoment() { return (*m_actual).second; }
123
const
CaloClusterMoment& getMoment() const
124
ATH_CLING_BODY
( {
return
(*m_actual).second; } )
126
moment_type
getMomentType()
const
127
ATH_CLING_BODY
( {
return
(
moment_type
)(*m_actual).first; } )
128
129
private
:
130
#ifndef __CLING__
132
moment_store_const_iter
m_actual;
133
#endif
134
};
135
137
typedef
CaloClusterMomentIterator
moment_iterator
;
138
144
virtual
void
insert
(
const
moment_type
& rMomType,
145
const
moment_value
& rMomData);
154
virtual
bool
retrieve
(
const
moment_type
& rMomType,
155
moment_value
& rMomData)
const
;
166
virtual
bool
retrieve
(
const
moment_iterator
& rMomIter,
167
moment_value
& rMomData)
const
;
174
virtual
bool
retrieveMomentTypes
(
moment_type_list
& rMomTypeList)
const
;
176
virtual
moment_iterator
begin
()
const
;
177
virtual
moment_iterator
end
()
const
;
185
virtual
moment_iterator
find
(
const
moment_type
& rMomType)
const
;
190
virtual
bool
contains
(
const
moment_type
& rMomType)
const
;
192
size_t
size
()
const
;
193
198
virtual
const
moment_store
&
momentStore
()
const
;
205
virtual
void
setMomentStore
(
const
moment_store
& rMomStore );
206
virtual
void
setMomentStore
(
moment_store
&& rMomStore );
207
208
private
:
209
210
moment_store
m_store
;
211
};
212
213
inline
void
CaloClusterMomentStore::insert
(
const
moment_type
& rMomType,
214
const
moment_value
& rMomData)
215
{
216
(*(
m_store
.insert(moment_store::value_type((
moment_key
)rMomType,rMomData))).first).second = rMomData;
217
}
218
219
inline
CaloClusterMomentStore::moment_iterator
220
CaloClusterMomentStore::begin
()
const
221
{
222
return
moment_iterator
(
m_store
.begin());
223
}
224
225
inline
CaloClusterMomentStore::moment_iterator
226
CaloClusterMomentStore::end
()
const
227
{
228
return
moment_iterator
(
m_store
.end());
229
}
230
231
inline
CaloClusterMomentStore::moment_iterator
232
CaloClusterMomentStore::find
(
const
moment_type
& rMomType)
const
233
{
234
return
moment_iterator
(
m_store
.find((
moment_key
)rMomType));
235
}
236
237
inline
bool
CaloClusterMomentStore::contains
(
const
moment_type
& rMomType)
const
238
{
239
return
m_store
.find((
moment_key
)rMomType) !=
m_store
.end();
240
}
241
242
inline
size_t
CaloClusterMomentStore::size
()
const
243
{
244
return
m_store
.size();
245
}
246
247
inline
const
CaloClusterMomentStore::moment_store
&
248
CaloClusterMomentStore::momentStore
()
const
249
{
250
return
m_store
;
251
}
252
253
inline
void
CaloClusterMomentStore::setMomentStore
(
const
moment_store
&
254
rMomStore)
255
{
256
m_store
= rMomStore;
257
}
258
inline
void
CaloClusterMomentStore::setMomentStore
(
moment_store
&&
259
rMomStore)
260
{
261
m_store
= std::move(rMomStore);
262
}
263
267
#endif
ATH_CLING_BODY
#define ATH_CLING_BODY(BODY)
Definition
CaloClusterMomentStore.h:49
CaloClusterMoment.h
CaloClusterMomentStore::CaloClusterMomentIterator
Internally used iterator.
Definition
CaloClusterMomentStore.h:54
CaloClusterMomentStore::CaloClusterMomentIterator::operator==
bool operator==(const CaloClusterMomentIterator &anOtherIter) const bool operator
Equality comparator.
CaloClusterMomentStore::CaloClusterMomentIterator::CaloClusterMomentIterator
CaloClusterMomentIterator() ATH_CLING_BODY(
Default constructor.
Definition
CaloClusterMomentStore.h:57
CaloClusterMomentStore::CaloClusterMomentIterator::prev
CaloClusterMomentIterator prev() CaloClusterMomentIterator operator--()
Iterator reverse method.
Definition
CaloClusterMomentStore.h:77
CaloClusterMomentStore::CaloClusterMomentIterator::next
CaloClusterMomentIterator next() CaloClusterMomentIterator operator++()
Iterator advance method.
Definition
CaloClusterMomentStore.h:69
CaloClusterMomentStore::CaloClusterMomentIterator::operator--
CaloClusterMomentIterator operator--(int)
Iterator prior reverse operator.
Definition
CaloClusterMomentStore.h:82
CaloClusterMomentStore::CaloClusterMomentIterator::CaloClusterMomentIterator
CaloClusterMomentIterator(moment_store_const_iter iStore) ~CaloClusterMomentIterator() ATH_CLING_BODY(
Useful constructor.
Definition
CaloClusterMomentStore.h:59
CaloClusterMomentStore::CaloClusterMomentIterator::operator++
CaloClusterMomentIterator operator++(int)
Iterator prior advance operator.
Definition
CaloClusterMomentStore.h:74
CaloClusterMomentStore::moment_type_list
std::vector< moment_type > moment_type_list
List of moment types.
Definition
CaloClusterMomentStore.h:41
CaloClusterMomentStore::moment_store_iter
moment_store::iterator moment_store_iter
Internal moment store iterator type.
Definition
CaloClusterMomentStore.h:39
CaloClusterMomentStore::moment_store_const_iter
moment_store::const_iterator moment_store_const_iter
Internal moment store const iterator type.
Definition
CaloClusterMomentStore.h:37
CaloClusterMomentStore::~CaloClusterMomentStore
virtual ~CaloClusterMomentStore()
Default destructor.
Definition
CaloClusterMomentStore.cxx:33
CaloClusterMomentStore::end
virtual moment_iterator end() const
iterator loop terminator
Definition
CaloClusterMomentStore.h:226
CaloClusterMomentStore::moment_iterator
CaloClusterMomentIterator moment_iterator
External moment iterator type.
Definition
CaloClusterMomentStore.h:137
CaloClusterMomentStore::operator=
CaloClusterMomentStore & operator=(const CaloClusterMomentStore &rMomStore)
Assignment.
Definition
CaloClusterMomentStore.cxx:25
CaloClusterMomentStore::setMomentStore
virtual void setMomentStore(const moment_store &rMomStore)
Set internal store.
Definition
CaloClusterMomentStore.h:253
CaloClusterMomentStore::insert
virtual void insert(const moment_type &rMomType, const moment_value &rMomData)
Insert key/data pair.
Definition
CaloClusterMomentStore.h:213
CaloClusterMomentStore::moment_type
CaloClusterMoment::MomentType moment_type
Moment type.
Definition
CaloClusterMomentStore.h:31
CaloClusterMomentStore::moment_store
std::map< moment_key, moment_value > moment_store
Internal moment store type.
Definition
CaloClusterMomentStore.h:35
CaloClusterMomentStore::momentStore
virtual const moment_store & momentStore() const
Access to internal store.
Definition
CaloClusterMomentStore.h:248
CaloClusterMomentStore::moment_key
int moment_key
Moment key type.
Definition
CaloClusterMomentStore.h:33
CaloClusterMomentStore::retrieveMomentTypes
virtual bool retrieveMomentTypes(moment_type_list &rMomTypeList) const
Retrieve list of moment types in store.
Definition
CaloClusterMomentStore.cxx:58
CaloClusterMomentStore::CaloClusterMomentStore
CaloClusterMomentStore()
Default constructor.
Definition
CaloClusterMomentStore.cxx:9
CaloClusterMomentStore::retrieve
virtual bool retrieve(const moment_type &rMomType, moment_value &rMomData) const
Retrieve cluster moment for a given key.
Definition
CaloClusterMomentStore.cxx:37
CaloClusterMomentStore::moment_value
CaloClusterMoment moment_value
Moment data.
Definition
CaloClusterMomentStore.h:29
CaloClusterMomentStore::find
virtual moment_iterator find(const moment_type &rMomType) const
}
Definition
CaloClusterMomentStore.h:232
CaloClusterMomentStore::size
size_t size() const
Number of stored moments.
Definition
CaloClusterMomentStore.h:242
CaloClusterMomentStore::m_store
moment_store m_store
Definition
CaloClusterMomentStore.h:210
CaloClusterMomentStore::contains
virtual bool contains(const moment_type &rMomType) const
Containment check.
Definition
CaloClusterMomentStore.h:237
CaloClusterMomentStore::begin
virtual moment_iterator begin() const
{
Definition
CaloClusterMomentStore.h:220
CaloClusterMoment
defines enums and data types for different moments of CaloCluster
Definition
CaloClusterMoment.h:29
CaloClusterMoment::MomentType
MomentType
enums to identify different moments
Definition
CaloClusterMoment.h:38
Generated on
for ATLAS Offline Software by
1.17.0