ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloEvent
src
CaloSamplingData.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
CaloEvent/CaloSamplingData.h
"
7
8
#include <iterator>
9
#include <algorithm>
10
15
CaloSamplingData::CaloSamplingData
()
16
:
m_varTypePattern
(0)
17
{
18
this->
setupStores
();
19
}
20
21
CaloSamplingData::CaloSamplingData
(
unsigned
int
varTypePattern)
22
:
m_varTypePattern
(
CaloVariableType
::setConstMarker(varTypePattern))
23
{
24
this->
setupStores
();
25
}
26
27
CaloSamplingData::CaloSamplingData
(
const
CaloSamplingData
& rData)
28
29
30
=
default
;
31
32
CaloSamplingData::CaloSamplingData
(
const
CaloSamplingData
* pData)
33
:
m_dataStore
(pData->
m_dataStore
),
34
m_varTypePattern
(pData->
m_varTypePattern
)
35
{
36
}
37
38
CaloSamplingData
&
CaloSamplingData::operator=
(
const
CaloSamplingData
& other)
39
{
40
if
(
this
!= &other) {
41
m_dataStore
= other.m_dataStore;
42
m_varTypePattern
= other.m_varTypePattern;
43
}
44
return
*
this
;
45
}
46
47
CaloSamplingData::~CaloSamplingData
()
48
=
default
;
49
50
51
void
CaloSamplingData::swap
(
CaloSamplingData
& other)
52
{
53
m_dataStore
.swap (other.m_dataStore);
54
std::swap
(
m_varTypePattern
, other.m_varTypePattern);
55
}
56
57
68
bool
69
CaloSamplingData::retrieveData
(
variable_key_type
theVariable,
70
vector_type
& theData)
const
71
{
72
variable_store_type::const_iterator beg =
73
m_dataStore
.begin() +
index
(theVariable, 0);
74
theData.assign (beg, beg +
fastNsamp
());
75
return
!theData.empty();
76
}
77
94
bool
CaloSamplingData::storeData
(
variable_key_type
theVariable,
95
const
vector_type
& theData)
96
{
97
return
storeData
(theVariable, theData.begin(), theData.end());
98
}
99
109
bool
CaloSamplingData::storeData
(
variable_key_type
theVariable,
110
sampling_key_type
theSampling,
111
value_type
theData)
112
{
113
bool
testWrite = this->
checkBitPattern
(theVariable);
114
if
( testWrite )
115
{
116
m_dataStore
[
index
(theVariable,theSampling)] = theData;
117
}
118
return
testWrite;
119
}
120
130
size_t
131
CaloSamplingData::getNumberOfSamplings
(
variable_key_type
theVariable)
const
132
{
133
variable_store_type::const_iterator beg =
134
m_dataStore
.begin() +
index
(theVariable, 0);
135
return
size_t(std::count_if(beg, beg +
fastNsamp
(),
136
IsValidData
()));
137
}
138
139
bool
140
CaloSamplingData::setupStores
()
141
{
142
//size_t samplingSize(this->getNumberOfSamplings());
143
size_t
variableSize(this->
getNumberOfVariableTypes
());
144
// preset store with default values (empty variable lists)
145
m_dataStore
.resize(
index
(variableSize, 0));
146
return
!
m_dataStore
.empty();
147
}
148
149
bool
150
CaloSamplingData::clearBitPattern
(
variable_key_type
theVariable)
151
{
152
unsigned
int
extractBit = this->
getBitPattern
(theVariable);
153
m_varTypePattern
=
m_varTypePattern
& ~extractBit ;
154
return
(
m_varTypePattern
& extractBit ) == 0;
155
}
156
157
bool
158
CaloSamplingData::clearBitPattern
()
159
{
160
bool
testConst = this->
testConstPattern
();
161
m_varTypePattern
=
m_varTypePattern
&
~m_varTypePattern
;
162
if
( testConst )
163
m_varTypePattern
=
CaloVariableType::setConstMarker
(
m_varTypePattern
);
164
return
true
;
165
}
166
167
bool
168
CaloSamplingData::checkBitPattern
(
variable_key_type
theVariable)
169
{
170
if
( this->
testConstPattern
() )
return
this->
testBitPattern
(theVariable);
171
m_varTypePattern
=
m_varTypePattern
| this->
getBitPattern
(theVariable);
172
return
true
;
173
}
CaloSamplingData.h
CaloSamplingData::IsValidData
Functor to check if data is valid (non-zero).
Definition
CaloSamplingData.h:99
CaloSamplingData
Simple data object to store all variables in calorimeter samplings.
Definition
CaloSamplingData.h:18
CaloSamplingData::getBitPattern
unsigned int getBitPattern(variable_key_type theVariable) const
Definition
CaloSamplingData.h:286
CaloSamplingData::swap
void swap(CaloSamplingData &other)
Definition
CaloSamplingData.cxx:51
CaloSamplingData::fastNsamp
size_t fastNsamp() const
Definition
CaloSamplingData.h:307
CaloSamplingData::getNumberOfSamplings
size_t getNumberOfSamplings() const
Set variable type pattern for this store.
Definition
CaloSamplingData.h:186
CaloSamplingData::vector_type
std::vector< value_type > vector_type
Vector type for data exchange (read/write).
Definition
CaloSamplingData.h:34
CaloSamplingData::variable_key_type
CaloVariableType::VariableType variable_key_type
Variable look-up type.
Definition
CaloSamplingData.h:24
CaloSamplingData::m_varTypePattern
unsigned int m_varTypePattern
Definition
CaloSamplingData.h:117
CaloSamplingData::checkBitPattern
bool checkBitPattern(variable_key_type theVariable)
Definition
CaloSamplingData.cxx:168
CaloSamplingData::CaloSamplingData
CaloSamplingData()
Constructor.
Definition
CaloSamplingData.cxx:15
CaloSamplingData::retrieveData
value_type retrieveData(variable_key_type theVariable, sampling_key_type theSampling) const
Retrieve const reference to individual variable.
Definition
CaloSamplingData.h:225
CaloSamplingData::value_type
double value_type
General data type.
Definition
CaloSamplingData.h:27
CaloSamplingData::setupStores
bool setupStores()
Definition
CaloSamplingData.cxx:140
CaloSamplingData::testConstPattern
bool testConstPattern() const
Definition
CaloSamplingData.h:297
CaloSamplingData::sampling_key_type
CaloSampling::CaloSample sampling_key_type
Sampling look-up key type.
Definition
CaloSamplingData.h:22
CaloSamplingData::getNumberOfVariableTypes
size_t getNumberOfVariableTypes() const
Return number of variable types.
Definition
CaloSamplingData.h:189
CaloSamplingData::~CaloSamplingData
virtual ~CaloSamplingData()
Destructor.
CaloSamplingData::clearBitPattern
bool clearBitPattern()
Definition
CaloSamplingData.cxx:158
CaloSamplingData::testBitPattern
bool testBitPattern(variable_key_type theVariable) const
Definition
CaloSamplingData.h:290
CaloSamplingData::storeData
bool storeData(variable_key_type theVariable, sampling_key_type theSampling, value_type theData)
}
Definition
CaloSamplingData.cxx:109
CaloSamplingData::operator=
CaloSamplingData & operator=(const CaloSamplingData &)
Definition
CaloSamplingData.cxx:38
CaloSamplingData::m_dataStore
variable_store_type m_dataStore
Definition
CaloSamplingData.h:115
index
Definition
index.py:1
std::swap
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
Definition
AthLinks/ElementLinkVector.h:484
CaloVariableType
definition of Calorimeter Variable types in CaloCluster.
Definition
CaloVariableType.h:13
CaloVariableType::setConstMarker
static unsigned int setConstMarker(const unsigned int &bitPattern)
Definition
CaloVariableType.h:53
Generated on
for ATLAS Offline Software by
1.17.0