CMS 3D CMS Logo

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 (const std::vector< double > &, const std::vector< double > &)
 
void setCut (double, double)
 
 TMom ()
 
 TMom (const std::vector< double > &, const std::vector< double > &)
 
 TMom (double, double)
 
 ~TMom () override
 

Public Attributes

int _dimCut
 

Private Member Functions

void init (const std::vector< double > &, const std::vector< double > &)
 
void init (double, 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() [1/3]

TMom::TMom ( )

Definition at line 18 of file TMom.cc.

18 { init(0.0, 10.0e9); }

References init.

◆ TMom() [2/3]

TMom::TMom ( double  cutlow,
double  cuthigh 
)

Definition at line 21 of file TMom.cc.

21 { init(cutlow, cuthigh); }

References init.

◆ TMom() [3/3]

TMom::TMom ( const std::vector< double > &  cutlow,
const std::vector< double > &  cuthigh 
)

Definition at line 22 of file TMom.cc.

22 { init(cutlow, cuthigh); }

References init.

◆ ~TMom()

TMom::~TMom ( )
override

Definition at line 25 of file TMom.cc.

25 {}

Member Function Documentation

◆ addEntry() [1/2]

void TMom::addEntry ( double  val)

Definition at line 88 of file TMom.cc.

88  {
89  std::vector<double> dumb;
90  dumb.push_back(val);
91  addEntry(val, dumb);
92 }

References heppy_batch::val.

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

◆ addEntry() [2/2]

void TMom::addEntry ( double  val,
const std::vector< double > &  valcut 
)

Definition at line 94 of file TMom.cc.

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 }

References SiStripPI::max, min(), nevt, TagProbeFitTreeAnalyzer_cfi::passing, combinedConstraintHelpers::sum2(), and heppy_batch::val.

◆ getM3()

double TMom::getM3 ( )

Definition at line 156 of file TMom.cc.

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 }

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

Referenced by EcalTestPulseAnalyzer::endJob().

◆ getMax()

double TMom::getMax ( )

Definition at line 170 of file TMom.cc.

170 { return max; }

References SiStripPI::max.

Referenced by EcalTestPulseAnalyzer::endJob().

◆ getMean()

double TMom::getMean ( )

Definition at line 121 of file TMom.cc.

121  {
122  if (nevt != 0)
123  mean = sum / nevt;
124  else
125  mean = 0.0;
126  return mean;
127 }

References SiStripPI::mean, and nevt.

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

◆ getMean2()

double TMom::getMean2 ( )

Definition at line 129 of file TMom.cc.

129  {
130  if (nevt != 0)
131  mean2 = sum2 / nevt;
132  else
133  mean2 = 0.0;
134  return mean2;
135 }

References nevt, and combinedConstraintHelpers::sum2().

◆ getMean3()

double TMom::getMean3 ( )

Definition at line 136 of file TMom.cc.

136  {
137  if (nevt != 0)
138  mean3 = sum3 / nevt;
139  else
140  mean3 = 0.0;
141  return mean3;
142 }

References nevt.

◆ getMin()

double TMom::getMin ( )

Definition at line 169 of file TMom.cc.

169 { return min; }

References min().

Referenced by EcalTestPulseAnalyzer::endJob().

◆ getNevt()

int TMom::getNevt ( )

Definition at line 144 of file TMom.cc.

144 { return nevt; }

References nevt.

Referenced by EcalTestPulseAnalyzer::endJob().

◆ getPeak()

std::vector< double > TMom::getPeak ( )

Definition at line 172 of file TMom.cc.

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 }

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

◆ getRMS()

double TMom::getRMS ( )

Definition at line 146 of file TMom.cc.

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 }

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

Referenced by EcalTestPulseAnalyzer::endJob().

◆ init() [1/2]

void TMom::init ( const std::vector< double > &  cutlow,
const std::vector< double > &  cuthigh 
)
private

Definition at line 49 of file TMom.cc.

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 }

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

◆ init() [2/2]

void TMom::init ( double  cutlow,
double  cuthigh 
)
private

Definition at line 27 of file TMom.cc.

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 }

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

◆ setCut() [1/2]

void TMom::setCut ( const std::vector< double > &  cutlow,
const std::vector< double > &  cuthigh 
)

Definition at line 79 of file TMom.cc.

79  {
80  assert(cutlow.size() == cuthigh.size());
81  _cutLow.clear();
82  _cutHigh.clear();
83  _dimCut = cutlow.size();
84  _cutLow = cutlow;
85  _cutHigh = cuthigh;
86 }

References cms::cuda::assert().

◆ setCut() [2/2]

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 }

Member Data Documentation

◆ _ampl

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

Definition at line 24 of file TMom.h.

◆ _cutHigh

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

Definition at line 23 of file TMom.h.

◆ _cutLow

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

Definition at line 22 of file TMom.h.

◆ _dimCut

int TMom::_dimCut

Definition at line 30 of file TMom.h.

◆ bing

int TMom::bing[101]
private

Definition at line 21 of file TMom.h.

◆ M3

double TMom::M3
private

Definition at line 17 of file TMom.h.

◆ max

double TMom::max
private

Definition at line 20 of file TMom.h.

◆ mean

double TMom::mean
private

Definition at line 10 of file TMom.h.

◆ mean2

double TMom::mean2
private

Definition at line 11 of file TMom.h.

◆ mean3

double TMom::mean3
private

Definition at line 12 of file TMom.h.

◆ min

double TMom::min
private

Definition at line 19 of file TMom.h.

◆ nevt

int TMom::nevt
private

Definition at line 9 of file TMom.h.

◆ peak

double TMom::peak
private

Definition at line 18 of file TMom.h.

◆ rms

double TMom::rms
private

Definition at line 16 of file TMom.h.

◆ sum

double TMom::sum
private

Definition at line 13 of file TMom.h.

◆ sum2

double TMom::sum2
private

Definition at line 14 of file TMom.h.

◆ sum3

double TMom::sum3
private

Definition at line 15 of file TMom.h.

TMom::addEntry
void addEntry(double val)
Definition: TMom.cc:88
mps_fire.i
i
Definition: mps_fire.py:428
TMom::_cutHigh
std::vector< double > _cutHigh
Definition: TMom.h:23
TMom::getMean3
double getMean3()
Definition: TMom.cc:136
TMom::_ampl
std::vector< double > _ampl
Definition: TMom.h:24
TMom::max
double max
Definition: TMom.h:20
cms::cuda::assert
assert(be >=bs)
TMom::_dimCut
int _dimCut
Definition: TMom.h:30
TMom::mean2
double mean2
Definition: TMom.h:11
TMom::_cutLow
std::vector< double > _cutLow
Definition: TMom.h:22
TMom::mean
double mean
Definition: TMom.h:10
TMom::sum2
double sum2
Definition: TMom.h:14
TMarkov
Definition: TMarkov.h:6
TMarkov::getPeakValue
double getPeakValue(int i) const
Definition: TMarkov.h:24
TMarkov::peakFinder
void peakFinder(int *)
Definition: TMarkov.cc:105
TMom::sum3
double sum3
Definition: TMom.h:15
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:78
dqmdumpme.k
k
Definition: dqmdumpme.py:60
TMom::min
double min
Definition: TMom.h:19
TMom::mean3
double mean3
Definition: TMom.h:12
TMom::init
void init(double, double)
Definition: TMom.cc:27
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TagProbeFitTreeAnalyzer_cfi.passing
passing
Definition: TagProbeFitTreeAnalyzer_cfi.py:25
createfilelist.int
int
Definition: createfilelist.py:10
TMom::nevt
int nevt
Definition: TMom.h:9
TMom::rms
double rms
Definition: TMom.h:16
TMom::getMean
double getMean()
Definition: TMom.cc:121
callgraph.m2
m2
Definition: callgraph.py:38
heppy_batch.val
val
Definition: heppy_batch.py:351
TMom::getMean2
double getMean2()
Definition: TMom.cc:129
TMom::bing
int bing[101]
Definition: TMom.h:21
TMom::peak
double peak
Definition: TMom.h:18
TMom::sum
double sum
Definition: TMom.h:13
TMom::getRMS
double getRMS()
Definition: TMom.cc:146
TMom::M3
double M3
Definition: TMom.h:17