19 , std::string_view author
20 , std::string_view comment
24 calibDrawer->init(objVersion, nSamples, nPhases, nChans, nGains, author, comment, timeStamp);
68 unsigned int thisObjSize = 0;
71 thisObjSize =
sizeof(uint32_t);
75 thisObjSize =
sizeof(uint32_t);
79 thisObjSize =
sizeof(uint32_t);
81 if(blobObjSize != thisObjSize){
95 , std::string_view author
96 , std::string_view comment
99 const uint16_t extraHeaderSize(2);
101 uint32_t objSize = 1;
102 uint32_t objCount = extraHeaderSize;
106 unsigned int nPhasesAbs = std::abs(nPhases);
107 int nPhasesSgn = nPhases < 0 ? -1 : 1;
108 unsigned int phasesSize = nPhasesAbs;
109 if(nPhasesSgn > 0){ phasesSize *= nChans*nGains; }
110 objCount += phasesSize;
113 objCount += ( nSamples * nFields * nGains * nPhasesAbs * nChans );
116 uint32_t blobLengthUint32 =
117 createBlob(objType, objVersion, objSize, objCount, nChans, nGains, author, comment, timeStamp);
120 uint32_t* pu =
static_cast<uint32_t*
>(
getAddress(0));
122 int32_t*
pi =
reinterpret_cast<int32_t*
>(++pu);
125 for(
unsigned int iPhase = 0; iPhase < phasesSize; ++iPhase){
126 *(++
pi) = int32_t(0);
130 for(
unsigned int i = 0; i < blobLengthUint32 - (
m_hdrSize32 + extraHeaderSize + phasesSize); ++i){
140 std::set<int32_t> phaseSet;
141 for (
const float phase : phases) {
145 if(
int(phaseSet.size()) != std::abs(
getNPhases())){
150 for (
const int32_t phase : phaseSet) {
161 unsigned int channel = 0;
162 for(
int iPhase = 0; iPhase < std::abs(
getNPhases()); ++iPhase){
163 for(
unsigned int sample = 0; sample <
getNSamples(); ++sample){
164 for(
unsigned int adc = 0; adc <
getNGains(); ++adc){
165 float phase =
getPhase(channel, adc, iPhase);
166 stm << channel <<
"/" << phase <<
"/" << sample <<
"/" << adc <<
"\t";
168 stm <<
getOfc(field,channel, adc, phase, sample) <<
"\t";
#define PHASE_PRECISION
Class for storing Optimal Filtering Coefficients (OFCs) in a coral::Blob.
uint16_t getObjType() const
Returns the BLOB object type.
uint16_t getNGains() const
Returns the number of gains stored for each channel.
long getBlobSize() const
Returns the BLOB size in units of bytes.
void dumpHeader(std::ostream &stm) const
Prints the BLOB header summary information.
TileCalibDrawerBase(const TileCalibDrawerBase &other)
Copy Ctor.
static const unsigned int m_hdrSize32
The header size in units of uint32_t.
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.
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
TileCalibDrawerOfc(const coral::Blob &blob)
Ctor (const).
int32_t getNPhases() const
Returns the number of phases (WARNING: Can be negative!).
void init(uint16_t objVersion, uint32_t nSamples, int32_t nPhases, uint16_t nChans, uint16_t nGains, std::string_view author="", std::string_view comment="", uint64_t timeStamp=0)
Function for initializing a TileCalibDrawerOfc BLOB.
float getPhase(unsigned int channel, unsigned int adc, unsigned int phaseIdx) const
Returns the stored phase.
uint32_t getNSamples() const
Returns the number of sample stored.
virtual uint16_t getType() const
Returns TileCalibType::OFC.
void setPhases(unsigned int channel, unsigned int adc, const std::vector< float > &phases)
Sets a phase value.
float getOfc(unsigned int field, unsigned int channel, unsigned int adc, float phase, unsigned int sample) const
Returns OFC data.
virtual void dump() const
Prints out the object content to std::cout.
const int32_t * getPhaseStartAddress(unsigned int channel, unsigned int adc, unsigned int phaseIdx) const
Returns pointer to the requested phase value.
uint32_t getNFields(uint16_t objVersion=0) const
Returns the number of fields.
static TileCalibDrawerOfc * getInstance(coral::Blob &blob, uint16_t objVersion, uint32_t nSamples, int32_t nPhases, uint16_t nChans, uint16_t nGains, std::string_view author="", std::string_view comment="", uint64_t timeStamp=0)
Returns a pointer to a non-const TileCalibDrawerOfc.
Thrown if an index is out of range.
Thrown if coral::Blob does not conform with expected structure.
Thrown if BLOB size is not correct.
Thrown if object type in BLOB does not agree with class type.