AnalysisPlugins 2.0(r200)
For the analysis of event energy and time

PacWaveformDICF.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Matthias Nagl   *
00003  *   mnagl@uni-goettingen.de   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef PACWAVEFORMDICF_H
00021 #define PACWAVEFORMDICF_H
00022 
00023 #include "../PacWaveformBase.h"
00024 #include <QPointer>
00025 #include <QHBoxLayout>
00026 #include <QLabel>
00027 #include <QLineEdit>
00028 
00029 class PacWaveformDataDICF;
00030 class QwtPlotCurve;
00031 
00036 class PacWaveformDICF : public PacWaveformBase
00037 {
00038   public:
00039     enum InterpolationMethod {
00040       LinearInterpolation          = 0,
00041       CubicPolynomialInterpolation = 1
00042     };
00043     PacWaveformDICF(QObject *parent = 0);
00044     virtual ~PacWaveformDICF();
00045 
00046     virtual QObject * emptyClone();
00047     virtual void setParentBranch(PropertyBranchInterface *p = 0);
00048 //    virtual void attachToPlot(QwtPlot *plot);
00049     virtual void setWaveformData(WaveformDataInterface *data);
00050     virtual WaveformDataInterface ** createWaveformDataObjects(quint32 num) const;
00053     virtual void readUpdatedParameters();
00054     virtual QWidget * getWidget();
00055 //    virtual void deleteControlWidget();
00056     friend class PacWaveformDataDICF;
00057 
00058   private:
00059     void setBasicCorrectionLabel(const QString &text);
00060     void setLinearCorrectionLabel(const QString &text);
00061     void setCubicCorrectionLabel(const QString &text);
00062     QPointer<QHBoxLayout> controlLayout;
00063     QPointer<QLabel> basiccorr, lincorr, cubcorr;
00064     QwtPlotMarker *cflevel, *cftime;
00065     PropertyBranch b_bgcorrection;
00066     TransmittableProperty p_bgcorrection, p_bgestimationsamples, p_divisor, p_searchbeforetrigger, p_searchaftertrigger, p_interpolationmethod;
00067     bool bgcorrection;
00068     qint32 bgestimationsamples;
00069     qreal divisor;
00070     qint32 searchbeforetrigger, searchaftertrigger;
00071     InterpolationMethod interpolationmethod;
00072     QVector<qreal> interpolationxvector, interpolationvoltvector;
00073     QwtPlotCurve *risingedgeinterpolation;
00074 };
00075 
00080 class PacWaveformDataDICF : public PacWaveformDataBase
00081 {
00082   public:
00083     PacWaveformDataDICF(const PacWaveformDICF *creator = 0);
00084     PacWaveformDataDICF(const PacWaveformDICF *creator, const QByteArray &serialized);
00085     virtual void clone(const WaveformDataInterface *original);
00086     virtual ~PacWaveformDataDICF();
00087 
00088     virtual void setData(
00089       quint32 numsamples,
00090       const qint8 * dataArray,
00091       qulonglong triggertimestamp,
00092       qreal hpos,
00093       qint32 samplesbeforetrigger,
00094       qreal sampleinterval,
00095       qreal vgain,
00096       qreal voffset,
00097       qint8 polarity,
00098       qreal triggerlevel
00099     );
00100 
00101     virtual QByteArray serialize(const QByteArray &childrensdata = QByteArray()) const;
00102     virtual QByteArray deserialize(const QByteArray &serialized);
00103     friend void PacWaveformDICF::setWaveformData(WaveformDataInterface *data);
00104 
00105   private:
00106     struct cubic_poly_params {
00107       cubic_poly_params() : a(0.0), b(0.0), c(0.0), d(0.0) {};
00108       double a, b, c, d;
00109     };
00110     static double cubic_poly(double x, void * params);
00111     static double dcubic_poly(double x, void * params);
00112     static void combined_cubic_poly(double x, void * params, double * f, double * df);
00113     void analyze() const;
00114     const PacWaveformDICF *creator;
00115     mutable qreal cflevel;
00116     mutable cubic_poly_params polyparams;
00117     mutable qreal lincorrection, cubcorrection; 
00118     mutable PacWaveformDICF::InterpolationMethod interpolationmethod; 
00119 };
00120 
00121 #endif
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends