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
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)
 
virtual ~TPNPulse ()
 

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::TPNPulse ( )

Definition at line 19 of file TPNPulse.cc.

References init.

20 {
21  init(50,6);
22 }
void init(int, int)
Definition: TPNPulse.cc:35
TPNPulse::TPNPulse ( int  nsamples,
int  presample 
)

Definition at line 25 of file TPNPulse.cc.

References init.

26 {
27  init( nsamples, presample);
28 }
void init(int, int)
Definition: TPNPulse.cc:35
TPNPulse::~TPNPulse ( )
virtual

Definition at line 31 of file TPNPulse.cc.

32 {
33 }

Member Function Documentation

double * TPNPulse::getAdcWithoutPedestal ( )

Definition at line 100 of file TPNPulse.cc.

References i.

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

100  {
101 
102  double ped;
103  if(!isPedCalc_) ped=getPedestal();
104  else ped=pedestal_;
105 
106  double *adcNoPed= new double[50];
107  for (int i=0;i<_nsamples;i++){
108  adcNoPed[i]=adc_[i]-ped;
109  }
110  return adcNoPed;
111 }
double * adc_
Definition: TPNPulse.h:16
bool isPedCalc_
Definition: TPNPulse.h:18
int i
Definition: DBlmapReader.cc:9
double getPedestal()
Definition: TPNPulse.cc:88
int _nsamples
Definition: TPNPulse.h:12
double pedestal_
Definition: TPNPulse.h:21
double TPNPulse::getMax ( )

Definition at line 65 of file TPNPulse.cc.

References i.

65  {
66 
67  if(isMaxFound_) return adcMax_;
68 
69  int iadcmax=0;
70  double adcmax=0.0;
71  for(int i=0;i<_nsamples;i++){
72  if(adc_[i]>adcmax){
73  iadcmax=i;
74  adcmax=adc_[i];
75  }
76  }
77  iadcMax_=iadcmax;
78  adcMax_=adcmax;
79  return adcMax_;
80 }
double * adc_
Definition: TPNPulse.h:16
int i
Definition: DBlmapReader.cc:9
bool isMaxFound_
Definition: TPNPulse.h:17
int _nsamples
Definition: TPNPulse.h:12
double adcMax_
Definition: TPNPulse.h:19
int iadcMax_
Definition: TPNPulse.h:20
int TPNPulse::getMaxSample ( )

Definition at line 82 of file TPNPulse.cc.

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

82  {
83  if(!isMaxFound_) getMax();
84  return iadcMax_;
85 
86 }
double getMax()
Definition: TPNPulse.cc:65
bool isMaxFound_
Definition: TPNPulse.h:17
int iadcMax_
Definition: TPNPulse.h:20
double TPNPulse::getPedestal ( )

Definition at line 88 of file TPNPulse.cc.

References i.

88  {
89  if(isPedCalc_) return pedestal_;
90  double ped=0;
91  for(int i=0;i<_presample;i++){
92  ped+=adc_[i];
93  }
94  ped/=double(_presample);
95  pedestal_=ped;
96  isPedCalc_=true;
97  return pedestal_;
98 }
double * adc_
Definition: TPNPulse.h:16
bool isPedCalc_
Definition: TPNPulse.h:18
int i
Definition: DBlmapReader.cc:9
int _presample
Definition: TPNPulse.h:13
double pedestal_
Definition: TPNPulse.h:21
void TPNPulse::init ( int  nsamples,
int  presample 
)
private

Definition at line 35 of file TPNPulse.cc.

References i.

36 {
37  _nsamples=50;
38  assert(nsamples==_nsamples);
39  assert(presample!=0);
40  adc_ = new double[50];
41 
42  _presample=presample;
43 
44  for(int i=0;i<_nsamples;i++){
45  adc_[i]=0.0;
46  }
47 
48  adcMax_=0;
49  iadcMax_=0;
50  pedestal_=0;
51 
52  isMaxFound_=false;
53  isPedCalc_=false;
54 }
double * adc_
Definition: TPNPulse.h:16
bool isPedCalc_
Definition: TPNPulse.h:18
int i
Definition: DBlmapReader.cc:9
int _presample
Definition: TPNPulse.h:13
bool isMaxFound_
Definition: TPNPulse.h:17
int _nsamples
Definition: TPNPulse.h:12
double pedestal_
Definition: TPNPulse.h:21
double adcMax_
Definition: TPNPulse.h:19
int iadcMax_
Definition: TPNPulse.h:20
void TPNPulse::setPresamples ( int  presample)

Definition at line 113 of file TPNPulse.cc.

113  {
114  isPedCalc_=false;
115  _presample=presample;
116 }
bool isPedCalc_
Definition: TPNPulse.h:18
int _presample
Definition: TPNPulse.h:13
bool TPNPulse::setPulse ( double *  adc)

Definition at line 56 of file TPNPulse.cc.

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

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

56  {
57 
58  bool done=false;
59  adc_=adc;
60  done=true;
61  isMaxFound_=false;
62  isPedCalc_=false;
63  return done;
64 }
int adc(sample_type sample)
get the ADC sample (12 bits)
double * adc_
Definition: TPNPulse.h:16
bool isPedCalc_
Definition: TPNPulse.h:18
bool isMaxFound_
Definition: TPNPulse.h:17

Member Data Documentation

int TPNPulse::_nsamples
private

Definition at line 12 of file TPNPulse.h.

int TPNPulse::_presample
private

Definition at line 13 of file TPNPulse.h.

double* TPNPulse::adc_
private

Definition at line 16 of file TPNPulse.h.

double TPNPulse::adcMax_
private

Definition at line 19 of file TPNPulse.h.

int TPNPulse::iadcMax_
private

Definition at line 20 of file TPNPulse.h.

bool TPNPulse::isMaxFound_
private

Definition at line 17 of file TPNPulse.h.

bool TPNPulse::isPedCalc_
private

Definition at line 18 of file TPNPulse.h.

double TPNPulse::pedestal_
private

Definition at line 21 of file TPNPulse.h.