CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
sistrip::MeanAndStdDev Class Reference

#include <Utility.h>

Classes

class  Params
 

Public Member Functions

void add (const float &value, const float &error)
 
void fit (Params &fit_params)
 
 MeanAndStdDev ()
 
 ~MeanAndStdDev ()
 

Private Attributes

float s_
 
std::vector< float > vec_
 
float x_
 
float xx_
 

Detailed Description

Definition at line 50 of file Utility.h.

Constructor & Destructor Documentation

◆ MeanAndStdDev()

sistrip::MeanAndStdDev::MeanAndStdDev ( )

Definition at line 66 of file Utility.cc.

66 : s_(0.), x_(0.), xx_(0.), vec_() { ; }
std::vector< float > vec_
Definition: Utility.h:73

◆ ~MeanAndStdDev()

sistrip::MeanAndStdDev::~MeanAndStdDev ( )
inline

Definition at line 54 of file Utility.h.

54 { ; }

Member Function Documentation

◆ add()

void sistrip::MeanAndStdDev::add ( const float &  value,
const float &  error 
)

Definition at line 70 of file Utility.cc.

References MillePedeFileConverter_cfg::e, mathSSE::sqrt(), and x.

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

70  {
71  if (e > 0.) {
72  float wt = 1. / sqrt(e);
73  s_ += wt;
74  x_ += x * wt;
75  xx_ += x * x * wt;
76  } else {
77  s_++;
78  x_ += x;
79  xx_ += x * x;
80  }
81  vec_.push_back(x);
82 }
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< float > vec_
Definition: Utility.h:73

◆ fit()

void sistrip::MeanAndStdDev::fit ( Params fit_params)

Definition at line 86 of file Utility.cc.

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

Referenced by trackingPlots.Iteration::modules().

86  {
87  if (s_ > 0.) {
88  float m = x_ / s_;
89  float t = xx_ / s_ - m * m;
90  if (t > 0.) {
91  t = sqrt(t);
92  } else {
93  t = 0.;
94  }
95  params.mean_ = m;
96  params.rms_ = t;
97  }
98  if (!vec_.empty()) {
99  sort(vec_.begin(), vec_.end());
100  uint16_t index = vec_.size() % 2 ? vec_.size() / 2 : vec_.size() / 2 - 1;
101  params.median_ = vec_[index];
102  }
103 }
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< float > vec_
Definition: Utility.h:73

Member Data Documentation

◆ s_

float sistrip::MeanAndStdDev::s_
private

Definition at line 70 of file Utility.h.

◆ vec_

std::vector<float> sistrip::MeanAndStdDev::vec_
private

Definition at line 73 of file Utility.h.

◆ x_

float sistrip::MeanAndStdDev::x_
private

Definition at line 71 of file Utility.h.

◆ xx_

float sistrip::MeanAndStdDev::xx_
private

Definition at line 72 of file Utility.h.