CMS 3D CMS Logo

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)
 
 ~TAPDPulse () override
 

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() [1/2]

TAPDPulse::TAPDPulse ( )

Definition at line 16 of file TAPDPulse.cc.

References init.

16 { init(10, 3, 1, 2, 2, 9, 3, 8, 0.4, 0.95, 0.8); }
void init(int, int, int, int, int, int, int, int, double, double, double)
Definition: TAPDPulse.cc:46

◆ TAPDPulse() [2/2]

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

References init.

29  {
30  init(nsamples,
31  presample,
32  firstsample,
33  lastsample,
34  timingcutlow,
35  timingcuthigh,
36  timingquallow,
37  timingqualhigh,
38  ratiomincutlow,
39  ratiomincuthigh,
40  ratiomaxcutlow);
41 }
void init(int, int, int, int, int, int, int, int, double, double, double)
Definition: TAPDPulse.cc:46

◆ ~TAPDPulse()

TAPDPulse::~TAPDPulse ( )
override

Definition at line 44 of file TAPDPulse.cc.

44 {}

Member Function Documentation

◆ areFitSamplesOK()

bool TAPDPulse::areFitSamplesOK ( )

Definition at line 154 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

154  {
155  bool ok = true;
156  if (!isMaxFound_)
157  getMax();
159  ok = false;
160  return ok;
161 }
bool isMaxFound_
Definition: TAPDPulse.h:22
int iadcMax_
Definition: TAPDPulse.h:25
int _firstsample
Definition: TAPDPulse.h:11
int _nsamples
Definition: TAPDPulse.h:9
int _presample
Definition: TAPDPulse.h:10
int _lastsample
Definition: TAPDPulse.h:12
double getMax()
Definition: TAPDPulse.cc:94

◆ arePulseRatioOK()

bool TAPDPulse::arePulseRatioOK ( )

Definition at line 171 of file TAPDPulse.cc.

References METSkim_cff::Max, METSkim_cff::Min, convertSQLiteXML::ok, bTagCommon_cff::ratioMax, and bTagCommon_cff::ratioMin.

171  {
172  bool ok = true;
173 
174  if (!isMaxFound_)
175  getMax();
176  if (iadcMax_ < 1 || iadcMax_ >= _nsamples - 1)
177  return false;
178 
179  double ratioNm1 = getRatio(iadcMax_ - 1, iadcMax_);
180  double ratioNp1 = getRatio(iadcMax_ + 1, iadcMax_);
181  double ratioMax = TMath::Max(ratioNm1, ratioNp1);
182  double ratioMin = TMath::Min(ratioNm1, ratioNp1);
183 
185  ok = false;
186  if (ratioMin < _ratiomincutlow || ratioMin > _ratiomincuthigh)
187  ok = false;
188 
189  return ok;
190 }
bool isMaxFound_
Definition: TAPDPulse.h:22
int iadcMax_
Definition: TAPDPulse.h:25
double getRatio(int, int)
Definition: TAPDPulse.cc:123
double _ratiomaxcutlow
Definition: TAPDPulse.h:17
int _nsamples
Definition: TAPDPulse.h:9
double _ratiomincuthigh
Definition: TAPDPulse.h:19
double getMax()
Definition: TAPDPulse.cc:94

◆ getAdcWithoutPedestal()

double * TAPDPulse::getAdcWithoutPedestal ( )

Definition at line 237 of file TAPDPulse.cc.

References mps_fire::i.

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

237  {
238  double ped;
239  if (!isPedCalc_)
240  ped = getPedestal();
241  else
242  ped = pedestal_;
243 
244  double *adcNoPed = new double[10];
245  for (int i = 0; i < _nsamples; i++) {
246  adcNoPed[i] = adc_[i] - ped;
247  }
248  return adcNoPed;
249 }
double getPedestal()
Definition: TAPDPulse.cc:224
double * adc_
Definition: TAPDPulse.h:21
int _nsamples
Definition: TAPDPulse.h:9
bool isPedCalc_
Definition: TAPDPulse.h:23
double pedestal_
Definition: TAPDPulse.h:26

◆ getDelta()

double TAPDPulse::getDelta ( int  n1,
int  n2 
)

Definition at line 116 of file TAPDPulse.cc.

References cms::cuda::assert(), and dumpMFGeometry_cfg::delta.

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

116  {
117  assert(n1 < _nsamples && n1 >= 0);
118  assert(n2 < _nsamples && n2 >= 0);
119 
120  double delta = adc_[n1] - adc_[n2];
121  return delta;
122 }
assert(be >=bs)
double * adc_
Definition: TAPDPulse.h:21

◆ getMax()

double TAPDPulse::getMax ( )

Definition at line 94 of file TAPDPulse.cc.

References mps_fire::i.

94  {
95  if (isMaxFound_)
96  return adcMax_;
97 
98  int iadcmax = 0;
99  double adcmax = 0.0;
100  for (int i = 0; i < _nsamples; i++) {
101  if (adc_[i] > adcmax) {
102  iadcmax = i;
103  adcmax = adc_[i];
104  }
105  }
106  iadcMax_ = iadcmax;
107  adcMax_ = adcmax;
108  return adcMax_;
109 }
bool isMaxFound_
Definition: TAPDPulse.h:22
int iadcMax_
Definition: TAPDPulse.h:25
double * adc_
Definition: TAPDPulse.h:21
int _nsamples
Definition: TAPDPulse.h:9
double adcMax_
Definition: TAPDPulse.h:24

◆ getMaxSample()

int TAPDPulse::getMaxSample ( )

Definition at line 111 of file TAPDPulse.cc.

111  {
112  if (!isMaxFound_)
113  getMax();
114  return iadcMax_;
115 }
bool isMaxFound_
Definition: TAPDPulse.h:22
int iadcMax_
Definition: TAPDPulse.h:25
double getMax()
Definition: TAPDPulse.cc:94

◆ getPedestal()

double TAPDPulse::getPedestal ( )

Definition at line 224 of file TAPDPulse.cc.

References mps_fire::i.

224  {
225  if (isPedCalc_)
226  return pedestal_;
227  double ped = 0;
228  for (int i = 0; i < _presample; i++) {
229  ped += adc_[i];
230  }
231  ped /= double(_presample);
232  pedestal_ = ped;
233  isPedCalc_ = true;
234  return pedestal_;
235 }
double * adc_
Definition: TAPDPulse.h:21
bool isPedCalc_
Definition: TAPDPulse.h:23
int _presample
Definition: TAPDPulse.h:10
double pedestal_
Definition: TAPDPulse.h:26

◆ getRatio()

double TAPDPulse::getRatio ( int  n1,
int  n2 
)

Definition at line 123 of file TAPDPulse.cc.

References cms::cuda::assert(), and particleFlowDisplacedVertex_cfi::ratio.

123  {
124  assert(n1 < _nsamples && n1 >= 0);
125  assert(n2 < _nsamples && n2 >= 0);
126 
127  double ped = 0;
128  if (isPedCalc_)
129  ped = pedestal_;
130  else
131  ped = adc_[0];
132 
133  double ratio = (adc_[n1] - ped) / (adc_[n2] - ped);
134  return ratio;
135 }
assert(be >=bs)
double * adc_
Definition: TAPDPulse.h:21
bool isPedCalc_
Definition: TAPDPulse.h:23
double pedestal_
Definition: TAPDPulse.h:26

◆ init()

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

References cms::cuda::assert(), and mps_fire::i.

56  {
57  _nsamples = 10;
58  assert(nsamples == _nsamples);
59  assert(presample != 0);
60  adc_ = new double[10];
61 
62  _presample = presample;
63  _firstsample = firstsample;
64  _lastsample = lastsample;
65 
66  _timingcutlow = timingcutlow;
67  _timingcuthigh = timingcuthigh;
68  _timingquallow = timingquallow;
69  _timingqualhigh = timingqualhigh;
70  _ratiomincutlow = ratiomincutlow;
71  _ratiomincuthigh = ratiomincuthigh;
72  _ratiomaxcutlow = ratiomaxcutlow;
73 
74  for (int i = 0; i < _nsamples; i++) {
75  adc_[i] = 0.0;
76  }
77 
78  adcMax_ = 0;
79  iadcMax_ = 0;
80  pedestal_ = 0;
81 
82  isMaxFound_ = false;
83  isPedCalc_ = false;
84 }
bool isMaxFound_
Definition: TAPDPulse.h:22
int iadcMax_
Definition: TAPDPulse.h:25
double _ratiomaxcutlow
Definition: TAPDPulse.h:17
int _firstsample
Definition: TAPDPulse.h:11
assert(be >=bs)
double * adc_
Definition: TAPDPulse.h:21
int _nsamples
Definition: TAPDPulse.h:9
double _ratiomincuthigh
Definition: TAPDPulse.h:19
bool isPedCalc_
Definition: TAPDPulse.h:23
int _presample
Definition: TAPDPulse.h:10
int _lastsample
Definition: TAPDPulse.h:12
int _timingcuthigh
Definition: TAPDPulse.h:14
int _timingqualhigh
Definition: TAPDPulse.h:16
int _timingcutlow
Definition: TAPDPulse.h:13
double adcMax_
Definition: TAPDPulse.h:24
double _ratiomincutlow
Definition: TAPDPulse.h:18
int _timingquallow
Definition: TAPDPulse.h:15
double pedestal_
Definition: TAPDPulse.h:26

◆ isPulseOK()

bool TAPDPulse::isPulseOK ( )

Definition at line 162 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

162  {
163  bool okSamples = areFitSamplesOK();
164  bool okTiming = isTimingOK();
165  bool okPulse = arePulseRatioOK();
166 
167  bool ok = (okSamples && okTiming && okPulse);
168 
169  return ok;
170 }
bool areFitSamplesOK()
Definition: TAPDPulse.cc:154
bool isTimingOK()
Definition: TAPDPulse.cc:137
bool arePulseRatioOK()
Definition: TAPDPulse.cc:171

◆ isPulseRatioMaxOK()

bool TAPDPulse::isPulseRatioMaxOK ( )

Definition at line 191 of file TAPDPulse.cc.

References METSkim_cff::Max, convertSQLiteXML::ok, and bTagCommon_cff::ratioMax.

191  {
192  bool ok = true;
193 
194  if (!isMaxFound_)
195  getMax();
196  if (iadcMax_ < 1 || iadcMax_ >= _nsamples - 1)
197  return false;
198 
199  double ratioNm1 = getRatio(iadcMax_ - 1, iadcMax_);
200  double ratioNp1 = getRatio(iadcMax_ + 1, iadcMax_);
201  double ratioMax = TMath::Max(ratioNm1, ratioNp1);
202 
204  ok = false;
205  return ok;
206 }
bool isMaxFound_
Definition: TAPDPulse.h:22
int iadcMax_
Definition: TAPDPulse.h:25
double getRatio(int, int)
Definition: TAPDPulse.cc:123
double _ratiomaxcutlow
Definition: TAPDPulse.h:17
int _nsamples
Definition: TAPDPulse.h:9
double getMax()
Definition: TAPDPulse.cc:94

◆ isPulseRatioMinOK()

bool TAPDPulse::isPulseRatioMinOK ( )

Definition at line 207 of file TAPDPulse.cc.

References METSkim_cff::Min, convertSQLiteXML::ok, and bTagCommon_cff::ratioMin.

207  {
208  bool ok = true;
209 
210  if (!isMaxFound_)
211  getMax();
212  if (iadcMax_ < 1 || iadcMax_ >= _nsamples - 1)
213  return false;
214 
215  double ratioNm1 = getRatio(iadcMax_ - 1, iadcMax_);
216  double ratioNp1 = getRatio(iadcMax_ + 1, iadcMax_);
217  double ratioMin = TMath::Min(ratioNm1, ratioNp1);
218 
219  if (ratioMin < _ratiomincutlow || ratioMin > _ratiomincuthigh)
220  ok = false;
221  return ok;
222 }
bool isMaxFound_
Definition: TAPDPulse.h:22
int iadcMax_
Definition: TAPDPulse.h:25
double getRatio(int, int)
Definition: TAPDPulse.cc:123
int _nsamples
Definition: TAPDPulse.h:9
double _ratiomincuthigh
Definition: TAPDPulse.h:19
double getMax()
Definition: TAPDPulse.cc:94

◆ isTimingOK()

bool TAPDPulse::isTimingOK ( )

Definition at line 137 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

137  {
138  bool ok = true;
139  if (!isMaxFound_)
140  getMax();
141  if (iadcMax_ <= _timingcutlow || iadcMax_ >= _timingcuthigh)
142  ok = false;
143  return ok;
144 }
bool isMaxFound_
Definition: TAPDPulse.h:22
int _timingcuthigh
Definition: TAPDPulse.h:14
double getMax()
Definition: TAPDPulse.cc:94

◆ isTimingQualOK()

bool TAPDPulse::isTimingQualOK ( )

Definition at line 145 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

145  {
146  bool ok = true;
147  if (!isMaxFound_)
148  getMax();
149  if (iadcMax_ <= _timingquallow || iadcMax_ >= _timingqualhigh)
150  ok = false;
151  return ok;
152 }
bool isMaxFound_
Definition: TAPDPulse.h:22
double getMax()
Definition: TAPDPulse.cc:94
int _timingqualhigh
Definition: TAPDPulse.h:16

◆ setPresamples()

void TAPDPulse::setPresamples ( int  presample)

Definition at line 251 of file TAPDPulse.cc.

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

251  {
252  isPedCalc_ = false;
253  _presample = presample;
254 }
bool isPedCalc_
Definition: TAPDPulse.h:23
int _presample
Definition: TAPDPulse.h:10

◆ setPulse()

bool TAPDPulse::setPulse ( double *  adc)

Definition at line 86 of file TAPDPulse.cc.

References gpuClustering::adc, and fileCollector::done.

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

86  {
87  bool done = false;
88  adc_ = adc;
89  done = true;
90  isMaxFound_ = false;
91  isPedCalc_ = false;
92  return done;
93 }
bool isMaxFound_
Definition: TAPDPulse.h:22
double * adc_
Definition: TAPDPulse.h:21
bool isPedCalc_
Definition: TAPDPulse.h:23
uint16_t *__restrict__ uint16_t const *__restrict__ adc

Member Data Documentation

◆ _firstsample

int TAPDPulse::_firstsample
private

Definition at line 11 of file TAPDPulse.h.

◆ _lastsample

int TAPDPulse::_lastsample
private

Definition at line 12 of file TAPDPulse.h.

◆ _nsamples

int TAPDPulse::_nsamples
private

Definition at line 9 of file TAPDPulse.h.

◆ _presample

int TAPDPulse::_presample
private

Definition at line 10 of file TAPDPulse.h.

◆ _ratiomaxcutlow

double TAPDPulse::_ratiomaxcutlow
private

Definition at line 17 of file TAPDPulse.h.

◆ _ratiomincuthigh

double TAPDPulse::_ratiomincuthigh
private

Definition at line 19 of file TAPDPulse.h.

◆ _ratiomincutlow

double TAPDPulse::_ratiomincutlow
private

Definition at line 18 of file TAPDPulse.h.

◆ _timingcuthigh

int TAPDPulse::_timingcuthigh
private

Definition at line 14 of file TAPDPulse.h.

◆ _timingcutlow

int TAPDPulse::_timingcutlow
private

Definition at line 13 of file TAPDPulse.h.

◆ _timingqualhigh

int TAPDPulse::_timingqualhigh
private

Definition at line 16 of file TAPDPulse.h.

◆ _timingquallow

int TAPDPulse::_timingquallow
private

Definition at line 15 of file TAPDPulse.h.

◆ adc_

double* TAPDPulse::adc_
private

Definition at line 21 of file TAPDPulse.h.

◆ adcMax_

double TAPDPulse::adcMax_
private

Definition at line 24 of file TAPDPulse.h.

◆ iadcMax_

int TAPDPulse::iadcMax_
private

Definition at line 25 of file TAPDPulse.h.

◆ isMaxFound_

bool TAPDPulse::isMaxFound_
private

Definition at line 22 of file TAPDPulse.h.

◆ isPedCalc_

bool TAPDPulse::isPedCalc_
private

Definition at line 23 of file TAPDPulse.h.

◆ pedestal_

double TAPDPulse::pedestal_
private

Definition at line 26 of file TAPDPulse.h.