Algorithm::ConstantFractionTime Struct Reference

#include <TAPAlgorithms.h>

List of all members.

Public Member Functions

 ConstantFractionTime (double ped, int trig_pol, double clk_tick, double t_shift, double const_frac)
double operator() (const TPulseIsland *tpi) const

Public Attributes

const double pedestal
const int trigger_polarity
const double clock_tick_in_ns
const double time_shift
const double constant_fraction

Detailed Description

Definition at line 43 of file TAPAlgorithms.h.


Constructor & Destructor Documentation

Algorithm::ConstantFractionTime::ConstantFractionTime ( double  ped,
int  trig_pol,
double  clk_tick,
double  t_shift,
double  const_frac 
) [inline]

Definition at line 45 of file TAPAlgorithms.h.

00046     :pedestal(ped), trigger_polarity(trig_pol), clock_tick_in_ns(clk_tick), time_shift(t_shift), constant_fraction(const_frac){}


Member Function Documentation

double Algorithm::ConstantFractionTime::operator() ( const TPulseIsland tpi  )  const

Definition at line 49 of file TAPAlgorithms.cpp.

References clock_tick_in_ns, constant_fraction, TPulseIsland::GetSamples(), TPulseIsland::GetTimeStamp(), pedestal, time_shift, and trigger_polarity.

00049                                                                                {
00050 
00051   const std::vector<int>& samps = tpi->GetSamples();
00052   const std::vector<int>::const_iterator b = samps.begin(), e = samps.end();
00053 
00054   std::vector<int>::const_iterator m = trigger_polarity > 0 ? std::max_element(b, e) : std::min_element(b, e);
00055   const int amp = *m;
00056   const unsigned int cf = trigger_polarity > 0 ?
00057       (unsigned int)(constant_fraction*(double)(amp-pedestal)) + pedestal :
00058       (unsigned int)((double)(pedestal-amp)*(1.-constant_fraction) + amp);
00059   while (m != b && (trigger_polarity > 0 ? *--m > (int)cf : *--m < (int)cf));
00060   double dx = (double)(m-b);
00061   if (*(m+1) != *m)
00062     dx += (double)((int)cf - *m)/(double)(*(m+1) - *m);
00063 
00064   return (dx + (double)tpi->GetTimeStamp()) * clock_tick_in_ns - time_shift;
00065 }


Member Data Documentation

Definition at line 51 of file TAPAlgorithms.h.

Referenced by operator()().

Definition at line 54 of file TAPAlgorithms.h.

Referenced by operator()().

Definition at line 49 of file TAPAlgorithms.h.

Referenced by operator()().

Definition at line 52 of file TAPAlgorithms.h.

Referenced by operator()().

Definition at line 50 of file TAPAlgorithms.h.

Referenced by operator()().


The documentation for this struct was generated from the following files:

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1