ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
StatDouble Class Reference

#include <TileTBStat.h>

Collaboration diagram for StatDouble:

Public Member Functions

 StatDouble ()
 
void addValue (double Value)
 
double getMean ()
 
double getChi2 ()
 
void print (const char *s, bool minMaxOnly=false)
 

Public Attributes

int Counter
 
double Min
 
double Max
 
double Sum
 
double SumSq
 

Detailed Description

Definition at line 57 of file TileTBStat.h.

Constructor & Destructor Documentation

◆ StatDouble()

StatDouble::StatDouble ( )

Definition at line 49 of file TileTBStat.cxx.

49  {
50  Min = HUGE_VAL;
51  Max = -HUGE_VAL;
52  Sum = 0;
53  SumSq = 0;
54  Counter = 0;
55 }

Member Function Documentation

◆ addValue()

void StatDouble::addValue ( double  Value)

Definition at line 57 of file TileTBStat.cxx.

57  {
58  if (Value <= 0.0) return;
59  if (Max < Value) Max = Value;
60  if (Min > Value) Min = Value;
61  Sum += Value;
62  SumSq += Value * Value;
63  Counter++;
64 }

◆ getChi2()

double StatDouble::getChi2 ( )

Definition at line 70 of file TileTBStat.cxx.

70  {
71  if (Counter <= 1) return 0;
72  return sqrt(std::max(0.0,((SumSq - ((Sum * Sum) / Counter)) / (Counter - 1))));
73 }

◆ getMean()

double StatDouble::getMean ( )

Definition at line 66 of file TileTBStat.cxx.

66  {
67  return Sum / Counter;
68 }

◆ print()

void StatDouble::print ( const char *  s,
bool  minMaxOnly = false 
)

Definition at line 75 of file TileTBStat.cxx.

75  {
76  boost::io::ios_base_all_saver coutsave(std::cout);
77  std::cout << s << " " << std::fixed;
78  if (minMaxOnly) {
79  if (Counter > 0)
80  std::cout << " " << std::setw(4) << std::setprecision(1) << Min
81  << " - " << std::setw(4) << std::setprecision(1) << Max;
82  else
83  std::cout << " ---- - ----";
84  } else {
85  if (Counter > 0)
86  std::cout << " " << std::setw(4) << std::setprecision(1) << Min
87  << " - " << std::setw(4) << std::setprecision(1) << Max
88  << " mean= " << std::setw(6) << std::setprecision(3) << getMean()
89  << " rms= " << std::setw(5) << std::setprecision(3) << getChi2();
90  else
91  std::cout << " ---- - ---- mean= ------ rms= -----";
92  }
93  std::cout << std::endl;
94 }

Member Data Documentation

◆ Counter

int StatDouble::Counter

Definition at line 64 of file TileTBStat.h.

◆ Max

double StatDouble::Max

Definition at line 65 of file TileTBStat.h.

◆ Min

double StatDouble::Min

Definition at line 65 of file TileTBStat.h.

◆ Sum

double StatDouble::Sum

Definition at line 65 of file TileTBStat.h.

◆ SumSq

double StatDouble::SumSq

Definition at line 65 of file TileTBStat.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
max
#define max(a, b)
Definition: cfImp.cxx:41
Value
tag-value pair class.
Definition: Value.h:39
StatDouble::Counter
int Counter
Definition: TileTBStat.h:64
StatDouble::SumSq
double SumSq
Definition: TileTBStat.h:65
StatDouble::Min
double Min
Definition: TileTBStat.h:65
StatDouble::Max
double Max
Definition: TileTBStat.h:65
StatDouble::getMean
double getMean()
Definition: TileTBStat.cxx:66
StatDouble::Sum
double Sum
Definition: TileTBStat.h:65
StatDouble::getChi2
double getChi2()
Definition: TileTBStat.cxx:70