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,
const int64_t *  trgoff,
const int64_t  scalerel 
)
inlinestatic

Definition at line 357 of file DrsCalib.h.

References start().

361  {
362  if (start<0)
363  {
364  memset(vec, 0, roi);
365  return;
366  }
367  /*
368  for (size_t i=0; i<roi; i++)
369  {
370  // Value is relative to trigger
371  // Offset is relative to DRS pipeline
372  // Abs is corresponding index relative to DRS pipeline
373  const size_t abs = (start+i)%1024;
374 
375  const int64_t v =
376  + (int64_t(val[i])*scaleabs-offset[abs])*scalerel
377  - trgoff[i]
378  ;
379 
380  const int64_t div = gain[abs]*scalerel;
381  vec[i] = div==0 ? 0 : double(v)*scalegain/div;
382  }
383  */
384  // (Here we are dominated by numerics... improvement ~10%)
385  const int32_t *poffset = offset + start; // offset[abs]
386  const int64_t *pgain = gain + start; // gain[abs]
387  const int16_t *pval = val; // val[rel]
388  const int64_t *ptrgoff = trgoff; // trgoff[rel]
389  float *pvec = vec; // vec[rel]
390 
391  if (start+roi>1024)
392  {
393  while (poffset<offset+1024)
394  {
395  const int64_t v =
396  + (int64_t(*pval++)*scaleabs - *poffset++)*scalerel
397  - *ptrgoff++;
398  ;
399 
400  const int64_t div = *pgain * scalerel;
401  *pvec++ = div==0 ? 0 : double(v)*scalegain / div;
402 
403  pgain++;
404  }
405 
406  poffset = offset;
407  pgain = gain;
408  }
409 
410  while (pvec<vec+roi)
411  {
412  const int64_t v =
413  + (int64_t(*pval++)*scaleabs - *poffset++)*scalerel
414  - *ptrgoff++;
415  ;
416 
417  const int64_t div = *pgain * scalerel;
418  *pvec++ = div==0 ? 0 : double(v)*scalegain / div;
419 
420  pgain++;
421  }
422  }
int start(int initState)
Definition: feeserver.c:1740

+ Here is the call graph for this function: