5#ifndef CALOCONDBLOBOBJS_CALOCONDBLOBDAT_H
6#define CALOCONDBLOBOBJS_CALOCONDBLOBDAT_H
27#include "CoralBase/Blob.h"
37 typedef std::vector<std::vector<T> >
DefType;
49 T
getData(
const unsigned int channel,
const unsigned int adc,
const unsigned int idx)
const;
57 T
getData(
const unsigned int channel)
const;
70 const std::string& author=
"",
71 const std::string& comment=
"",
72 uint64_t timeStamp=0);
79 void setData(
unsigned int channel,
unsigned int adc,
unsigned int idx, T
data);
85 void setData(
unsigned int channel,
unsigned int adc,
const std::vector<T>&
data);
92 virtual void dump(std::ostream& stm)
const;
104 const T*
getAddress(
const unsigned int channel,
const unsigned int adc)
const;
105 T*
getAddress(
const unsigned int channel,
const unsigned int adc);
110template<
class T>
void
114 const std::string& author,
115 const std::string& comment,
118 uint32_t objSize = def.begin()->size() *
sizeof(T)/
sizeof(uint32_t);
119 uint16_t nGains = def.size();
120 uint32_t nObjs = nChans*nGains;
121 createBlob(
getType(), objVers, objSize, nObjs, nChans, nGains, author, comment, timeStamp);
124 for(
unsigned int channel=0; channel<nChans; ++channel){
125 for(
unsigned int adc=0; adc<nGains; ++adc){
126 setData(channel, adc, def[adc]);
149template<
class T>
void
158template<
class T>
void
161 for(
typename std::vector<T>::const_iterator i=
data.begin(); i!=
data.end(); ++i){
168template<
class T>
const T*
179 const unsigned int idx = channel*
getNGains() + adc;
196 const unsigned int idx = channel*
getNGains() + adc;
202template<
class T>
void
206 for(
unsigned int channel=0; channel<
getNChans(); ++channel){
207 for(
unsigned int adc=0; adc<
getNGains(); ++adc){
208 stm << channel<<
"/"<<adc<<
":\t";
210 stm <<
getData(channel,adc,idx) <<
"\t";
char data[hepevt_bytes_allocation_ATLAS]
uint32_t getNGains() const
Returns the number of gains stored for each channel.
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
uint32_t getObjSizeUint32() const
Returns the size of a data object in units of uint32_t.
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.
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.
CaloCondBlobBase(const CaloCondBlobBase &other)
Copy Ctor.
uint32_t getNChans() const
Returns the number of channels stored in the BLOB.
uint16_t getObjVersion() const
Returns the BLOB object version.
const void * m_pDataStart
virtual uint16_t getType() const
Returns CaloCondDrawer::BASE.
virtual void dump() const
Prints out the content of the blob to std::out.
CaloCondBlobDat(coral::Blob &blob)
Ctor.
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.
const T * getAddress(const unsigned int channel, const unsigned int adc) const
Returns a pointer to the first value for the specified channel/gain.
std::vector< std::vector< T > > DefType
Object to hold default data used for initialization.
CaloCondBlobDat(const coral::Blob &blob)
Ctor.
void setData(unsigned int channel, unsigned int adc, unsigned int idx, T data)
Sets a single T belonging to a channel/gain.
virtual ~CaloCondBlobDat()
Dtor.
T getData(const unsigned int channel, const unsigned int adc, const unsigned int idx) const
Returns a single T belonging to a channel/gain.
Thrown if an index is out of range.