ATLAS Offline Software
|
Simple data object to store all variables in calorimeter samplings. More...
#include <CaloSamplingData.h>
Classes | |
class | IsValidData |
Functor to check if data is valid (non-zero) More... | |
Public Types | |
typedef CaloSampling::CaloSample | sampling_key_type |
Sampling look-up key type. More... | |
typedef CaloVariableType::VariableType | variable_key_type |
Variable look-up type. More... | |
typedef double | value_type |
General data type. More... | |
typedef std::vector< value_type > | variable_store_type |
Sampling look-up table type, internal use only. More... | |
typedef std::vector< value_type > | const_vector_type |
Vector type for data exchange (read only) More... | |
typedef std::vector< value_type > | vector_type |
Vector type for data exchange (read/write) More... | |
Public Member Functions | |
CaloSamplingData () | |
Constructor. More... | |
CaloSamplingData (unsigned int varTypePattern) | |
Alternative constructor with variable type pattern. More... | |
CaloSamplingData (const CaloSamplingData &rData) | |
Copy constructor. More... | |
CaloSamplingData (const CaloSamplingData *pData) | |
CaloSamplingData & | operator= (const CaloSamplingData &) |
virtual | ~CaloSamplingData () |
Destructor. More... | |
void | swap (CaloSamplingData &other) |
size_t | getNumberOfSamplings () const |
Set variable type pattern for this store. More... | |
size_t | getNumberOfSamplings (variable_key_type theVariable) const |
Return number of samplings stored for a given variable type. More... | |
size_t | getNumberOfVariableTypes () const |
Return number of variable types. More... | |
value_type | retrieveData (variable_key_type theVariable, sampling_key_type theSampling) const |
Retrieve const reference to individual variable. More... | |
value_type & | retrieveData (variable_key_type theVariable, sampling_key_type theSampling) |
Retrieve non-cont reference to individual variable. More... | |
bool | retrieveData (variable_key_type theVariable, vector_type &theData) const |
Retrieve set of variables into a vector. More... | |
bool | removeVariable (variable_key_type theVariable, sampling_key_type theSampling) |
Remove a certain variable. More... | |
bool | removeVariable (variable_key_type theVariable) |
Remove all variables of the same type. More... | |
bool | removeVariable (sampling_key_type theSampling) |
Remove all variables from a certain sampling. More... | |
bool | removeVariable () |
bool | clearStore () |
bool | storeData (variable_key_type theVariable, sampling_key_type theSampling, value_type theData) |
} More... | |
bool | storeData (variable_key_type theVariable, const vector_type &theData) |
Store vector of data. More... | |
template<class Iterator > | |
bool | storeData (variable_key_type theVariable, Iterator beg, Iterator end) |
Store range of data. More... | |
bool | contains (variable_key_type theVariable) const |
Check on available variable types. More... | |
Private Member Functions | |
bool | setupStores () |
unsigned int | getBitPattern (variable_key_type theVariable) const |
bool | checkBitPattern (variable_key_type theVariable) |
bool | testBitPattern (variable_key_type theVariable) const |
bool | clearBitPattern (variable_key_type theVariable) |
bool | clearBitPattern () |
bool | testConstPattern () const |
size_t | index (size_t theVariable, size_t theSampling) const |
size_t | fastNsamp () const |
Private Attributes | |
variable_store_type | m_dataStore |
unsigned int | m_varTypePattern |
Friends | |
class | CaloSamplingDataCnv_p1 |
class | CaloSamplingDataContainerCnv_p1 |
class | CaloClusterContainerCnv_p4 |
class | CaloClusterContainerCnv_p5 |
class | CaloClusterContainerCnv_p6 |
class | CaloClusterContainerCnv_p7 |
class | CaloClusterContainerCnvTest_p6 |
class | CaloClusterContainerCnvTest_p7 |
Simple data object to store all variables in calorimeter samplings.
Simple data object to store all variables in calorimeter samplings. The underlying store is compressed in that only variables indexed by the sampling indicator and the variable type are actually stored. The store is dynamic as it adds the appropriate data words for a given samping and variable type, if those are not existing yet. Already existing data words are replaced (overwritten). Note that whenever an interface involving a vector of data words is used to set the variables, the store for the given variable type is completely cleared before insertion of new data words from the vector (all 0's are ignored in this process, and the vector index is translated into a sampling indicator).
This was orginally a vector<vector<double> >. But it was always strictly a rectangular array, so it was rewritten to store the data as a flat vector to avoid multiple memory allocations.
Definition at line 17 of file CaloSamplingData.h.
typedef std::vector<value_type> CaloSamplingData::const_vector_type |
Vector type for data exchange (read only)
Definition at line 32 of file CaloSamplingData.h.
Sampling look-up key type.
Definition at line 22 of file CaloSamplingData.h.
typedef double CaloSamplingData::value_type |
General data type.
Definition at line 27 of file CaloSamplingData.h.
Variable look-up type.
Definition at line 24 of file CaloSamplingData.h.
typedef std::vector<value_type> CaloSamplingData::variable_store_type |
Sampling look-up table type, internal use only.
Definition at line 29 of file CaloSamplingData.h.
typedef std::vector<value_type> CaloSamplingData::vector_type |
Vector type for data exchange (read/write)
Definition at line 34 of file CaloSamplingData.h.
CaloSamplingData::CaloSamplingData | ( | ) |
Constructor.
Generates an empty but complete store by default (all values are indexed and defaulted, i.e.
= 0.).
Definition at line 15 of file CaloSamplingData.cxx.
CaloSamplingData::CaloSamplingData | ( | unsigned int | varTypePattern | ) |
Alternative constructor with variable type pattern.
Definition at line 21 of file CaloSamplingData.cxx.
|
explicitdefault |
Copy constructor.
|
explicit |
Definition at line 32 of file CaloSamplingData.cxx.
|
virtualdefault |
Destructor.
|
private |
Definition at line 168 of file CaloSamplingData.cxx.
|
private |
Definition at line 158 of file CaloSamplingData.cxx.
|
private |
Definition at line 150 of file CaloSamplingData.cxx.
|
inline |
Definition at line 278 of file CaloSamplingData.h.
|
inline |
|
inlineprivate |
Definition at line 307 of file CaloSamplingData.h.
|
inlineprivate |
Definition at line 286 of file CaloSamplingData.h.
|
inline |
Set variable type pattern for this store.
Returns the maximum number of possible calo samplings, which also delimits the numerical range for the calo sampling indicator to [0,getNumberOfSamples()-1]
.
Return number of samplings stored
Useful for sizing the data vectors holding sampling variables.
Definition at line 186 of file CaloSamplingData.h.
size_t CaloSamplingData::getNumberOfSamplings | ( | variable_key_type | theVariable | ) | const |
Return number of samplings stored for a given variable type.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
theVariable | reference to non-modifiable variable type |
This is a run time calculation. It returns the number of samplings with data content for a given variable type. Note the difference to the getNumberOfSamplings() method.
Definition at line 131 of file CaloSamplingData.cxx.
|
inline |
|
inlineprivate |
Definition at line 301 of file CaloSamplingData.h.
CaloSamplingData & CaloSamplingData::operator= | ( | const CaloSamplingData & | other | ) |
Definition at line 38 of file CaloSamplingData.cxx.
|
inline |
Definition at line 273 of file CaloSamplingData.h.
|
inline |
|
inline |
|
inline |
Remove a certain variable.
{
theVariable | reference to a non-modifiable variable type |
theSampling | reference to a non-modifiable sampling indicator |
Removing a variable in this implementation means to set it to the default value generated by its constructor, e.g. double() generates 0. The data word is left in store. This is an artifact of the underlying storage model, which cannot use maps. Several interfaces are available for data removal, starting from the removal of individual data words to the removal of all words of a given variable type or sampling.
Definition at line 248 of file CaloSamplingData.h.
|
inline |
Retrieve non-cont reference to individual variable.
theVariable | reference to variable key, non-modifiable |
theSampling | reference to sampling key, non-modifiable |
Retrieval of a modifiable indexed data word.
The enumerator ranges prevent illegal data access out of the valid index space. The internal data matrix is dimensioned as ([valid_number_of_variables]+1) * ([valid_number_of_samplings]+1). This allows valid response to the CaloSampling::Unknown and CaloVariableType::NO_OF_TYPES enumerators.
Definition at line 206 of file CaloSamplingData.h.
|
inline |
Retrieve const reference to individual variable.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
theVariable | reference to variable key, non-modifiable |
theSampling | reference to sampling key, non-modifiable |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Retrieval of a non-modifiable indexed data word.
Definition at line 225 of file CaloSamplingData.h.
bool CaloSamplingData::retrieveData | ( | variable_key_type | theVariable, |
vector_type & | theData | ||
) | const |
Retrieve set of variables into a vector.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
theVariable | reference to variable key, non-modifiable |
theData | vector of data words |
Retrieves all data for a given variable type into a vector. This vector is referenced on input, and is cleared in any case. Returns true
if vector is not empty on output.
Definition at line 69 of file CaloSamplingData.cxx.
|
private |
Definition at line 140 of file CaloSamplingData.cxx.
bool CaloSamplingData::storeData | ( | variable_key_type | theVariable, |
const vector_type & | theData | ||
) |
Store vector of data.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
theVariable | reference to a non-modifiable variable type indicator |
theData | vector of data words |
Returns true
only if input data vector is empty. Note that the vector index is translated into a calo sampling indicator. Only up to theData.size() words are overwritten in the store. If this number is smaller than the store size, the original data beyond the corresponding index is not changed.
If theData.size() is larger than the store size, only the first store size words are copied from theData. If theData.size() is 0, the store is unchanged.
Definition at line 94 of file CaloSamplingData.cxx.
bool CaloSamplingData::storeData | ( | variable_key_type | theVariable, |
Iterator | beg, | ||
Iterator | end | ||
) |
bool CaloSamplingData::storeData | ( | variable_key_type | theVariable, |
sampling_key_type | theSampling, | ||
value_type | theData | ||
) |
}
Store individual data word
theVariable | reference to non-modifiable variable type indicator |
theSampling | reference to non-modifiable calo sampling indicator |
theData | reference to non-modifiable data word |
Returns true
if data is succesfully stored. Note that previously stored data with the same indices are overwritten without warning.
Definition at line 109 of file CaloSamplingData.cxx.
void CaloSamplingData::swap | ( | CaloSamplingData & | other | ) |
Definition at line 51 of file CaloSamplingData.cxx.
|
inlineprivate |
Definition at line 290 of file CaloSamplingData.h.
|
inlineprivate |
Definition at line 297 of file CaloSamplingData.h.
|
friend |
Definition at line 108 of file CaloSamplingData.h.
|
friend |
Definition at line 109 of file CaloSamplingData.h.
|
friend |
Definition at line 110 of file CaloSamplingData.h.
|
friend |
Definition at line 111 of file CaloSamplingData.h.
|
friend |
Definition at line 112 of file CaloSamplingData.h.
|
friend |
Definition at line 113 of file CaloSamplingData.h.
|
friend |
Definition at line 106 of file CaloSamplingData.h.
|
friend |
Definition at line 107 of file CaloSamplingData.h.
|
private |
Definition at line 115 of file CaloSamplingData.h.
|
private |
Definition at line 117 of file CaloSamplingData.h.