#include <Averages.h>
Classes | |
class | Params |
Public Member Functions | |
void | add (const float &value, const float &weight) |
void | add (const float &value) |
void | add (const uint32_t &value, const uint32_t &weight) |
void | add (const uint32_t &value) |
Averages () | |
void | calc (Params &) |
~Averages () | |
Private Attributes | |
std::vector< float > | median_ |
std::map< uint32_t, uint32_t > | mode_ |
uint32_t | n_ |
float | s_ |
float | x_ |
float | xx_ |
Definition at line 10 of file Averages.h.
Averages::Averages | ( | ) |
Averages::~Averages | ( | ) | [inline] |
Definition at line 15 of file Averages.h.
{;}
void Averages::add | ( | const float & | value, |
const float & | weight | ||
) |
Definition at line 36 of file Averages.cc.
References median_, n_, s_, mathSSE::sqrt(), x, x_, and xx_.
Referenced by add(), and SiStripCommissioningSource::fillCablingHistos().
void Averages::add | ( | const float & | value | ) |
void Averages::add | ( | const uint32_t & | value | ) |
void Averages::add | ( | const uint32_t & | value, |
const uint32_t & | weight | ||
) |
void Averages::calc | ( | Params & | params | ) |
Definition at line 60 of file Averages.cc.
References getHLTprescales::index, m, max(), Averages::Params::max_, Averages::Params::mean_, median_, Averages::Params::median_, Averages::Params::min_, mode_, Averages::Params::mode_, n_, Averages::Params::num_, Averages::Params::rms_, s_, python::multivaluedict::sort(), mathSSE::sqrt(), matplotRender::t, Averages::Params::weight_, x_, and xx_.
Referenced by SiStripCommissioningSource::fillCablingHistos().
{ params.num_ = n_; if ( s_ > 0. ) { float m = x_/s_; float t = xx_/s_ - m*m; if ( t > 0. ) { t = sqrt(t); } else { t = 0.; } params.mean_ = m; params.rms_ = t; params.weight_ = s_; } if ( !median_.empty() ) { sort( median_.begin(), median_.end() ); uint16_t index = median_.size()%2 ? median_.size()/2 : median_.size()/2-1; params.median_ = median_[index]; params.max_ = median_.back(); params.min_ = median_.front(); } if ( !mode_.empty() ) { uint32_t max = 0; std::map<uint32_t,uint32_t>::const_iterator imap = mode_.begin(); for ( ; imap != mode_.end(); imap++ ) { if ( imap->second > max ) { max = imap->second; params.mode_ = imap->first; } } } }
std::vector<float> Averages::median_ [private] |
Definition at line 55 of file Averages.h.
std::map<uint32_t,uint32_t> Averages::mode_ [private] |
Definition at line 56 of file Averages.h.
uint32_t Averages::n_ [private] |
Definition at line 51 of file Averages.h.
float Averages::s_ [private] |
Definition at line 52 of file Averages.h.
float Averages::x_ [private] |
Definition at line 53 of file Averages.h.
float Averages::xx_ [private] |
Definition at line 54 of file Averages.h.