CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Erf.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: Erf.cc,v 1.6 2010/06/16 18:22:01 garren Exp $
00003 
00004 #include <cmath>
00005 
00006 #include "CLHEP/GenericFunctions/Erf.hh"
00007 #include "CLHEP/GenericFunctions/Gaussian.hh"
00008 #include <assert.h>
00009 namespace Genfun {
00010 FUNCTION_OBJECT_IMP(Erf)
00011 
00012 Erf::Erf()
00013 {
00014   _incompleteGamma.a().setValue(0.5);
00015 }
00016 
00017 Erf::Erf(const Erf & right):
00018   AbsFunction(right), _incompleteGamma(right._incompleteGamma)
00019 {
00020 }
00021 
00022 Erf::~Erf() {
00023 }
00024 
00025 double Erf::operator() (double x) const {
00026   return x<0 ? -_incompleteGamma(x*x): _incompleteGamma(x*x);
00027 }
00028 
00029 
00030 
00031 Derivative Erf::partial(unsigned int index) const {
00032   assert(index==0);
00033   Gaussian gauss = Gaussian();
00034   gauss.sigma().setValue(sqrt(2.0));
00035   const AbsFunction & fPrime = 2.0*gauss;
00036   return Derivative(& fPrime);
00037 }
00038 
00039 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7