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

References init.

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

Definition at line 24 of file TPNPulse.cc.

References init.

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

Definition at line 30 of file TPNPulse.cc.

31 {
32 }

Member Function Documentation

double * TPNPulse::getAdcWithoutPedestal ( )

Definition at line 99 of file TPNPulse.cc.

References i.

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

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

Definition at line 64 of file TPNPulse.cc.

References i.

64  {
65 
66  if(isMaxFound_) return adcMax_;
67 
68  int iadcmax=0;
69  double adcmax=0.0;
70  for(int i=0;i<_nsamples;i++){
71  if(adc_[i]>adcmax){
72  iadcmax=i;
73  adcmax=adc_[i];
74  }
75  }
76  iadcMax_=iadcmax;
77  adcMax_=adcmax;
78  return adcMax_;
79 }
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 81 of file TPNPulse.cc.

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

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

Definition at line 87 of file TPNPulse.cc.

References i.

87  {
88  if(isPedCalc_) return pedestal_;
89  double ped=0;
90  for(int i=0;i<_presample;i++){
91  ped+=adc_[i];
92  }
93  ped/=double(_presample);
94  pedestal_=ped;
95  isPedCalc_=true;
96  return pedestal_;
97 }
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 34 of file TPNPulse.cc.

References assert(), and i.

35 {
36  _nsamples=50;
37  assert(nsamples==_nsamples);
38  assert(presample!=0);
39  adc_ = new double[50];
40 
41  _presample=presample;
42 
43  for(int i=0;i<_nsamples;i++){
44  adc_[i]=0.0;
45  }
46 
47  adcMax_=0;
48  iadcMax_=0;
49  pedestal_=0;
50 
51  isMaxFound_=false;
52  isPedCalc_=false;
53 }
double * adc_
Definition: TPNPulse.h:16
bool isPedCalc_
Definition: TPNPulse.h:18
int i
Definition: DBlmapReader.cc:9
int _presample
Definition: TPNPulse.h:13
assert(m_qm.get())
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 112 of file TPNPulse.cc.

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

Definition at line 55 of file TPNPulse.cc.

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

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

55  {
56 
57  bool done=false;
58  adc_=adc;
59  done=true;
60  isMaxFound_=false;
61  isPedCalc_=false;
62  return done;
63 }
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.