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

#include <computils.h>

Collaboration diagram for true_mean:

Public Member Functions

 true_mean (TH1F *h)
 
double mean () const
 
double error () const
 

Private Attributes

double m_mean
 
double m_error
 

Detailed Description

Definition at line 127 of file computils.h.

Constructor & Destructor Documentation

◆ true_mean()

true_mean::true_mean ( TH1F *  h)

Definition at line 80 of file computils.cxx.

80  :
81  m_mean(0), m_error(0) {
82 
83  double f = 0;
84  double fx = 0;
85  double fx2 = 0;
86 
87  for ( int i=0 ; i<h->GetNbinsX() ; i++ ) {
88  double w = h->GetBinLowEdge(i+2)-h->GetBinLowEdge(i+1);
89  f += h->GetBinContent(i+1)*w;
90  fx += h->GetBinContent(i+1)*w*h->GetBinCenter(i+1);
91  fx2 += h->GetBinContent(i+1)*w*h->GetBinCenter(i+1)*h->GetBinCenter(i+1);
92  }
93 
94  if ( f!=0 ) {
95  m_mean = fx/f;
96  m_error = std::sqrt( (fx2/f - m_mean*m_mean )/f );
97  }
98 
99 }

Member Function Documentation

◆ error()

double true_mean::error ( ) const
inline

Definition at line 134 of file computils.h.

134 { return m_error; }

◆ mean()

double true_mean::mean ( ) const
inline

Definition at line 133 of file computils.h.

133 { return m_mean; }

Member Data Documentation

◆ m_error

double true_mean::m_error
private

Definition at line 139 of file computils.h.

◆ m_mean

double true_mean::m_mean
private

Definition at line 138 of file computils.h.


The documentation for this class was generated from the following files:
lumiFormat.i
int i
Definition: lumiFormat.py:85
hist_file_dump.f
f
Definition: hist_file_dump.py:135
true_mean::m_mean
double m_mean
Definition: computils.h:138
true_mean::m_error
double m_error
Definition: computils.h:139
h
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200