FACT++  1.0
std::pair<std::vector<double>,std::vector<double> > DrsCalibrate::GetSampleStats ( ) const
inline

Definition at line 796 of file DrsCalib.h.

References fNumEntries.

797  {
798  if (fNumEntries==0)
799  return make_pair(std::vector<double>(),std::vector<double>());
800 
801  std::vector<double> mean(fSum.size());
802  std::vector<double> error(fSum.size());
803 
804  std::vector<int64_t>::const_iterator it = fSum.begin();
805  std::vector<int64_t>::const_iterator i2 = fSum2.begin();
806  std::vector<double>::iterator im = mean.begin();
807  std::vector<double>::iterator ie = error.begin();
808 
809  while (it!=fSum.end())
810  {
811  *im = /*cnt<fResult.size() ? fResult[cnt] :*/ double(*it)/fNumEntries;
812  *ie = sqrt(double(*i2*int64_t(fNumEntries) - *it * *it))/fNumEntries;
813 
814  im++;
815  ie++;
816  it++;
817  i2++;
818  }
819 
820 
821  /*
822  valarray<double> ...
823 
824  mean /= fNumEntries;
825  error = sqrt(error/fNumEntries - mean*mean);
826  */
827 
828  return make_pair(mean, error);
829  }
std::vector< int64_t > fSum
Definition: DrsCalib.h:23
std::vector< int64_t > fSum2
Definition: DrsCalib.h:24
int64_t fNumEntries
Definition: DrsCalib.h:18