ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CaloCondBlobFlt Class Reference

Class for storing a number of floats (Flt) and functions on those. More...

#include <CaloCondBlobFlt.h>

Inheritance diagram for CaloCondBlobFlt:
Collaboration diagram for CaloCondBlobFlt:

Public Types

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

Public Member Functions

virtual ~CaloCondBlobFlt ()
 Dtor. More...
 
virtual uint16_t getType () const
 Returns CaloCondType::FLT. More...
 
float getCalib (unsigned int channel, unsigned int adc, float x, bool invert=false) const
 Returns the calibrated energy for a given channel/gain and input energy. More...
 
float getData (const unsigned int channel, const unsigned int adc, const unsigned int idx) const
 Returns a single T belonging to a channel/gain. More...
 
float 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, float data)
 Sets a single T belonging to a channel/gain. 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)
 
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...
 

Static Public Member Functions

static CaloCondBlobFltgetInstance (coral::Blob &blob)
 Returns a pointer to a non-const CaloCondBlobFlt. More...
 
static const CaloCondBlobFltgetInstance (const coral::Blob &blob)
 Returns a pointer to a const CaloCondBlobFlt. More...
 

Protected Member Functions

 CaloCondBlobFlt (const coral::Blob &blob)
 Ctor. More...
 
 CaloCondBlobFlt (coral::Blob &blob)
 Ctor. More...
 
const float * getAddress (const unsigned int channel, const unsigned int adc) const
 Returns a pointer to the first value for the specified channel/gain. More...
 
float * 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...
 

Protected Attributes

const void * m_pDataStart
 

Private Member Functions

const uint32_t * getBlobStart () const
 Returns the BLOB start address as uint32_t pointer. More...
 
uint32_t * getBlobStart ()
 Returns the BLOB start address as uint32_t pointer. More...
 

Static Private Member Functions

static uint32_t packGainAndNchans (const uint32_t gain, const uint32_t nChans)
 
static uint32_t unpacknGains (const uint32_t gainAndnChans)
 
static uint32_t unpacknChans (const uint32_t gainAndnChans)
 

Private Attributes

coral::Blob * m_blob_nc
 Non-const reference to the BLOB. More...
 
const coral::Blob * m_blob
 Const reference to the BLOB (always there) More...
 
bool m_isBlobOwner
 Do I own the BLOB? More...
 
unsigned m_sizeOfObj
 Chache of some frequently-used numbers. More...
 
unsigned m_nChans
 
unsigned m_nGains
 

Detailed Description

Class for storing a number of floats (Flt) and functions on those.

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 stored floats can be used to define a function of one parameter. Different functional forms can be implemented and differentiated by the objVersion header variable (this allows for e.g. schema evolution). The functions are evaluated by calling the getCalib() function.

Definition at line 28 of file CaloCondBlobFlt.h.

Member Typedef Documentation

◆ DefType

typedef std::vector<std::vector<float > > CaloCondBlobDat< float >::DefType
inherited

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.

Constructor & Destructor Documentation

◆ ~CaloCondBlobFlt()

virtual CaloCondBlobFlt::~CaloCondBlobFlt ( )
inlinevirtual

Dtor.

Definition at line 33 of file CaloCondBlobFlt.h.

33 {}

◆ CaloCondBlobFlt() [1/2]

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

Ctor.

Definition at line 26 of file CaloCondBlobFlt.cxx.

28 {
29  //=== check for correct blob type
30  if(getBlobSize()){
32  throw CaloCond::TypeConflict("CaloCondBlobFlt::Ctor",getObjType(),CaloCondBlobFlt::getType());
33  }
34  }
35 }

◆ CaloCondBlobFlt() [2/2]

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

Ctor.

Definition at line 39 of file CaloCondBlobFlt.cxx.

41 {
42  //=== check for correct blob type
43  if(getBlobSize()){
45  throw CaloCond::TypeConflict("CaloCondBlobFlt::Ctor",getObjType(),CaloCondBlobFlt::getType());
46  }
47  }
48 }

Member Function Documentation

◆ 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
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 83 of file CaloCondBlobBase.cxx.

92 {
93 
94  //=== blob data length including header in bytes
95  const uint32_t dataSizeByte = (getHdrSize()+objSizeUint32*nObjs) * sizeof(uint32_t);
96 
97  //=== calculate comment length, including two ASCII NULLs to end text fields
98  uint32_t commentSizeChar(0);
99  if(!author.empty() || !comment.empty() || timeStamp){
100  commentSizeChar += author.size()+comment.size()+sizeof(uint64_t) + 2;
101  //=== force comment length to end on 4 byte boundary
102  commentSizeChar += (commentSizeChar % sizeof(uint32_t)) ?
103  (sizeof(uint32_t)-(commentSizeChar % sizeof(uint32_t))) : 0;
104  }
105 
106  //=== create blob
107  const uint32_t blobSizeInBytes = dataSizeByte+commentSizeChar;
108  m_blob_nc->resize(blobSizeInBytes);
109 
110  //=== fill header
111  reinterpret_cast<uint16_t*>(getBlobStart())[0] = objType;
112  reinterpret_cast<uint16_t*>(getBlobStart())[1] = objVersion;
113  getBlobStart()[1] = objSizeUint32;
114  m_sizeOfObj=objSizeUint32;
115  getBlobStart()[2] = nObjs;
116  getBlobStart()[3] = packGainAndNchans(nGains,nChans);
117  m_nChans=nChans;
118  m_nGains=nGains;
119  getBlobStart()[4] = commentSizeChar/sizeof(uint32_t);
120 
121  //==== fill comment fields
122  if(commentSizeChar){
123  if(!timeStamp) timeStamp = ::time(nullptr);
124  uint64_t* pTimeStamp = reinterpret_cast<uint64_t*>(getBlobStart()+dataSizeByte/sizeof(uint32_t));
125  pTimeStamp[0] = timeStamp;
126  char* pChar = reinterpret_cast<char*>(++pTimeStamp);
127  std::string::const_iterator iStr = author.begin();
128  for(; iStr!=author.end(); ++iStr){ *pChar = *iStr; ++pChar; }
129  *pChar = 0;
130  for(iStr=comment.begin(); iStr!=comment.end(); ++iStr){ *(++pChar) = *iStr; }
131  *(++pChar) = 0;
132  }
133 
134  m_pDataStart=static_cast<const void*>(getBlobStart()+getHdrSize());
135  return (blobSizeInBytes/sizeof(uint32_t));
136 }

◆ dump() [1/3]

virtual void CaloCondBlobBase::dump ( ) const
inlinevirtualinherited

Prints the BLOB header summary information to std::cout.

Reimplemented in CaloCondBlobDat< T >.

Definition at line 55 of file CaloCondBlobBase.h.

55 { dumpHeader(std::cout); }

◆ dump() [2/3]

virtual void CaloCondBlobDat< float >::dump
inlinevirtualinherited

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

Definition at line 89 of file CaloCondBlobDat.h.

89 { dump(std::cout); }

◆ dump() [3/3]

void CaloCondBlobDat< float >::dump ( std::ostream &  stm) const
virtualinherited

Prints out the content of the blob.

Parameters
stmThe stream to print to

Reimplemented from CaloCondBlobBase.

Definition at line 92 of file CaloCondBlobDat.h.

204 {
206  for(unsigned int channel=0; channel<getNChans(); ++channel){
207  for(unsigned int adc=0; adc<getNGains(); ++adc){
208  stm << channel<<"/"<<adc<<":\t";
209  for(unsigned int idx=0; idx<getObjSizeUint32(); ++idx){
210  stm << getData(channel,adc,idx) << "\t";
211  }
212  stm << std::endl;
213  }
214  }
215 }

◆ dumpHeader()

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

Prints the BLOB header summary information.

Parameters
stmoutput stream to use

Definition at line 229 of file CaloCondBlobBase.cxx.

230 {
231  stm << "This is a " << CaloCondType::getClassName(getObjType()) << std::endl;
232  stm << "ObjType : " << getObjType() << std::endl;
233  stm << "ObjVersion : " << getObjVersion() << std::endl;
234  stm << "ObjSize [bytes]: " << getObjSizeByte() << std::endl;
235  stm << "NObjs : " << getNObjs() << std::endl;
236  stm << "NChannels : " << getNChans() << std::endl;
237  stm << "NGains : " << getNGains() << std::endl;
238  if(!getCommentSizeUint32()){
239  stm << "=== No comment available ===" << std::endl;
240  }
241  else{
242  stm << "Author : " << getAuthor() << std::endl;
243  stm << "Date : " << getDate() << " ("<< getTimeStamp() << ")" << std::endl;
244  stm << "Comment: : " << getComment() << std::endl;
245  }
246 }

◆ getAddress() [1/4]

float * CaloCondBlobDat< float >::getAddress ( const unsigned int  channel,
const unsigned int  adc 
)
protectedinherited

Definition at line 105 of file CaloCondBlobDat.h.

187 {
188  //=== check for out of bounds
189  if(channel >= getNChans()){
190  throw CaloCond::IndexOutOfRange("CaloCondBlobDat::getAddress(channel)",channel,getNChans());
191  }
192  if(adc>=getNGains()){
193  throw CaloCond::IndexOutOfRange("CaloCondBlobDat::getAddress(gain)",adc,getNGains());
194  }
195 
196  const unsigned int idx = channel*getNGains() + adc;
197  return static_cast<T*>(CaloCondBlobBase::getAddress(idx));
198 }

◆ getAddress() [2/4]

const float * CaloCondBlobDat< float >::getAddress ( const unsigned int  channel,
const unsigned int  adc 
) const
protectedinherited

Returns a pointer to the first value for the specified channel/gain.

Parameters
channelThe channel number; if >= getNChans() 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 104 of file CaloCondBlobDat.h.

170 {
171  //=== check for out of bounds
172  if(channel >= getNChans()){
173  throw CaloCond::IndexOutOfRange("CaloCondBlobDat::getAddress(channel)",channel,getNChans());
174  }
175  if(adc>=getNGains()){
176  throw CaloCond::IndexOutOfRange("CaloCondBlobDat::getAddress(gain)",adc,getNGains());
177  }
178 
179  const unsigned int idx = channel*getNGains() + adc;
180  return static_cast<const T*>(CaloCondBlobBase::getAddress(idx));
181 }

◆ getAddress() [3/4]

void * CaloCondBlobBase::getAddress ( unsigned int  iEle)
inlineinherited

Definition at line 271 of file CaloCondBlobBase.h.

272 {
273  if(iEle>=getNObjs()){
274  throw CaloCond::IndexOutOfRange("CaloCondBlobBase::getAddress", iEle, getNObjs());
275  }
276  return static_cast<void*>
277  ( getBlobStart() + getHdrSize() + getObjSizeUint32()*iEle );
278 }

◆ getAddress() [4/4]

const void * CaloCondBlobBase::getAddress ( unsigned int  iEle) const
inlineinherited

Returns start address of iEle-th basic unit.

Parameters
iElesequential basic unit number

Definition at line 259 of file CaloCondBlobBase.h.

260 {
261  if(iEle>=getNObjs()){
262  throw CaloCond::IndexOutOfRange("CaloCondBlobBase::getAddress", iEle, getNObjs());
263  }
264  return static_cast<const void*>
265  ( getBlobStart() + getHdrSize() + getObjSizeUint32()*iEle );
266 }

◆ getAuthor()

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

Returns the comment author.

Definition at line 176 of file CaloCondBlobBase.cxx.

177 {
178  if(!getCommentSizeUint32()) return std::string("");
179  const char* iBeg =
180  reinterpret_cast<const char*>(getBlobStart()+getHdrSize() +
182  sizeof(uint64_t)/sizeof(uint32_t));
183  return std::string(iBeg);
184 }

◆ getBlobSize()

long CaloCondBlobBase::getBlobSize ( ) const
inlineinherited

Returns the BLOB size.

Definition at line 65 of file CaloCondBlobBase.h.

65 {return m_blob->size(); }

◆ getBlobStart() [1/2]

uint32_t * CaloCondBlobBase::getBlobStart ( )
inlineprivateinherited

Returns the BLOB start address as uint32_t pointer.

Definition at line 185 of file CaloCondBlobBase.h.

186 {
187  return static_cast<uint32_t*>(m_blob_nc->startingAddress());
188 }

◆ getBlobStart() [2/2]

const uint32_t * CaloCondBlobBase::getBlobStart ( ) const
inlineprivateinherited

Returns the BLOB start address as uint32_t pointer.

Definition at line 177 of file CaloCondBlobBase.h.

178 {
179  return static_cast<const uint32_t*>(m_blob->startingAddress());
180 }

◆ getCalib()

float CaloCondBlobFlt::getCalib ( unsigned int  channel,
unsigned int  adc,
float  x,
bool  invert = false 
) const

Returns the calibrated energy for a given channel/gain and input energy.

Parameters
channelThe channel number
adcThe gain index
xParameter of the (calibration) function
invertIf true, the calibration is undone

Definition at line 53 of file CaloCondBlobFlt.cxx.

54 {
55  //=== interpretation of data depends on the objVersion
56  if(getObjVersion()==1){
57  //=== Total noise parameterized as
58  //=== Sigma**2 = a**2 + b**2 * Lumi
59  float a = getData(channel,adc,0);
60  float b = getData(channel,adc,1);
61  if(invert){ x = (x*x - a*a) / (b*b) ;}
62  else { x = std::sqrt( a*a + b*b*x );}
63  }
64  else if (getObjVersion()==2) {
65  //== parameterization for pedestal = a + b*Lumi
66  float a = getData(channel,adc,0);
67  float b = getData(channel,adc,1);
68  if(invert){ x = (x - a) / (b) ;}
69  else { x = a+b*x;}
70  }
71  else{
72  throw CaloCond::VersionConflict("CaloCondBlobFlt::getCalib",getObjVersion());
73  }
74 
75  return x;
76 }

◆ getComment()

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

Returns the actual comment.

Definition at line 190 of file CaloCondBlobBase.cxx.

191 {
192  if(!getCommentSizeUint32()) return std::string("");
193  const char* iBeg =
194  reinterpret_cast<const char*>(getBlobStart()+getHdrSize() +
196  sizeof(uint64_t)/sizeof(uint32_t));
197  const char* iEnd = iBeg + getCommentSizeChar();
198  iBeg = std::find(iBeg,iEnd,0);
199  return std::string(++iBeg);
200 }

◆ 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.

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

◆ 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.

250 {
251  if(uint64_t(m_blob->size())<getHdrSize()*sizeof(uint32_t))
252  throw CaloCond::InvalidBlob("CaloCondBlobBase::getCommentSizeUint32");
253  return static_cast<const uint32_t*>(m_blob->startingAddress())[4];
254 }

◆ getData() [1/2]

float CaloCondBlobDat< float >::getData ( const unsigned int  channel) const
inherited

Returns a single T belonging to a channel/gain.

Parameters
channelThe channel number

Definition at line 57 of file CaloCondBlobDat.h.

142  {
143 return (static_cast<const T*>(m_pDataStart))[channel];
144 }

◆ getData() [2/2]

float CaloCondBlobDat< float >::getData ( const unsigned int  channel,
const unsigned int  adc,
const unsigned int  idx 
) const
inherited

Returns a single T belonging to a channel/gain.

Parameters
channelThe channel number
adcThe gain index
idxThe index of the requested value

Definition at line 49 of file CaloCondBlobDat.h.

135 {
136  if(idx<getObjSizeUint32()){return getAddress(channel,adc)[idx];}
137  else{throw CaloCond::IndexOutOfRange("CaloCondBlobDat::getData",idx,getObjVersion());}
138 }

◆ 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.

206 {
207  if(!getCommentSizeUint32()) return std::string("");
208  ::time_t timeStamp = getTimeStamp();
209  char buf[26];
210  char* iBeg = ::ctime_r(&timeStamp, buf);
211  char* iEnd = iBeg;
212  while(*iEnd!='\n'){++iEnd;}
213  return std::string(iBeg,iEnd-iBeg);
214 }

◆ getFullComment()

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

Returns a formated string build from all comment fields.

Definition at line 219 of file CaloCondBlobBase.cxx.

220 {
221  if(!getCommentSizeUint32()) return std::string("");
222  return getAuthor()+" ("+getDate()+"): "+getComment();
223 }

◆ 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.

85 {return 5;}

◆ getInstance() [1/2]

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

Returns a pointer to a const CaloCondBlobFlt.

Definition at line 19 of file CaloCondBlobFlt.cxx.

20 {
21  return (new CaloCondBlobFlt(blob));
22 }

◆ getInstance() [2/2]

CaloCondBlobFlt * CaloCondBlobFlt::getInstance ( coral::Blob &  blob)
static

Returns a pointer to a non-const CaloCondBlobFlt.

Definition at line 12 of file CaloCondBlobFlt.cxx.

13 {
14  return (new CaloCondBlobFlt(blob));
15 }

◆ getNChans()

uint32_t CaloCondBlobBase::getNChans ( ) const
inlineinherited

Returns the number of channels stored in the BLOB.

Definition at line 231 of file CaloCondBlobBase.h.

232 {
233  return m_nChans;
234 }

◆ getNGains()

uint32_t CaloCondBlobBase::getNGains ( ) const
inlineinherited

Returns the number of gains stored for each channel.

Definition at line 239 of file CaloCondBlobBase.h.

240 {
241  return m_nGains;
242 
243 
244 }

◆ 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.

222 {
223  if(uint64_t(m_blob->size())<getHdrSize()*sizeof(uint32_t))
224  throw CaloCond::InvalidBlob("CaloCondBlobBase::getNObjs");
225  return static_cast<const uint32_t*>(m_blob->startingAddress())[2];
226 }

◆ 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.

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

◆ 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.

214 {
215  return m_sizeOfObj;
216 }

◆ getObjType()

uint16_t CaloCondBlobBase::getObjType ( ) const
inlineinherited

Returns the BLOB object type.

Definition at line 193 of file CaloCondBlobBase.h.

194 {
195  if(uint64_t(m_blob->size())<getHdrSize()*sizeof(uint32_t))
196  throw CaloCond::InvalidBlob("CaloCondBlobBase::getObjType");
197  return static_cast<const uint16_t*>(m_blob->startingAddress())[0];
198 }

◆ getObjVersion()

uint16_t CaloCondBlobBase::getObjVersion ( ) const
inlineinherited

Returns the BLOB object version.

Definition at line 203 of file CaloCondBlobBase.h.

204 {
205  if(uint64_t(m_blob->size())<getHdrSize()*sizeof(uint32_t))
206  throw CaloCond::InvalidBlob("CaloCondBlobBase::getObjVersion");
207  return static_cast<const uint16_t*>(m_blob->startingAddress())[1];
208 }

◆ 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.

284 {
285  if(!getCommentSizeUint32()) return 0;
286  return *(reinterpret_cast<const uint64_t*>(getBlobStart()+getHdrSize() +
288 }

◆ getType()

virtual uint16_t CaloCondBlobFlt::getType ( ) const
inlinevirtual

Returns CaloCondType::FLT.

Reimplemented from CaloCondBlobBase.

Definition at line 36 of file CaloCondBlobFlt.h.

36 {return CaloCondType::FLT;}

◆ init()

void CaloCondBlobDat< float >::init ( const DefType def,
uint32_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 object
objVersVersion of the object
authorString containing the author user id
commentString containing the actual comment
timeStampUnix time stamp (if 0, current time is used)

Definition at line 67 of file CaloCondBlobDat.h.

117 {
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);
122 
123  //=== fill the blob with default
124  for(unsigned int channel=0; channel<nChans; ++channel){
125  for(unsigned int adc=0; adc<nGains; ++adc){
126  setData(channel, adc, def[adc]);
127  }
128  }
129 }

◆ packGainAndNchans()

uint32_t CaloCondBlobBase::packGainAndNchans ( const uint32_t  gain,
const uint32_t  nChans 
)
staticprivateinherited

Definition at line 139 of file CaloCondBlobBase.cxx.

139  {
140 
141  if (gain>0x7F)
142  throw CaloCond::InvalidBlob("CaloCondBlobBase::packGainAndNchans: Gain too large");
143 
144  if (nChans>0xFFFFFF)
145  throw CaloCond::InvalidBlob("CaloCondBlobBase::packGainAndNchans: Number of channels too large");
146 
147  return 0x80000000 | (gain << 24) | nChans;
148 }

◆ setData() [1/2]

void CaloCondBlobDat< 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
channelThe channel number
adcThe gain index
dataA vector containing the values to be set

Definition at line 85 of file CaloCondBlobDat.h.

160 {
161  for(typename std::vector<T>::const_iterator i=data.begin(); i!=data.end(); ++i){
162  setData(channel,adc,i-data.begin(),*i);
163  }
164 }

◆ setData() [2/2]

void CaloCondBlobDat< float >::setData ( unsigned int  channel,
unsigned int  adc,
unsigned int  idx,
float  data 
)
inherited

Sets a single T belonging to a channel/gain.

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

Definition at line 79 of file CaloCondBlobDat.h.

151 {
153  else{throw CaloCond::IndexOutOfRange("CaloCondBlobDat::setData",idx,getObjVersion());}
154 }

◆ unpacknChans()

uint32_t CaloCondBlobBase::unpacknChans ( const uint32_t  gainAndnChans)
staticprivateinherited

Definition at line 160 of file CaloCondBlobBase.cxx.

160  {
161  if (gainAndnChans & 0x80000000) { //new version: 24 bytes for the nChans, 7 for the gain
162  //std::cout << "CaloCondBlobBase: Reading nChans from new version" << std::endl;
163  return gainAndnChans & 0xFFFFFF;
164  }
165  else //Old version: 16 bits for nChans
166  //std::cout << "CaloCondBlobBase: Reading nChangs from old version" << std::endl;
167  return gainAndnChans & 0xFFFF;
168 }

◆ unpacknGains()

uint32_t CaloCondBlobBase::unpacknGains ( const uint32_t  gainAndnChans)
staticprivateinherited

Definition at line 150 of file CaloCondBlobBase.cxx.

150  {
151  if (gainAndnChans & 0x80000000) { //new version: 24 bytes for the nChans, 7 for the gain
152  //std::cout << "CaloCondBlobBase: Reading gain from new version" << std::endl;
153  return (gainAndnChans>>24) & 0x7F;
154  }
155  else //Old version: 16 bigs for gain
156  //std::cout << "CaloCondBlobBase: Reading gain from old version" << std::endl;
157  return (gainAndnChans>>16) & 0xFFFF;
158 }

Member Data Documentation

◆ m_blob

const coral::Blob* CaloCondBlobBase::m_blob
privateinherited

Const reference to the BLOB (always there)

Definition at line 160 of file CaloCondBlobBase.h.

◆ 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

Do I own the BLOB?

Definition at line 163 of file CaloCondBlobBase.h.

◆ m_nChans

unsigned CaloCondBlobBase::m_nChans
privateinherited

Definition at line 167 of file CaloCondBlobBase.h.

◆ m_nGains

unsigned CaloCondBlobBase::m_nGains
privateinherited

Definition at line 168 of file CaloCondBlobBase.h.

◆ m_pDataStart

const void* CaloCondBlobBase::m_pDataStart
protectedinherited

Definition at line 170 of file CaloCondBlobBase.h.

◆ m_sizeOfObj

unsigned CaloCondBlobBase::m_sizeOfObj
privateinherited

Chache of some frequently-used numbers.

Definition at line 166 of file CaloCondBlobBase.h.


The documentation for this class was generated from the following files:
CaloCondBlobBase::getCommentSizeUint32
uint32_t getCommentSizeUint32() const
Returns the space occupied by the comment fields in units of uint32_t.
Definition: CaloCondBlobBase.h:249
checkFileSG.nObjs
nObjs
Definition: checkFileSG.py:90
CaloCondBlobDat< float >::setData
void setData(unsigned int channel, unsigned int adc, unsigned int idx, float data)
Sets a single T belonging to a channel/gain.
Definition: CaloCondBlobDat.h:150
CaloCondBlobFlt::CaloCondBlobFlt
CaloCondBlobFlt(const coral::Blob &blob)
Ctor.
Definition: CaloCondBlobFlt.cxx:26
CaloCondBlobBase::packGainAndNchans
static uint32_t packGainAndNchans(const uint32_t gain, const uint32_t nChans)
Definition: CaloCondBlobBase.cxx:139
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
CaloCondBlobDat< float >
CaloCondBlobBase::getObjSizeUint32
uint32_t getObjSizeUint32() const
Returns the size of a data object in units of uint32_t.
Definition: CaloCondBlobBase.h:213
CaloCondBlobDat< float >::getData
float getData(const unsigned int channel, const unsigned int adc, const unsigned int idx) const
Returns a single T belonging to a channel/gain.
Definition: CaloCondBlobDat.h:134
CaloCondBlobBase::getAuthor
std::string getAuthor() const
Returns the comment author.
Definition: CaloCondBlobBase.cxx:176
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CaloCondBlobBase::m_nGains
unsigned m_nGains
Definition: CaloCondBlobBase.h:168
CaloCondBlobBase::m_blob_nc
coral::Blob * m_blob_nc
Non-const reference to the BLOB.
Definition: CaloCondBlobBase.h:157
CaloCondBlobBase::getAddress
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
Definition: CaloCondBlobBase.h:259
CaloCondBlobDat< float >::getAddress
const float * getAddress(const unsigned int channel, const unsigned int adc) const
Returns a pointer to the first value for the specified channel/gain.
Definition: CaloCondBlobDat.h:169
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
CaloCondBlobBase::getBlobSize
long getBlobSize() const
Returns the BLOB size.
Definition: CaloCondBlobBase.h:65
CaloCondBlobBase::m_pDataStart
const void * m_pDataStart
Definition: CaloCondBlobBase.h:170
CaloCondBlobBase::getType
virtual uint16_t getType() const
Returns CaloCondDrawer::BASE.
Definition: CaloCondBlobBase.h:52
CaloCondBlobBase::createBlob
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.
Definition: CaloCondBlobBase.cxx:83
CaloCondBlobBase::getObjType
uint16_t getObjType() const
Returns the BLOB object type.
Definition: CaloCondBlobBase.h:193
x
#define x
CaloCondBlobBase::getDate
std::string getDate() const
Returns the date of the comment as string (derived from timestamp)
Definition: CaloCondBlobBase.cxx:205
TileCalibBlobPython_writeOfc.objVersion
objVersion
Definition: TileCalibBlobPython_writeOfc.py:71
CaloCond::TypeConflict
Thrown if object type in BLOB does not agree with class type.
Definition: Calorimeter/CaloCondBlobObjs/CaloCondBlobObjs/Exception.h:84
CaloCondBlobBase::getHdrSize
unsigned int getHdrSize() const
Returns the size of the header in units of uint32_t.
Definition: CaloCondBlobBase.h:85
CaloCondBlobBase::getCommentSizeChar
uint32_t getCommentSizeChar() const
Returns the space occupied by the comment fields in units of chars.
Definition: CaloCondBlobBase.h:83
CaloCondBlobBase::getBlobStart
const uint32_t * getBlobStart() const
Returns the BLOB start address as uint32_t pointer.
Definition: CaloCondBlobBase.h:177
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
CaloCondBlobFlt::getType
virtual uint16_t getType() const
Returns CaloCondType::FLT.
Definition: CaloCondBlobFlt.h:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
CaloCondBlobBase::getObjVersion
uint16_t getObjVersion() const
Returns the BLOB object version.
Definition: CaloCondBlobBase.h:203
CaloCondBlobBase::getComment
std::string getComment() const
Returns the actual comment.
Definition: CaloCondBlobBase.cxx:190
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
CaloCondBlobBase::m_nChans
unsigned m_nChans
Definition: CaloCondBlobBase.h:167
CaloCondBlobBase::dumpHeader
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.
Definition: CaloCondBlobBase.cxx:229
CaloCond::VersionConflict
Thrown if object version in BLOB does not agree with class version.
Definition: Calorimeter/CaloCondBlobObjs/CaloCondBlobObjs/Exception.h:64
CaloCond::InvalidBlob
Thrown if coral::Blob does not conform with expected structure.
Definition: Calorimeter/CaloCondBlobObjs/CaloCondBlobObjs/Exception.h:50
CaloCondBlobAlgs_fillNoiseFromASCII.comment
string comment
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:27
CaloCond::IndexOutOfRange
Thrown if an index is out of range.
Definition: Calorimeter/CaloCondBlobObjs/CaloCondBlobObjs/Exception.h:124
CaloCondType::getClassName
static std::string getClassName(CaloCondType::TYPE type)
Returns the class name.
Definition: CaloCondType.cxx:10
CaloCondBlobBase::getNObjs
uint32_t getNObjs() const
Returns the number of data objects stored int the BLOB.
Definition: CaloCondBlobBase.h:221
CaloCondBlobBase::getNGains
uint32_t getNGains() const
Returns the number of gains stored for each channel.
Definition: CaloCondBlobBase.h:239
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
CaloCondType::FLT
@ FLT
Enum for CaloCondBlobFlt class.
Definition: CaloCondType.h:29
xAOD::timeStamp
setEventNumber timeStamp
Definition: EventInfo_v1.cxx:128
CaloCondBlobBase::m_blob
const coral::Blob * m_blob
Const reference to the BLOB (always there)
Definition: CaloCondBlobBase.h:160
CaloCondBlobBase::getObjSizeByte
uint32_t getObjSizeByte() const
Returns the size of a data object in units of bytes.
Definition: CaloCondBlobBase.h:73
a
TList * a
Definition: liststreamerinfos.cxx:10
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
CaloCondBlobDat< float >::dump
virtual void dump() const
Prints out the content of the blob to std::out.
Definition: CaloCondBlobDat.h:89
CaloCondBlobBase::m_sizeOfObj
unsigned m_sizeOfObj
Chache of some frequently-used numbers.
Definition: CaloCondBlobBase.h:166
CaloCondBlobAlgs_fillNoiseFromASCII.author
string author
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
CaloCondBlobBase::getTimeStamp
uint64_t getTimeStamp() const
Returns the unix timestamp of the comment (seconds since 1.1.1970)
Definition: CaloCondBlobBase.h:283
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
CaloCondBlobBase::getNChans
uint32_t getNChans() const
Returns the number of channels stored in the BLOB.
Definition: CaloCondBlobBase.h:231