204 {
205 return *(
static_cast<const uint32_t*
>(getAddress(0)));
206}
207
208
209
212 return *(
static_cast<const int32_t*
>(
getAddress(1)));
213}
214
215
216
219
220 if (std::abs(phase) > 1e6F) {
221
223 }
227 const int32_t*
pos = std::lower_bound(beg, end, db_phase);
228
229 if (pos == end || (*pos != db_phase && pos != beg && (*pos - db_phase) > (db_phase - *(pos - 1)))) {
231 }
232
234 return (pos - beg);
235}
236
237
238
242}
243
244
245
248
250
251 if( objVersion == 3){ return 5; }
252 else if(objVersion == 2){ return 4; }
253 else if(objVersion == 1){ return 3; }
254 else{
255 throw TileCalib::VersionConflict("TileCalibDrawerOfc::getNFields", objVersion);
256 }
257}
258
259
260
262 , float phase, unsigned int sample) const {
264 throw TileCalib::IndexOutOfRange(
"TileCalibDrawerOfc::getA", sample,
getNSamples());
266}
267
269 , float* w_a, float* w_b, float* w_c, float* g, float* dg) const {
270
271
275
276 memcpy(w_a, startAddress, allSamplesSize);
277 startAddress += fieldSize;
278 memcpy(w_b, startAddress, allSamplesSize);
279 startAddress += fieldSize;
280 memcpy(g, startAddress, allSamplesSize);
281 startAddress += fieldSize;
282 memcpy(w_c, startAddress, allSamplesSize);
284 startAddress += fieldSize;
285 memcpy(dg, startAddress, allSamplesSize);
286 } else {
287 memset(dg, 0, allSamplesSize);
288 }
289}
290
291
292
293
295 , float phase, unsigned int sample, float value) {
297 throw TileCalib::IndexOutOfRange(
"TileCalibDrawerOfc::setOfc", sample,
getNSamples());
299}
__attribute__((always_inline)) inline uint32_t TileCalibDrawerOfc
#define PHASE_PRECISION
Class for storing Optimal Filtering Coefficients (OFCs) in a coral::Blob.
uint16_t getObjVersion() const
Returns the BLOB object version.
uint32_t getObjSizeUint32() const
Returns the size of a data object in units of uint32_t.
const void * getAddress(unsigned int iEle) const
Returns start address of iEle-th basic unit.
unsigned int getPhaseNumber(unsigned int channel, unsigned int adc, float &phase) const
Returns the index for a given phase.
int32_t getNPhases() const
Returns the number of phases (WARNING: Can be negative!)
void setOfc(unsigned int field, unsigned int channel, unsigned int adc, float phase, unsigned int sample, float value)
Sets OFC data.
float getPhase(unsigned int channel, unsigned int adc, unsigned int phaseIdx) const
Returns the stored phase.
void fillOfc(unsigned int channel, unsigned int adc, float &phase, float *w_a, float *w_b, float *w_c, float *g, float *dg) const
Fill all OFC for optimazation.
uint32_t getNSamples() const
Returns the number of sample stored.
const float * getOfcStartAddress(unsigned int field, unsigned int channel, unsigned int adc, float &phase) const
Returns pointer to first data OFC for a given field, ADC & phase.
float getOfc(unsigned int field, unsigned int channel, unsigned int adc, float phase, unsigned int sample) const
Returns OFC data.
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.