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 PACCONVOLVEDEXPONENTIAL_H 00022 #define PACCONVOLVEDEXPONENTIAL_H 00023 00024 #include <vector> 00025 #include <math.h> 00026 #ifndef M_LN2l 00027 #define M_LN2l 0.6931471805599453094172321214581766L /* log_e 2 */ 00028 #endif 00029 #ifndef M_SQRT1_2l 00030 #define M_SQRT1_2l 0.7071067811865475244008443621048490L /* 1/sqrt(2) */ 00031 #endif 00032 #include "PacAbstractFitFunction.h" 00033 #include <QtDebug> 00034 00042 class PacConvolvedExponential : public PacAbstractFitFunction 00043 { 00044 public: 00045 PacConvolvedExponential(const std::vector<double> ¶ms); 00046 PacConvolvedExponential(); 00047 ~PacConvolvedExponential(); 00048 00049 QList<Pac::FitParameterProperties> parameterProperties() const; 00050 PacParameterState initialParameterSet() const; 00051 QPixmap formulaAsPixmap() const; 00052 QString formulaExplanation() const; 00053 00057 QVector<double> fitResultCurve(const QVector<double> &xvals, const ROOT::Minuit2::MnUserParameterState ¶ms) const; 00058 double operator()(const std::vector<double> &x) const; 00059 00060 private: 00061 inline double myexp(double x, double a, double b, double c, double t, double t0, double s) const { 00062 const long double s_t = s / t; 00063 const long double dt = x - t0; 00064 double result = a * 0.5L * powl( 2.0L, 0.5L*s_t*s_t*M_LN2l - dt/t ) * erfcl( s_t*M_LN2l*M_SQRT1_2l - dt/s*M_SQRT1_2l) + b * expl(-0.5L*dt*dt/s/s) + c; 00065 return isnan(result) ? std::numeric_limits<double>::max() : result; 00066 }; 00067 }; 00068 00069 #endif