CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
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 $
3
#include "
CLHEP/GenericFunctions/PeriodicRectangular.hh
"
4
#include "
CLHEP/GenericFunctions/FixedConstant.hh
"
5
#include <assert.h>
6
#include <cmath>
// for floor()
7
8
namespace
Genfun {
9
FUNCTION_OBJECT_IMP
(PeriodicRectangular)
10
11
PeriodicRectangular
::
PeriodicRectangular
():
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
17
PeriodicRectangular::PeriodicRectangular
(
const
PeriodicRectangular
& right):
18
_a(right._a),
19
_b(right._b),
20
_height(right._height)
21
{
22
}
23
24
PeriodicRectangular::~PeriodicRectangular
() {
25
}
26
27
double
PeriodicRectangular::operator()
(
double
x)
const
{
28
double
xx = x/(_a.
getValue
()+_b.
getValue
());
29
xx = xx - floor(xx);
30
if
(xx < _a.
getValue
()/(_a.
getValue
()+_b.
getValue
())) {
31
return
0;
32
}
33
else
{
34
return
_height.
getValue
();
35
}
36
}
37
38
Parameter
&
PeriodicRectangular::a
() {
39
return
_a;
40
}
41
42
Parameter
&
PeriodicRectangular::b
() {
43
return
_b;
44
}
45
46
47
Parameter
&
PeriodicRectangular::height
() {
48
return
_height;
49
}
50
51
52
53
Derivative
PeriodicRectangular::partial
(
unsigned
int
index)
const
{
54
assert(index==0);
55
const
AbsFunction
& fPrime =
FixedConstant
(0);
56
return
Derivative
(&fPrime);
57
}
58
59
}
// namespace Genfun
Generated on Sun Jun 17 2012 08:08:27 for CLHEP by
1.8.1.1