#include <TAPAlgorithms.h>
Public Member Functions | |
SimpleIntegral (double ped, int trig_pol) | |
SimpleIntegral (double ped, int trig_pol, int first, int last) | |
double | operator() (const TPulseIsland *tpi) const |
double | GetPedestal () const |
int | GetStart () const |
int | GetStop () const |
void | SetPedestal (double v) |
void | SetStart (int v) |
void | SetStop (int v) |
Public Attributes | |
const int | trigger_polarity |
Private Member Functions | |
void | operator= (const SimpleIntegral &rhs) |
Private Attributes | |
double | pedestal |
int | start |
int | stop |
Definition at line 58 of file TAPAlgorithms.h.
Algorithm::SimpleIntegral::SimpleIntegral | ( | double | ped, | |
int | trig_pol | |||
) | [inline] |
Definition at line 60 of file TAPAlgorithms.h.
00061 :trigger_polarity(trig_pol), pedestal(ped),start(0),stop(0){}
Algorithm::SimpleIntegral::SimpleIntegral | ( | double | ped, | |
int | trig_pol, | |||
int | first, | |||
int | last | |||
) | [inline] |
first | Start integral from "samples.begin()+first" sample | |
last | End integral at "samples.begin()+last" if last>0 or "samples.end()+last" if last<=0 |
Definition at line 65 of file TAPAlgorithms.h.
00066 :trigger_polarity(trig_pol), pedestal(ped),start(first),stop(last){}
double Algorithm::SimpleIntegral::GetPedestal | ( | ) | const [inline] |
int Algorithm::SimpleIntegral::GetStart | ( | ) | const [inline] |
int Algorithm::SimpleIntegral::GetStop | ( | ) | const [inline] |
double Algorithm::SimpleIntegral::operator() | ( | const TPulseIsland * | tpi | ) | const |
Definition at line 67 of file TAPAlgorithms.cpp.
References TPulseIsland::GetSamples(), pedestal, start, stop, and trigger_polarity.
00067 { 00068 const std::vector<int>& samples = tpi->GetSamples(); 00069 00070 double length = samples.size(); 00071 typedef std::vector<int> SampleVector; 00072 SampleVector::const_iterator begin=samples.begin()+start; 00073 if(start > length 00074 || ( stop>0 && stop<start ) 00075 || (stop<0 && length+stop <start) ){ 00076 throw std::out_of_range("Algorithm::SimpleIntegral::operator() bad integral range" ); 00077 } 00078 SampleVector::const_iterator end=(stop>0?samples.begin():samples.end())+stop; 00079 double tempint=std::accumulate(begin,end,0); 00080 00081 double integral = trigger_polarity * (tempint - (pedestal * (end-begin))); 00082 00083 return integral; 00084 }
void Algorithm::SimpleIntegral::operator= | ( | const SimpleIntegral & | rhs | ) | [inline, private] |
Definition at line 80 of file TAPAlgorithms.h.
void Algorithm::SimpleIntegral::SetPedestal | ( | double | v | ) | [inline] |
Definition at line 75 of file TAPAlgorithms.h.
References pedestal.
Referenced by Algorithm::IntegralRatio::SetPedestal().
00075 {pedestal=v;};
void Algorithm::SimpleIntegral::SetStart | ( | int | v | ) | [inline] |
Definition at line 76 of file TAPAlgorithms.h.
References start.
Referenced by Algorithm::IntegralRatio::SetTailStart().
00076 {start=v;};
void Algorithm::SimpleIntegral::SetStop | ( | int | v | ) | [inline] |
Definition at line 77 of file TAPAlgorithms.h.
References stop.
Referenced by Algorithm::IntegralRatio::SetTailStart().
00077 {stop=v;};
double Algorithm::SimpleIntegral::pedestal [private] |
Definition at line 80 of file TAPAlgorithms.h.
Referenced by GetPedestal(), operator()(), and SetPedestal().
int Algorithm::SimpleIntegral::start [private] |
Definition at line 82 of file TAPAlgorithms.h.
Referenced by GetStart(), operator()(), and SetStart().
int Algorithm::SimpleIntegral::stop [private] |
Definition at line 83 of file TAPAlgorithms.h.
Referenced by GetStop(), operator()(), and SetStop().
Definition at line 69 of file TAPAlgorithms.h.
Referenced by operator()().