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.

16 { init(10, 3, 1, 2, 2, 9, 3, 8, 0.4, 0.95, 0.8); }

References init.

◆ 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.

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 }

References init.

◆ ~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.

154  {
155  bool ok = true;
156  if (!isMaxFound_)
157  getMax();
159  ok = false;
160  return ok;
161 }

References convertSQLiteXML::ok.

◆ arePulseRatioOK()

bool TAPDPulse::arePulseRatioOK ( )

Definition at line 171 of file TAPDPulse.cc.

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 }

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

◆ getAdcWithoutPedestal()

double * TAPDPulse::getAdcWithoutPedestal ( )

Definition at line 237 of file TAPDPulse.cc.

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 }

References mps_fire::i.

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

◆ getDelta()

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

Definition at line 116 of file TAPDPulse.cc.

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 }

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

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

◆ getMax()

double TAPDPulse::getMax ( )

Definition at line 94 of file TAPDPulse.cc.

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 }

References mps_fire::i.

◆ getMaxSample()

int TAPDPulse::getMaxSample ( )

Definition at line 111 of file TAPDPulse.cc.

111  {
112  if (!isMaxFound_)
113  getMax();
114  return iadcMax_;
115 }

◆ getPedestal()

double TAPDPulse::getPedestal ( )

Definition at line 224 of file TAPDPulse.cc.

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 }

References mps_fire::i.

◆ getRatio()

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

Definition at line 123 of file TAPDPulse.cc.

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 }

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

◆ 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.

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 }

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

◆ isPulseOK()

bool TAPDPulse::isPulseOK ( )

Definition at line 162 of file TAPDPulse.cc.

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 }

References convertSQLiteXML::ok.

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

◆ isPulseRatioMaxOK()

bool TAPDPulse::isPulseRatioMaxOK ( )

Definition at line 191 of file TAPDPulse.cc.

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 }

References Max(), convertSQLiteXML::ok, and bTagCommon_cff::ratioMax.

◆ isPulseRatioMinOK()

bool TAPDPulse::isPulseRatioMinOK ( )

Definition at line 207 of file TAPDPulse.cc.

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 }

References Min(), convertSQLiteXML::ok, and bTagCommon_cff::ratioMin.

◆ isTimingOK()

bool TAPDPulse::isTimingOK ( )

Definition at line 137 of file TAPDPulse.cc.

137  {
138  bool ok = true;
139  if (!isMaxFound_)
140  getMax();
141  if (iadcMax_ <= _timingcutlow || iadcMax_ >= _timingcuthigh)
142  ok = false;
143  return ok;
144 }

References convertSQLiteXML::ok.

◆ isTimingQualOK()

bool TAPDPulse::isTimingQualOK ( )

Definition at line 145 of file TAPDPulse.cc.

145  {
146  bool ok = true;
147  if (!isMaxFound_)
148  getMax();
149  if (iadcMax_ <= _timingquallow || iadcMax_ >= _timingqualhigh)
150  ok = false;
151  return ok;
152 }

References convertSQLiteXML::ok.

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

◆ setPresamples()

void TAPDPulse::setPresamples ( int  presample)

Definition at line 251 of file TAPDPulse.cc.

251  {
252  isPedCalc_ = false;
253  _presample = presample;
254 }

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

◆ setPulse()

bool TAPDPulse::setPulse ( double *  adc)

Definition at line 86 of file TAPDPulse.cc.

86  {
87  bool done = false;
88  adc_ = adc;
89  done = true;
90  isMaxFound_ = false;
91  isPedCalc_ = false;
92  return done;
93 }

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

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

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.

mps_fire.i
i
Definition: mps_fire.py:428
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
TAPDPulse::_ratiomaxcutlow
double _ratiomaxcutlow
Definition: TAPDPulse.h:17
TAPDPulse::isMaxFound_
bool isMaxFound_
Definition: TAPDPulse.h:22
cms::cuda::assert
assert(be >=bs)
TAPDPulse::areFitSamplesOK
bool areFitSamplesOK()
Definition: TAPDPulse.cc:154
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
TAPDPulse::arePulseRatioOK
bool arePulseRatioOK()
Definition: TAPDPulse.cc:171
TAPDPulse::pedestal_
double pedestal_
Definition: TAPDPulse.h:26
fileCollector.done
done
Definition: fileCollector.py:123
TAPDPulse::getRatio
double getRatio(int, int)
Definition: TAPDPulse.cc:123
TAPDPulse::adcMax_
double adcMax_
Definition: TAPDPulse.h:24
TAPDPulse::iadcMax_
int iadcMax_
Definition: TAPDPulse.h:25
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
TAPDPulse::_presample
int _presample
Definition: TAPDPulse.h:10
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
Max
T Max(T a, T b)
Definition: MathUtil.h:44
TAPDPulse::_nsamples
int _nsamples
Definition: TAPDPulse.h:9
TAPDPulse::_timingcutlow
int _timingcutlow
Definition: TAPDPulse.h:13
TAPDPulse::_timingquallow
int _timingquallow
Definition: TAPDPulse.h:15
TAPDPulse::_ratiomincuthigh
double _ratiomincuthigh
Definition: TAPDPulse.h:19
TAPDPulse::isPedCalc_
bool isPedCalc_
Definition: TAPDPulse.h:23
TAPDPulse::_ratiomincutlow
double _ratiomincutlow
Definition: TAPDPulse.h:18
TAPDPulse::_timingcuthigh
int _timingcuthigh
Definition: TAPDPulse.h:14
TAPDPulse::_lastsample
int _lastsample
Definition: TAPDPulse.h:12
TAPDPulse::isTimingOK
bool isTimingOK()
Definition: TAPDPulse.cc:137
TAPDPulse::_firstsample
int _firstsample
Definition: TAPDPulse.h:11
TAPDPulse::getMax
double getMax()
Definition: TAPDPulse.cc:94
Min
T Min(T a, T b)
Definition: MathUtil.h:39
TAPDPulse::_timingqualhigh
int _timingqualhigh
Definition: TAPDPulse.h:16
TAPDPulse::adc_
double * adc_
Definition: TAPDPulse.h:21
bTagCommon_cff.ratioMax
ratioMax
Definition: bTagCommon_cff.py:34
TAPDPulse::init
void init(int, int, int, int, int, int, int, int, double, double, double)
Definition: TAPDPulse.cc:46
TAPDPulse::getPedestal
double getPedestal()
Definition: TAPDPulse.cc:224
bTagCommon_cff.ratioMin
ratioMin
Definition: bTagCommon_cff.py:33