ATLAS Offline Software
Loading...
Searching...
No Matches
TileCalibDrawerBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TILECALIBBLOBOBJS_TILECALIBDRAWERBASE_H
6#define TILECALIBBLOBOBJS_TILECALIBDRAWERBASE_H
7
48
49
50
51#include "CoralBase/Blob.h"
54
55#include <stdint.h>
56#include <vector>
57#include <string>
58#include <iosfwd>
59
60
62 public:
64 virtual ~TileCalibDrawerBase();
65
72
75
79 virtual void clone(const TileCalibDrawerBase& other);
80
82 virtual uint16_t getType() const {return TileCalibType::BASE;}
83
85 virtual void dump() const;
88 virtual void dump(std::ostream& stm) const {dumpHeader(stm);}
89
90 //==================================================================
91 //== Accessor methods for the header
92 //==================================================================
94 long getBlobSize() const { return m_blobSize32 * sizeof(uint32_t); }
96 long getBlobSize32() const { return m_blobSize32; }
98 uint16_t getObjType() const;
100 uint16_t getObjVersion() const;
102 uint32_t getObjSizeUint32() const;
104 uint32_t getObjSizeByte() const {return getObjSizeUint32()*sizeof(uint32_t);}
106 uint32_t getNObjs() const;
108 uint16_t getNChans() const;
110 uint16_t getNGains() const;
112 uint32_t getCommentSizeUint32() const;
114 uint32_t getCommentSizeChar() const {return getCommentSizeUint32()*sizeof(uint32_t);}
115
116 //==================================================================
117 //== Accessor methods for the comment fields
118 //==================================================================
120 std::string getAuthor() const;
122 std::string getComment() const;
124 uint64_t getTimeStamp() const;
126 std::string getDate() const;
128 std::string getFullComment() const;
129
130
131 //==================================================================
132 //== Blob field access
133 //==================================================================
136 const void* getAddress(unsigned int iEle) const;
137 void* getAddress(unsigned int iEle);
138
140 static const unsigned int m_hdrSize32 = 5;
141
142 protected:
144 TileCalibDrawerBase(const coral::Blob& blob);
145
147 TileCalibDrawerBase(coral::Blob& blob);
148
159 uint32_t createBlob(uint16_t objType,
160 uint16_t objVersion,
161 uint32_t objSizeUint32,
162 uint32_t nObjs,
163 uint16_t nChans,
164 uint16_t nGains,
165 std::string_view author="",
166 std::string_view comment="",
167 uint64_t timeStamp=0);
168
171 void dumpHeader(std::ostream& stm) const;
172
173 private:
176 coral::Blob* m_blob_nc;
178 const coral::Blob* m_blob;
180 const uint32_t* m_blobStart32;
182 const uint16_t* m_blobStart16;
184 uint64_t m_blobSize32;
187};
188
189
190//
191//_________________________________________________________
192__attribute__((always_inline)) inline uint16_t
194{
195 return m_blobStart16[0];
196}
197
198//
199//_________________________________________________________
200__attribute__((always_inline)) inline uint16_t
202{
203 return m_blobStart16[1];
204}
205
206//
207//_________________________________________________________
208__attribute__((always_inline)) inline uint32_t
210{
211 return m_blobStart32[1];
212}
213
214//
215//_________________________________________________________
216__attribute__((always_inline)) inline uint32_t
218{
219 return m_blobStart32[2];
220}
221
222//
223//_________________________________________________________
224__attribute__((always_inline)) inline uint16_t
226{
227 return m_blobStart16[6];
228}
229
230//
231//_________________________________________________________
232__attribute__((always_inline)) inline uint16_t
234{
235 return m_blobStart16[7];
236}
237
238//
239//_________________________________________________________
240__attribute__((always_inline)) inline uint32_t
242{
243 return m_blobStart32[4];
244}
245
246//
247//_________________________________________________________
248__attribute__((always_inline)) inline const void*
249TileCalibDrawerBase::getAddress(unsigned int iEle) const
250{
251 if(iEle>=getNObjs()){
252 throw TileCalib::IndexOutOfRange("TileCalibDrawerBase::getAddress", iEle, getNObjs());
253 }
254 return static_cast<const void*>( m_blobStart32 + m_hdrSize32 + getObjSizeUint32()*iEle );
255}
256
257//
258//_________________________________________________________
259__attribute__((always_inline)) inline void*
260TileCalibDrawerBase::getAddress(unsigned int iEle)
261{
262 if(iEle>=getNObjs()){
263 throw TileCalib::IndexOutOfRange("TileCalibDrawerBase::getAddress", iEle, getNObjs());
264 }
265 uint32_t* blobStart32 = static_cast<uint32_t*>(m_blob_nc->startingAddress());
266 return static_cast<void*>( blobStart32 + m_hdrSize32 + getObjSizeUint32()*iEle );
267}
268
269//
270//_________________________________________________________
271__attribute__((always_inline)) inline uint64_t
273{
274 if(!getCommentSizeUint32()) return 0;
275 return *(reinterpret_cast<const uint64_t*>(m_blobStart32 + m_hdrSize32 +
277}
278
279#endif
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
virtual uint16_t getType() const
Returns TileCalibDrawer::BASE.
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.
TileCalibDrawerBase & operator=(const TileCalibDrawerBase &other)
Assignment operator.
virtual void clone(const TileCalibDrawerBase &other)
Initialzes Blob with content of other Blob.
uint64_t m_blobSize32
Cache blob size in units of uint32_t.
std::string getFullComment() const
Returns a formated string build from all comment fields.
std::string getComment() const
Returns the actual comment.
virtual void dump(std::ostream &stm) const
Prints the BLOB header summary information.
uint16_t getObjType() const
Returns the BLOB object type.
const uint32_t * m_blobStart32
Cache blob starting address as uint_32t*.
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).
const coral::Blob * m_blob
Const reference to the BLOB (always there).
long getBlobSize() const
Returns the BLOB size in units of bytes.
void * getAddress(unsigned int iEle)
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.
virtual ~TileCalibDrawerBase()
Dtor.
TileCalibDrawerBase(const TileCalibDrawerBase &other)
Copy Ctor.
uint32_t getNObjs() const
Returns the number of data objects stored int the BLOB.
const uint16_t * m_blobStart16
Cache blob starting address as uint_16t*.
std::string getAuthor() const
Returns the comment author.
static const unsigned int m_hdrSize32
The header size in units of uint32_t.
bool m_isBlobOwner
Is this TileCalibDrawer owner of the BLOB.
virtual void dump() const
Prints the BLOB header summary information to std::cout.
uint16_t getObjVersion() const
Returns the BLOB object version.
uint32_t getObjSizeByte() const
Returns the size of a data object in units of bytes.
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.
coral::Blob * m_blob_nc
Non-const reference to the BLOB.
long getBlobSize32() const
Returns the BLOB size in units of uint32_t.
uint32_t getObjSizeUint32() const
Returns the size of a data object in units of uint32_t.
uint32_t getCommentSizeChar() const
Returns the space occupied by the comment fields in units of chars.
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
@ BASE
Enum for TileCalibDrawerBase class.
setWord1 uint16_t
setEventNumber uint32_t