|
ATLAS Offline Software
|
Generic class for storing a number of floats (Flt) for each channel or ADC.
More...
#include <TileCalibDrawerFlt.h>
|
typedef std::vector< std::vector< float > > | DefType |
| Object to hold default data used for initialization. More...
|
|
|
virtual | ~TileCalibDrawerFlt () |
| Dtor. More...
|
|
virtual uint16_t | getType () const |
| Returns TileCalibType::FLT. More...
|
|
float | getCalib (unsigned int channel, unsigned int adc, float energy, bool invert=false) const |
| Returns the calibrated energy for a given channel/ADC and input energy. More...
|
|
bool | getYDY (unsigned int channel, unsigned int adc, float x, float &y, float &dy) const |
| Returns y and derivative dy for a given x for function blob of type 200. More...
|
|
float | getY (unsigned int channel, unsigned int adc, float x) const |
| Returns y for a given x for function blob of type 200. More...
|
|
float | getDY (unsigned int channel, unsigned int adc, float x) const |
| Returns y for a given x for function blob of type 200. More...
|
|
float | getData (unsigned int channel, unsigned int adc, unsigned int idx) const |
| Returns a single T belonging to a channel/ADC. More...
|
|
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. More...
|
|
void | setData (unsigned int channel, unsigned int adc, unsigned int idx, float data) |
| Sets a single T belonging to a channel/ADC. More...
|
|
void | setData (unsigned int channel, unsigned int adc, const std::vector< float > &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 void | dump () const |
| Prints the BLOB header summary information to std::cout. More...
|
|
const void * | getAddress (unsigned int iEle) const |
| Returns start address of iEle-th basic unit. More...
|
|
void * | getAddress (unsigned int iEle) |
|
virtual void | clone (const TileCalibDrawerBase &other) |
| Initialzes Blob with content of other Blob. More...
|
|
long | getBlobSize () const |
| Returns the BLOB size in units of bytes. More...
|
|
long | getBlobSize32 () const |
| Returns the BLOB size in units of uint32_t. 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...
|
|
uint16_t | getNChans () const |
| Returns the number of channels stored in the BLOB. More...
|
|
uint16_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...
|
|
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...
|
|
|
| TileCalibDrawerFlt (const coral::Blob &blob) |
| Ctor (const). More...
|
|
| TileCalibDrawerFlt (coral::Blob &blob) |
| Ctor (non-const). More...
|
|
const float * | getAddress (unsigned int channel, unsigned int adc) const |
| Returns a pointer to the first value for the specified channel & ADC. More...
|
|
float * | getAddress (unsigned int channel, unsigned int adc) |
|
uint32_t | createBlob (uint16_t objType, uint16_t objVersion, uint32_t objSizeUint32, uint32_t nObjs, uint16_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...
|
|
Generic class for storing a number of floats (Flt) for each channel or ADC.
- 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 floats for each channel or ADC. The number of floats to store is encoded in the objSize header variable. The object version header variable is used to encode different functional forms on the stored data, accessed through the getCalib function.
Definition at line 26 of file TileCalibDrawerFlt.h.
◆ DefType
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.
◆ ~TileCalibDrawerFlt()
virtual TileCalibDrawerFlt::~TileCalibDrawerFlt |
( |
| ) |
|
|
inlinevirtual |
◆ TileCalibDrawerFlt() [1/2]
TileCalibDrawerFlt::TileCalibDrawerFlt |
( |
const coral::Blob & |
blob | ) |
|
|
protected |
◆ TileCalibDrawerFlt() [2/2]
TileCalibDrawerFlt::TileCalibDrawerFlt |
( |
coral::Blob & |
blob | ) |
|
|
protected |
◆ clone()
Initialzes Blob with content of other Blob.
- Parameters
-
other | TileCalibDrawer used for initialization |
Definition at line 74 of file TileCalibDrawerBase.cxx.
◆ createBlob()
uint32_t TileCalibDrawerBase::createBlob |
( |
uint16_t |
objType, |
|
|
uint16_t |
objVersion, |
|
|
uint32_t |
objSizeUint32, |
|
|
uint32_t |
nObjs, |
|
|
uint16_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 87 of file TileCalibDrawerBase.cxx.
105 commentSizeChar += (commentSizeChar %
sizeof(
uint32_t)) ?
110 uint32_t blobSizeInBytes = dataSizeByte+commentSizeChar;
120 blobStart16[0] = objType;
122 blobStart32[1] = objSizeUint32;
123 blobStart32[2] =
nObjs;
124 blobStart16[6] = nChans;
125 blobStart16[7] = nGains;
126 blobStart32[4] = commentSizeChar/
sizeof(
uint32_t);
133 char* pChar =
reinterpret_cast<char*
>(++pTimeStamp);
134 std::string::const_iterator iStr =
author.begin();
135 for(; iStr!=
author.end(); ++iStr){ *pChar = *iStr; ++pChar; }
137 for(iStr=
comment.begin(); iStr!=
comment.end(); ++iStr){ *(++pChar) = *iStr; }
141 return (blobSizeInBytes/
sizeof(
uint32_t));
◆ dump() [1/3]
◆ dump() [2/3]
virtual void TileCalibDrawerBase::dump |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ dump() [3/3]
◆ dumpHeader()
void TileCalibDrawerBase::dumpHeader |
( |
std::ostream & |
stm | ) |
const |
|
protectedinherited |
Prints the BLOB header summary information.
- Parameters
-
Definition at line 200 of file TileCalibDrawerBase.cxx.
203 stm <<
"ObjType : " <<
getObjType() << std::endl;
206 stm <<
"NObjs : " <<
getNObjs() << std::endl;
207 stm <<
"NChannels : " <<
getNChans() << std::endl;
208 stm <<
"NGains : " <<
getNGains() << std::endl;
210 stm <<
"=== No comment available ===" << std::endl;
213 stm <<
"Author : " <<
getAuthor() << std::endl;
215 stm <<
"Comment: : " <<
getComment() << std::endl;
◆ getAddress() [1/4]
float * TileCalibDrawerDat< float >::getAddress |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc |
|
) |
| |
|
protectedinherited |
◆ getAddress() [2/4]
Returns a pointer to the first value for the specified channel & ADC.
- Parameters
-
channel | The 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)
|
adc | The gain index; if >= getNGains() it is reset to 0 without warning (default policy) |
Definition at line 100 of file TileCalibDrawerDat.h.
◆ getAddress() [3/4]
void* TileCalibDrawerBase::getAddress |
( |
unsigned int |
iEle | ) |
|
|
inherited |
◆ getAddress() [4/4]
const void* TileCalibDrawerBase::getAddress |
( |
unsigned int |
iEle | ) |
const |
|
inherited |
Returns start address of iEle-th basic unit.
- Parameters
-
iEle | sequential basic unit number |
◆ getAuthor()
std::string TileCalibDrawerBase::getAuthor |
( |
| ) |
const |
|
inherited |
◆ getBlobSize()
long TileCalibDrawerBase::getBlobSize |
( |
| ) |
const |
|
inlineinherited |
◆ getBlobSize32()
long TileCalibDrawerBase::getBlobSize32 |
( |
| ) |
const |
|
inlineinherited |
◆ getCalib()
float TileCalibDrawerFlt::getCalib |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
float |
energy, |
|
|
bool |
invert = false |
|
) |
| const |
Returns the calibrated energy for a given channel/ADC and input energy.
- Parameters
-
channel | The 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)
|
adc | The gain index; if >= getNGains() it is reset to 0 without warning (default policy)
|
energy | The energy that should be calibrated |
invert | If true, the calibration is inverted |
Definition at line 65 of file TileCalibDrawerFlt.cxx.
124 const float*
iX = std::upper_bound(xBeg,xEnd,
energy);
128 if(
iX==xBeg ||
iX==xEnd){
◆ getComment()
std::string TileCalibDrawerBase::getComment |
( |
| ) |
const |
|
inherited |
◆ getCommentSizeChar()
uint32_t TileCalibDrawerBase::getCommentSizeChar |
( |
| ) |
const |
|
inlineinherited |
Returns the space occupied by the comment fields in units of chars.
Definition at line 112 of file TileCalibDrawerBase.h.
◆ getCommentSizeUint32()
uint32_t TileCalibDrawerBase::getCommentSizeUint32 |
( |
| ) |
const |
|
inherited |
Returns the space occupied by the comment fields in units of uint32_t.
◆ getData()
float TileCalibDrawerDat< float >::getData |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
unsigned int |
idx |
|
) |
| const |
|
inherited |
Returns a single T belonging to a channel/ADC.
- Parameters
-
adc | The gain index; if >= getNGains() it is reset to 0 without warning (default policy)
|
idx | The index of the requested value |
Definition at line 49 of file TileCalibDrawerDat.h.
◆ getDate()
std::string TileCalibDrawerBase::getDate |
( |
| ) |
const |
|
inherited |
Returns the date of the comment as string (derived from timestamp)
Definition at line 176 of file TileCalibDrawerBase.cxx.
183 while(*iEnd!=
'\n'){++iEnd;}
184 return std::string(iBeg,iEnd-iBeg);
◆ getDY()
float TileCalibDrawerFlt::getDY |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
float |
x |
|
) |
| const |
Returns y for a given x for function blob of type 200.
This function is inefficient and created for python use only. (Python does not like float references)
Definition at line 275 of file TileCalibDrawerFlt.cxx.
277 float y(-9999.),
dy(-9999.);
◆ getFullComment()
std::string TileCalibDrawerBase::getFullComment |
( |
| ) |
const |
|
inherited |
◆ getInstance() [1/2]
◆ getInstance() [2/2]
TileCalibDrawerFlt * TileCalibDrawerFlt::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 TileCalibDrawerFlt.
- Parameters
-
blob | Reference to a coral::Blob |
def | A reference to a DefType object, specifying the inital layout and values |
nChans | Number of channels to create |
objType | Type of the (derived class) object |
objVers | Version of the (derived class) 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 25 of file TileCalibDrawerFlt.cxx.
◆ getNChans()
uint16_t TileCalibDrawerBase::getNChans |
( |
| ) |
const |
|
inherited |
Returns the number of channels stored in the BLOB.
◆ getNGains()
uint16_t TileCalibDrawerBase::getNGains |
( |
| ) |
const |
|
inherited |
Returns the number of gains stored for each channel.
◆ getNObjs()
uint32_t TileCalibDrawerBase::getNObjs |
( |
| ) |
const |
|
inherited |
Returns the number of data objects stored int the BLOB.
◆ getObjSizeByte()
uint32_t TileCalibDrawerBase::getObjSizeByte |
( |
| ) |
const |
|
inlineinherited |
◆ getObjSizeUint32()
uint32_t TileCalibDrawerBase::getObjSizeUint32 |
( |
| ) |
const |
|
inherited |
Returns the size of a data object in units of uint32_t.
◆ getObjType()
uint16_t TileCalibDrawerBase::getObjType |
( |
| ) |
const |
|
inherited |
Returns the BLOB object type.
◆ getObjVersion()
uint16_t TileCalibDrawerBase::getObjVersion |
( |
| ) |
const |
|
inherited |
Returns the BLOB object version.
◆ getTimeStamp()
uint64_t TileCalibDrawerBase::getTimeStamp |
( |
| ) |
const |
|
inherited |
Returns the unix timestamp of the comment (seconds since 1.1.1970)
◆ getType()
virtual uint16_t TileCalibDrawerFlt::getType |
( |
| ) |
const |
|
inlinevirtual |
◆ getY()
float TileCalibDrawerFlt::getY |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
float |
x |
|
) |
| const |
Returns y for a given x for function blob of type 200.
This function is created as a helper function for TileCalibDrawer::getYDY and for python use. (Python does not like float references)
Definition at line 217 of file TileCalibDrawerFlt.cxx.
247 const float*
iX = std::upper_bound(xBeg,xEnd,
x);
266 float slope = (
y1-
y0)/(
x1-x0);
◆ getYDY()
bool TileCalibDrawerFlt::getYDY |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
float |
x, |
|
|
float & |
y, |
|
|
float & |
dy |
|
) |
| const |
Returns y and derivative dy for a given x for function blob of type 200.
- Returns
- A bool indicating whether x was within the function range (true) or outside (false)
- Parameters
-
channel | The 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)
|
adc | The gain index; if >= getNGains() it is reset to 0 without warning (default policy)
|
x | Input x value |
y | Y value corresponding to x |
dy | Derivative of the function at x |
Definition at line 149 of file TileCalibDrawerFlt.cxx.
179 const float*
iX = std::upper_bound(xBeg,xEnd,
x);
184 const float delta = 1.0e-3;
188 if (
x < (*(xBeg) - delta))
return false;
193 if (
x > (*(xEnd-1) + delta))
return false;
202 float slope = (
y1-
y0)/(
x1-x0);
207 float xs1 =
x + 0.5 *
dx;
208 float xs0 =
x - 0.5 *
dx;
◆ 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 (derived class) object |
objVers | Version of the (derived class) 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 59 of file TileCalibDrawerDat.h.
115 uint32_t objSize = nGains>0 ? def.begin()->size() *
sizeof(
T)/
sizeof(
uint32_t) : 0;
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 ){
131 for(
unsigned int adc=0;
adc<nGains; ++
adc){
◆ setData() [1/2]
void TileCalibDrawerDat< float >::setData |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
const std::vector< float > & |
data |
|
) |
| |
|
inherited |
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 77 of file TileCalibDrawerDat.h.
186 for(
typename std::vector<T>::const_iterator
i=
data.begin();
i!=
data.end(); ++
i){
◆ setData() [2/2]
void TileCalibDrawerDat< float >::setData |
( |
unsigned int |
channel, |
|
|
unsigned int |
adc, |
|
|
unsigned int |
idx, |
|
|
float |
data |
|
) |
| |
|
inherited |
Sets a single T belonging to a channel/ADC.
- 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 71 of file TileCalibDrawerDat.h.
◆ m_blob
const coral::Blob* TileCalibDrawerBase::m_blob |
|
privateinherited |
◆ m_blob_nc
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 174 of file TileCalibDrawerBase.h.
◆ m_blobSize32
uint64_t TileCalibDrawerBase::m_blobSize32 |
|
privateinherited |
◆ m_blobStart16
const uint16_t* TileCalibDrawerBase::m_blobStart16 |
|
privateinherited |
◆ m_blobStart32
const uint32_t* TileCalibDrawerBase::m_blobStart32 |
|
privateinherited |
◆ m_hdrSize32
const unsigned int TileCalibDrawerBase::m_hdrSize32 = 5 |
|
staticinherited |
◆ m_isBlobOwner
bool TileCalibDrawerBase::m_isBlobOwner |
|
privateinherited |
The documentation for this class was generated from the following files:
std::string getAuthor() const
Returns the comment author.
Generic class for storing a number of floats (Flt) for each channel or ADC.
char data[hepevt_bytes_allocation_ATLAS]
float getY(unsigned int channel, unsigned int adc, float x) const
Returns y for a given x for function blob of type 200.
@ FLT
Enum for TileCalibDrawerFlt class.
long getBlobSize() const
Returns the BLOB size in units of bytes.
virtual uint16_t getType() const
Returns TileCalibDrawer::BASE.
Thrown if an index is out of range.
uint16_t getNGains() const
Returns the number of gains stored for each channel.
const uint32_t * m_blobStart32
Cache blob starting address as uint_32t*.
std::string find(const std::string &s)
return a remapped string
coral::Blob * m_blob_nc
Non-const reference to the BLOB.
static const unsigned int m_hdrSize32
The header size in units of uint32_t.
TileCalibDrawerFlt(const coral::Blob &blob)
Ctor (const).
Thrown if coral::Blob does not conform with expected structure.
uint32_t getCommentSizeUint32() const
Returns the space occupied by the comment fields in units of uint32_t.
static std::string getClassName(TileCalibType::TYPE type)
Returns the class name.
uint32_t getCommentSizeChar() const
Returns the space occupied by the comment fields in units of chars.
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.
bool getYDY(unsigned int channel, unsigned int adc, float x, float &y, float &dy) const
Returns y and derivative dy for a given x for function blob of type 200.
Thrown if BLOB size is not correct.
void setData(unsigned int channel, unsigned int adc, unsigned int idx, float data)
Sets a single T belonging to a channel/ADC.
uint16_t getObjVersion() const
Returns the BLOB object version.
uint64_t getTimeStamp() const
Returns the unix timestamp of the comment (seconds since 1.1.1970)
uint32_t getObjSizeByte() const
Returns the size of a data object in units of bytes.
uint16_t getNChans() const
Returns the number of channels stored in the BLOB.
virtual uint16_t getType() const
Returns TileCalibType::FLT.
std::string getDate() const
Returns the date of the comment as string (derived from timestamp)
Thrown if object version in BLOB does not agree with class.
uint32_t createBlob(uint16_t objType, uint16_t objVersion, uint32_t objSizeUint32, uint32_t nObjs, uint16_t nChans, uint16_t nGains, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0)
(re-)creation of the referenced BLOB object.
std::string getComment() const
Returns the actual comment.
virtual void dump() const
Prints out the content of the blob to std::out.
uint64_t m_blobSize32
Cache blob size in units of uint32_t.
uint16_t getObjType() const
Returns the BLOB object type.
def time(flags, cells_name, *args, **kw)
const float * getAddress(unsigned int channel, unsigned int adc) const
Returns a pointer to the first value for the specified channel & ADC.
Thrown if object type in BLOB does not agree with class type.
const coral::Blob * m_blob
Const reference to the BLOB (always there)
float getData(unsigned int channel, unsigned int adc, unsigned int idx) const
Returns a single T belonging to a channel/ADC.
static const unsigned int MAX_CHAN
Number of channels in drawer.
uint32_t getObjSizeUint32() const
Returns the size of a data object in units of uint32_t.
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
const uint16_t * m_blobStart16
Cache blob starting address as uint_16t*.
Thrown to prevent invalid results, eg.
uint32_t getNObjs() const
Returns the number of data objects stored int the BLOB.