ATLAS Offline Software
Loading...
Searching...
No Matches
TileCalibDrawerInt Class Reference

Class for storing a 32 bit array of words for each ADC. More...

#include <TileCalibDrawerInt.h>

Inheritance diagram for TileCalibDrawerInt:
Collaboration diagram for TileCalibDrawerInt:

Public Types

typedef std::vector< std::vector< uint32_t > > DefType
 Object to hold default data used for initialization.

Public Member Functions

virtual ~TileCalibDrawerInt ()
 Dtor.
virtual uint16_t getType () const
 Returns TileCalibType::BCH.
uint32_t getData (unsigned int channel, unsigned int adc, unsigned int idx) const
 Returns a single T belonging to a channel/ADC.
void init (const DefType &def, uint16_t nChans, uint16_t objVers, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0)
 Initializing function.
void setData (unsigned int channel, unsigned int adc, unsigned int idx, uint32_t data)
 Sets a single T belonging to a channel/ADC.
virtual void dump () const
 Prints out the content of the blob to std::out.
virtual void dump (std::ostream &stm) const
 Prints the BLOB header summary information.
const void * getAddress (unsigned int iEle) const
 Returns start address of iEle-th basic unit.
void * getAddress (unsigned int iEle)
const void * getAddress (unsigned int iEle) const
 Returns start address of iEle-th basic unit.
void * getAddress (unsigned int iEle)
virtual void clone (const TileCalibDrawerBase &other)
 Initialzes Blob with content of other Blob.
virtual void clone (const TileCalibDrawerBase &other)
 Initialzes Blob with content of other Blob.
long getBlobSize () const
 Returns the BLOB size in units of bytes.
long getBlobSize () const
 Returns the BLOB size in units of bytes.
long getBlobSize32 () const
 Returns the BLOB size in units of uint32_t.
long getBlobSize32 () const
 Returns the BLOB size in units of uint32_t.
uint16_t getObjType () const
 Returns the BLOB object type.
uint16_t getObjType () const
 Returns the BLOB object type.
uint16_t getObjVersion () const
 Returns the BLOB object version.
uint16_t getObjVersion () const
 Returns the BLOB object version.
uint32_t getObjSizeUint32 () const
 Returns the size of a data object in units of uint32_t.
uint32_t getObjSizeUint32 () const
 Returns the size of a data object in units of uint32_t.
uint32_t getObjSizeByte () const
 Returns the size of a data object in units of bytes.
uint32_t getObjSizeByte () const
 Returns the size of a data object in units of bytes.
uint32_t getNObjs () const
 Returns the number of data objects stored int the BLOB.
uint32_t getNObjs () const
 Returns the number of data objects stored int the BLOB.
uint16_t getNChans () const
 Returns the number of channels stored in the BLOB.
uint16_t getNChans () const
 Returns the number of channels stored in the BLOB.
uint16_t getNGains () const
 Returns the number of gains stored for each channel.
uint16_t getNGains () const
 Returns the number of gains stored for each channel.
uint32_t getCommentSizeUint32 () const
 Returns the space occupied by the comment fields in units of uint32_t.
uint32_t getCommentSizeUint32 () const
 Returns the space occupied by the comment fields in units of uint32_t.
uint32_t getCommentSizeChar () const
 Returns the space occupied by the comment fields in units of chars.
uint32_t getCommentSizeChar () const
 Returns the space occupied by the comment fields in units of chars.
std::string getAuthor () const
 Returns the comment author.
std::string getAuthor () const
 Returns the comment author.
std::string getComment () const
 Returns the actual comment.
std::string getComment () const
 Returns the actual comment.
uint64_t getTimeStamp () const
 Returns the unix timestamp of the comment (seconds since 1.1.1970).
uint64_t getTimeStamp () const
 Returns the unix timestamp of the comment (seconds since 1.1.1970).
std::string getDate () const
 Returns the date of the comment as string (derived from timestamp).
std::string getDate () const
 Returns the date of the comment as string (derived from timestamp).
std::string getFullComment () const
 Returns a formated string build from all comment fields.
std::string getFullComment () const
 Returns a formated string build from all comment fields.

Static Public Member Functions

static const TileCalibDrawerIntgetInstance (const coral::Blob &blob)
 Returns a pointer to a const TileCalibDrawerBch.
static TileCalibDrawerIntgetInstance (coral::Blob &blob, const DefType &def, uint16_t nChans, uint16_t objVers, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0)
 Returns a pointer to a non-const TileCalibDrawerInt.

Static Public Attributes

static const unsigned int m_hdrSize32 = 5
 The header size in units of uint32_t.
static const unsigned int m_hdrSize32
 The header size in units of uint32_t.

Protected Member Functions

 TileCalibDrawerInt (const coral::Blob &blob)
 Ctor.
 TileCalibDrawerInt (coral::Blob &blob)
 Ctor (non-const).
const uint32_t * getAddress (unsigned int channel, unsigned int adc) const
 Returns a pointer to the first value for the specified channel & ADC.
uint32_t createBlob (uint16_t objType, uint16_t objVersion, uint32_t objSizeUint32, uint32_t nObjs, uint16_t nChans, uint16_t nGains, std::string_view author="", std::string_view comment="", uint64_t timeStamp=0)
 (re-)creation of the referenced BLOB object.
uint32_t createBlob (uint16_t objType, uint16_t objVersion, uint32_t objSizeUint32, uint32_t nObjs, uint16_t nChans, uint16_t nGains, std::string_view author="", std::string_view comment="", uint64_t timeStamp=0)
 (re-)creation of the referenced BLOB object.
void dumpHeader (std::ostream &stm) const
 Prints the BLOB header summary information.
void dumpHeader (std::ostream &stm) const
 Prints the BLOB header summary information.

Private Attributes

coral::Blob * m_blob_nc
 Non-const reference to the BLOB.
coral::Blob * m_blob_nc
 Non-const reference to the BLOB.
const coral::Blob * m_blob
 Const reference to the BLOB (always there).
const coral::Blob * m_blob
 Const reference to the BLOB (always there).
const uint32_t * m_blobStart32
 Cache blob starting address as uint_32t*.
const uint32_t * m_blobStart32
 Cache blob starting address as uint_32t*.
const uint16_t * m_blobStart16
 Cache blob starting address as uint_16t*.
const uint16_t * m_blobStart16
 Cache blob starting address as uint_16t*.
uint64_t m_blobSize32
 Cache blob size in units of uint32_t.
uint64_t m_blobSize32
 Cache blob size in units of uint32_t.
bool m_isBlobOwner
 Is this TileCalibDrawer owner of the BLOB.
bool m_isBlobOwner
 Is this TileCalibDrawer owner of the BLOB.

Detailed Description

Class for storing a 32 bit array of words for each ADC.

Author
Carlos Solans carlo.nosp@m.s.so.nosp@m.lans@.nosp@m.cern.nosp@m..ch

This class stores an array of 32 bit (uint32_t) words for each ADC.

Definition at line 22 of file TileCalibDrawerInt.h.

Member Typedef Documentation

◆ DefType

typedef std::vector<std::vector<uint32_t> > TileCalibDrawerDat< uint32_t >::DefType
inherited

Object to hold default data used for initialization.

The length of the first and second 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 TileCalibDrawerDat.h.

Constructor & Destructor Documentation

◆ ~TileCalibDrawerInt()

virtual TileCalibDrawerInt::~TileCalibDrawerInt ( )
inlinevirtual

Dtor.

Definition at line 27 of file TileCalibDrawerInt.h.

27{}

◆ TileCalibDrawerInt() [1/2]

TileCalibDrawerInt::TileCalibDrawerInt ( const coral::Blob & blob)
protected

Ctor.

Definition at line 38 of file TileCalibDrawerInt.cxx.

40{
41 //=== check for correct blob type
42 if(getBlobSize()){
44 throw TileCalib::TypeConflict("TileCalibDrawerInt::Ctor",getObjType(),TileCalibDrawerInt::getType());
45 }
46 }
47}
TileCalibDrawerDat(const coral::Blob &blob)
virtual uint16_t getType() const
Returns TileCalibType::BCH.

◆ TileCalibDrawerInt() [2/2]

TileCalibDrawerInt::TileCalibDrawerInt ( coral::Blob & blob)
protected

Ctor (non-const).

Definition at line 51 of file TileCalibDrawerInt.cxx.

53{
54 //=== check for correct blob type
55 if(getBlobSize()){
57 throw TileCalib::TypeConflict("TileCalibDrawerInt::Ctor",getObjType(),TileCalibDrawerInt::getType());
58 }
59 }
60}

Member Function Documentation

◆ clone() [1/2]

void TileCalibDrawerBase::clone ( const TileCalibDrawerBase & other)
virtualinherited

Initialzes Blob with content of other Blob.

Parameters
otherTileCalibDrawer used for initialization

Definition at line 75 of file TileCalibDrawerBase.cxx.

76{
77 //=== copy content of other blob
78 *m_blob_nc = *other.m_blob;
79 //=== and reset cached attributes
80 m_blobStart32 = static_cast<const uint32_t*>(m_blob->startingAddress());
81 m_blobStart16 = static_cast<const uint16_t*>(m_blob->startingAddress());
82 m_blobSize32 = m_blob->size()/sizeof(uint32_t);
83}
uint64_t m_blobSize32
Cache blob size in units of uint32_t.
const uint32_t * m_blobStart32
Cache blob starting address as uint_32t*.
const coral::Blob * m_blob
Const reference to the BLOB (always there).
const uint16_t * m_blobStart16
Cache blob starting address as uint_16t*.
coral::Blob * m_blob_nc
Non-const reference to the BLOB.
setWord1 uint16_t
setEventNumber uint32_t

◆ clone() [2/2]

void TileCalibDrawerBase::clone ( const TileCalibDrawerBase & other)
virtualinherited

Initialzes Blob with content of other Blob.

Parameters
otherTileCalibDrawer used for initialization

Definition at line 79 of file TileCalibDrawerBase.cxx.

76{
77 //=== copy content of other blob
79 //=== and reset cached attributes
80 m_blobStart32 = static_cast<const uint32_t*>(m_blob->startingAddress());
81 m_blobStart16 = static_cast<const uint16_t*>(m_blob->startingAddress());
82 m_blobSize32 = m_blob->size()/sizeof(uint32_t);
83}
Generic template class for storing a number of "T"s for each channel or ADC.

◆ createBlob() [1/2]

uint32_t TileCalibDrawerBase::createBlob ( uint16_t objType,
uint16_t objVersion,
uint32_t objSizeUint32,
uint32_t nObjs,
uint16_t nChans,
uint16_t nGains,
std::string_view author = "",
std::string_view comment = "",
uint64_t timeStamp = 0 )
protectedinherited

(re-)creation of the referenced BLOB object.

Parameters
objTypeObject type
objVersionObject version
objSizeUint32Size of a data object (in uint32_t)
nObjsTotal number of data objects
nChansnumber of stored channels
nGainsnumber of stored gains
authorcomment author
commentactual comment
timeStampunix time stamp (if 0, current time is used)

Definition at line 88 of file TileCalibDrawerBase.cxx.

97{
98 //=== blob data length including header in bytes
99 uint32_t dataSizeByte = (m_hdrSize32+objSizeUint32*nObjs) * sizeof(uint32_t);
100
101 //=== calculate comment length, including two ASCII NULLs to end text fields
102 uint32_t commentSizeChar(0);
103 if(author.size() || comment.size() || timeStamp){
104 commentSizeChar += author.size()+comment.size()+sizeof(uint64_t) + 2;
105 //=== force comment length to end on 4 byte boundary
106 commentSizeChar += (commentSizeChar % sizeof(uint32_t)) ?
107 (sizeof(uint32_t)-(commentSizeChar % sizeof(uint32_t))) : 0;
108 }
109
110 //=== create blob
111 uint32_t blobSizeInBytes = dataSizeByte+commentSizeChar;
112 m_blob_nc->resize(blobSizeInBytes);
113 uint32_t* blobStart32 = static_cast<uint32_t*>(m_blob_nc->startingAddress());
114 uint16_t* blobStart16 = static_cast<uint16_t*>(m_blob_nc->startingAddress());
115 m_blobSize32 = m_blob_nc->size()/sizeof(uint32_t);
116
117 m_blobStart32 = blobStart32;
118 m_blobStart16 = blobStart16;
119
120 //=== fill header
121 blobStart16[0] = objType;
122 blobStart16[1] = objVersion;
123 blobStart32[1] = objSizeUint32;
124 blobStart32[2] = nObjs;
125 blobStart16[6] = nChans;
126 blobStart16[7] = nGains;
127 blobStart32[4] = commentSizeChar/sizeof(uint32_t);
128
129 //==== fill comment fields
130 if(commentSizeChar){
131 if(!timeStamp) timeStamp = ::time(0);
132 uint64_t* pTimeStamp = reinterpret_cast<uint64_t*>(blobStart32+dataSizeByte/sizeof(uint32_t));
133 pTimeStamp[0] = timeStamp;
134 char* pChar = reinterpret_cast<char*>(++pTimeStamp);
135 auto iStr = author.begin();
136 for(; iStr!=author.end(); ++iStr){ *pChar = *iStr; ++pChar; }
137 *pChar = 0;
138 for(iStr=comment.begin(); iStr!=comment.end(); ++iStr){ *(++pChar) = *iStr; }
139 *(++pChar) = 0;
140 }
141
142 return (blobSizeInBytes/sizeof(uint32_t));
143}
static const unsigned int m_hdrSize32
The header size in units of uint32_t.
setEventNumber timeStamp

◆ createBlob() [2/2]

uint32_t TileCalibDrawerBase::createBlob ( uint16_t objType,
uint16_t objVersion,
uint32_t objSizeUint32,
uint32_t nObjs,
uint16_t nChans,
uint16_t nGains,
std::string_view author = "",
std::string_view comment = "",
uint64_t timeStamp = 0 )
protectedinherited

(re-)creation of the referenced BLOB object.

Parameters
objTypeObject type
objVersionObject version
objSizeUint32Size of a data object (in uint32_t)
nObjsTotal number of data objects
nChansnumber of stored channels
nGainsnumber of stored gains
authorcomment author
commentactual comment
timeStampunix time stamp (if 0, current time is used)

Definition at line 159 of file TileCalibDrawerBase.cxx.

97{
98 //=== blob data length including header in bytes
100
101 //=== calculate comment length, including two ASCII NULLs to end text fields
103 if(author.size() || comment.size() || timeStamp){
104 commentSizeChar += author.size()+comment.size()+sizeof(uint64_t) + 2;
105 //=== force comment length to end on 4 byte boundary
107 (sizeof(uint32_t)-(commentSizeChar % sizeof(uint32_t))) : 0;
108 }
109
110 //=== create blob
112 m_blob_nc->resize(blobSizeInBytes);
113 uint32_t* blobStart32 = static_cast<uint32_t*>(m_blob_nc->startingAddress());
114 uint16_t* blobStart16 = static_cast<uint16_t*>(m_blob_nc->startingAddress());
115 m_blobSize32 = m_blob_nc->size()/sizeof(uint32_t);
116
119
120 //=== fill header
121 blobStart16[0] = objType;
124 blobStart32[2] = nObjs;
125 blobStart16[6] = nChans;
126 blobStart16[7] = nGains;
128
129 //==== fill comment fields
130 if(commentSizeChar){
131 if(!timeStamp) timeStamp = ::time(0);
132 uint64_t* pTimeStamp = reinterpret_cast<uint64_t*>(blobStart32+dataSizeByte/sizeof(uint32_t));
134 char* pChar = reinterpret_cast<char*>(++pTimeStamp);
135 auto iStr = author.begin();
136 for(; iStr!=author.end(); ++iStr){ *pChar = *iStr; ++pChar; }
137 *pChar = 0;
138 for(iStr=comment.begin(); iStr!=comment.end(); ++iStr){ *(++pChar) = *iStr; }
139 *(++pChar) = 0;
140 }
141
142 return (blobSizeInBytes/sizeof(uint32_t));
143}

◆ dump() [1/2]

virtual void TileCalibDrawerBase::dump ( std::ostream & stm) const
inlinevirtualinherited

Prints the BLOB header summary information.

Parameters
stmThe output stream to use

Reimplemented in TileCalibDrawerCmt, TileCalibDrawerDat< T >, and TileCalibDrawerOfc.

Definition at line 88 of file TileCalibDrawerBase.h.

88{dumpHeader(stm);}
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.

◆ dump() [2/2]

virtual void TileCalibDrawerDat< uint32_t >::dump ( ) const
inlinevirtualinherited

Prints out the content of the blob to std::out.

Reimplemented from TileCalibDrawerBase.

Definition at line 81 of file TileCalibDrawerDat.h.

81{ dump(std::cout); }

◆ dumpHeader() [1/2]

void TileCalibDrawerBase::dumpHeader ( std::ostream & stm) const
protectedinherited

Prints the BLOB header summary information.

Parameters
stmoutput stream to use

Definition at line 201 of file TileCalibDrawerBase.cxx.

202{
203 stm << "This is a " << TileCalibType::getClassName(getObjType()) << std::endl;
204 stm << "ObjType : " << getObjType() << std::endl;
205 stm << "ObjVersion : " << getObjVersion() << std::endl;
206 stm << "ObjSize [bytes]: " << getObjSizeByte() << std::endl;
207 stm << "NObjs : " << getNObjs() << std::endl;
208 stm << "NChannels : " << getNChans() << std::endl;
209 stm << "NGains : " << getNGains() << std::endl;
211 stm << "=== No comment available ===" << std::endl;
212 }
213 else{
214 stm << "Author : " << getAuthor() << std::endl;
215 stm << "Date : " << getDate() << " ("<< getTimeStamp() << ")" << std::endl;
216 stm << "Comment: : " << getComment() << std::endl;
217 }
218}
uint32_t getCommentSizeUint32() const
Returns the space occupied by the comment fields in units of uint32_t.
uint16_t getNChans() const
Returns the number of channels stored in the BLOB.
std::string getComment() const
Returns the actual comment.
uint16_t getNGains() const
Returns the number of gains stored for each channel.
uint64_t getTimeStamp() const
Returns the unix timestamp of the comment (seconds since 1.1.1970).
std::string getDate() const
Returns the date of the comment as string (derived from timestamp).
uint32_t getNObjs() const
Returns the number of data objects stored int the BLOB.
std::string getAuthor() const
Returns the comment author.
uint16_t getObjVersion() const
Returns the BLOB object version.
uint32_t getObjSizeByte() const
Returns the size of a data object in units of bytes.
static std::string getClassName(TileCalibType::TYPE type)
Returns the class name.

◆ dumpHeader() [2/2]

void TileCalibDrawerBase::dumpHeader ( std::ostream & stm) const
protectedinherited

Prints the BLOB header summary information.

Parameters
stmoutput stream to use

Definition at line 171 of file TileCalibDrawerBase.cxx.

202{
203 stm << "This is a " << TileCalibType::getClassName(getObjType()) << std::endl;
204 stm << "ObjType : " << getObjType() << std::endl;
205 stm << "ObjVersion : " << getObjVersion() << std::endl;
206 stm << "ObjSize [bytes]: " << getObjSizeByte() << std::endl;
207 stm << "NObjs : " << getNObjs() << std::endl;
208 stm << "NChannels : " << getNChans() << std::endl;
209 stm << "NGains : " << getNGains() << std::endl;
211 stm << "=== No comment available ===" << std::endl;
212 }
213 else{
214 stm << "Author : " << getAuthor() << std::endl;
215 stm << "Date : " << getDate() << " ("<< getTimeStamp() << ")" << std::endl;
216 stm << "Comment: : " << getComment() << std::endl;
217 }
218}

◆ getAddress() [1/5]

void * TileCalibDrawerBase::getAddress ( unsigned int iEle)
inherited

◆ getAddress() [2/5]

const void * TileCalibDrawerBase::getAddress ( unsigned int iEle) const
inherited

Returns start address of iEle-th basic unit.

Parameters
iElesequential basic unit number

◆ getAddress() [3/5]

const uint32_t * TileCalibDrawerDat< uint32_t >::getAddress ( unsigned int channel,
unsigned int adc ) const
protectedinherited

Returns a pointer to the first value for the specified channel & ADC.

Parameters
channelThe channel number; If channel number >= getNChans() it is reset to channel % (maximum number of channels in drawer) if channel number > (maximum number of channels in drawer) otherwise it is reset to 0 without warning (default policy)
adcThe gain index; if >= getNGains() it is reset to 0 without warning (default policy)

Definition at line 100 of file TileCalibDrawerDat.h.

195{
196 unsigned int idx = channel*getNGains() + adc;
197 return static_cast<const T*>(TileCalibDrawerBase::getAddress(idx));
198}
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.

◆ getAddress() [4/5]

void * TileCalibDrawerBase::getAddress ( unsigned int iEle)
inherited

◆ getAddress() [5/5]

const void * TileCalibDrawerBase::getAddress ( unsigned int iEle) const
inherited

Returns start address of iEle-th basic unit.

Parameters
iElesequential basic unit number

◆ getAuthor() [1/2]

std::string TileCalibDrawerBase::getAuthor ( ) const
inherited

Returns the comment author.

Definition at line 148 of file TileCalibDrawerBase.cxx.

149{
150 if(!getCommentSizeUint32()) return std::string("");
151 const char* iBeg =
152 reinterpret_cast<const char*>(m_blobStart32 + m_hdrSize32 +
154 sizeof(uint64_t)/sizeof(uint32_t));
155 return std::string(iBeg);
156}
uint32_t getObjSizeUint32() const
Returns the size of a data object in units of uint32_t.

◆ getAuthor() [2/2]

std::string TileCalibDrawerBase::getAuthor ( ) const
inherited

Returns the comment author.

Definition at line 120 of file TileCalibDrawerBase.cxx.

149{
150 if(!getCommentSizeUint32()) return std::string("");
151 const char* iBeg =
152 reinterpret_cast<const char*>(m_blobStart32 + m_hdrSize32 +
154 sizeof(uint64_t)/sizeof(uint32_t));
155 return std::string(iBeg);
156}

◆ getBlobSize() [1/2]

long TileCalibDrawerBase::getBlobSize ( ) const
inlineinherited

Returns the BLOB size in units of bytes.

Definition at line 94 of file TileCalibDrawerBase.h.

94{ return m_blobSize32 * sizeof(uint32_t); }

◆ getBlobSize() [2/2]

long TileCalibDrawerBase::getBlobSize ( ) const
inlineinherited

Returns the BLOB size in units of bytes.

Definition at line 94 of file TileCalibDrawerBase.h.

94{ return m_blobSize32 * sizeof(uint32_t); }

◆ getBlobSize32() [1/2]

long TileCalibDrawerBase::getBlobSize32 ( ) const
inlineinherited

Returns the BLOB size in units of uint32_t.

Definition at line 96 of file TileCalibDrawerBase.h.

96{ return m_blobSize32; }

◆ getBlobSize32() [2/2]

long TileCalibDrawerBase::getBlobSize32 ( ) const
inlineinherited

Returns the BLOB size in units of uint32_t.

Definition at line 96 of file TileCalibDrawerBase.h.

96{ return m_blobSize32; }

◆ getComment() [1/2]

std::string TileCalibDrawerBase::getComment ( ) const
inherited

Returns the actual comment.

Definition at line 162 of file TileCalibDrawerBase.cxx.

163{
164 if(!getCommentSizeUint32()) return std::string("");
165 const char* iBeg =
166 reinterpret_cast<const char*>(m_blobStart32 + m_hdrSize32 +
168 sizeof(uint64_t)/sizeof(uint32_t));
169 const char* iEnd = iBeg + getCommentSizeChar();
170 iBeg = std::find(iBeg,iEnd,0);
171 return std::string(++iBeg);
172}
uint32_t getCommentSizeChar() const
Returns the space occupied by the comment fields in units of chars.

◆ getComment() [2/2]

std::string TileCalibDrawerBase::getComment ( ) const
inherited

Returns the actual comment.

Definition at line 122 of file TileCalibDrawerBase.cxx.

163{
164 if(!getCommentSizeUint32()) return std::string("");
165 const char* iBeg =
166 reinterpret_cast<const char*>(m_blobStart32 + m_hdrSize32 +
168 sizeof(uint64_t)/sizeof(uint32_t));
169 const char* iEnd = iBeg + getCommentSizeChar();
170 iBeg = std::find(iBeg,iEnd,0);
171 return std::string(++iBeg);
172}

◆ getCommentSizeChar() [1/2]

uint32_t TileCalibDrawerBase::getCommentSizeChar ( ) const
inlineinherited

Returns the space occupied by the comment fields in units of chars.

Definition at line 114 of file TileCalibDrawerBase.h.

114{return getCommentSizeUint32()*sizeof(uint32_t);}

◆ getCommentSizeChar() [2/2]

uint32_t TileCalibDrawerBase::getCommentSizeChar ( ) const
inlineinherited

Returns the space occupied by the comment fields in units of chars.

Definition at line 114 of file TileCalibDrawerBase.h.

114{return getCommentSizeUint32()*sizeof(uint32_t);}

◆ getCommentSizeUint32() [1/2]

uint32_t TileCalibDrawerBase::getCommentSizeUint32 ( ) const
inherited

Returns the space occupied by the comment fields in units of uint32_t.

◆ getCommentSizeUint32() [2/2]

uint32_t TileCalibDrawerBase::getCommentSizeUint32 ( ) const
inherited

Returns the space occupied by the comment fields in units of uint32_t.

◆ getData()

uint32_t TileCalibDrawerDat< uint32_t >::getData ( unsigned int channel,
unsigned int adc,
unsigned int idx ) const
inherited

Returns a single T belonging to a channel/ADC.

Parameters
adcThe gain index; if >= getNGains() it is reset to 0 without warning (default policy)
idxThe index of the requested value

Definition at line 49 of file TileCalibDrawerDat.h.

141{
142 if(idx>=getObjSizeUint32()){
143 throw TileCalib::IndexOutOfRange("TileCalibDrawerDat::getData",idx,getObjVersion());
144 }
145
146 //=== Tile Default Policy
147
148 if(channel >= getNChans()) {
150 channel = 0;
151 } else {
153 if (channel >= getNChans()) channel = 0;
154 }
155 }
156
157 if(adc >= getNGains()) {adc = 0;}
158
159 return getAddress(channel,adc)[idx];
160}
const uint32_t * getAddress(unsigned int channel, unsigned int adc) const

◆ getDate() [1/2]

std::string TileCalibDrawerBase::getDate ( ) const
inherited

Returns the date of the comment as string (derived from timestamp).

Definition at line 177 of file TileCalibDrawerBase.cxx.

178{
179 if(!getCommentSizeUint32()) return std::string("");
180 ::time_t timeStamp = getTimeStamp();
181 char buf[32];
182 char* iBeg = ::ctime_r(&timeStamp, buf);
183 char* iEnd = iBeg;
184 while(*iEnd!='\n'){++iEnd;}
185 return std::string(iBeg,iEnd-iBeg);
186}

◆ getDate() [2/2]

std::string TileCalibDrawerBase::getDate ( ) const
inherited

Returns the date of the comment as string (derived from timestamp).

Definition at line 126 of file TileCalibDrawerBase.cxx.

178{
179 if(!getCommentSizeUint32()) return std::string("");
181 char buf[32];
182 char* iBeg = ::ctime_r(&timeStamp, buf);
183 char* iEnd = iBeg;
184 while(*iEnd!='\n'){++iEnd;}
185 return std::string(iBeg,iEnd-iBeg);
186}

◆ getFullComment() [1/2]

std::string TileCalibDrawerBase::getFullComment ( ) const
inherited

Returns a formated string build from all comment fields.

Definition at line 191 of file TileCalibDrawerBase.cxx.

192{
193 if(!getCommentSizeUint32()) return std::string("");
194 return getAuthor()+" ("+getDate()+"): "+getComment();
195}

◆ getFullComment() [2/2]

std::string TileCalibDrawerBase::getFullComment ( ) const
inherited

Returns a formated string build from all comment fields.

Definition at line 128 of file TileCalibDrawerBase.cxx.

192{
193 if(!getCommentSizeUint32()) return std::string("");
194 return getAuthor()+" ("+getDate()+"): "+getComment();
195}

◆ getInstance() [1/2]

const TileCalibDrawerInt * TileCalibDrawerInt::getInstance ( const coral::Blob & blob)
static

Returns a pointer to a const TileCalibDrawerBch.

Definition at line 27 of file TileCalibDrawerInt.cxx.

28{
29 //=== const Blob needs to be correctly formated
30 if(blob.size()<static_cast<long>(m_hdrSize32)){
31 throw TileCalib::InvalidBlob("TileCalibDrawerBch::getInstance");
32 }
33 return (new TileCalibDrawerInt(blob));
34}
TileCalibDrawerInt(const coral::Blob &blob)
Ctor.

◆ getInstance() [2/2]

TileCalibDrawerInt * TileCalibDrawerInt::getInstance ( coral::Blob & blob,
const DefType & def,
uint16_t nChans,
uint16_t objVers,
const std::string & author = "",
const std::string & comment = "",
uint64_t timeStamp = 0 )
static

Returns a pointer to a non-const TileCalibDrawerInt.

Parameters
blobReference to a coral::Blob
defA reference to a DefType object, specifying the inital layout and values
nChansNumber of channels to create
objVersVersion of the (derived class) object
authorString containing the author user id
commentString containing the actual comment
timeStampUnix time stamp (if 0, current time is used)

Definition at line 11 of file TileCalibDrawerInt.cxx.

18{
20 calibDrawer->init(def,nChans,objVers,author,comment,timeStamp);
21 return calibDrawer;
22}

◆ getNChans() [1/2]

uint16_t TileCalibDrawerBase::getNChans ( ) const
inherited

Returns the number of channels stored in the BLOB.

◆ getNChans() [2/2]

uint16_t TileCalibDrawerBase::getNChans ( ) const
inherited

Returns the number of channels stored in the BLOB.

◆ getNGains() [1/2]

uint16_t TileCalibDrawerBase::getNGains ( ) const
inherited

Returns the number of gains stored for each channel.

◆ getNGains() [2/2]

uint16_t TileCalibDrawerBase::getNGains ( ) const
inherited

Returns the number of gains stored for each channel.

◆ getNObjs() [1/2]

uint32_t TileCalibDrawerBase::getNObjs ( ) const
inherited

Returns the number of data objects stored int the BLOB.

◆ getNObjs() [2/2]

uint32_t TileCalibDrawerBase::getNObjs ( ) const
inherited

Returns the number of data objects stored int the BLOB.

◆ getObjSizeByte() [1/2]

uint32_t TileCalibDrawerBase::getObjSizeByte ( ) const
inlineinherited

Returns the size of a data object in units of bytes.

Definition at line 104 of file TileCalibDrawerBase.h.

104{return getObjSizeUint32()*sizeof(uint32_t);}

◆ getObjSizeByte() [2/2]

uint32_t TileCalibDrawerBase::getObjSizeByte ( ) const
inlineinherited

Returns the size of a data object in units of bytes.

Definition at line 104 of file TileCalibDrawerBase.h.

104{return getObjSizeUint32()*sizeof(uint32_t);}

◆ getObjSizeUint32() [1/2]

uint32_t TileCalibDrawerBase::getObjSizeUint32 ( ) const
inherited

Returns the size of a data object in units of uint32_t.

◆ getObjSizeUint32() [2/2]

uint32_t TileCalibDrawerBase::getObjSizeUint32 ( ) const
inherited

Returns the size of a data object in units of uint32_t.

◆ getObjType() [1/2]

uint16_t TileCalibDrawerBase::getObjType ( ) const
inherited

Returns the BLOB object type.

◆ getObjType() [2/2]

uint16_t TileCalibDrawerBase::getObjType ( ) const
inherited

Returns the BLOB object type.

◆ getObjVersion() [1/2]

uint16_t TileCalibDrawerBase::getObjVersion ( ) const
inherited

Returns the BLOB object version.

◆ getObjVersion() [2/2]

uint16_t TileCalibDrawerBase::getObjVersion ( ) const
inherited

Returns the BLOB object version.

◆ getTimeStamp() [1/2]

uint64_t TileCalibDrawerBase::getTimeStamp ( ) const
inherited

Returns the unix timestamp of the comment (seconds since 1.1.1970).

◆ getTimeStamp() [2/2]

uint64_t TileCalibDrawerBase::getTimeStamp ( ) const
inherited

Returns the unix timestamp of the comment (seconds since 1.1.1970).

◆ getType()

virtual uint16_t TileCalibDrawerInt::getType ( ) const
inlinevirtual

Returns TileCalibType::BCH.

Reimplemented from TileCalibDrawerBase.

Definition at line 30 of file TileCalibDrawerInt.h.

30{return TileCalibType::INT;}
@ INT
Enum for TileCalibDrawerInt class.

◆ init()

void TileCalibDrawerDat< uint32_t >::init ( const DefType & def,
uint16_t nChans,
uint16_t objVers,
const std::string & author = "",
const std::string & comment = "",
uint64_t timeStamp = 0 )
inherited

Initializing function.

Parameters
defA reference to a DefType object, specifying the inital layout and values
nChansNumber of channels to create
objTypeType of the (derived class) object
objVersVersion of the (derived class) object
authorString containing the author user id
commentString containing the actual comment
timeStampUnix time stamp (if 0, current time is used)

Definition at line 59 of file TileCalibDrawerDat.h.

113{
114 uint16_t nGains = def.size();
115 uint32_t objSize = nGains>0 ? def.begin()->size() * sizeof(T)/sizeof(uint32_t) : 0;
117
118 //=== ensure all gains have the same object size
119 for(unsigned int iGain=0; iGain<nGains; ++iGain){
120 unsigned int thisSize = def[iGain].size()*sizeof(T)/sizeof(uint32_t);
121 if( thisSize != objSize ){
122 throw TileCalib::SizeConflict("TileCalibDrawerDat<T>::init",thisSize,objSize);
123 }
124 }
125
126 //=== create blob
128
129 //=== fill the blob with default
130 for(unsigned int channel=0; channel<nChans; ++channel){
131 for(unsigned int adc=0; adc<nGains; ++adc){
133 }
134 }
135}
virtual uint16_t getType() const
uint32_t createBlob(uint16_t objType, uint16_t objVersion, uint32_t objSizeUint32, uint32_t nObjs, uint16_t nChans, uint16_t nGains, std::string_view author="", std::string_view comment="", uint64_t timeStamp=0)
void setData(unsigned int channel, unsigned int adc, unsigned int idx, uint32_t data)

◆ setData()

void TileCalibDrawerDat< uint32_t >::setData ( unsigned int channel,
unsigned int adc,
unsigned int idx,
uint32_t data )
inherited

Sets a single T belonging to a channel/ADC.

Parameters
channelThe channel number
adcThe gain index
idxThe index of the value to set
dataThe data value to set

Definition at line 71 of file TileCalibDrawerDat.h.

166{
167 //=== check for out of bounds
168 if(channel >= getNChans()){
169 throw TileCalib::IndexOutOfRange("TileCalibDrawerDat::getAddress(channel)",channel,getNChans());
170 }
171 if(adc>=getNGains()){
172 throw TileCalib::IndexOutOfRange("CaloCalibDrawerDat::getAddress(gain)",adc,getNGains());
173 }
174 if(idx>=getObjSizeUint32()){
175 throw TileCalib::IndexOutOfRange("TileCalibDrawerDat::getData",idx,getObjVersion());
176 }
177
179}

Member Data Documentation

◆ m_blob [1/2]

const coral::Blob* TileCalibDrawerBase::m_blob
privateinherited

Const reference to the BLOB (always there).

Definition at line 178 of file TileCalibDrawerBase.h.

◆ m_blob [2/2]

const coral::Blob* TileCalibDrawerBase::m_blob
privateinherited

Const reference to the BLOB (always there).

Definition at line 178 of file TileCalibDrawerBase.h.

◆ m_blob_nc [1/2]

coral::Blob* TileCalibDrawerBase::m_blob_nc
privateinherited

Non-const reference to the BLOB.

(Only present if we were created with a non-const blob.)

Definition at line 176 of file TileCalibDrawerBase.h.

◆ m_blob_nc [2/2]

coral::Blob* TileCalibDrawerBase::m_blob_nc
privateinherited

Non-const reference to the BLOB.

(Only present if we were created with a non-const blob.)

Definition at line 176 of file TileCalibDrawerBase.h.

◆ m_blobSize32 [1/2]

uint64_t TileCalibDrawerBase::m_blobSize32
privateinherited

Cache blob size in units of uint32_t.

Definition at line 184 of file TileCalibDrawerBase.h.

◆ m_blobSize32 [2/2]

uint64_t TileCalibDrawerBase::m_blobSize32
privateinherited

Cache blob size in units of uint32_t.

Definition at line 184 of file TileCalibDrawerBase.h.

◆ m_blobStart16 [1/2]

const uint16_t* TileCalibDrawerBase::m_blobStart16
privateinherited

Cache blob starting address as uint_16t*.

Definition at line 182 of file TileCalibDrawerBase.h.

◆ m_blobStart16 [2/2]

const uint16_t* TileCalibDrawerBase::m_blobStart16
privateinherited

Cache blob starting address as uint_16t*.

Definition at line 182 of file TileCalibDrawerBase.h.

◆ m_blobStart32 [1/2]

const uint32_t* TileCalibDrawerBase::m_blobStart32
privateinherited

Cache blob starting address as uint_32t*.

Definition at line 180 of file TileCalibDrawerBase.h.

◆ m_blobStart32 [2/2]

const uint32_t* TileCalibDrawerBase::m_blobStart32
privateinherited

Cache blob starting address as uint_32t*.

Definition at line 180 of file TileCalibDrawerBase.h.

◆ m_hdrSize32 [1/2]

const unsigned int TileCalibDrawerBase::m_hdrSize32 = 5
staticinherited

The header size in units of uint32_t.

Definition at line 140 of file TileCalibDrawerBase.h.

◆ m_hdrSize32 [2/2]

const unsigned int TileCalibDrawerBase::m_hdrSize32
staticinherited

The header size in units of uint32_t.

Definition at line 140 of file TileCalibDrawerBase.h.

◆ m_isBlobOwner [1/2]

bool TileCalibDrawerBase::m_isBlobOwner
privateinherited

Is this TileCalibDrawer owner of the BLOB.

Definition at line 186 of file TileCalibDrawerBase.h.

◆ m_isBlobOwner [2/2]

bool TileCalibDrawerBase::m_isBlobOwner
privateinherited

Is this TileCalibDrawer owner of the BLOB.

Definition at line 186 of file TileCalibDrawerBase.h.


The documentation for this class was generated from the following files: