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_() { ; }

◆ ~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.

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 }

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

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

◆ fit()

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

Definition at line 86 of file Utility.cc.

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 }

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

Referenced by trackingPlots.Iteration::modules().

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.

sistrip::MeanAndStdDev::x_
float x_
Definition: Utility.h:71
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
sistrip::MeanAndStdDev::vec_
std::vector< float > vec_
Definition: Utility.h:73
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:79
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
sistrip::MeanAndStdDev::xx_
float xx_
Definition: Utility.h:72
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
genVertex_cff.x
x
Definition: genVertex_cff.py:13
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
sistrip::MeanAndStdDev::s_
float s_
Definition: Utility.h:70
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37