|
ATLAS Offline Software
|
Generic template class for storing a number of "T"s for each channel/gain.
More...
#include <CaloCondBlobDat.h>
|
typedef std::vector< std::vector< T > > | DefType |
| Object to hold default data used for initialization. More...
|
|
|
virtual | ~CaloCondBlobDat () |
| Dtor. More...
|
|
T | getData (const unsigned int channel, const unsigned int adc, const unsigned int idx) const |
| Returns a single T belonging to a channel/gain. More...
|
|
T | getData (const unsigned int channel) const |
| Returns a single T belonging to a channel/gain. More...
|
|
void | init (const DefType &def, uint32_t nChans, uint16_t objVers, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0) |
| Initializing function. More...
|
|
void | setData (unsigned int channel, unsigned int adc, unsigned int idx, T data) |
| Sets a single T belonging to a channel/gain. More...
|
|
void | setData (unsigned int channel, unsigned int adc, const std::vector< T > &data) |
| Sets a number of Ts stored in the input vector. More...
|
|
virtual void | dump () const |
| Prints out the content of the blob to std::out. More...
|
|
virtual void | dump (std::ostream &stm) const |
| Prints out the content of the blob. More...
|
|
virtual uint16_t | getType () const |
| Returns CaloCondDrawer::BASE. More...
|
|
long | getBlobSize () const |
| Returns the BLOB size. More...
|
|
uint16_t | getObjType () const |
| Returns the BLOB object type. More...
|
|
uint16_t | getObjVersion () const |
| Returns the BLOB object version. More...
|
|
uint32_t | getObjSizeUint32 () const |
| Returns the size of a data object in units of uint32_t. More...
|
|
uint32_t | getObjSizeByte () const |
| Returns the size of a data object in units of bytes. More...
|
|
uint32_t | getNObjs () const |
| Returns the number of data objects stored int the BLOB. More...
|
|
uint32_t | getNChans () const |
| Returns the number of channels stored in the BLOB. More...
|
|
uint32_t | getNGains () const |
| Returns the number of gains stored for each channel. More...
|
|
uint32_t | getCommentSizeUint32 () const |
| Returns the space occupied by the comment fields in units of uint32_t. More...
|
|
uint32_t | getCommentSizeChar () const |
| Returns the space occupied by the comment fields in units of chars. More...
|
|
unsigned int | getHdrSize () const |
| Returns the size of the header in units of uint32_t. More...
|
|
std::string | getAuthor () const |
| Returns the comment author. More...
|
|
std::string | getComment () const |
| Returns the actual comment. More...
|
|
uint64_t | getTimeStamp () const |
| Returns the unix timestamp of the comment (seconds since 1.1.1970) More...
|
|
std::string | getDate () const |
| Returns the date of the comment as string (derived from timestamp) More...
|
|
std::string | getFullComment () const |
| Returns a formated string build from all comment fields. More...
|
|
const void * | getAddress (unsigned int iEle) const |
| Returns start address of iEle-th basic unit. More...
|
|
void * | getAddress (unsigned int iEle) |
|
|
| CaloCondBlobDat (const coral::Blob &blob) |
| Ctor. More...
|
|
| CaloCondBlobDat (coral::Blob &blob) |
| Ctor. More...
|
|
const T * | getAddress (const unsigned int channel, const unsigned int adc) const |
| Returns a pointer to the first value for the specified channel/gain. More...
|
|
T * | getAddress (const unsigned int channel, const unsigned int adc) |
|
uint32_t | createBlob (uint16_t objType, uint16_t objVersion, uint32_t objSizeUint32, uint32_t nObjs, uint32_t nChans, uint16_t nGains, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0) |
| (re-)creation of the referenced BLOB object. More...
|
|
void | dumpHeader (std::ostream &stm) const |
| Prints the BLOB header summary information. More...
|
|
template<class T>
class CaloCondBlobDat< T >
Generic template class for storing a number of "T"s for each channel/gain.
- Author
- Nils Gollub nils..nosp@m.goll.nosp@m.ub@ce.nosp@m.rn.c.nosp@m.h
This class implements the infrastructure to store a (variable) number of Ts for each channel/gain. Only types that are a multiple of uint32_t can be stored, i.e. float, uint32_t, uint64_t, etc... The number of Ts to store is encoded in the objSize header variable. The object version header variable has no meaning for this class (since schema evolution does not make sense here) and is always set to 0.
Definition at line 30 of file CaloCondBlobDat.h.
◆ DefType
Object to hold default data used for initialization.
The length of the outer and inner vector determines respectively the number of gains and values per gain to be stored. The indexing is thus DefType[iGain][iValue].
Definition at line 37 of file CaloCondBlobDat.h.
◆ ~CaloCondBlobDat()
◆ CaloCondBlobDat() [1/2]
◆ CaloCondBlobDat() [2/2]
◆ createBlob()
uint32_t CaloCondBlobBase::createBlob |
( |
uint16_t |
objType, |
|
|
uint16_t |
objVersion, |
|
|
uint32_t |
objSizeUint32, |
|
|
uint32_t |
nObjs, |
|
|
uint32_t |
nChans, |
|
|
uint16_t |
nGains, |
|
|
const std::string & |
author = "" , |
|
|
const std::string & |
comment = "" , |
|
|
uint64_t |
timeStamp = 0 |
|
) |
| |
|
protectedinherited |
(re-)creation of the referenced BLOB object.
- Parameters
-
objType | Object type |
objVersion | Object version |
objSizeUint32 | Size of a data object (in uint32_t) |
nObjs | Total number of data objects |
nChans | number of stored channels |
nGains | number of stored gains |
author | comment author |
comment | actual comment |
timeStamp | unix time stamp (if 0, current time is used) |
Definition at line 83 of file CaloCondBlobBase.cxx.
102 commentSizeChar += (commentSizeChar %
sizeof(
uint32_t)) ?
107 const uint32_t blobSizeInBytes = dataSizeByte+commentSizeChar;
126 char* pChar =
reinterpret_cast<char*
>(++pTimeStamp);
127 std::string::const_iterator iStr =
author.begin();
128 for(; iStr!=
author.end(); ++iStr){ *pChar = *iStr; ++pChar; }
130 for(iStr=
comment.begin(); iStr!=
comment.end(); ++iStr){ *(++pChar) = *iStr; }
135 return (blobSizeInBytes/
sizeof(
uint32_t));
◆ dump() [1/2]
◆ dump() [2/2]
◆ dumpHeader()
void CaloCondBlobBase::dumpHeader |
( |
std::ostream & |
stm | ) |
const |
|
protectedinherited |
Prints the BLOB header summary information.
- Parameters
-
Definition at line 229 of file CaloCondBlobBase.cxx.
232 stm <<
"ObjType : " <<
getObjType() << std::endl;
235 stm <<
"NObjs : " <<
getNObjs() << std::endl;
236 stm <<
"NChannels : " <<
getNChans() << std::endl;
237 stm <<
"NGains : " <<
getNGains() << std::endl;
239 stm <<
"=== No comment available ===" << std::endl;
242 stm <<
"Author : " <<
getAuthor() << std::endl;
244 stm <<
"Comment: : " <<
getComment() << std::endl;
◆ getAddress() [1/4]
◆ getAddress() [2/4]
Returns a pointer to the first value for the specified channel/gain.
- Parameters
-
channel | The channel number; if >= getNChans() it is reset to 0 without warning (default policy)
|
adc | The gain index; if >= getNGains() it is reset to 0 without warning (default policy) |
Definition at line 169 of file CaloCondBlobDat.h.
◆ getAddress() [3/4]
void * CaloCondBlobBase::getAddress |
( |
unsigned int |
iEle | ) |
|
|
inlineinherited |
◆ getAddress() [4/4]
const void * CaloCondBlobBase::getAddress |
( |
unsigned int |
iEle | ) |
const |
|
inlineinherited |
Returns start address of iEle-th basic unit.
- Parameters
-
iEle | sequential basic unit number |
Definition at line 259 of file CaloCondBlobBase.h.
264 return static_cast<const void*
>
◆ getAuthor()
std::string CaloCondBlobBase::getAuthor |
( |
| ) |
const |
|
inherited |
◆ getBlobSize()
long CaloCondBlobBase::getBlobSize |
( |
| ) |
const |
|
inlineinherited |
◆ getBlobStart() [1/2]
uint32_t * CaloCondBlobBase::getBlobStart |
( |
| ) |
|
|
inlineprivateinherited |
◆ getBlobStart() [2/2]
const uint32_t * CaloCondBlobBase::getBlobStart |
( |
| ) |
const |
|
inlineprivateinherited |
◆ getComment()
std::string CaloCondBlobBase::getComment |
( |
| ) |
const |
|
inherited |
◆ getCommentSizeChar()
uint32_t CaloCondBlobBase::getCommentSizeChar |
( |
| ) |
const |
|
inlineinherited |
Returns the space occupied by the comment fields in units of chars.
Definition at line 83 of file CaloCondBlobBase.h.
◆ getCommentSizeUint32()
uint32_t CaloCondBlobBase::getCommentSizeUint32 |
( |
| ) |
const |
|
inlineinherited |
Returns the space occupied by the comment fields in units of uint32_t.
Definition at line 249 of file CaloCondBlobBase.h.
253 return static_cast<const uint32_t*
>(
m_blob->startingAddress())[4];
◆ getData() [1/2]
Returns a single T belonging to a channel/gain.
- Parameters
-
channel | The channel number |
Definition at line 142 of file CaloCondBlobDat.h.
◆ getData() [2/2]
Returns a single T belonging to a channel/gain.
- Parameters
-
channel | The channel number |
adc | The gain index |
idx | The index of the requested value |
Definition at line 134 of file CaloCondBlobDat.h.
◆ getDate()
std::string CaloCondBlobBase::getDate |
( |
| ) |
const |
|
inherited |
Returns the date of the comment as string (derived from timestamp)
Definition at line 205 of file CaloCondBlobBase.cxx.
212 while(*iEnd!=
'\n'){++iEnd;}
213 return std::string(iBeg,iEnd-iBeg);
◆ getFullComment()
std::string CaloCondBlobBase::getFullComment |
( |
| ) |
const |
|
inherited |
◆ getHdrSize()
unsigned int CaloCondBlobBase::getHdrSize |
( |
| ) |
const |
|
inlineinherited |
Returns the size of the header in units of uint32_t.
Definition at line 85 of file CaloCondBlobBase.h.
◆ getNChans()
uint32_t CaloCondBlobBase::getNChans |
( |
| ) |
const |
|
inlineinherited |
◆ getNGains()
uint32_t CaloCondBlobBase::getNGains |
( |
| ) |
const |
|
inlineinherited |
◆ getNObjs()
uint32_t CaloCondBlobBase::getNObjs |
( |
| ) |
const |
|
inlineinherited |
Returns the number of data objects stored int the BLOB.
Definition at line 221 of file CaloCondBlobBase.h.
225 return static_cast<const uint32_t*
>(
m_blob->startingAddress())[2];
◆ getObjSizeByte()
uint32_t CaloCondBlobBase::getObjSizeByte |
( |
| ) |
const |
|
inlineinherited |
Returns the size of a data object in units of bytes.
Definition at line 73 of file CaloCondBlobBase.h.
◆ getObjSizeUint32()
uint32_t CaloCondBlobBase::getObjSizeUint32 |
( |
| ) |
const |
|
inlineinherited |
Returns the size of a data object in units of uint32_t.
Definition at line 213 of file CaloCondBlobBase.h.
◆ getObjType()
uint16_t CaloCondBlobBase::getObjType |
( |
| ) |
const |
|
inlineinherited |
◆ getObjVersion()
uint16_t CaloCondBlobBase::getObjVersion |
( |
| ) |
const |
|
inlineinherited |
◆ getTimeStamp()
uint64_t CaloCondBlobBase::getTimeStamp |
( |
| ) |
const |
|
inlineinherited |
Returns the unix timestamp of the comment (seconds since 1.1.1970)
Definition at line 283 of file CaloCondBlobBase.h.
◆ getType()
virtual uint16_t CaloCondBlobBase::getType |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ init()
Initializing function.
- Parameters
-
def | A reference to a DefType object, specifying the inital layout and values |
nChans | Number of channels to create |
objType | Type of the object |
objVers | Version of the object |
author | String containing the author user id |
comment | String containing the actual comment |
timeStamp | Unix time stamp (if 0, current time is used) |
Definition at line 111 of file CaloCondBlobDat.h.
125 for(
unsigned int adc=0;
adc<nGains; ++
adc){
◆ packGainAndNchans()
uint32_t CaloCondBlobBase::packGainAndNchans |
( |
const uint32_t |
gain, |
|
|
const uint32_t |
nChans |
|
) |
| |
|
staticprivateinherited |
◆ setData() [1/2]
template<class T >
void CaloCondBlobDat< T >::setData |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
const std::vector< T > & |
data |
|
) |
| |
Sets a number of Ts stored in the input vector.
- Parameters
-
channel | The channel number |
adc | The gain index |
data | A vector containing the values to be set |
Definition at line 159 of file CaloCondBlobDat.h.
161 for(
typename std::vector<T>::const_iterator
i=
data.begin();
i!=
data.end(); ++
i){
◆ setData() [2/2]
template<class T >
void CaloCondBlobDat< T >::setData |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
unsigned int |
idx, |
|
|
T |
data |
|
) |
| |
Sets a single T belonging to a channel/gain.
- Parameters
-
channel | The channel number |
adc | The gain index |
idx | The index of the value to set |
data | The data value to set |
Definition at line 150 of file CaloCondBlobDat.h.
◆ unpacknChans()
uint32_t CaloCondBlobBase::unpacknChans |
( |
const uint32_t |
gainAndnChans | ) |
|
|
staticprivateinherited |
Definition at line 160 of file CaloCondBlobBase.cxx.
161 if (gainAndnChans & 0x80000000) {
163 return gainAndnChans & 0xFFFFFF;
167 return gainAndnChans & 0xFFFF;
◆ unpacknGains()
uint32_t CaloCondBlobBase::unpacknGains |
( |
const uint32_t |
gainAndnChans | ) |
|
|
staticprivateinherited |
Definition at line 150 of file CaloCondBlobBase.cxx.
151 if (gainAndnChans & 0x80000000) {
153 return (gainAndnChans>>24) & 0x7F;
157 return (gainAndnChans>>16) & 0xFFFF;
◆ m_blob
const coral::Blob* CaloCondBlobBase::m_blob |
|
privateinherited |
◆ m_blob_nc
coral::Blob* CaloCondBlobBase::m_blob_nc |
|
privateinherited |
Non-const reference to the BLOB.
(Only present if we were created with a non-const blob.)
Definition at line 157 of file CaloCondBlobBase.h.
◆ m_isBlobOwner
bool CaloCondBlobBase::m_isBlobOwner |
|
privateinherited |
◆ m_nChans
unsigned CaloCondBlobBase::m_nChans |
|
privateinherited |
◆ m_nGains
unsigned CaloCondBlobBase::m_nGains |
|
privateinherited |
◆ m_pDataStart
const void* CaloCondBlobBase::m_pDataStart |
|
protectedinherited |
◆ m_sizeOfObj
unsigned CaloCondBlobBase::m_sizeOfObj |
|
privateinherited |
The documentation for this class was generated from the following file:
uint32_t getCommentSizeUint32() const
Returns the space occupied by the comment fields in units of uint32_t.
void setData(unsigned int channel, unsigned int adc, unsigned int idx, T data)
Sets a single T belonging to a channel/gain.
static uint32_t packGainAndNchans(const uint32_t gain, const uint32_t nChans)
char data[hepevt_bytes_allocation_ATLAS]
uint32_t getObjSizeUint32() const
Returns the size of a data object in units of uint32_t.
T getData(const unsigned int channel, const unsigned int adc, const unsigned int idx) const
Returns a single T belonging to a channel/gain.
std::string getAuthor() const
Returns the comment author.
std::string find(const std::string &s)
return a remapped string
coral::Blob * m_blob_nc
Non-const reference to the BLOB.
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
const T * getAddress(const unsigned int channel, const unsigned int adc) const
Returns a pointer to the first value for the specified channel/gain.
const void * m_pDataStart
virtual uint16_t getType() const
Returns CaloCondDrawer::BASE.
uint32_t createBlob(uint16_t objType, uint16_t objVersion, uint32_t objSizeUint32, uint32_t nObjs, uint32_t nChans, uint16_t nGains, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0)
(re-)creation of the referenced BLOB object.
uint16_t getObjType() const
Returns the BLOB object type.
std::string getDate() const
Returns the date of the comment as string (derived from timestamp)
CaloCondBlobBase(const CaloCondBlobBase &other)
Copy Ctor.
unsigned int getHdrSize() const
Returns the size of the header in units of uint32_t.
uint32_t getCommentSizeChar() const
Returns the space occupied by the comment fields in units of chars.
const uint32_t * getBlobStart() const
Returns the BLOB start address as uint32_t pointer.
uint16_t getObjVersion() const
Returns the BLOB object version.
@ BASE
Enum for CaloCondBlobBase class.
std::string getComment() const
Returns the actual comment.
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.
Thrown if coral::Blob does not conform with expected structure.
Thrown if an index is out of range.
static std::string getClassName(CaloCondType::TYPE type)
Returns the class name.
uint32_t getNObjs() const
Returns the number of data objects stored int the BLOB.
uint32_t getNGains() const
Returns the number of gains stored for each channel.
const coral::Blob * m_blob
Const reference to the BLOB (always there)
uint32_t getObjSizeByte() const
Returns the size of a data object in units of bytes.
def time(flags, cells_name, *args, **kw)
virtual void dump() const
Prints out the content of the blob to std::out.
unsigned m_sizeOfObj
Chache of some frequently-used numbers.
uint64_t getTimeStamp() const
Returns the unix timestamp of the comment (seconds since 1.1.1970)
uint32_t getNChans() const
Returns the number of channels stored in the BLOB.