SpectraPac 2.0(r200)
Evaluates PAC Measurements
|
00001 /***+************************************************************************ 00002 * Copyright (C) 2008-2010 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 00021 #ifndef PACENERGYSPECTRUM_H 00022 #define PACENERGYSPECTRUM_H 00023 00024 #include <QObject> 00025 #include <QPointer> 00026 #include <QWidget> 00027 #include <qwt_double_rect.h> 00028 #include "pacDefinitions.h" 00029 00030 class QLabel; 00031 class QDomElement; 00032 class PacEnergyContainer; 00033 class PacCommonEnergyResult; 00034 class PacPlot; 00035 class QwtPlotCurve; 00036 class QwtPlotMarker; 00037 00043 class PacEnergySpectrum : public QObject 00044 { 00045 Q_OBJECT 00046 public: 00047 PacEnergySpectrum(PacEnergyContainer *container, quint8 detectorid, float phi, float theta); 00048 PacEnergySpectrum(PacEnergyContainer *container, const QDomElement &root); 00049 ~PacEnergySpectrum(); 00050 00051 void setSpectrum( 00052 const PacCommonEnergyResult* beginning, 00053 const PacCommonEnergyResult* end 00054 ); 00055 00056 QWidget * plotWidget(); 00057 00058 quint8 detectorId() const; 00059 float phi() const; 00060 float theta() const; 00061 00063 00064 QVector<double> spectrumX() const; 00065 QVector<quint64> spectrumComplete() const; 00066 QVector<quint64> spectrumBeginning() const; 00067 QVector<quint64> spectrumEnd() const; 00069 00070 qreal redEnergy() const; 00071 qreal blueEnergy() const; 00072 qreal redPosition() const; 00073 qreal bluePosition() const; 00074 00080 void appendToDomNode(QDomElement &node) const; 00086 void initializeFromDomNode(const QDomElement &node); 00087 00088 public slots: 00089 void setRedEnergy(double e); 00090 void setBlueEnergy(double e); 00091 void setDisplayRange(Pac::ReadoutRange); 00092 00093 private slots: 00094 void selectMarker(QwtDoublePoint p); 00095 void applyNewMarkerPosition(QwtDoublePoint p); 00096 void setRedPosition(double pos); 00097 void setBluePosition(double pos); 00098 00099 private: 00100 QVector<qreal> spectrumCompleteAsDouble() const; 00101 void updateSpectrumPlot(); 00102 00103 // pointers to shared objects (not exported to XML) 00104 PacEnergyContainer *container; 00105 00106 // spectrum info 00107 quint8 detectorid; 00108 float angle_phi; 00109 float angle_theta; 00110 00111 // results 00112 const PacCommonEnergyResult* beginning; 00113 const PacCommonEnergyResult* end; 00114 00115 // gui states 00116 qreal redposition; 00117 qreal blueposition; 00118 qreal redenergy; 00119 qreal blueenergy; 00120 00121 // widgets 00122 QPointer<QWidget> plotwidget; 00123 PacPlot * plot; 00124 QwtPlotCurve *curve; 00125 QwtPlotMarker *redmarker, *bluemarker; 00126 bool selectedredmarker; 00127 QLabel *infolabel; 00128 00129 // tmp variables (not exported to XML) 00130 mutable QVector<qreal> spectrumcomplete; 00131 }; 00132 00133 #endif // PACENERGYSPECTRUM_H