CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TAPDPulse Class Reference

#include <TAPDPulse.h>

List of all members.

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

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

Definition at line 18 of file TAPDPulse.cc.

References init.

{
  init(10,3,1,2,2,9,3,8,0.4,0.95,0.8);
}
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 24 of file TAPDPulse.cc.

References init.

{
  init( nsamples,  presample,  firstsample,  lastsample,  timingcutlow, timingcuthigh,  timingquallow,  timingqualhigh,ratiomincutlow,ratiomincuthigh, ratiomaxcutlow );
}
TAPDPulse::~TAPDPulse ( ) [virtual]

Definition at line 30 of file TAPDPulse.cc.

{
}

Member Function Documentation

bool TAPDPulse::areFitSamplesOK ( )

Definition at line 132 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

                               {
  
  bool ok=true;
  if(!isMaxFound_) getMax();
  if ((iadcMax_-_firstsample)<_presample || (iadcMax_+_lastsample)>_nsamples-1) ok=false;
  return ok;
  
}
bool TAPDPulse::arePulseRatioOK ( )

Definition at line 150 of file TAPDPulse.cc.

References siStripFEDMonitor_P5_cff::Max, siStripFEDMonitor_P5_cff::Min, and convertSQLiteXML::ok.

                               {

  bool ok=true;

  if(!isMaxFound_) getMax();
  if(iadcMax_<1 || iadcMax_>=_nsamples-1) return false;
  
  double ratioNm1=getRatio(iadcMax_-1,iadcMax_);
  double ratioNp1=getRatio(iadcMax_+1,iadcMax_);
  double ratioMax=TMath::Max(ratioNm1,ratioNp1);
  double ratioMin=TMath::Min(ratioNm1,ratioNp1);
  
  if(ratioMax<_ratiomaxcutlow) ok=false;
  if(ratioMin<_ratiomincutlow || ratioMin>_ratiomincuthigh) ok=false;

  return ok;

}
double * TAPDPulse::getAdcWithoutPedestal ( )

Definition at line 210 of file TAPDPulse.cc.

References i.

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

                                        {
  
  double ped;
  if(!isPedCalc_) ped=getPedestal();
  else ped=pedestal_;
  
  double *adcNoPed= new double[10];
  for (int i=0;i<_nsamples;i++){
    adcNoPed[i]=adc_[i]-ped;
  }
  return adcNoPed;  
}
double TAPDPulse::getDelta ( int  n1,
int  n2 
)

Definition at line 96 of file TAPDPulse.cc.

References delta.

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

                                        {

  assert (n1<_nsamples && n1>=0);
  assert (n2<_nsamples && n2>=0);
  
  double delta=adc_[n1]-adc_[n2];
  return delta;
}
double TAPDPulse::getMax ( )

Definition at line 74 of file TAPDPulse.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 TAPDPulse::getMaxSample ( )

Definition at line 91 of file TAPDPulse.cc.

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

}
double TAPDPulse::getPedestal ( )

Definition at line 198 of file TAPDPulse.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_;
}
double TAPDPulse::getRatio ( int  n1,
int  n2 
)

Definition at line 104 of file TAPDPulse.cc.

                                        {
  
  assert (n1<_nsamples && n1>=0);
  assert (n2<_nsamples && n2>=0);

  double ped=0;
  if(isPedCalc_)ped=pedestal_; 
  else ped=adc_[0];
  
  double ratio=(adc_[n1]-ped)/(adc_[n2]-ped);
  return ratio; 
}
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 34 of file TAPDPulse.cc.

References i.

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

  _presample=presample;
  _firstsample=firstsample;
  _lastsample=lastsample;
  
  _timingcutlow=timingcutlow;
  _timingcuthigh=timingcuthigh;
  _timingquallow=timingquallow;
  _timingqualhigh=timingqualhigh;
  _ratiomincutlow=ratiomincutlow;
  _ratiomincuthigh=ratiomincuthigh;
  _ratiomaxcutlow=ratiomaxcutlow;

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

  adcMax_=0;
  iadcMax_=0;
  pedestal_=0;
  
  isMaxFound_=false;
  isPedCalc_=false;
}
bool TAPDPulse::isPulseOK ( )

Definition at line 140 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

                         {

  bool okSamples=areFitSamplesOK();
  bool okTiming=isTimingOK();
  bool okPulse=arePulseRatioOK();

  bool ok=(okSamples && okTiming && okPulse);

  return ok;
}
bool TAPDPulse::isPulseRatioMaxOK ( )

Definition at line 168 of file TAPDPulse.cc.

References siStripFEDMonitor_P5_cff::Max, and convertSQLiteXML::ok.

                                 {

  bool ok=true;

  if(!isMaxFound_) getMax();
  if(iadcMax_<1 || iadcMax_>=_nsamples-1) return false;
  
  double ratioNm1=getRatio(iadcMax_-1,iadcMax_);
  double ratioNp1=getRatio(iadcMax_+1,iadcMax_);
  double ratioMax=TMath::Max(ratioNm1,ratioNp1);
  
  if(ratioMax<_ratiomaxcutlow) ok=false;
  return ok;

}
bool TAPDPulse::isPulseRatioMinOK ( )

Definition at line 183 of file TAPDPulse.cc.

References siStripFEDMonitor_P5_cff::Min, and convertSQLiteXML::ok.

                                 {

  bool ok=true;
  
  if(!isMaxFound_) getMax();
  if(iadcMax_<1 || iadcMax_>=_nsamples-1) return false;
  
  double ratioNm1=getRatio(iadcMax_-1,iadcMax_);
  double ratioNp1=getRatio(iadcMax_+1,iadcMax_);
  double ratioMin=TMath::Min(ratioNm1,ratioNp1);
  
  if(ratioMin<_ratiomincutlow || ratioMin>_ratiomincuthigh) ok=false;
  return ok;  
}
bool TAPDPulse::isTimingOK ( )

Definition at line 117 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

                          {

  bool ok=true;
  if(!isMaxFound_) getMax();
  if(iadcMax_<=_timingcutlow || iadcMax_>=_timingcuthigh) ok=false;
  return ok;
}
bool TAPDPulse::isTimingQualOK ( )

Definition at line 124 of file TAPDPulse.cc.

References convertSQLiteXML::ok.

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

                              {

  bool ok=true;
  if(!isMaxFound_) getMax();
  if(iadcMax_<=_timingquallow || iadcMax_>=_timingqualhigh) ok=false;
  return ok;
}
void TAPDPulse::setPresamples ( int  presample)

Definition at line 223 of file TAPDPulse.cc.

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

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

Member Data Documentation

int TAPDPulse::_firstsample [private]

Definition at line 14 of file TAPDPulse.h.

int TAPDPulse::_lastsample [private]

Definition at line 15 of file TAPDPulse.h.

int TAPDPulse::_nsamples [private]

Definition at line 12 of file TAPDPulse.h.

int TAPDPulse::_presample [private]

Definition at line 13 of file TAPDPulse.h.

double TAPDPulse::_ratiomaxcutlow [private]

Definition at line 20 of file TAPDPulse.h.

double TAPDPulse::_ratiomincuthigh [private]

Definition at line 22 of file TAPDPulse.h.

double TAPDPulse::_ratiomincutlow [private]

Definition at line 21 of file TAPDPulse.h.

Definition at line 17 of file TAPDPulse.h.

int TAPDPulse::_timingcutlow [private]

Definition at line 16 of file TAPDPulse.h.

Definition at line 19 of file TAPDPulse.h.

Definition at line 18 of file TAPDPulse.h.

double* TAPDPulse::adc_ [private]

Definition at line 25 of file TAPDPulse.h.

double TAPDPulse::adcMax_ [private]

Definition at line 28 of file TAPDPulse.h.

int TAPDPulse::iadcMax_ [private]

Definition at line 29 of file TAPDPulse.h.

bool TAPDPulse::isMaxFound_ [private]

Definition at line 26 of file TAPDPulse.h.

bool TAPDPulse::isPedCalc_ [private]

Definition at line 27 of file TAPDPulse.h.

double TAPDPulse::pedestal_ [private]

Definition at line 30 of file TAPDPulse.h.