#include <TAPAlgorithms.h>
Public Member Functions | |
MaxBinTime (int trig_pol, double clk_tick, double t_shift) | |
double | operator() (const TPulseIsland *tpi) const |
Public Attributes | |
const int | trigger_polarity |
const double | clock_tick_in_ns |
const double | time_shift |
Definition at line 32 of file TAPAlgorithms.h.
Algorithm::MaxBinTime::MaxBinTime | ( | int | trig_pol, | |
double | clk_tick, | |||
double | t_shift | |||
) | [inline] |
Definition at line 34 of file TAPAlgorithms.h.
00035 :trigger_polarity(trig_pol), clock_tick_in_ns(clk_tick), time_shift(t_shift){}
double Algorithm::MaxBinTime::operator() | ( | const TPulseIsland * | tpi | ) | const |
Definition at line 31 of file TAPAlgorithms.cpp.
References clock_tick_in_ns, TPulseIsland::GetSamples(), TPulseIsland::GetTimeStamp(), time_shift, and trigger_polarity.
00031 { 00032 00033 // Get the samples and get an iterator ready to find the peak sample 00034 std::vector<int> pulseSamples = tpi->GetSamples(); 00035 std::vector<int>::iterator peak_sample_pos; 00036 00037 // Find the position of the peak samples 00038 if (trigger_polarity == 1) 00039 peak_sample_pos = std::max_element(pulseSamples.begin(), pulseSamples.end()); 00040 else if (trigger_polarity == -1) 00041 peak_sample_pos = std::min_element(pulseSamples.begin(), pulseSamples.end()); 00042 00043 // Now calculate the time 00044 double time = ((tpi->GetTimeStamp() + (peak_sample_pos - pulseSamples.begin())) * clock_tick_in_ns) - time_shift; 00045 00046 return time; 00047 }
const double Algorithm::MaxBinTime::clock_tick_in_ns |
Definition at line 39 of file TAPAlgorithms.h.
Referenced by operator()().
const double Algorithm::MaxBinTime::time_shift |
Definition at line 40 of file TAPAlgorithms.h.
Referenced by operator()().
const int Algorithm::MaxBinTime::trigger_polarity |
Definition at line 38 of file TAPAlgorithms.h.
Referenced by operator()().