SpectraPac 2.0(r200)
Evaluates PAC Measurements

PacCoincidenceParameterDialog.h

Go to the documentation of this file.
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 PACCOINCIDENCEPARAMETERDIALOG_H
00022 #define PACCOINCIDENCEPARAMETERDIALOG_H
00023 
00024 #include <QWidget>
00025 #include <QPointer>
00026 #include <limits>
00027 #include "ui_PacCoincidenceParameterDialog.h"
00028 #include "PacCoincidenceFormulaDialog.h"
00029 #include "pacCoincidenceDefinitions.h"
00030 
00031 class QScienceSpinBox;
00032 class QSignalMapper;
00033 class QCheckBox;
00034 class PacAbstractFitFunction;
00035 namespace ROOT {
00036   namespace Minuit2 {
00037     class MnUserParameterState;
00038   }
00039 }
00040 
00046 class PacCoincidenceParameterDialog : public QWidget, private Ui::PacCoincidenceParameterDialog {
00047     Q_OBJECT
00048 public:
00049     PacCoincidenceParameterDialog(const PacAbstractFitFunction *t0fitfunction, const PacAbstractFitFunction *bgfitfunction, ROOT::Minuit2::MnUserParameterState *t0params, ROOT::Minuit2::MnUserParameterState *bgparams, QWidget *parent = 0);
00050     ~PacCoincidenceParameterDialog();
00051 
00052     bool automaticFittingEnabled() const;
00053     void setAutomaticFittingEnabled(bool enabled);
00054 
00055 signals:
00056     void updateT0FitRequested(bool force);
00057     void updateBackgroundFitRequested(bool force);
00058     void t0ParametersUpdated();
00059     void backgroundParametersUpdated();
00060     void reestimateT0Parameters();
00061     void reestimateBackgroundParameters();
00062 
00063 public slots:
00064     void updateT0ParameterDisplay(ROOT::Minuit2::MnUserParameterState *t0params, bool updatefit = false);
00065     void updateBackgroundParameterDisplay(ROOT::Minuit2::MnUserParameterState *bgparams, bool updatefit = false);
00066     void lockT0Widgets(bool lock);
00067     void lockBackgroundWidgets(bool lock);
00068 
00069 private slots:
00070     void t0ParameterFixationUpdated(const QString &name);
00071     void t0ParameterValueUpdated(const QString &name);
00072     void t0ParameterTmpValueUpdated(const QString &name);
00073     void t0ParameterErrorUpdated(const QString &name);
00074     void t0ParameterLimitUpdated(const QString &name);
00075     void bgParameterFixationUpdated(const QString &name);
00076     void bgParameterValueUpdated(const QString &name);
00077     void bgParameterTmpValueUpdated(const QString &name);
00078     void bgParameterErrorUpdated(const QString &name);
00079     void bgParameterLimitUpdated(const QString &name);
00080 
00081     void showT0Formula();
00082     void showBackgroundFormula();
00083 
00084     void forceUpdateT0Fit();
00085     void forceUpdateBackgroundFit();
00086 
00087 private:
00088     struct ParameterWidgetSet {
00089       QCheckBox *fix;
00090       QScienceSpinBox *value;
00091       QScienceSpinBox *error;
00092       QCheckBox *lowerenable;
00093       QScienceSpinBox *lowerlimit;
00094       QCheckBox *upperenable;
00095       QScienceSpinBox *upperlimit;
00096       double absolutelowerlimit;
00097       double absoluteupperlimit;
00098     };
00099     QMap< std::string, ParameterWidgetSet > t0widgets, bgwidgets;
00100 
00101     void initializeParameterWidgetSet(
00102         QGridLayout *targetlayout,
00103         const ROOT::Minuit2::MnUserParameterState *paramset,
00104         Pac::FitParameterProperties paramprops,
00105         QMap< std::string, ParameterWidgetSet > &widgetset,
00106         QSignalMapper *fixmapper,
00107         QSignalMapper *valmapper,
00108         QSignalMapper *tmpvalmapper,
00109         QSignalMapper *errmapper,
00110         QSignalMapper *limitmapper
00111                                     );
00112     void updateParameterWidgets(
00113         QMap< std::string, ParameterWidgetSet > &widgetset,
00114         const ROOT::Minuit2::MnUserParameterState *paramset
00115                                );
00116     void parameterLimitUpdated(
00117         const std::string &paramname,
00118         QMap< std::string, ParameterWidgetSet > &widgetset,
00119         ROOT::Minuit2::MnUserParameterState *paramset
00120                               );
00121     void parameterFixationUpdated(
00122         const std::string &paramname,
00123         QMap< std::string, ParameterWidgetSet > &widgetset,
00124         ROOT::Minuit2::MnUserParameterState *paramset
00125                                  );
00126 
00127     const PacAbstractFitFunction *t0fitfunction, *bgfitfunction;
00128     ROOT::Minuit2::MnUserParameterState *t0params;
00129     ROOT::Minuit2::MnUserParameterState *bgparams;
00130 
00131     QSignalMapper *t0fixmapper, *t0valmapper, *t0tmpvalmapper, *t0errmapper, *t0limitmapper;
00132     QSignalMapper *bgfixmapper, *bgvalmapper, *bgtmpvalmapper, *bgerrmapper, *bglimitmapper;
00133 
00134     QPointer<PacCoincidenceFormulaDialog> t0formula, bgformula;
00135     bool dontupdate, t0dirty, bgdirty;
00136 };
00137 
00138 #endif // PACCOINCIDENCEPARAMETERDIALOG_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines