20 ,
const std::string& author
21 ,
const std::string& comment
25 calibDrawer->init(objVersion, nSamples, nPhases, nChans, nGains, author, comment, timeStamp);
69 unsigned int thisObjSize = 0;
72 thisObjSize =
sizeof(uint32_t);
76 thisObjSize =
sizeof(uint32_t);
80 thisObjSize =
sizeof(uint32_t);
82 if(blobObjSize != thisObjSize){
96 ,
const std::string& author
97 ,
const std::string& comment
100 const uint16_t extraHeaderSize(2);
102 uint32_t objSize = 1;
103 uint32_t objCount = extraHeaderSize;
107 unsigned int nPhasesAbs = std::abs(nPhases);
108 int nPhasesSgn = nPhases < 0 ? -1 : 1;
109 unsigned int phasesSize = nPhasesAbs;
110 if(nPhasesSgn > 0){ phasesSize *= nChans*nGains; }
111 objCount += phasesSize;
114 objCount += ( nSamples * nFields * nGains * nPhasesAbs * nChans );
117 uint32_t blobLengthUint32 =
118 createBlob(objType, objVersion, objSize, objCount, nChans, nGains, author, comment, timeStamp);
121 uint32_t* pu =
static_cast<uint32_t*
>(
getAddress(0));
123 int32_t*
pi =
reinterpret_cast<int32_t*
>(++pu);
126 for(
unsigned int iPhase = 0; iPhase < phasesSize; ++iPhase){
127 *(++
pi) = int32_t(0);
136 for(
unsigned int i = 0; i < blobLengthUint32 - (
m_hdrSize32 + extraHeaderSize+phasesSize); ++i){
146 std::set<int32_t> phaseSet;
147 for (
const float phase : phases) {
151 if(
int(phaseSet.size()) != std::abs(
getNPhases())){
156 for (
const int32_t phase : phaseSet) {
167 unsigned int channel = 0;
168 for(
int iPhase = 0; iPhase < std::abs(
getNPhases()); ++iPhase){
169 for(
unsigned int sample = 0; sample <
getNSamples(); ++sample){
170 for(
unsigned int adc = 0; adc <
getNGains(); ++adc){
171 float phase =
getPhase(channel, adc, iPhase);
172 stm << channel <<
"/" << phase <<
"/" << sample <<
"/" << adc <<
"\t";
174 stm <<
getOfc(field,channel, adc, phase, sample) <<
"\t";
#define PHASE_PRECISION
Class for storing Optimal Filtering Coefficients (OFCs) in a coral::Blob.
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.
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.
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!)
float getPhase(unsigned int channel, unsigned int adc, unsigned int phaseIdx) const
Returns the stored phase.
virtual void dump() const
Prints out the object content to std::cout.
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.
void init(uint16_t objVersion, uint32_t nSamples, int32_t nPhases, uint16_t nChans, uint16_t nGains, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0)
Function for initializing a TileCalibDrawerOfc BLOB.
float getOfc(unsigned int field, unsigned int channel, unsigned int adc, float phase, unsigned int sample) const
Returns OFC data.
static TileCalibDrawerOfc * getInstance(coral::Blob &blob, uint16_t objVersion, uint32_t nSamples, int32_t nPhases, uint16_t nChans, uint16_t nGains, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0)
Returns a pointer to a non-const TileCalibDrawerOfc.
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.
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.
void zero(TH2 *h)
zero the contents of a 2d histogram