FACT++  1.0
static void DrsCalibrate::ApplyCh ( float *  vec,
const int16_t *  val,
int16_t  start,
uint32_t  roi,
const int32_t *  offset,
const int64_t  scaleabs,
const int64_t *  gain,
const int64_t  scalegain 
)
inlinestatic

Definition at line 294 of file DrsCalib.h.

References start().

Referenced by DrsCalibration::Apply().

297  {
298  if (start<0)
299  {
300  memset(vec, 0, roi);
301  return;
302  }
303  /*
304  for (size_t i=0; i<roi; i++)
305  {
306  // Value is relative to trigger
307  // Offset is relative to DRS pipeline
308  // Abs is corresponding index relative to DRS pipeline
309  const size_t abs = (start+i)%1024;
310 
311  const int64_t v =
312  + int64_t(val[i])*scaleabs-offset[abs]
313  ;
314 
315  const int64_t div = gain[abs];
316  vec[i] = div==0 ? 0 : double(v)*scalegain/div;
317  }
318  */
319 
320  // This version is faster because the compilers optimization
321  // is not biased by the evaluation of %1024
322  // (Here we are dominated by numerics... improvement ~10%)
323  const int32_t *poffset = offset + start; // offset[abs]
324  const int64_t *pgain = gain + start; // gain[abs]
325  const int16_t *pval = val; // val[rel]
326  float *pvec = vec; // vec[rel]
327 
328  if (start+roi>1024)
329  {
330  while (poffset<offset+1024)
331  {
332  const int64_t v =
333  + int64_t(*pval++)*scaleabs - *poffset++
334  ;
335 
336  *pvec++ = *pgain==0 ? 0 : double(v)*scalegain / *pgain;
337 
338  pgain++;
339  }
340 
341  poffset = offset;
342  pgain = gain;
343  }
344 
345  while (pvec<vec+roi)
346  {
347  const int64_t v =
348  + int64_t(*pval++)*scaleabs - *poffset++
349  ;
350 
351  *pvec++ = *pgain==0 ? 0 : double(v)*scalegain / *pgain;
352 
353  pgain++;
354  }
355  }
int start(int initState)
Definition: feeserver.c:1740

+ Here is the call graph for this function:

+ Here is the caller graph for this function: