00001 #ifndef _Q_WP_ANALYZER_HH_ 00002 #define _Q_WP_ANALYZER_HH_ 00003 00004 #include "QCuore.hh" 00005 #include "QError.hh" 00006 #include "QWPCommon.hh" 00007 #include <list> 00008 00016 class QLCSlowConfig; 00017 namespace Cuore {class QEvent; class QVector;} 00018 00019 class QWPAnalyzer { 00020 00021 public: 00022 class Measurement { 00023 public: 00024 double fBias; 00025 bool fBiasPolarity; 00026 double fGain; 00027 double fRL; 00028 int fNumberOfPulses; 00029 double fBaseline; 00030 double fBaselineRMS; 00031 double fSlope; 00032 double fTimeSec; 00033 }; 00034 00035 00036 QWPAnalyzer(unsigned short lg); 00037 00038 QWPAnalyzer(const QWPAnalyzer& other); 00039 00040 void SetMaxEventsPerConfig(const int nmax) { fMaxMeasNumber = nmax; } 00041 ~QWPAnalyzer(); 00042 00043 bool DoneConfig() const {return fDoneConfig;} 00044 00045 bool DoneConfig(const QWPCommon::Step step) const; 00046 00047 bool AllDone() const {return fDone;} 00048 00049 QError AddMeasurement(const Measurement& meas, const QWPCommon::Step step); 00050 00051 QError Analyze(Cuore::QVector& result); 00052 00053 std::string GetHeader() const { return fHeader;} 00054 00055 00056 private: 00057 const QWPAnalyzer& operator=(const QWPAnalyzer& other) { return *this;} 00058 00059 class StepResult { 00060 public: 00061 double fRealBias; 00062 double fRealGain; 00063 double fRealRL; 00064 double fBaseline; 00065 double fBaselineErr; 00066 double fSlope; 00067 double fSlopeErr; 00068 double fTimeSec; 00069 }; 00070 00071 const std::list<Measurement>* GetList(const QWPCommon::Step step) const; 00072 std::list<Measurement>* GetList(const QWPCommon::Step step) ; 00073 bool CheckMeasurementCompatibility(const QWPAnalyzer::Measurement& meas, const QWPCommon::Step step); 00074 StepResult AnalyzeStep(const std::list<Measurement>* stepList) const; 00075 std::list<Measurement> fBaseline1; 00076 std::list<Measurement> fVMinus; 00077 std::list<Measurement> fVPlus; 00078 std::list<Measurement> fBaseline2; 00079 00080 unsigned short fLg; 00081 bool fDoneConfig; 00082 bool fDone; 00083 int fMaxMeasNumber; 00084 std::string fHeader; 00085 00086 }; 00087 00088 #endif