CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
Averages Class Reference

#include <Averages.h>

Classes

class  Params
 

Public Member Functions

void add (const float &value)
 
void add (const float &value, const float &weight)
 
void add (const uint32_t &value)
 
void add (const uint32_t &value, const uint32_t &weight)
 
 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_
 

Detailed Description

Definition at line 10 of file Averages.h.

Constructor & Destructor Documentation

◆ Averages()

Averages::Averages ( )

Definition at line 10 of file Averages.cc.

10 : n_(0), s_(0.), x_(0.), xx_(0.), median_(), mode_() { ; }

◆ ~Averages()

Averages::~Averages ( )
inline

Definition at line 13 of file Averages.h.

13 { ; }

Member Function Documentation

◆ add() [1/4]

void Averages::add ( const float &  value)

◆ add() [2/4]

void Averages::add ( const float &  value,
const float &  weight 
)

◆ add() [3/4]

void Averages::add ( const uint32_t &  value)

◆ add() [4/4]

void Averages::add ( const uint32_t &  value,
const uint32_t &  weight 
)

◆ calc()

void Averages::calc ( Params params)

Definition at line 48 of file Averages.cc.

48  {
49  params.num_ = n_;
50  if (s_ > 0.) {
51  float m = x_ / s_;
52  float t = xx_ / s_ - m * m;
53  if (t > 0.) {
54  t = sqrt(t);
55  } else {
56  t = 0.;
57  }
58  params.mean_ = m;
59  params.rms_ = t;
60  params.weight_ = s_;
61  }
62  if (!median_.empty()) {
63  sort(median_.begin(), median_.end());
64  uint16_t index = median_.size() % 2 ? median_.size() / 2 : median_.size() / 2 - 1;
65  params.median_ = median_[index];
66  params.max_ = median_.back();
67  params.min_ = median_.front();
68  }
69  if (!mode_.empty()) {
70  uint32_t max = 0;
71  std::map<uint32_t, uint32_t>::const_iterator imap = mode_.begin();
72  for (; imap != mode_.end(); imap++) {
73  if (imap->second > max) {
74  max = imap->second;
75  params.mode_ = imap->first;
76  }
77  }
78  }
79 }

References visualization-live-secondInstance_cfg::m, SiStripPI::max, CalibrationSummaryClient_cfi::params, jetUpdater_cfi::sort, mathSSE::sqrt(), and submitPVValidationJobs::t.

Member Data Documentation

◆ median_

std::vector<float> Averages::median_
private

Definition at line 54 of file Averages.h.

◆ mode_

std::map<uint32_t, uint32_t> Averages::mode_
private

Definition at line 55 of file Averages.h.

◆ n_

uint32_t Averages::n_
private

Definition at line 50 of file Averages.h.

◆ s_

float Averages::s_
private

Definition at line 51 of file Averages.h.

◆ x_

float Averages::x_
private

Definition at line 52 of file Averages.h.

◆ xx_

float Averages::xx_
private

Definition at line 53 of file Averages.h.

Averages::x_
float x_
Definition: Averages.h:52
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
Averages::mode_
std::map< uint32_t, uint32_t > mode_
Definition: Averages.h:55
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Averages::median_
std::vector< float > median_
Definition: Averages.h:54
Averages::s_
float s_
Definition: Averages.h:51
Averages::xx_
float xx_
Definition: Averages.h:53
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
Averages::n_
uint32_t n_
Definition: Averages.h:50
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644