CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TPNPulse Class Reference

#include <TPNPulse.h>

List of all members.

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.

{
  init(50,6);
}
TPNPulse::TPNPulse ( int  nsamples,
int  presample 
)

Definition at line 25 of file TPNPulse.cc.

References init.

{
  init( nsamples,  presample);
}
TPNPulse::~TPNPulse ( ) [virtual]

Definition at line 31 of file TPNPulse.cc.

{
}

Member Function Documentation

double * TPNPulse::getAdcWithoutPedestal ( )

Definition at line 100 of file TPNPulse.cc.

References i.

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

                                       {
  
  double ped;
  if(!isPedCalc_) ped=getPedestal();
  else ped=pedestal_;
  
  double *adcNoPed= new double[50];
  for (int i=0;i<_nsamples;i++){
    adcNoPed[i]=adc_[i]-ped;
  }
  return adcNoPed;  
}
double TPNPulse::getMax ( )

Definition at line 65 of file TPNPulse.cc.

References i.

                       {

  if(isMaxFound_) return adcMax_; 

  int iadcmax=0;
  double adcmax=0.0;
  for(int i=0;i<_nsamples;i++){
    if(adc_[i]>adcmax){
      iadcmax=i;
      adcmax=adc_[i];
    }
  }
  iadcMax_=iadcmax;
  adcMax_=adcmax;
  return adcMax_;  
}
int TPNPulse::getMaxSample ( )

Definition at line 82 of file TPNPulse.cc.

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

                          {
  if(!isMaxFound_) getMax();
  return iadcMax_;

}
double TPNPulse::getPedestal ( )

Definition at line 88 of file TPNPulse.cc.

References i.

                            {
  if(isPedCalc_) return pedestal_;
  double ped=0;
  for(int i=0;i<_presample;i++){
    ped+=adc_[i];
  }
  ped/=double(_presample);
  pedestal_=ped;
  isPedCalc_=true;
  return pedestal_;
}
void TPNPulse::init ( int  nsamples,
int  presample 
) [private]

Definition at line 35 of file TPNPulse.cc.

References i.

{
  _nsamples=50;
  assert(nsamples==_nsamples);
  assert(presample!=0);
  adc_ = new double[50];  

  _presample=presample;
  
  for(int i=0;i<_nsamples;i++){
    adc_[i]=0.0;
  }

  adcMax_=0;
  iadcMax_=0;
  pedestal_=0;
  
  isMaxFound_=false;
  isPedCalc_=false;
}
void TPNPulse::setPresamples ( int  presample)

Definition at line 113 of file TPNPulse.cc.

                                         {
  isPedCalc_=false;
  _presample=presample;
}
bool TPNPulse::setPulse ( double *  adc)

Definition at line 56 of file TPNPulse.cc.

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

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

                                  {

  bool done=false;
  adc_=adc;
  done=true;
  isMaxFound_=false;
  isPedCalc_=false;
  return done;
}

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.