00001 00009 #ifndef _Q_OFFSET_HH_ 00010 #define _Q_OFFSET_HH_ 00011 00012 #include "QCuore.hh" 00013 #include "QVector.hh" 00014 00015 namespace Cuore {class QEvent;} 00016 class TGraph; 00017 class TSpline3; 00018 00019 Q_BEGIN_NAMESPACE 00020 00021 class QOffset { 00022 public: 00023 00025 QOffset(); 00026 00028 virtual ~QOffset(); 00029 00032 double GetChiSquared() {return fChiSquared;} 00033 00035 double GetOffset() {return fOffset;} 00036 00038 int GetLowerLimit() {return fLowerLimit;} 00039 00041 int GetUpperLimit() {return fUpperLimit;} 00042 00044 void Resample(QEvent*, QVector&); 00045 00047 void ResampleIdealPulse(QVector&, bool useResidualOffset = true); 00048 00050 void SetIdealPulse(const QVector& idealPulse); 00051 00056 void SetLimits(int lower, int upper) 00057 {fLowerLimit = lower; fUpperLimit = upper;} 00058 00060 void SetOffset(QEvent*); 00061 00063 void SetOffset(double offset); 00064 00065 private: 00066 00068 void Derivative(const QVector&, QVector&); 00069 00071 TSpline3* MakeSpline(const QVector&); 00072 00074 TGraph* MakeTGraph(const QVector&); 00075 00077 inline int Round(double x) {return int(x > 0.0 ? x + 0.5 : x - 0.5);} 00078 00080 double fChiSquared; 00081 00083 TSpline3 *fIdealDerivativeSpline; 00084 00086 bool fIdealPulseIsOk; 00087 00089 QVector fIdealPulseQVector; 00090 00092 TSpline3 *fIdealPulseSpline; 00093 00095 int fLowerLimit; 00096 00098 double fOffset; 00099 00101 int fRoundedOffset; 00102 00104 int fUpperLimit; 00105 00106 }; 00107 00108 Q_END_NAMESPACE 00109 00110 #endif