SubsetStat Class Reference

#include <SubsetStat.h>

List of all members.

Public Member Functions

 SubsetStat ()
virtual ~SubsetStat ()
void Fill (const double &value)
double GetMean () const
double GetSigma () const
unsigned int GetSize () const
double GetSum () const
double GetSum2 () const
void Reset ()

Private Attributes

unsigned int size
double sum
double sum2

Detailed Description

Definition at line 20 of file SubsetStat.h.


Constructor & Destructor Documentation

SubsetStat::SubsetStat (  ) 

Definition at line 12 of file SubsetStat.cxx.

00013    :size(0),
00014     sum(0.0),
00015     sum2(0.0)
00016 {
00017 }

virtual SubsetStat::~SubsetStat (  )  [inline, virtual]

Definition at line 26 of file SubsetStat.h.

00026 {};


Member Function Documentation

void SubsetStat::Fill ( const double &  value  ) 
double SubsetStat::GetMean (  )  const

Definition at line 27 of file SubsetStat.cxx.

References size, and sum.

Referenced by AlignmentAlgorithm::AnalyzeModuleResiduals(), AlignmentAlgorithm::AnalyzeStripData(), AlignmentRunSummary::FillSummary(), and StatisticalFluctuations::Reset().

00028 {
00029    if(size < 1) return 0.0;
00030 
00031    //calculate mean
00032    const double mean = sum/double(size);
00033 
00034    return mean;
00035 }

double SubsetStat::GetSigma (  )  const

Definition at line 37 of file SubsetStat.cxx.

References size, sum, and sum2.

Referenced by AlignmentAlgorithm::AnalyzeModuleResiduals(), AlignmentAlgorithm::AnalyzeStripData(), AlignmentRunSummary::FillSummary(), and StatisticalFluctuations::Reset().

00038 {
00039    if(size < 2) return 0.0;
00040       
00041    //calculate standard deviation
00042    const double size_tmp = size;
00043    const double sigma    = (size_tmp*sum2 - sum*sum)/(size_tmp*(size_tmp-1.0));
00044 
00045    if(sigma < 0.0)
00046    {
00047       std::cout << "Floating point error: sigma can not be negative!" << std::endl;
00048       return 0.0;
00049    }
00050 
00051    return std::pow(sigma, 0.5);
00052 }

unsigned int SubsetStat::GetSize (  )  const [inline]
double SubsetStat::GetSum (  )  const [inline]

Definition at line 41 of file SubsetStat.h.

References sum.

Referenced by AlignmentRunSummary::FillSummary(), and StatisticalFluctuations::Reset().

00041 {return sum;};

double SubsetStat::GetSum2 (  )  const [inline]

Definition at line 44 of file SubsetStat.h.

References sum2.

00044 {return sum2;};

void SubsetStat::Reset (  ) 

Definition at line 54 of file SubsetStat.cxx.

References size, and sum.

Referenced by AlignmentRunSummary::FillSummary().

00055 {
00056    size = 0;
00057    sum  = 0.0;
00058    sum = 0.0;
00059 }


Member Data Documentation

unsigned int SubsetStat::size [private]

Definition at line 51 of file SubsetStat.h.

Referenced by Fill(), GetMean(), GetSigma(), GetSize(), and Reset().

double SubsetStat::sum [private]

Definition at line 52 of file SubsetStat.h.

Referenced by Fill(), GetMean(), GetSigma(), GetSum(), and Reset().

double SubsetStat::sum2 [private]

Definition at line 53 of file SubsetStat.h.

Referenced by Fill(), GetSigma(), and GetSum2().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1