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 18 of file TAPDPulse.cc.

References init.

19 {
20  init(10,3,1,2,2,9,3,8,0.4,0.95,0.8);
21 }
void init(int, int, int, int, int, int, int, int, double, double, double)
Definition: TAPDPulse.cc:34
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 24 of file TAPDPulse.cc.

References init.

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

Definition at line 30 of file TAPDPulse.cc.

31 {
32 }

Member Function Documentation

bool TAPDPulse::areFitSamplesOK ( )

Definition at line 132 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

132  {
133 
134  bool ok=true;
135  if(!isMaxFound_) getMax();
137  return ok;
138 
139 }
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:74
bool TAPDPulse::arePulseRatioOK ( )

Definition at line 150 of file TAPDPulse.cc.

References siStripFEDMonitor_P5_cff::Max, siStripFEDMonitor_P5_cff::Min, and convertSQLiteXML::ok.

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

Definition at line 210 of file TAPDPulse.cc.

References i.

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

210  {
211 
212  double ped;
213  if(!isPedCalc_) ped=getPedestal();
214  else ped=pedestal_;
215 
216  double *adcNoPed= new double[10];
217  for (int i=0;i<_nsamples;i++){
218  adcNoPed[i]=adc_[i]-ped;
219  }
220  return adcNoPed;
221 }
int i
Definition: DBlmapReader.cc:9
double getPedestal()
Definition: TAPDPulse.cc:198
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 96 of file TAPDPulse.cc.

References delta.

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

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

Definition at line 74 of file TAPDPulse.cc.

References i.

74  {
75 
76  if(isMaxFound_) return adcMax_;
77 
78  int iadcmax=0;
79  double adcmax=0.0;
80  for(int i=0;i<_nsamples;i++){
81  if(adc_[i]>adcmax){
82  iadcmax=i;
83  adcmax=adc_[i];
84  }
85  }
86  iadcMax_=iadcmax;
87  adcMax_=adcmax;
88  return adcMax_;
89 }
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 91 of file TAPDPulse.cc.

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

Definition at line 198 of file TAPDPulse.cc.

References i.

198  {
199  if(isPedCalc_) return pedestal_;
200  double ped=0;
201  for(int i=0;i<_presample;i++){
202  ped+=adc_[i];
203  }
204  ped/=double(_presample);
205  pedestal_=ped;
206  isPedCalc_=true;
207  return pedestal_;
208 }
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 104 of file TAPDPulse.cc.

104  {
105 
106  assert (n1<_nsamples && n1>=0);
107  assert (n2<_nsamples && n2>=0);
108 
109  double ped=0;
110  if(isPedCalc_)ped=pedestal_;
111  else ped=adc_[0];
112 
113  double ratio=(adc_[n1]-ped)/(adc_[n2]-ped);
114  return ratio;
115 }
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 34 of file TAPDPulse.cc.

References i.

35 {
36  _nsamples=10;
37  assert(nsamples==_nsamples);
38  assert(presample!=0);
39  adc_ = new double[10];
40 
41  _presample=presample;
42  _firstsample=firstsample;
43  _lastsample=lastsample;
44 
45  _timingcutlow=timingcutlow;
46  _timingcuthigh=timingcuthigh;
47  _timingquallow=timingquallow;
48  _timingqualhigh=timingqualhigh;
49  _ratiomincutlow=ratiomincutlow;
50  _ratiomincuthigh=ratiomincuthigh;
51  _ratiomaxcutlow=ratiomaxcutlow;
52 
53  for(int i=0;i<_nsamples;i++){
54  adc_[i]=0.0;
55  }
56 
57  adcMax_=0;
58  iadcMax_=0;
59  pedestal_=0;
60 
61  isMaxFound_=false;
62  isPedCalc_=false;
63 }
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
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 140 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

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

Definition at line 168 of file TAPDPulse.cc.

References siStripFEDMonitor_P5_cff::Max, and convertSQLiteXML::ok.

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

Definition at line 183 of file TAPDPulse.cc.

References siStripFEDMonitor_P5_cff::Min, and convertSQLiteXML::ok.

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

Definition at line 117 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

Definition at line 124 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

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

Definition at line 223 of file TAPDPulse.cc.

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

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

Definition at line 65 of file TAPDPulse.cc.

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

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

65  {
66 
67  bool done=false;
68  adc_=adc;
69  done=true;
70  isMaxFound_=false;
71  isPedCalc_=false;
72  return done;
73 }
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.