FACT++  1.0
static Step DrsCalibrate::AverageSteps ( const std::vector< Step >::iterator  beg,
const std::vector< Step >::iterator  end 
)
inlinestatic

Definition at line 487 of file DrsCalib.h.

References DrsCalibrate::Step::avg, DrsCalibrate::Step::cnt, end, DrsCalibrate::Step::pos, and DrsCalibrate::Step::rms.

Referenced by CorrectStep().

488  {
489  Step rc;
490  for (auto it=beg; it!=end; it++)
491  {
492  rc.pos += it->pos;
493  rc.avg += it->avg;
494  rc.rms += it->avg*it->avg;
495  }
496 
497  rc.cnt = end-beg;
498 
499  rc.pos /= rc.cnt;
500  rc.avg /= rc.cnt;
501  rc.rms /= rc.cnt;
502  rc.rms -= rc.avg*rc.avg;
503  rc.rms = rc.rms<0 ? 0 : sqrt(rc.rms);
504 
505  return rc;
506  }
double end

+ Here is the caller graph for this function: