CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
TMom Class Reference

#include <TMom.h>

Inheritance diagram for TMom:

Public Member Functions

void addEntry (double val)
 
void addEntry (double val, const std::vector< double > &valcut)
 
double getM3 ()
 
double getMax ()
 
double getMean ()
 
double getMean2 ()
 
double getMean3 ()
 
double getMin ()
 
int getNevt ()
 
std::vector< double > getPeak ()
 
double getRMS ()
 
void setCut (double, double)
 
void setCut (const std::vector< double > &, const std::vector< double > &)
 
 TMom ()
 
 TMom (double, double)
 
 TMom (const std::vector< double > &, const std::vector< double > &)
 
 ~TMom () override
 

Public Attributes

int _dimCut
 

Private Member Functions

void init (double, double)
 
void init (const std::vector< double > &, const std::vector< double > &)
 

Private Attributes

std::vector< double > _ampl
 
std::vector< double > _cutHigh
 
std::vector< double > _cutLow
 
int bing [101]
 
double M3
 
double max
 
double mean
 
double mean2
 
double mean3
 
double min
 
int nevt
 
double peak
 
double rms
 
double sum
 
double sum2
 
double sum3
 

Detailed Description

Definition at line 7 of file TMom.h.

Constructor & Destructor Documentation

TMom::TMom ( )

Definition at line 18 of file TMom.cc.

References init.

18 { init(0.0, 10.0e9); }
void init(double, double)
Definition: TMom.cc:27
TMom::TMom ( double  cutlow,
double  cuthigh 
)

Definition at line 21 of file TMom.cc.

References init.

21 { init(cutlow, cuthigh); }
void init(double, double)
Definition: TMom.cc:27
TMom::TMom ( const std::vector< double > &  cutlow,
const std::vector< double > &  cuthigh 
)

Definition at line 22 of file TMom.cc.

References init.

22 { init(cutlow, cuthigh); }
void init(double, double)
Definition: TMom.cc:27
TMom::~TMom ( )
override

Definition at line 25 of file TMom.cc.

25 {}

Member Function Documentation

void TMom::addEntry ( double  val)

Definition at line 88 of file TMom.cc.

Referenced by EcalABAnalyzer::analyze(), EcalLaserAnalyzer::analyze(), EcalLaserAnalyzer2::analyze(), and EcalTestPulseAnalyzer::endJob().

88  {
89  std::vector<double> dumb;
90  dumb.push_back(val);
91  addEntry(val, dumb);
92 }
void addEntry(double val)
Definition: TMom.cc:88
void TMom::addEntry ( double  val,
const std::vector< double > &  valcut 
)

Definition at line 94 of file TMom.cc.

References SiStripPI::max, min(), nevt, and hgcalPerformanceValidation::val.

94  {
95  int passingAllCuts = 1;
96 
97  for (int iCut = 0; iCut < _dimCut; iCut++) {
98  int passing;
99  if (valcut.at(iCut) > _cutLow.at(iCut) && valcut.at(iCut) <= _cutHigh.at(iCut)) {
100  passing = 1;
101  } else
102  passing = 0;
103  passingAllCuts *= passing;
104  }
105 
106  if (passingAllCuts == 1) {
107  nevt += 1;
108  sum += val;
109  sum2 += val * val;
110  sum3 += val * val * val;
111  if (val > max)
112  max = val;
113  if (val < min)
114  min = val;
115 
116  // for peak stuff
117  _ampl.push_back(val);
118  }
119 }
double sum
Definition: TMom.h:13
double min
Definition: TMom.h:19
int _dimCut
Definition: TMom.h:30
double sum2
Definition: TMom.h:14
double sum3
Definition: TMom.h:15
double max
Definition: TMom.h:20
int nevt
Definition: TMom.h:9
std::vector< double > _ampl
Definition: TMom.h:24
std::vector< double > _cutHigh
Definition: TMom.h:23
std::vector< double > _cutLow
Definition: TMom.h:22
double TMom::getM3 ( )

Definition at line 156 of file TMom.cc.

References visualization-live-secondInstance_cfg::m, callgraph::m2, and nevt.

Referenced by EcalTestPulseAnalyzer::endJob().

156  {
157  double m = getMean();
158  double m2 = getMean2();
159  double m3 = getMean3();
160  double sig = getRMS();
161 
162  if (nevt != 0 && sig != 0)
163  M3 = (m3 - 3.0 * m * (m2 - m * m) - m * m * m) / (sig * sig * sig);
164  else
165  M3 = 0.0;
166  return M3;
167 }
double M3
Definition: TMom.h:17
tuple m2
Definition: callgraph.py:57
double getMean2()
Definition: TMom.cc:129
double getRMS()
Definition: TMom.cc:146
double getMean3()
Definition: TMom.cc:136
int nevt
Definition: TMom.h:9
double getMean()
Definition: TMom.cc:121
double TMom::getMax ( )

Definition at line 170 of file TMom.cc.

References SiStripPI::max.

Referenced by EcalTestPulseAnalyzer::endJob().

170 { return max; }
double max
Definition: TMom.h:20
double TMom::getMean ( )

Definition at line 121 of file TMom.cc.

References SiStripPI::mean, and nevt.

Referenced by EcalABAnalyzer::endJob(), EcalTestPulseAnalyzer::endJob(), EcalLaserAnalyzer2::endJob(), and EcalLaserAnalyzer::endJob().

121  {
122  if (nevt != 0)
123  mean = sum / nevt;
124  else
125  mean = 0.0;
126  return mean;
127 }
double sum
Definition: TMom.h:13
double mean
Definition: TMom.h:10
int nevt
Definition: TMom.h:9
double TMom::getMean2 ( )

Definition at line 129 of file TMom.cc.

References nevt.

129  {
130  if (nevt != 0)
131  mean2 = sum2 / nevt;
132  else
133  mean2 = 0.0;
134  return mean2;
135 }
double mean2
Definition: TMom.h:11
double sum2
Definition: TMom.h:14
int nevt
Definition: TMom.h:9
double TMom::getMean3 ( )

Definition at line 136 of file TMom.cc.

References nevt.

136  {
137  if (nevt != 0)
138  mean3 = sum3 / nevt;
139  else
140  mean3 = 0.0;
141  return mean3;
142 }
double mean3
Definition: TMom.h:12
double sum3
Definition: TMom.h:15
int nevt
Definition: TMom.h:9
double TMom::getMin ( )

Definition at line 169 of file TMom.cc.

References min().

Referenced by EcalTestPulseAnalyzer::endJob().

169 { return min; }
double min
Definition: TMom.h:19
int TMom::getNevt ( )

Definition at line 144 of file TMom.cc.

References nevt.

Referenced by EcalTestPulseAnalyzer::endJob().

144 { return nevt; }
int nevt
Definition: TMom.h:9
std::vector< double > TMom::getPeak ( )

Definition at line 172 of file TMom.cc.

References TMarkov::getPeakValue(), mps_fire::i, isotrackApplyRegressor::k, SiStripPI::max, min(), AlCaHLTBitMon_ParallelJobs::p, and TMarkov::peakFinder().

172  {
173  std::vector<double> p;
174  double wbin = (max - min) / 100.;
175  int bung;
176 
177  for (unsigned int i = 0; i < _ampl.size(); i++) {
178  if (wbin <= 0.0)
179  bung = 1;
180  else
181  bung = (int)((_ampl.at(i) - min) / wbin) + 1;
182  if (1 <= bung && bung <= 100)
183  bing[bung]++;
184  }
185 
186  TMarkov* peakM = new TMarkov();
187 
188  int popmax = 0;
189 
190  for (int k = 1; k < 101; k++) {
191  if (bing[k] > popmax) {
192  popmax = bing[k];
193  }
194  }
195 
196  peakM->peakFinder(&bing[0]);
197  p.push_back(peakM->getPeakValue(0));
198  p.push_back(peakM->getPeakValue(1));
199 
200  return p;
201 }
double getPeakValue(int i) const
Definition: TMarkov.h:24
int bing[101]
Definition: TMom.h:21
double min
Definition: TMom.h:19
Definition: TMarkov.h:6
void peakFinder(int *)
Definition: TMarkov.cc:105
double max
Definition: TMom.h:20
std::vector< double > _ampl
Definition: TMom.h:24
double TMom::getRMS ( )

Definition at line 146 of file TMom.cc.

References visualization-live-secondInstance_cfg::m, callgraph::m2, nevt, and SiStripPI::rms.

Referenced by EcalTestPulseAnalyzer::endJob().

146  {
147  double m = getMean();
148  double m2 = getMean2();
149  if (nevt != 0)
150  rms = TMath::Sqrt(m2 - m * m);
151  else
152  rms = 0.0;
153  return rms;
154 }
tuple m2
Definition: callgraph.py:57
double getMean2()
Definition: TMom.cc:129
int nevt
Definition: TMom.h:9
double getMean()
Definition: TMom.cc:121
double rms
Definition: TMom.h:16
void TMom::init ( double  cutlow,
double  cuthigh 
)
private

Definition at line 27 of file TMom.cc.

References mps_fire::i, SiStripPI::max, SiStripPI::mean, min(), nevt, and SiStripPI::rms.

27  {
28  nevt = 0;
29  mean = 0;
30  mean2 = 0;
31  mean3 = 0;
32  sum = 0;
33  sum2 = 0;
34  sum3 = 0;
35  rms = 0;
36  M3 = 0;
37  peak = 0;
38  min = 10.0e9;
39  max = 0.;
40  _cutLow.clear();
41  _cutHigh.clear();
42  _dimCut = 1;
43  _cutLow.push_back(cutlow);
44  _cutHigh.push_back(cuthigh);
45  for (int i = 0; i < 101; i++) {
46  bing[i] = 0;
47  }
48 }
double M3
Definition: TMom.h:17
int bing[101]
Definition: TMom.h:21
double peak
Definition: TMom.h:18
double sum
Definition: TMom.h:13
double mean3
Definition: TMom.h:12
double min
Definition: TMom.h:19
double mean2
Definition: TMom.h:11
int _dimCut
Definition: TMom.h:30
double mean
Definition: TMom.h:10
double sum2
Definition: TMom.h:14
double sum3
Definition: TMom.h:15
double max
Definition: TMom.h:20
int nevt
Definition: TMom.h:9
std::vector< double > _cutHigh
Definition: TMom.h:23
double rms
Definition: TMom.h:16
std::vector< double > _cutLow
Definition: TMom.h:22
void TMom::init ( const std::vector< double > &  cutlow,
const std::vector< double > &  cuthigh 
)
private

Definition at line 49 of file TMom.cc.

References cms::cuda::assert(), mps_fire::i, SiStripPI::max, SiStripPI::mean, min(), nevt, and SiStripPI::rms.

49  {
50  nevt = 0;
51  mean = 0;
52  mean2 = 0;
53  mean3 = 0;
54  sum = 0;
55  sum2 = 0;
56  sum3 = 0;
57  rms = 0;
58  M3 = 0;
59  peak = 0;
60  min = 10.0e9;
61  max = 0.;
62  assert(cutlow.size() == cuthigh.size());
63  _cutLow.clear();
64  _cutHigh.clear();
65  _dimCut = cutlow.size();
66  _cutLow = cutlow;
67  _cutHigh = cuthigh;
68  for (int i = 0; i < 101; i++) {
69  bing[i] = 0;
70  }
71 }
double M3
Definition: TMom.h:17
int bing[101]
Definition: TMom.h:21
double peak
Definition: TMom.h:18
double sum
Definition: TMom.h:13
double mean3
Definition: TMom.h:12
assert(be >=bs)
double min
Definition: TMom.h:19
double mean2
Definition: TMom.h:11
int _dimCut
Definition: TMom.h:30
double mean
Definition: TMom.h:10
double sum2
Definition: TMom.h:14
double sum3
Definition: TMom.h:15
double max
Definition: TMom.h:20
int nevt
Definition: TMom.h:9
std::vector< double > _cutHigh
Definition: TMom.h:23
double rms
Definition: TMom.h:16
std::vector< double > _cutLow
Definition: TMom.h:22
void TMom::setCut ( double  cutlow,
double  cuthigh 
)

Definition at line 72 of file TMom.cc.

72  {
73  _cutLow.clear();
74  _cutHigh.clear();
75  _dimCut = 1;
76  _cutLow.push_back(cutlow);
77  _cutHigh.push_back(cuthigh);
78 }
int _dimCut
Definition: TMom.h:30
std::vector< double > _cutHigh
Definition: TMom.h:23
std::vector< double > _cutLow
Definition: TMom.h:22
void TMom::setCut ( const std::vector< double > &  cutlow,
const std::vector< double > &  cuthigh 
)

Definition at line 79 of file TMom.cc.

References cms::cuda::assert().

79  {
80  assert(cutlow.size() == cuthigh.size());
81  _cutLow.clear();
82  _cutHigh.clear();
83  _dimCut = cutlow.size();
84  _cutLow = cutlow;
85  _cutHigh = cuthigh;
86 }
assert(be >=bs)
int _dimCut
Definition: TMom.h:30
std::vector< double > _cutHigh
Definition: TMom.h:23
std::vector< double > _cutLow
Definition: TMom.h:22

Member Data Documentation

std::vector<double> TMom::_ampl
private

Definition at line 24 of file TMom.h.

std::vector<double> TMom::_cutHigh
private

Definition at line 23 of file TMom.h.

std::vector<double> TMom::_cutLow
private

Definition at line 22 of file TMom.h.

int TMom::_dimCut

Definition at line 30 of file TMom.h.

int TMom::bing[101]
private

Definition at line 21 of file TMom.h.

double TMom::M3
private

Definition at line 17 of file TMom.h.

double TMom::max
private

Definition at line 20 of file TMom.h.

double TMom::mean
private

Definition at line 10 of file TMom.h.

double TMom::mean2
private

Definition at line 11 of file TMom.h.

double TMom::mean3
private

Definition at line 12 of file TMom.h.

double TMom::min
private

Definition at line 19 of file TMom.h.

int TMom::nevt
private

Definition at line 9 of file TMom.h.

double TMom::peak
private

Definition at line 18 of file TMom.h.

double TMom::rms
private

Definition at line 16 of file TMom.h.

double TMom::sum
private

Definition at line 13 of file TMom.h.

double TMom::sum2
private

Definition at line 14 of file TMom.h.

double TMom::sum3
private

Definition at line 15 of file TMom.h.