Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 129 of file computils.h.

Constructor & Destructor Documentation

◆ true_mean()

true_mean::true_mean ( TH1F *  h)

Definition at line 81 of file computils.cxx.

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

Member Function Documentation

◆ error()

double true_mean::error ( ) const
inline

Definition at line 136 of file computils.h.

136 { return m_error; }

◆ mean()

double true_mean::mean ( ) const
inline

Definition at line 135 of file computils.h.

135 { return m_mean; }

Member Data Documentation

◆ m_error

double true_mean::m_error
private

Definition at line 141 of file computils.h.

◆ m_mean

double true_mean::m_mean
private

Definition at line 140 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:141
true_mean::m_mean
double m_mean
Definition: computils.h:140
true_mean::m_error
double m_error
Definition: computils.h:141
h
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200