00001 00009 #ifndef _Q_OFFSET_HH_ 00010 #define _Q_OFFSET_HH_ 00011 00012 #include "QVector.hh" 00013 00014 namespace Cuore{class QEvent;} 00015 using namespace Cuore; 00016 class TGraph; 00017 class TSpline3; 00018 00019 class QOffset { 00020 public: 00021 00023 QOffset(); 00024 00026 virtual ~QOffset(); 00027 00030 double GetChiSquared() {return fChiSquared;} 00031 00033 double GetOffset() {return fOffset;} 00034 00036 int GetLowerLimit() {return fLowerLimit;} 00037 00039 int GetUpperLimit() {return fUpperLimit;} 00040 00042 void Resample(QEvent*, QVector&); 00043 00045 void ResampleIdealPulse(QVector&, bool useResidualOffset = true); 00046 00048 void SetIdealPulse(const QVector& idealPulse); 00049 00054 void SetLimits(int lower, int upper) 00055 {fLowerLimit = lower; fUpperLimit = upper;} 00056 00058 void SetOffset(QEvent*); 00059 00061 void SetOffset(double offset); 00062 00063 private: 00064 00066 void Derivative(const QVector&, QVector&); 00067 00069 TSpline3* MakeSpline(const QVector&); 00070 00072 TGraph* MakeTGraph(const QVector&); 00073 00075 inline int Round(double x) {return int(x > 0.0 ? x + 0.5 : x - 0.5);} 00076 00078 double fChiSquared; 00079 00081 TSpline3 *fIdealDerivativeSpline; 00082 00084 bool fIdealPulseIsOk; 00085 00087 QVector fIdealPulseQVector; 00088 00090 TSpline3 *fIdealPulseSpline; 00091 00093 int fLowerLimit; 00094 00096 double fOffset; 00097 00099 int fRoundedOffset; 00100 00102 int fUpperLimit; 00103 00104 }; 00105 00106 #endif