ATLAS Offline Software
TileCalibDrawerBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TILECALIBBLOBOBJS_TILECALIBDRAWERBASE_H
6 #define TILECALIBBLOBOBJS_TILECALIBDRAWERBASE_H
7 
50 #include <stdint.h>
51 #include <vector>
52 #include <string>
53 #include <iostream>
54 #include "CoralBase/Blob.h"
57 
58 
60  public:
62  virtual ~TileCalibDrawerBase();
63 
70 
73 
77  virtual void clone(const TileCalibDrawerBase& other);
78 
80  virtual uint16_t getType() const {return TileCalibType::BASE;}
81 
83  virtual void dump() const { dumpHeader(std::cout); }
86  virtual void dump(std::ostream& stm) const {dumpHeader(stm);}
87 
88  //==================================================================
89  //== Accessor methods for the header
90  //==================================================================
92  long getBlobSize() const { return m_blobSize32 * sizeof(uint32_t); }
94  long getBlobSize32() const { return m_blobSize32; }
102  uint32_t getObjSizeByte() const {return getObjSizeUint32()*sizeof(uint32_t);}
113 
114  //==================================================================
115  //== Accessor methods for the comment fields
116  //==================================================================
118  std::string getAuthor() const;
120  std::string getComment() const;
124  std::string getDate() const;
126  std::string getFullComment() const;
127 
128 
129  //==================================================================
130  //== Blob field access
131  //==================================================================
134  const void* getAddress(unsigned int iEle) const;
135  void* getAddress(unsigned int iEle);
136 
138  static const unsigned int m_hdrSize32 = 5;
139 
140  protected:
143 
146 
157  uint32_t createBlob(uint16_t objType,
159  uint32_t objSizeUint32,
160  uint32_t nObjs,
161  uint16_t nChans,
162  uint16_t nGains,
163  const std::string& author="",
164  const std::string& comment="",
165  uint64_t timeStamp=0);
166 
169  void dumpHeader(std::ostream& stm) const;
170 
171  private:
185 };
186 
187 
188 //
189 //_________________________________________________________
190 __attribute__((always_inline)) inline uint16_t
192 {
193  return m_blobStart16[0];
194 }
195 
196 //
197 //_________________________________________________________
198 __attribute__((always_inline)) inline uint16_t
200 {
201  return m_blobStart16[1];
202 }
203 
204 //
205 //_________________________________________________________
206 __attribute__((always_inline)) inline uint32_t
208 {
209  return m_blobStart32[1];
210 }
211 
212 //
213 //_________________________________________________________
214 __attribute__((always_inline)) inline uint32_t
216 {
217  return m_blobStart32[2];
218 }
219 
220 //
221 //_________________________________________________________
222 __attribute__((always_inline)) inline uint16_t
224 {
225  return m_blobStart16[6];
226 }
227 
228 //
229 //_________________________________________________________
230 __attribute__((always_inline)) inline uint16_t
232 {
233  return m_blobStart16[7];
234 }
235 
236 //
237 //_________________________________________________________
238 __attribute__((always_inline)) inline uint32_t
240 {
241  return m_blobStart32[4];
242 }
243 
244 //
245 //_________________________________________________________
246 __attribute__((always_inline)) inline const void*
247 TileCalibDrawerBase::getAddress(unsigned int iEle) const
248 {
249  if(iEle>=getNObjs()){
250  throw TileCalib::IndexOutOfRange("TileCalibDrawerBase::getAddress", iEle, getNObjs());
251  }
252  return static_cast<const void*>( m_blobStart32 + m_hdrSize32 + getObjSizeUint32()*iEle );
253 }
254 
255 //
256 //_________________________________________________________
257 __attribute__((always_inline)) inline void*
258 TileCalibDrawerBase::getAddress(unsigned int iEle)
259 {
260  if(iEle>=getNObjs()){
261  throw TileCalib::IndexOutOfRange("TileCalibDrawerBase::getAddress", iEle, getNObjs());
262  }
263  uint32_t* blobStart32 = static_cast<uint32_t*>(m_blob_nc->startingAddress());
264  return static_cast<void*>( blobStart32 + m_hdrSize32 + getObjSizeUint32()*iEle );
265 }
266 
267 //
268 //_________________________________________________________
269 __attribute__((always_inline)) inline uint64_t
271 {
272  if(!getCommentSizeUint32()) return 0;
273  return *(reinterpret_cast<const uint64_t*>(m_blobStart32 + m_hdrSize32 +
275 }
276 
277 #endif
TileCalibDrawerBase::getAuthor
std::string getAuthor() const
Returns the comment author.
Definition: TileCalibDrawerBase.cxx:147
checkFileSG.nObjs
nObjs
Definition: checkFileSG.py:90
TileCalibDrawerBase::getBlobSize
long getBlobSize() const
Returns the BLOB size in units of bytes.
Definition: TileCalibDrawerBase.h:92
TileCalibDrawerBase::getType
virtual uint16_t getType() const
Returns TileCalibDrawer::BASE.
Definition: TileCalibDrawerBase.h:80
TileCalib::IndexOutOfRange
Thrown if an index is out of range.
Definition: TileCalorimeter/TileCalib/TileCalibBlobObjs/TileCalibBlobObjs/Exception.h:141
TileCalibDrawerBase::getNGains
uint16_t getNGains() const
Returns the number of gains stored for each channel.
TileCalibDrawerBase::m_blobStart32
const uint32_t * m_blobStart32
Cache blob starting address as uint_32t*.
Definition: TileCalibDrawerBase.h:178
TileCalibDrawerBase::m_blob_nc
coral::Blob * m_blob_nc
Non-const reference to the BLOB.
Definition: TileCalibDrawerBase.h:174
TileCalibDrawerBase::m_hdrSize32
static const unsigned int m_hdrSize32
The header size in units of uint32_t.
Definition: TileCalibDrawerBase.h:138
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileCalibDrawerBase::getBlobSize32
long getBlobSize32() const
Returns the BLOB size in units of uint32_t.
Definition: TileCalibDrawerBase.h:94
TileCalibType.h
TileCalibDrawerBase::m_isBlobOwner
bool m_isBlobOwner
Is this TileCalibDrawer owner of the BLOB.
Definition: TileCalibDrawerBase.h:184
TileCalibDrawerBase::getCommentSizeUint32
uint32_t getCommentSizeUint32() const
Returns the space occupied by the comment fields in units of uint32_t.
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
TileCalibDrawerBase::getCommentSizeChar
uint32_t getCommentSizeChar() const
Returns the space occupied by the comment fields in units of chars.
Definition: TileCalibDrawerBase.h:112
TileCalibDrawerBase::dumpHeader
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.
Definition: TileCalibDrawerBase.cxx:200
TileCalibDrawerBase::dump
virtual void dump(std::ostream &stm) const
Prints the BLOB header summary information.
Definition: TileCalibDrawerBase.h:86
TileCalibBlobPython_writeOfc.objVersion
objVersion
Definition: TileCalibBlobPython_writeOfc.py:71
TileCalibDrawerBase::getObjVersion
uint16_t getObjVersion() const
Returns the BLOB object version.
TileCalibDrawerBase::getTimeStamp
uint64_t getTimeStamp() const
Returns the unix timestamp of the comment (seconds since 1.1.1970)
TileCalibDrawerBase::getObjSizeByte
uint32_t getObjSizeByte() const
Returns the size of a data object in units of bytes.
Definition: TileCalibDrawerBase.h:102
TileCalibDrawerBase::clone
virtual void clone(const TileCalibDrawerBase &other)
Initialzes Blob with content of other Blob.
Definition: TileCalibDrawerBase.cxx:74
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TileCalibDrawerBase
This class provides the core BLOB infrastructure.
Definition: TileCalibDrawerBase.h:59
TileCalibDrawerBase::getNChans
uint16_t getNChans() const
Returns the number of channels stored in the BLOB.
TileCalibDrawerBase::getDate
std::string getDate() const
Returns the date of the comment as string (derived from timestamp)
Definition: TileCalibDrawerBase.cxx:176
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
TileCalibDrawerBase::dump
virtual void dump() const
Prints the BLOB header summary information to std::cout.
Definition: TileCalibDrawerBase.h:83
CaloCondBlobAlgs_fillNoiseFromASCII.comment
string comment
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:27
TileCalibDrawerBase::createBlob
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.
Definition: TileCalibDrawerBase.cxx:87
TileCalibDrawerBase::getComment
std::string getComment() const
Returns the actual comment.
Definition: TileCalibDrawerBase.cxx:161
xAOD::timeStamp
setEventNumber timeStamp
Definition: EventInfo_v1.cxx:128
TileCalibDrawerBase::m_blobSize32
uint64_t m_blobSize32
Cache blob size in units of uint32_t.
Definition: TileCalibDrawerBase.h:182
__attribute__
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
Definition: TileCalibDrawerBase.h:190
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
TileCalibDrawerBase::getObjType
uint16_t getObjType() const
Returns the BLOB object type.
TileCalibDrawerBase::~TileCalibDrawerBase
virtual ~TileCalibDrawerBase()
Dtor.
Definition: TileCalibDrawerBase.cxx:36
CaloCondBlobAlgs_fillNoiseFromASCII.author
string author
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
TileCalibDrawerBase::TileCalibDrawerBase
TileCalibDrawerBase(const TileCalibDrawerBase &other)
Copy Ctor.
Definition: TileCalibDrawerBase.cxx:44
TileCalibDrawerBase::m_blob
const coral::Blob * m_blob
Const reference to the BLOB (always there)
Definition: TileCalibDrawerBase.h:176
TileCalibDrawerBase::getAddress
void * getAddress(unsigned int iEle)
Exception.h
TileCalibDrawerBase::operator=
TileCalibDrawerBase & operator=(const TileCalibDrawerBase &other)
Assignment operator.
Definition: TileCalibDrawerBase.cxx:57
TileCalibDrawerBase::getObjSizeUint32
uint32_t getObjSizeUint32() const
Returns the size of a data object in units of uint32_t.
TileCalibDrawerBase::getAddress
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
TileCalibType::BASE
@ BASE
Enum for TileCalibDrawerBase class.
Definition: TileCalibType.h:27
TileCalibDrawerBase::m_blobStart16
const uint16_t * m_blobStart16
Cache blob starting address as uint_16t*.
Definition: TileCalibDrawerBase.h:180
TileCalibDrawerBase::getNObjs
uint32_t getNObjs() const
Returns the number of data objects stored int the BLOB.
TileCalibDrawerBase::getFullComment
std::string getFullComment() const
Returns a formated string build from all comment fields.
Definition: TileCalibDrawerBase.cxx:190