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, 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 (std::vector< double >, std::vector< double >)
 
 TMom ()
 
 TMom (double, double)
 
 TMom (std::vector< double >, std::vector< double >)
 
virtual ~TMom ()
 

Public Attributes

int _dimCut
 

Private Member Functions

void init (double, double)
 
void init (std::vector< double >, 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 20 of file TMom.cc.

References init.

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

Definition at line 26 of file TMom.cc.

References init.

27 {
28  init(cutlow,cuthigh);
29 }
void init(double, double)
Definition: TMom.cc:40
TMom::TMom ( std::vector< double >  cutlow,
std::vector< double >  cuthigh 
)

Definition at line 30 of file TMom.cc.

References init.

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

Definition at line 36 of file TMom.cc.

37 {
38 }

Member Function Documentation

void TMom::addEntry ( double  val)

Definition at line 111 of file TMom.cc.

References revisionDML::addEntry().

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

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

Definition at line 118 of file TMom.cc.

References max(), min, and nevt.

119 {
120 
121  int passingAllCuts=1;
122 
123  for (int iCut=0;iCut<_dimCut;iCut++){
124  int passing;
125  if( valcut.at(iCut)>_cutLow.at(iCut) && valcut.at(iCut) <=_cutHigh.at(iCut) ){
126  passing=1;
127  }else passing=0;
128  passingAllCuts*=passing;
129  }
130 
131  if( passingAllCuts == 1 ){
132 
133  nevt+=1;
134  sum+=val;
135  sum2+=val*val;
136  sum3+=val*val*val;
137  if(val>max) max=val;
138  if(val<min) min=val;
139 
140  // for peak stuff
141  _ampl.push_back(val);
142  }
143 
144 }
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 175 of file TMom.cc.

References m, and nevt.

Referenced by EcalTestPulseAnalyzer::endJob().

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

Definition at line 188 of file TMom.cc.

References max().

Referenced by EcalTestPulseAnalyzer::endJob().

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

Definition at line 148 of file TMom.cc.

References timingPdfMaker::mean, and nevt.

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

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

Definition at line 154 of file TMom.cc.

References nevt.

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

Definition at line 159 of file TMom.cc.

References nevt.

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

Definition at line 187 of file TMom.cc.

References min.

Referenced by EcalTestPulseAnalyzer::endJob().

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

Definition at line 165 of file TMom.cc.

References nevt.

Referenced by EcalTestPulseAnalyzer::endJob().

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

Definition at line 190 of file TMom.cc.

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

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

Definition at line 167 of file TMom.cc.

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

Referenced by EcalTestPulseAnalyzer::endJob().

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

Definition at line 40 of file TMom.cc.

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

41 {
42 
43  nevt=0;
44  mean=0;
45  mean2=0;
46  mean3=0;
47  sum=0;
48  sum2=0;
49  sum3=0;
50  rms=0;
51  M3=0;
52  peak=0;
53  min=10.0e9;
54  max=0.;
55  _cutLow.clear();
56  _cutHigh.clear();
57  _dimCut=1;
58  _cutLow.push_back(cutlow);
59  _cutHigh.push_back(cuthigh);
60  for(int i=0;i<101;i++){
61  bing[i]=0;
62  }
63 
64 }
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 ( std::vector< double >  cutlow,
std::vector< double >  cuthigh 
)
private

Definition at line 65 of file TMom.cc.

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

66 {
67 
68  nevt=0;
69  mean=0;
70  mean2=0;
71  mean3=0;
72  sum=0;
73  sum2=0;
74  sum3=0;
75  rms=0;
76  M3=0;
77  peak=0;
78  min=10.0e9;
79  max=0.;
80  assert(cutlow.size()==cuthigh.size());
81  _cutLow.clear();
82  _cutHigh.clear();
83  _dimCut=cutlow.size();
84  _cutLow=cutlow;
85  _cutHigh=cuthigh;
86  for(int i=0;i<101;i++){
87  bing[i]=0;
88  }
89 
90 }
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 91 of file TMom.cc.

91  {
92 
93  _cutLow.clear();
94  _cutHigh.clear();
95  _dimCut=1;
96  _cutLow.push_back(cutlow);
97  _cutHigh.push_back(cuthigh);
98 
99 }
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 ( std::vector< double >  cutlow,
std::vector< double >  cuthigh 
)

Definition at line 100 of file TMom.cc.

100  {
101 
102  assert(cutlow.size( )== cuthigh.size());
103  _cutLow.clear();
104  _cutHigh.clear();
105  _dimCut=cutlow.size();
106  _cutLow=cutlow;
107  _cutHigh=cuthigh;
108 
109 }
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.