5#ifndef TILECALIBBLOBOBJS_TILECALIBDRAWERDAT_H
6#define TILECALIBBLOBOBJS_TILECALIBDRAWERDAT_H
27#include "CoralBase/Blob.h"
37 typedef std::vector<std::vector<T> >
DefType;
49 T
getData(
unsigned int channel,
unsigned int adc,
unsigned int idx)
const;
62 const std::string& author=
"",
63 const std::string& comment=
"",
64 uint64_t timeStamp=0);
71 void setData(
unsigned int channel,
unsigned int adc,
unsigned int idx, T
data);
77 void setData(
unsigned int channel,
unsigned int adc,
const std::vector<T>&
data);
84 virtual void dump(std::ostream& stm)
const;
100 const T*
getAddress(
unsigned int channel,
unsigned int adc)
const;
101 T*
getAddress(
unsigned int channel,
unsigned int adc);
106template<
class T>
void
110 const std::string& author,
111 const std::string& comment,
114 uint16_t nGains = def.size();
115 uint32_t objSize = nGains>0 ? def.begin()->size() *
sizeof(T)/
sizeof(uint32_t) : 0;
116 uint32_t nObjs = nChans*nGains;
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 ){
127 createBlob(
getType(), objVers, objSize, nObjs, nChans, nGains, author, comment, timeStamp);
130 for(
unsigned int channel=0; channel<nChans; ++channel){
131 for(
unsigned int adc=0; adc<nGains; ++adc){
132 setData(channel, adc, def[adc]);
164template<
class T>
void
183template<
class T>
void
186 for(
typename std::vector<T>::const_iterator i=
data.begin(); i!=
data.end(); ++i){
193template<
class T>
const T*
196 unsigned int idx = channel*
getNGains() + adc;
205 unsigned int idx = channel*
getNGains() + adc;
211template<
class T>
void
215 for(
unsigned int channel=0; channel<
getNChans(); ++channel){
216 for(
unsigned int adc=0; adc<
getNGains(); ++adc){
217 stm << channel<<
"/"<<adc<<
":\t";
219 stm <<
getData(channel,adc,idx) <<
"\t";
char data[hepevt_bytes_allocation_ATLAS]
virtual uint16_t getType() const
Returns TileCalibDrawer::BASE.
uint16_t getNChans() const
Returns the number of channels stored in the BLOB.
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.
uint16_t getNGains() const
Returns the number of gains stored for each channel.
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.
TileCalibDrawerBase(const TileCalibDrawerBase &other)
Copy Ctor.
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.
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
virtual void dump() const
Prints out the content of the blob to std::out.
TileCalibDrawerDat(const coral::Blob &blob)
Ctor (const).
std::vector< std::vector< T > > DefType
Object to hold default data used for initialization.
TileCalibDrawerDat(coral::Blob &blob)
Ctor (non-const).
T getData(unsigned int channel, unsigned int adc, unsigned int idx) const
Returns a single T belonging to a channel/ADC.
void setData(unsigned int channel, unsigned int adc, unsigned int idx, T data)
Sets a single T belonging to a channel/ADC.
virtual ~TileCalibDrawerDat()
Dtor.
const T * getAddress(unsigned int channel, unsigned int adc) const
Returns a pointer to the first value for the specified 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.
static const unsigned int MAX_CHAN
Number of channels in drawer.
Thrown if an index is out of range.
Thrown if BLOB size is not correct.