test
CMS 3D CMS Logo

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

#include <TAPDPulse.h>

Inheritance diagram for TAPDPulse:

Public Member Functions

bool areFitSamplesOK ()
 
bool arePulseRatioOK ()
 
double * getAdcWithoutPedestal ()
 
double getDelta (int, int)
 
double getMax ()
 
int getMaxSample ()
 
double getPedestal ()
 
double getRatio (int, int)
 
bool isPulseOK ()
 
bool isPulseRatioMaxOK ()
 
bool isPulseRatioMinOK ()
 
bool isTimingOK ()
 
bool isTimingQualOK ()
 
void setPresamples (int)
 
bool setPulse (double *)
 
 TAPDPulse ()
 
 TAPDPulse (int, int, int, int, int, int, int, int, double, double, double)
 
virtual ~TAPDPulse ()
 

Private Member Functions

void init (int, int, int, int, int, int, int, int, double, double, double)
 

Private Attributes

int _firstsample
 
int _lastsample
 
int _nsamples
 
int _presample
 
double _ratiomaxcutlow
 
double _ratiomincuthigh
 
double _ratiomincutlow
 
int _timingcuthigh
 
int _timingcutlow
 
int _timingqualhigh
 
int _timingquallow
 
double * adc_
 
double adcMax_
 
int iadcMax_
 
bool isMaxFound_
 
bool isPedCalc_
 
double pedestal_
 

Detailed Description

Definition at line 7 of file TAPDPulse.h.

Constructor & Destructor Documentation

TAPDPulse::TAPDPulse ( )

Definition at line 17 of file TAPDPulse.cc.

References init.

18 {
19  init(10,3,1,2,2,9,3,8,0.4,0.95,0.8);
20 }
void init(int, int, int, int, int, int, int, int, double, double, double)
Definition: TAPDPulse.cc:33
TAPDPulse::TAPDPulse ( int  nsamples,
int  presample,
int  firstsample,
int  lastsample,
int  timingcutlow,
int  timingcuthigh,
int  timingquallow,
int  timingqualhigh,
double  ratiomincutlow,
double  ratiomincuthigh,
double  ratiomaxcutlow 
)

Definition at line 23 of file TAPDPulse.cc.

References init.

24 {
25  init( nsamples, presample, firstsample, lastsample, timingcutlow, timingcuthigh, timingquallow, timingqualhigh,ratiomincutlow,ratiomincuthigh, ratiomaxcutlow );
26 }
void init(int, int, int, int, int, int, int, int, double, double, double)
Definition: TAPDPulse.cc:33
TAPDPulse::~TAPDPulse ( )
virtual

Definition at line 29 of file TAPDPulse.cc.

30 {
31 }

Member Function Documentation

bool TAPDPulse::areFitSamplesOK ( )

Definition at line 131 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

131  {
132 
133  bool ok=true;
134  if(!isMaxFound_) getMax();
136  return ok;
137 
138 }
bool isMaxFound_
Definition: TAPDPulse.h:26
int iadcMax_
Definition: TAPDPulse.h:29
int _firstsample
Definition: TAPDPulse.h:14
int _nsamples
Definition: TAPDPulse.h:12
int _presample
Definition: TAPDPulse.h:13
int _lastsample
Definition: TAPDPulse.h:15
double getMax()
Definition: TAPDPulse.cc:73
bool TAPDPulse::arePulseRatioOK ( )

Definition at line 149 of file TAPDPulse.cc.

References Max(), Min(), and convertSQLiteXML::ok.

149  {
150 
151  bool ok=true;
152 
153  if(!isMaxFound_) getMax();
154  if(iadcMax_<1 || iadcMax_>=_nsamples-1) return false;
155 
156  double ratioNm1=getRatio(iadcMax_-1,iadcMax_);
157  double ratioNp1=getRatio(iadcMax_+1,iadcMax_);
158  double ratioMax=TMath::Max(ratioNm1,ratioNp1);
159  double ratioMin=TMath::Min(ratioNm1,ratioNp1);
160 
161  if(ratioMax<_ratiomaxcutlow) ok=false;
162  if(ratioMin<_ratiomincutlow || ratioMin>_ratiomincuthigh) ok=false;
163 
164  return ok;
165 
166 }
bool isMaxFound_
Definition: TAPDPulse.h:26
int iadcMax_
Definition: TAPDPulse.h:29
double getRatio(int, int)
Definition: TAPDPulse.cc:103
double _ratiomaxcutlow
Definition: TAPDPulse.h:20
T Min(T a, T b)
Definition: MathUtil.h:39
int _nsamples
Definition: TAPDPulse.h:12
double _ratiomincuthigh
Definition: TAPDPulse.h:22
T Max(T a, T b)
Definition: MathUtil.h:44
double getMax()
Definition: TAPDPulse.cc:73
double * TAPDPulse::getAdcWithoutPedestal ( )

Definition at line 209 of file TAPDPulse.cc.

References i.

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

209  {
210 
211  double ped;
212  if(!isPedCalc_) ped=getPedestal();
213  else ped=pedestal_;
214 
215  double *adcNoPed= new double[10];
216  for (int i=0;i<_nsamples;i++){
217  adcNoPed[i]=adc_[i]-ped;
218  }
219  return adcNoPed;
220 }
int i
Definition: DBlmapReader.cc:9
double getPedestal()
Definition: TAPDPulse.cc:197
double * adc_
Definition: TAPDPulse.h:25
int _nsamples
Definition: TAPDPulse.h:12
bool isPedCalc_
Definition: TAPDPulse.h:27
double pedestal_
Definition: TAPDPulse.h:30
double TAPDPulse::getDelta ( int  n1,
int  n2 
)

Definition at line 95 of file TAPDPulse.cc.

References assert(), and delta.

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

95  {
96 
97  assert (n1<_nsamples && n1>=0);
98  assert (n2<_nsamples && n2>=0);
99 
100  double delta=adc_[n1]-adc_[n2];
101  return delta;
102 }
dbl * delta
Definition: mlp_gen.cc:36
assert(m_qm.get())
double * adc_
Definition: TAPDPulse.h:25
double TAPDPulse::getMax ( )

Definition at line 73 of file TAPDPulse.cc.

References i.

73  {
74 
75  if(isMaxFound_) return adcMax_;
76 
77  int iadcmax=0;
78  double adcmax=0.0;
79  for(int i=0;i<_nsamples;i++){
80  if(adc_[i]>adcmax){
81  iadcmax=i;
82  adcmax=adc_[i];
83  }
84  }
85  iadcMax_=iadcmax;
86  adcMax_=adcmax;
87  return adcMax_;
88 }
bool isMaxFound_
Definition: TAPDPulse.h:26
int i
Definition: DBlmapReader.cc:9
int iadcMax_
Definition: TAPDPulse.h:29
double * adc_
Definition: TAPDPulse.h:25
int _nsamples
Definition: TAPDPulse.h:12
double adcMax_
Definition: TAPDPulse.h:28
int TAPDPulse::getMaxSample ( )

Definition at line 90 of file TAPDPulse.cc.

90  {
91  if(!isMaxFound_) getMax();
92  return iadcMax_;
93 
94 }
bool isMaxFound_
Definition: TAPDPulse.h:26
int iadcMax_
Definition: TAPDPulse.h:29
double getMax()
Definition: TAPDPulse.cc:73
double TAPDPulse::getPedestal ( )

Definition at line 197 of file TAPDPulse.cc.

References i.

197  {
198  if(isPedCalc_) return pedestal_;
199  double ped=0;
200  for(int i=0;i<_presample;i++){
201  ped+=adc_[i];
202  }
203  ped/=double(_presample);
204  pedestal_=ped;
205  isPedCalc_=true;
206  return pedestal_;
207 }
int i
Definition: DBlmapReader.cc:9
double * adc_
Definition: TAPDPulse.h:25
bool isPedCalc_
Definition: TAPDPulse.h:27
int _presample
Definition: TAPDPulse.h:13
double pedestal_
Definition: TAPDPulse.h:30
double TAPDPulse::getRatio ( int  n1,
int  n2 
)

Definition at line 103 of file TAPDPulse.cc.

References assert().

103  {
104 
105  assert (n1<_nsamples && n1>=0);
106  assert (n2<_nsamples && n2>=0);
107 
108  double ped=0;
109  if(isPedCalc_)ped=pedestal_;
110  else ped=adc_[0];
111 
112  double ratio=(adc_[n1]-ped)/(adc_[n2]-ped);
113  return ratio;
114 }
assert(m_qm.get())
double * adc_
Definition: TAPDPulse.h:25
bool isPedCalc_
Definition: TAPDPulse.h:27
double pedestal_
Definition: TAPDPulse.h:30
void TAPDPulse::init ( int  nsamples,
int  presample,
int  firstsample,
int  lastsample,
int  timingcutlow,
int  timingcuthigh,
int  timingquallow,
int  timingqualhigh,
double  ratiomincutlow,
double  ratiomincuthigh,
double  ratiomaxcutlow 
)
private

Definition at line 33 of file TAPDPulse.cc.

References assert(), and i.

34 {
35  _nsamples=10;
36  assert(nsamples==_nsamples);
37  assert(presample!=0);
38  adc_ = new double[10];
39 
40  _presample=presample;
41  _firstsample=firstsample;
42  _lastsample=lastsample;
43 
44  _timingcutlow=timingcutlow;
45  _timingcuthigh=timingcuthigh;
46  _timingquallow=timingquallow;
47  _timingqualhigh=timingqualhigh;
48  _ratiomincutlow=ratiomincutlow;
49  _ratiomincuthigh=ratiomincuthigh;
50  _ratiomaxcutlow=ratiomaxcutlow;
51 
52  for(int i=0;i<_nsamples;i++){
53  adc_[i]=0.0;
54  }
55 
56  adcMax_=0;
57  iadcMax_=0;
58  pedestal_=0;
59 
60  isMaxFound_=false;
61  isPedCalc_=false;
62 }
bool isMaxFound_
Definition: TAPDPulse.h:26
int i
Definition: DBlmapReader.cc:9
int iadcMax_
Definition: TAPDPulse.h:29
double _ratiomaxcutlow
Definition: TAPDPulse.h:20
int _firstsample
Definition: TAPDPulse.h:14
assert(m_qm.get())
double * adc_
Definition: TAPDPulse.h:25
int _nsamples
Definition: TAPDPulse.h:12
double _ratiomincuthigh
Definition: TAPDPulse.h:22
bool isPedCalc_
Definition: TAPDPulse.h:27
int _presample
Definition: TAPDPulse.h:13
int _lastsample
Definition: TAPDPulse.h:15
int _timingcuthigh
Definition: TAPDPulse.h:17
int _timingqualhigh
Definition: TAPDPulse.h:19
int _timingcutlow
Definition: TAPDPulse.h:16
double adcMax_
Definition: TAPDPulse.h:28
double _ratiomincutlow
Definition: TAPDPulse.h:21
int _timingquallow
Definition: TAPDPulse.h:18
double pedestal_
Definition: TAPDPulse.h:30
bool TAPDPulse::isPulseOK ( )

Definition at line 139 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

139  {
140 
141  bool okSamples=areFitSamplesOK();
142  bool okTiming=isTimingOK();
143  bool okPulse=arePulseRatioOK();
144 
145  bool ok=(okSamples && okTiming && okPulse);
146 
147  return ok;
148 }
bool areFitSamplesOK()
Definition: TAPDPulse.cc:131
bool isTimingOK()
Definition: TAPDPulse.cc:116
bool arePulseRatioOK()
Definition: TAPDPulse.cc:149
bool TAPDPulse::isPulseRatioMaxOK ( )

Definition at line 167 of file TAPDPulse.cc.

References Max(), and convertSQLiteXML::ok.

167  {
168 
169  bool ok=true;
170 
171  if(!isMaxFound_) getMax();
172  if(iadcMax_<1 || iadcMax_>=_nsamples-1) return false;
173 
174  double ratioNm1=getRatio(iadcMax_-1,iadcMax_);
175  double ratioNp1=getRatio(iadcMax_+1,iadcMax_);
176  double ratioMax=TMath::Max(ratioNm1,ratioNp1);
177 
178  if(ratioMax<_ratiomaxcutlow) ok=false;
179  return ok;
180 
181 }
bool isMaxFound_
Definition: TAPDPulse.h:26
int iadcMax_
Definition: TAPDPulse.h:29
double getRatio(int, int)
Definition: TAPDPulse.cc:103
double _ratiomaxcutlow
Definition: TAPDPulse.h:20
int _nsamples
Definition: TAPDPulse.h:12
T Max(T a, T b)
Definition: MathUtil.h:44
double getMax()
Definition: TAPDPulse.cc:73
bool TAPDPulse::isPulseRatioMinOK ( )

Definition at line 182 of file TAPDPulse.cc.

References Min(), and convertSQLiteXML::ok.

182  {
183 
184  bool ok=true;
185 
186  if(!isMaxFound_) getMax();
187  if(iadcMax_<1 || iadcMax_>=_nsamples-1) return false;
188 
189  double ratioNm1=getRatio(iadcMax_-1,iadcMax_);
190  double ratioNp1=getRatio(iadcMax_+1,iadcMax_);
191  double ratioMin=TMath::Min(ratioNm1,ratioNp1);
192 
193  if(ratioMin<_ratiomincutlow || ratioMin>_ratiomincuthigh) ok=false;
194  return ok;
195 }
bool isMaxFound_
Definition: TAPDPulse.h:26
int iadcMax_
Definition: TAPDPulse.h:29
double getRatio(int, int)
Definition: TAPDPulse.cc:103
T Min(T a, T b)
Definition: MathUtil.h:39
int _nsamples
Definition: TAPDPulse.h:12
double _ratiomincuthigh
Definition: TAPDPulse.h:22
double getMax()
Definition: TAPDPulse.cc:73
bool TAPDPulse::isTimingOK ( )

Definition at line 116 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

116  {
117 
118  bool ok=true;
119  if(!isMaxFound_) getMax();
120  if(iadcMax_<=_timingcutlow || iadcMax_>=_timingcuthigh) ok=false;
121  return ok;
122 }
bool isMaxFound_
Definition: TAPDPulse.h:26
int _timingcuthigh
Definition: TAPDPulse.h:17
double getMax()
Definition: TAPDPulse.cc:73
bool TAPDPulse::isTimingQualOK ( )

Definition at line 123 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

123  {
124 
125  bool ok=true;
126  if(!isMaxFound_) getMax();
127  if(iadcMax_<=_timingquallow || iadcMax_>=_timingqualhigh) ok=false;
128  return ok;
129 }
bool isMaxFound_
Definition: TAPDPulse.h:26
double getMax()
Definition: TAPDPulse.cc:73
int _timingqualhigh
Definition: TAPDPulse.h:19
void TAPDPulse::setPresamples ( int  presample)

Definition at line 222 of file TAPDPulse.cc.

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

222  {
223  isPedCalc_=false;
224  _presample=presample;
225 }
bool isPedCalc_
Definition: TAPDPulse.h:27
int _presample
Definition: TAPDPulse.h:13
bool TAPDPulse::setPulse ( double *  adc)

Definition at line 64 of file TAPDPulse.cc.

References ecalMGPA::adc(), and fileCollector::done.

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

64  {
65 
66  bool done=false;
67  adc_=adc;
68  done=true;
69  isMaxFound_=false;
70  isPedCalc_=false;
71  return done;
72 }
int adc(sample_type sample)
get the ADC sample (12 bits)
bool isMaxFound_
Definition: TAPDPulse.h:26
double * adc_
Definition: TAPDPulse.h:25
bool isPedCalc_
Definition: TAPDPulse.h:27

Member Data Documentation

int TAPDPulse::_firstsample
private

Definition at line 14 of file TAPDPulse.h.

int TAPDPulse::_lastsample
private

Definition at line 15 of file TAPDPulse.h.

int TAPDPulse::_nsamples
private

Definition at line 12 of file TAPDPulse.h.

int TAPDPulse::_presample
private

Definition at line 13 of file TAPDPulse.h.

double TAPDPulse::_ratiomaxcutlow
private

Definition at line 20 of file TAPDPulse.h.

double TAPDPulse::_ratiomincuthigh
private

Definition at line 22 of file TAPDPulse.h.

double TAPDPulse::_ratiomincutlow
private

Definition at line 21 of file TAPDPulse.h.

int TAPDPulse::_timingcuthigh
private

Definition at line 17 of file TAPDPulse.h.

int TAPDPulse::_timingcutlow
private

Definition at line 16 of file TAPDPulse.h.

int TAPDPulse::_timingqualhigh
private

Definition at line 19 of file TAPDPulse.h.

int TAPDPulse::_timingquallow
private

Definition at line 18 of file TAPDPulse.h.

double* TAPDPulse::adc_
private

Definition at line 25 of file TAPDPulse.h.

double TAPDPulse::adcMax_
private

Definition at line 28 of file TAPDPulse.h.

int TAPDPulse::iadcMax_
private

Definition at line 29 of file TAPDPulse.h.

bool TAPDPulse::isMaxFound_
private

Definition at line 26 of file TAPDPulse.h.

bool TAPDPulse::isPedCalc_
private

Definition at line 27 of file TAPDPulse.h.

double TAPDPulse::pedestal_
private

Definition at line 30 of file TAPDPulse.h.