CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 > &)
 
virtual ~TMom ()
 

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 19 of file TMom.cc.

References init.

20 {
21  init(0.0,10.0e9);
22 }
void init(double, double)
Definition: TMom.cc:39
TMom::TMom ( double  cutlow,
double  cuthigh 
)

Definition at line 25 of file TMom.cc.

References init.

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

Definition at line 29 of file TMom.cc.

References init.

30 {
31  init(cutlow,cuthigh);
32 }
void init(double, double)
Definition: TMom.cc:39
TMom::~TMom ( )
virtual

Definition at line 35 of file TMom.cc.

36 {
37 }

Member Function Documentation

void TMom::addEntry ( double  val)

Definition at line 110 of file TMom.cc.

References revisionDML::addEntry().

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

111 {
112  std::vector<double> dumb;
113  dumb.push_back(val);
114  addEntry(val,dumb);
115 }
void addEntry(double val)
Definition: TMom.cc:110
void TMom::addEntry ( double  val,
const std::vector< double > &  valcut 
)

Definition at line 117 of file TMom.cc.

References bookConverter::max, min(), and nevt.

118 {
119 
120  int passingAllCuts=1;
121 
122  for (int iCut=0;iCut<_dimCut;iCut++){
123  int passing;
124  if( valcut.at(iCut)>_cutLow.at(iCut) && valcut.at(iCut) <=_cutHigh.at(iCut) ){
125  passing=1;
126  }else passing=0;
127  passingAllCuts*=passing;
128  }
129 
130  if( passingAllCuts == 1 ){
131 
132  nevt+=1;
133  sum+=val;
134  sum2+=val*val;
135  sum3+=val*val*val;
136  if(val>max) max=val;
137  if(val<min) min=val;
138 
139  // for peak stuff
140  _ampl.push_back(val);
141  }
142 
143 }
double sum
Definition: TMom.h:16
double min
Definition: TMom.h:22
int _dimCut
Definition: TMom.h:35
double sum2
Definition: TMom.h:17
double sum3
Definition: TMom.h:18
double max
Definition: TMom.h:23
int nevt
Definition: TMom.h:12
std::vector< double > _ampl
Definition: TMom.h:27
std::vector< double > _cutHigh
Definition: TMom.h:26
std::vector< double > _cutLow
Definition: TMom.h:25
double TMom::getM3 ( )

Definition at line 174 of file TMom.cc.

References m, and nevt.

Referenced by EcalTestPulseAnalyzer::endJob().

174  {
175 
176  double m=getMean();
177  double m2=getMean2();
178  double m3=getMean3();
179  double sig = getRMS();
180 
181  if(nevt!=0 && sig!=0) M3=( m3 - 3.0*m*(m2-m*m) - m*m*m )/(sig*sig*sig);
182  else M3=0.0;
183  return M3;
184 }
double M3
Definition: TMom.h:20
double getMean2()
Definition: TMom.cc:153
double getRMS()
Definition: TMom.cc:166
double getMean3()
Definition: TMom.cc:158
int nevt
Definition: TMom.h:12
double getMean()
Definition: TMom.cc:147
double TMom::getMax ( )

Definition at line 187 of file TMom.cc.

References bookConverter::max.

Referenced by EcalTestPulseAnalyzer::endJob().

187 {return max;}
double max
Definition: TMom.h:23
double TMom::getMean ( )

Definition at line 147 of file TMom.cc.

References timingPdfMaker::mean, and nevt.

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

147  {
148  if(nevt!=0) mean=sum/nevt;
149  else mean=0.0;
150  return mean;
151 }
double sum
Definition: TMom.h:16
double mean
Definition: TMom.h:13
int nevt
Definition: TMom.h:12
double TMom::getMean2 ( )

Definition at line 153 of file TMom.cc.

References nevt.

153  {
154  if(nevt!=0) mean2=sum2/nevt;
155  else mean2=0.0;
156  return mean2;
157 }
double mean2
Definition: TMom.h:14
double sum2
Definition: TMom.h:17
int nevt
Definition: TMom.h:12
double TMom::getMean3 ( )

Definition at line 158 of file TMom.cc.

References nevt.

158  {
159  if(nevt!=0) mean3=sum3/nevt;
160  else mean3=0.0;
161  return mean3;
162 }
double mean3
Definition: TMom.h:15
double sum3
Definition: TMom.h:18
int nevt
Definition: TMom.h:12
double TMom::getMin ( )

Definition at line 186 of file TMom.cc.

References min().

Referenced by EcalTestPulseAnalyzer::endJob().

186 {return min;}
double min
Definition: TMom.h:22
int TMom::getNevt ( )

Definition at line 164 of file TMom.cc.

References nevt.

Referenced by EcalTestPulseAnalyzer::endJob().

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

Definition at line 189 of file TMom.cc.

References i, roll_playback::k, bookConverter::max, min(), and AlCaHLTBitMon_ParallelJobs::p.

189  {
190 
191  std::vector<double> p;
192  double wbin=(max-min)/100.;
193  int bung;
194 
195  for(unsigned int i=0;i<_ampl.size();i++){
196  if(wbin <= 0.0)
197  bung=1;
198  else
199  bung= (int) ((_ampl.at(i)-min)/wbin)+1;
200  if(1 <= bung && bung <= 100)
201  bing[bung]++;
202  }
203 
204  TMarkov *peakM = new TMarkov();
205 
206  int popmax=0;
207 
208  for(int k=1;k<101;k++) {
209  if(bing[k] > popmax) {
210  popmax=bing[k];
211  }
212  }
213 
214  peakM -> peakFinder(&bing[0]);
215  p.push_back(peakM -> getPeakValue(0));
216  p.push_back(peakM -> getPeakValue(1));
217 
218  return p;
219 }
int i
Definition: DBlmapReader.cc:9
int bing[101]
Definition: TMom.h:24
double min
Definition: TMom.h:22
Definition: TMarkov.h:6
double max
Definition: TMom.h:23
std::vector< double > _ampl
Definition: TMom.h:27
double TMom::getRMS ( )

Definition at line 166 of file TMom.cc.

References m, nevt, and plotscripts::rms().

Referenced by EcalTestPulseAnalyzer::endJob().

166  {
167  double m=getMean();
168  double m2=getMean2();
169  if(nevt!=0) rms=TMath::Sqrt( m2 - m*m );
170  else rms=0.0;
171  return rms;
172 }
double getMean2()
Definition: TMom.cc:153
int nevt
Definition: TMom.h:12
double getMean()
Definition: TMom.cc:147
double rms
Definition: TMom.h:19
void TMom::init ( double  cutlow,
double  cuthigh 
)
private

Definition at line 39 of file TMom.cc.

References i, bookConverter::max, timingPdfMaker::mean, min(), nevt, and plotscripts::rms().

40 {
41 
42  nevt=0;
43  mean=0;
44  mean2=0;
45  mean3=0;
46  sum=0;
47  sum2=0;
48  sum3=0;
49  rms=0;
50  M3=0;
51  peak=0;
52  min=10.0e9;
53  max=0.;
54  _cutLow.clear();
55  _cutHigh.clear();
56  _dimCut=1;
57  _cutLow.push_back(cutlow);
58  _cutHigh.push_back(cuthigh);
59  for(int i=0;i<101;i++){
60  bing[i]=0;
61  }
62 
63 }
double M3
Definition: TMom.h:20
int i
Definition: DBlmapReader.cc:9
int bing[101]
Definition: TMom.h:24
double peak
Definition: TMom.h:21
double sum
Definition: TMom.h:16
double mean3
Definition: TMom.h:15
double min
Definition: TMom.h:22
double mean2
Definition: TMom.h:14
int _dimCut
Definition: TMom.h:35
double mean
Definition: TMom.h:13
double sum2
Definition: TMom.h:17
double sum3
Definition: TMom.h:18
double max
Definition: TMom.h:23
int nevt
Definition: TMom.h:12
std::vector< double > _cutHigh
Definition: TMom.h:26
double rms
Definition: TMom.h:19
std::vector< double > _cutLow
Definition: TMom.h:25
void TMom::init ( const std::vector< double > &  cutlow,
const std::vector< double > &  cuthigh 
)
private

Definition at line 64 of file TMom.cc.

References i, bookConverter::max, timingPdfMaker::mean, min(), nevt, and plotscripts::rms().

65 {
66 
67  nevt=0;
68  mean=0;
69  mean2=0;
70  mean3=0;
71  sum=0;
72  sum2=0;
73  sum3=0;
74  rms=0;
75  M3=0;
76  peak=0;
77  min=10.0e9;
78  max=0.;
79  assert(cutlow.size()==cuthigh.size());
80  _cutLow.clear();
81  _cutHigh.clear();
82  _dimCut=cutlow.size();
83  _cutLow=cutlow;
84  _cutHigh=cuthigh;
85  for(int i=0;i<101;i++){
86  bing[i]=0;
87  }
88 
89 }
double M3
Definition: TMom.h:20
int i
Definition: DBlmapReader.cc:9
int bing[101]
Definition: TMom.h:24
double peak
Definition: TMom.h:21
double sum
Definition: TMom.h:16
double mean3
Definition: TMom.h:15
double min
Definition: TMom.h:22
double mean2
Definition: TMom.h:14
int _dimCut
Definition: TMom.h:35
double mean
Definition: TMom.h:13
double sum2
Definition: TMom.h:17
double sum3
Definition: TMom.h:18
double max
Definition: TMom.h:23
int nevt
Definition: TMom.h:12
std::vector< double > _cutHigh
Definition: TMom.h:26
double rms
Definition: TMom.h:19
std::vector< double > _cutLow
Definition: TMom.h:25
void TMom::setCut ( double  cutlow,
double  cuthigh 
)

Definition at line 90 of file TMom.cc.

90  {
91 
92  _cutLow.clear();
93  _cutHigh.clear();
94  _dimCut=1;
95  _cutLow.push_back(cutlow);
96  _cutHigh.push_back(cuthigh);
97 
98 }
int _dimCut
Definition: TMom.h:35
std::vector< double > _cutHigh
Definition: TMom.h:26
std::vector< double > _cutLow
Definition: TMom.h:25
void TMom::setCut ( const std::vector< double > &  cutlow,
const std::vector< double > &  cuthigh 
)

Definition at line 99 of file TMom.cc.

99  {
100 
101  assert(cutlow.size( )== cuthigh.size());
102  _cutLow.clear();
103  _cutHigh.clear();
104  _dimCut=cutlow.size();
105  _cutLow=cutlow;
106  _cutHigh=cuthigh;
107 
108 }
int _dimCut
Definition: TMom.h:35
std::vector< double > _cutHigh
Definition: TMom.h:26
std::vector< double > _cutLow
Definition: TMom.h:25

Member Data Documentation

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

Definition at line 27 of file TMom.h.

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

Definition at line 26 of file TMom.h.

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

Definition at line 25 of file TMom.h.

int TMom::_dimCut

Definition at line 35 of file TMom.h.

int TMom::bing[101]
private

Definition at line 24 of file TMom.h.

double TMom::M3
private

Definition at line 20 of file TMom.h.

double TMom::max
private

Definition at line 23 of file TMom.h.

double TMom::mean
private

Definition at line 13 of file TMom.h.

double TMom::mean2
private

Definition at line 14 of file TMom.h.

double TMom::mean3
private

Definition at line 15 of file TMom.h.

double TMom::min
private

Definition at line 22 of file TMom.h.

int TMom::nevt
private

Definition at line 12 of file TMom.h.

double TMom::peak
private

Definition at line 21 of file TMom.h.

double TMom::rms
private

Definition at line 19 of file TMom.h.

double TMom::sum
private

Definition at line 16 of file TMom.h.

double TMom::sum2
private

Definition at line 17 of file TMom.h.

double TMom::sum3
private

Definition at line 18 of file TMom.h.