FACT++  1.0
virtual void factofits::DrsOffsetCalibrate ( char *  target_location)
inlinevirtual

Apply the drs offset calibration (overload of super-method)

Reimplemented from zofits.

Definition at line 311 of file factofits.h.

References data, fDataOffset, fNumSlices, fOffsetCalibration, fStartCellsOffset, and IsOffsetCalibration().

312  {
313  if (!IsOffsetCalibration())
314  return;
315 
316  const int16_t* startCell = reinterpret_cast<int16_t*>(target_location + fStartCellsOffset);
317  int16_t* data = reinterpret_cast<int16_t*>(target_location + fDataOffset);
318 
319  for (uint32_t ch=0; ch<1440; ch++)
320  {
321  if (startCell[ch] < 0)
322  {
323  data += fNumSlices;
324  continue;
325  }
326 
327  const int16_t modStart = startCell[ch]%1024;
328  const int16_t *off = fOffsetCalibration.data() + ch*1024;
329 
330  const int16_t* cal = off+modStart;
331  const int16_t* end_stride = data+fNumSlices;
332 
333  if (modStart+fNumSlices > 1024)
334  {
335  while (cal < off+1024)
336  *data++ -= *cal++;
337  cal = off;
338  }
339 
340  while (data<end_stride)
341  *data++ -= *cal++;
342  }
343  }
int32_t fNumSlices
Number of samples per pixel per event.
Definition: factofits.h:366
int32_t fDataOffset
Offset in bytes for the data.
Definition: factofits.h:365
int32_t fStartCellsOffset
Offset in bytes for the startcell data.
Definition: factofits.h:364
float data[4 *1440]
std::vector< int16_t > fOffsetCalibration
The calibration itself.
Definition: factofits.h:363
virtual bool IsOffsetCalibration()
whether or not a calibration was given to the file writer
Definition: factofits.h:42

+ Here is the call graph for this function: