CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TPNPulse Class Reference

#include <TPNPulse.h>

Inheritance diagram for TPNPulse:

Public Member Functions

double * getAdcWithoutPedestal ()
 
double getMax ()
 
int getMaxSample ()
 
double getPedestal ()
 
void setPresamples (int)
 
bool setPulse (double *)
 
 TPNPulse ()
 
 TPNPulse (int, int)
 
 ~TPNPulse () override
 

Private Member Functions

void init (int, int)
 

Private Attributes

int _nsamples
 
int _presample
 
double * adc_
 
double adcMax_
 
int iadcMax_
 
bool isMaxFound_
 
bool isPedCalc_
 
double pedestal_
 

Detailed Description

Definition at line 7 of file TPNPulse.h.

Constructor & Destructor Documentation

◆ TPNPulse() [1/2]

TPNPulse::TPNPulse ( )

Definition at line 17 of file TPNPulse.cc.

References init.

17 { init(50, 6); }
void init(int, int)
Definition: TPNPulse.cc:25

◆ TPNPulse() [2/2]

TPNPulse::TPNPulse ( int  nsamples,
int  presample 
)

Definition at line 20 of file TPNPulse.cc.

References init.

20 { init(nsamples, presample); }
void init(int, int)
Definition: TPNPulse.cc:25

◆ ~TPNPulse()

TPNPulse::~TPNPulse ( )
override

Definition at line 23 of file TPNPulse.cc.

23 {}

Member Function Documentation

◆ getAdcWithoutPedestal()

double * TPNPulse::getAdcWithoutPedestal ( )

Definition at line 89 of file TPNPulse.cc.

References mps_fire::i.

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

89  {
90  double ped;
91  if (!isPedCalc_)
92  ped = getPedestal();
93  else
94  ped = pedestal_;
95 
96  double *adcNoPed = new double[50];
97  for (int i = 0; i < _nsamples; i++) {
98  adcNoPed[i] = adc_[i] - ped;
99  }
100  return adcNoPed;
101 }
double * adc_
Definition: TPNPulse.h:12
bool isPedCalc_
Definition: TPNPulse.h:14
double getPedestal()
Definition: TPNPulse.cc:76
int _nsamples
Definition: TPNPulse.h:9
double pedestal_
Definition: TPNPulse.h:17

◆ getMax()

double TPNPulse::getMax ( )

Definition at line 53 of file TPNPulse.cc.

References mps_fire::i.

53  {
54  if (isMaxFound_)
55  return adcMax_;
56 
57  int iadcmax = 0;
58  double adcmax = 0.0;
59  for (int i = 0; i < _nsamples; i++) {
60  if (adc_[i] > adcmax) {
61  iadcmax = i;
62  adcmax = adc_[i];
63  }
64  }
65  iadcMax_ = iadcmax;
66  adcMax_ = adcmax;
67  return adcMax_;
68 }
double * adc_
Definition: TPNPulse.h:12
bool isMaxFound_
Definition: TPNPulse.h:13
int _nsamples
Definition: TPNPulse.h:9
double adcMax_
Definition: TPNPulse.h:15
int iadcMax_
Definition: TPNPulse.h:16

◆ getMaxSample()

int TPNPulse::getMaxSample ( )

Definition at line 70 of file TPNPulse.cc.

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

70  {
71  if (!isMaxFound_)
72  getMax();
73  return iadcMax_;
74 }
double getMax()
Definition: TPNPulse.cc:53
bool isMaxFound_
Definition: TPNPulse.h:13
int iadcMax_
Definition: TPNPulse.h:16

◆ getPedestal()

double TPNPulse::getPedestal ( )

Definition at line 76 of file TPNPulse.cc.

References mps_fire::i.

76  {
77  if (isPedCalc_)
78  return pedestal_;
79  double ped = 0;
80  for (int i = 0; i < _presample; i++) {
81  ped += adc_[i];
82  }
83  ped /= double(_presample);
84  pedestal_ = ped;
85  isPedCalc_ = true;
86  return pedestal_;
87 }
double * adc_
Definition: TPNPulse.h:12
bool isPedCalc_
Definition: TPNPulse.h:14
int _presample
Definition: TPNPulse.h:10
double pedestal_
Definition: TPNPulse.h:17

◆ init()

void TPNPulse::init ( int  nsamples,
int  presample 
)
private

Definition at line 25 of file TPNPulse.cc.

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

25  {
26  _nsamples = 50;
27  assert(nsamples == _nsamples);
28  assert(presample != 0);
29  adc_ = new double[50];
30 
31  _presample = presample;
32 
33  for (int i = 0; i < _nsamples; i++) {
34  adc_[i] = 0.0;
35  }
36 
37  adcMax_ = 0;
38  iadcMax_ = 0;
39  pedestal_ = 0;
40 
41  isMaxFound_ = false;
42  isPedCalc_ = false;
43 }
double * adc_
Definition: TPNPulse.h:12
bool isPedCalc_
Definition: TPNPulse.h:14
int _presample
Definition: TPNPulse.h:10
bool isMaxFound_
Definition: TPNPulse.h:13
assert(be >=bs)
int _nsamples
Definition: TPNPulse.h:9
double pedestal_
Definition: TPNPulse.h:17
double adcMax_
Definition: TPNPulse.h:15
int iadcMax_
Definition: TPNPulse.h:16

◆ setPresamples()

void TPNPulse::setPresamples ( int  presample)

Definition at line 103 of file TPNPulse.cc.

103  {
104  isPedCalc_ = false;
105  _presample = presample;
106 }
bool isPedCalc_
Definition: TPNPulse.h:14
int _presample
Definition: TPNPulse.h:10

◆ setPulse()

bool TPNPulse::setPulse ( double *  adc)

Definition at line 45 of file TPNPulse.cc.

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

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

45  {
46  bool done = false;
47  adc_ = adc;
48  done = true;
49  isMaxFound_ = false;
50  isPedCalc_ = false;
51  return done;
52 }
double * adc_
Definition: TPNPulse.h:12
bool isPedCalc_
Definition: TPNPulse.h:14
bool isMaxFound_
Definition: TPNPulse.h:13
uint16_t *__restrict__ uint16_t const *__restrict__ adc

Member Data Documentation

◆ _nsamples

int TPNPulse::_nsamples
private

Definition at line 9 of file TPNPulse.h.

◆ _presample

int TPNPulse::_presample
private

Definition at line 10 of file TPNPulse.h.

◆ adc_

double* TPNPulse::adc_
private

Definition at line 12 of file TPNPulse.h.

◆ adcMax_

double TPNPulse::adcMax_
private

Definition at line 15 of file TPNPulse.h.

◆ iadcMax_

int TPNPulse::iadcMax_
private

Definition at line 16 of file TPNPulse.h.

◆ isMaxFound_

bool TPNPulse::isMaxFound_
private

Definition at line 13 of file TPNPulse.h.

◆ isPedCalc_

bool TPNPulse::isPedCalc_
private

Definition at line 14 of file TPNPulse.h.

◆ pedestal_

double TPNPulse::pedestal_
private

Definition at line 17 of file TPNPulse.h.