00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ATLFAST_SIMPLETESTSTATISTICABSDIFF_H
00017 #define ATLFAST_SIMPLETESTSTATISTICABSDIFF_H
00018 #include <string>
00019 #include <cmath>
00020 #include "AtlfastEvent/SimpleTestStatistic.h"
00021 namespace Atlfast {
00022 using std::string;
00023 using std::abs;
00027 class SimpleTestStatisticAbsDiff{
00028 public:
00029
00030 SimpleTestStatisticAbsDiff(const SimpleTestStatistic* s):
00031 m_val( s->val()){}
00032
00033 SimpleTestStatisticAbsDiff(const SimpleTestStatistic* const * const s):
00034 m_val( (*s)->val()){}
00035
00036 bool operator()(const SimpleTestStatistic s, const SimpleTestStatistic t)
00037 {
00038 return ( abs(s.val()-m_val) < abs(t.val()-m_val) );
00039 }
00040
00041 bool operator()(const SimpleTestStatistic* const s,
00042 const SimpleTestStatistic* const t) {
00043 return ( abs(s->val()-m_val) < abs(t->val()-m_val) );
00044 }
00045
00046 bool operator()(const SimpleTestStatistic** const s,
00047 const SimpleTestStatistic** const t) {
00048 return ( abs( (*s)->val()-m_val) < abs((*t)->val()-m_val) );
00049 }
00050 private:
00051 const double m_val;
00052 };
00053 }
00054 #endif
00055
00056