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

PeriodicRectangular.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: PeriodicRectangular.cc,v 1.4 2003/10/10 17:40:39 garren Exp $
5 #include <assert.h>
6 #include <cmath> // for floor()
7 
8 namespace Genfun {
9 FUNCTION_OBJECT_IMP(PeriodicRectangular)
10 
12  _a("Size-of-valley (a)", 1.0, 1.0, 10),
13  _b("Size-of-plateau (b)", 1.0, 1.0, 10),
14  _height("height",1, 0,10)
15 {}
16 
18 AbsFunction(right),
19 _a(right._a),
20 _b(right._b),
21 _height(right._height)
22 {
23 }
24 
26 }
27 
28 double PeriodicRectangular::operator() (double x) const {
29  double xx = x/(_a.getValue()+_b.getValue());
30  xx = xx - floor(xx);
31  if (xx < _a.getValue()/(_a.getValue()+_b.getValue())) {
32  return 0;
33  }
34  else {
35  return _height.getValue();
36  }
37 }
38 
40  return _a;
41 }
42 
44  return _b;
45 }
46 
47 
49  return _height;
50 }
51 
52 
53 
54 Derivative PeriodicRectangular::partial(unsigned int index) const {
55  assert(index==0);
56  const AbsFunction & fPrime = FixedConstant(0);
57  return Derivative(&fPrime);
58 }
59 
60 } // namespace Genfun
#define FUNCTION_OBJECT_IMP(classname)
virtual double getValue() const
Definition: Parameter.cc:27
Derivative partial(unsigned int) const
virtual double operator()(double argument) const
@ b
@ a