FACT++  1.0
static Step DrsCalibrate::CorrectStep ( float *  vec,
uint16_t  nch,
uint16_t  roi,
const int16_t *  prev,
const int16_t *  start,
const int16_t  offset,
const uint16_t *  map = NULL 
)
inlinestatic

Definition at line 509 of file DrsCalib.h.

References AverageSteps(), DrsCalibrate::Step::avg, FindStep(), DrsCalibrate::Step::pos, DrsCalibrate::Step::rms, DrsCalibrate::Step::sort(), DrsCalibrate::Step::Step(), and SubtractStep().

Referenced by EventBuilderWrapper::applyCalib().

512  {
513 
514  std::vector<Step> list;
515  list.reserve(nch);
516 
517  // Fill steps into array
518  // Exclude broken pixels?
519  // Remove maximum and minimum patches (4max and 4min)?
520  for (size_t ch=0; ch<nch; ch += 9)
521  {
522  if (prev[ch]<0 || start[ch]<0)
523  continue;
524 
525  const int16_t dist = (prev[ch]-start[ch]+1024+offset)%1024;
526  const double step = FindStep(ch, vec, roi, dist, map);
527  if (step==0)
528  continue;
529 
530  Step rc;
531  rc.pos = dist;
532  rc.avg = step;
533  list.push_back(rc);
534  }
535 
536  if (list.empty())
537  return Step();
538 
539  Step rc = AverageSteps(list.begin(), list.begin()+list.size());;
540 
541  if (rc.avg==0)
542  return Step();
543 
544  // std::cout << " A0=" << rc.avg << " rms=" << rc.rms << std::endl;
545  if (rc.rms>5)
546  {
547  sort(list.begin(), list.end(), Step::sort);
548 
549  //for (auto it=list.begin(); it!=list.end(); it++)
550  // std::cout << " " << it->avg << std::endl;
551 
552  const size_t skip = list.size()/10;
553  rc = AverageSteps(list.begin()+skip, list.begin()+list.size()-skip);
554 
555  // std::cout << " A1=" << rc.avg << " rms=" << rc.rms << std::endl;
556  }
557 
558  for (size_t ch=0; ch<nch; ch += 9)
559  {
560  const int16_t dist = (prev[ch]-start[ch]+1024+offset)%1024;
561  SubtractStep(ch, rc.avg, vec, roi, dist, map);
562  }
563 
564  return rc;
565  }
int start(int initState)
Definition: feeserver.c:1740
static Step AverageSteps(const std::vector< Step >::iterator beg, const std::vector< Step >::iterator end)
Definition: DrsCalib.h:487
static bool sort(const Step &s, const Step &r)
Definition: DrsCalib.h:484
static void SubtractStep(const size_t ch0, const double avg, float *vec, int16_t roi, int32_t pos, const uint16_t *map=NULL)
Definition: DrsCalib.h:454
static double FindStep(const size_t ch0, const float *vec, int16_t roi, const int16_t pos, const uint16_t *map=NULL)
Definition: DrsCalib.h:424

+ Here is the call graph for this function:

+ Here is the caller graph for this function: