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

Erf.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: Erf.cc,v 1.6 2010/06/16 18:22:01 garren Exp $
3 
4 #include <cmath>
5 
8 #include <assert.h>
9 namespace Genfun {
11 
12 Erf::Erf()
13 {
14  _incompleteGamma.a().setValue(0.5);
15 }
16 
17 Erf::Erf(const Erf & right):
18  AbsFunction(right), _incompleteGamma(right._incompleteGamma)
19 {
20 }
21 
23 }
24 
25 double Erf::operator() (double x) const {
26  return x<0 ? -_incompleteGamma(x*x): _incompleteGamma(x*x);
27 }
28 
29 
30 
31 Derivative Erf::partial(unsigned int index) const {
32  assert(index==0);
33  Gaussian gauss = Gaussian();
34  gauss.sigma().setValue(sqrt(2.0));
35  const AbsFunction & fPrime = 2.0*gauss;
36  return Derivative(& fPrime);
37 }
38 
39 } // namespace Genfun