VavilovAccuratePdf.cxx

Go to the documentation of this file.
00001 // @(#)root/mathmore:$Id: VavilovAccuratePdf.cxx 34195 2010-06-30 04:33:36Z brun $
00002 // Authors: B. List 29.4.2010
00003  
00004 
00005  /**********************************************************************
00006   *                                                                    *
00007   * Copyright (c) 2004 ROOT Foundation,  CERN/PH-SFT                   *
00008   *                                                                    *
00009   * This library is free software; you can redistribute it and/or      *
00010   * modify it under the terms of the GNU General Public License        *
00011   * as published by the Free Software Foundation; either version 2     *
00012   * of the License, or (at your option) any later version.             *
00013   *                                                                    *
00014   * This library is distributed in the hope that it will be useful,    *
00015   * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
00016   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00017   * General Public License for more details.                           *
00018   *                                                                    *
00019   * You should have received a copy of the GNU General Public License  *
00020   * along with this library (see file COPYING); if not, write          *
00021   * to the Free Software Foundation, Inc., 59 Temple Place, Suite      *
00022   * 330, Boston, MA 02111-1307 USA, or contact the author.             *
00023   *                                                                    *
00024   **********************************************************************/
00025 
00026 // Implementation file for class VavilovAccuratePdf
00027 // 
00028 // Created by: blist  at Thu Apr 29 11:19:00 2010
00029 // 
00030 // Last update: Thu Apr 29 11:19:00 2010
00031 // 
00032 
00033 #include "Math/VavilovAccuratePdf.h"
00034 #include "Math/VavilovAccurate.h"
00035 
00036 namespace ROOT {
00037 namespace Math {
00038 
00039 
00040 VavilovAccuratePdf::VavilovAccuratePdf() {
00041    fP[0] = 1;
00042    fP[1] = 0;
00043    fP[2] = 1;
00044    fP[3] = 1;
00045    fP[4] = 1;
00046 }
00047 
00048 VavilovAccuratePdf::VavilovAccuratePdf(const double *p) {
00049    if (p)
00050       for (int i = 0; i < 5; ++i) 
00051          fP[i] = p[i];
00052    else {
00053       fP[0] = 1;
00054       fP[1] = 0;
00055       fP[2] = 1;
00056       fP[3] = 1;
00057       fP[4] = 1;
00058    }  
00059 }
00060 
00061 VavilovAccuratePdf::~VavilovAccuratePdf ()
00062 {} 
00063  
00064 const double * VavilovAccuratePdf::Parameters() const {
00065    return fP;
00066 }
00067 
00068 void VavilovAccuratePdf::SetParameters(const double * p ) {
00069    if (p)
00070       for (int i = 0; i < 5; ++i) 
00071          fP[i] = p[i];
00072 }
00073  
00074 unsigned int VavilovAccuratePdf::NPar() const {
00075   return 5;
00076 }
00077 
00078 std::string VavilovAccuratePdf::ParameterName(unsigned int i) const { 
00079    switch (i) {
00080       case 0: return "Norm"; break;
00081       case 1: return "x0"; break;
00082       case 2: return "xi"; break;
00083       case 3: return "kappa"; break;
00084       case 4: return "beta2"; break;
00085    }
00086    return "???";
00087 }
00088       
00089 double VavilovAccuratePdf::DoEval(double x) const {
00090    VavilovAccurate v(fP[3], fP[4]);
00091    return fP[0]/fP[2]*v.Pdf ((x-fP[1])/fP[2]);
00092 }
00093 
00094 double VavilovAccuratePdf::DoEvalPar(double x, const double * p) const {
00095    if (!p) return 0;
00096    // p[0]: norm, p[1]: x0, p[2]: width, p[3]: kappa, p[4]: beta2
00097    VavilovAccurate v(p[3], p[4]);
00098    return p[0]/p[2]*v.Pdf ((x-p[1])/p[2]);
00099 }
00100 
00101 IBaseFunctionOneDim  * VavilovAccuratePdf::Clone() const {
00102    return new VavilovAccuratePdf (*this);
00103 }
00104 
00105 
00106 } // namespace Math
00107 } // namespace ROOT

Generated on Tue Jul 5 14:34:57 2011 for ROOT_528-00b_version by  doxygen 1.5.1