Diana Software
QTimingAnalyzer.hh
Go to the documentation of this file.
1 #ifndef _Q_TIMING_ANALYZER_HH_
2 #define _Q_TIMING_ANALYZER_HH_
3 
12 #include <vector>
13 
15  public:
18 
20  virtual ~QTimingAnalyzer();
21 
23  void AddValue(const double value)
24  {fValues.push_back(value); fNeedsSort = true;}
25 
27  void ComputeGoodnessThreshold(const double falseRate);
28 
30  void FindPeriod(const double uncertainty,
31  const double stepSize = 0.008);
32 
34  unsigned int GetBestGoodness();
35 
37  unsigned int GetGoodness(const double value);
38 
40  unsigned int GetGoodnessParameter(const double value);
41 
43  unsigned int GetGoodnessThreshold() const {return fGoodnessThreshold;}
44 
46  double GetPeriod() const {return fPeriod;}
47 
49  unsigned int GetTotalGoodness();
50 
52  void SetAdjustments(const std::vector<double>& adjustments)
53  {fAdjustments = adjustments;}
54 
56  void SetExpectedPeriod(const double period) {fPeriod = period;}
57 
59  void SetTolerance(const double tolerance) {fTolerance = tolerance;}
60 
61  private:
64  double DistanceToClosestElement(const double value,
65  double& closestValue);
66 
68  std::vector<double> fAdjustments;
69 
71  unsigned int fGoodnessThreshold;
72 
74  bool fNeedsSort;
75 
77  double fPeriod;
78 
80  double fTolerance;
81 
83  std::vector<double> fValues;
84 
85 };
86 
87 #endif
Analyzes a list of values for the occurance of elements separated by regular intervals.
void SetExpectedPeriod(const double period)
Set period for repetition of values.
std::vector< double > fValues
Time values.
double fPeriod
Period for repetition of values.
double DistanceToClosestElement(const double value, double &closestValue)
Computes distance from 'value' to closest element in fValues.
unsigned int GetGoodness(const double value)
Get goodness for a given time, using adjustments.
unsigned int fGoodnessThreshold
Goodness threshold at a certain false positive rate.
void SetAdjustments(const std::vector< double > &adjustments)
Set adjustments.
void AddValue(const double value)
Add a time value to the list of values.
double fTolerance
Size of window in which to look for event.
QTimingAnalyzer()
Constructor.
void SetTolerance(const double tolerance)
Set size of window in which to look for event.
unsigned int GetGoodnessThreshold() const
Get goodness threshold at given false positive rate.
unsigned int GetBestGoodness()
Get best goodness parameter for the values in fValues.
void ComputeGoodnessThreshold(const double falseRate)
Compute goodness threshold at given false positive rate.
unsigned int GetTotalGoodness()
Get total goodness for the values in fValues.
virtual ~QTimingAnalyzer()
Destructor.
double GetPeriod() const
Get period.
void FindPeriod(const double uncertainty, const double stepSize=0.008)
Find period by searching within 'uncertainty' of fPeriod.
bool fNeedsSort
Whether or not vector could be out of order.
std::vector< double > fAdjustments
Adjustments.
unsigned int GetGoodnessParameter(const double value)
Get goodness for a given time value, no adjustments.