CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
Rectangular.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id: Rectangular.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
3
#include "
CLHEP/GenericFunctions/Rectangular.hh
"
4
#include "
CLHEP/GenericFunctions/FixedConstant.hh
"
5
#include <assert.h>
6
7
namespace
Genfun {
8
FUNCTION_OBJECT_IMP
(Rectangular)
9
10
Rectangular
::
Rectangular
():
11
_x0("x0", -1.0, -10, 0),
12
_x1("x1", 1.0, 0, 10),
13
_baseline("baseline", 0,-10, 10),
14
_height("height",1, -10, 10)
15
{}
16
17
Rectangular::Rectangular
(
const
Rectangular
& right) :
18
AbsFunction
(right),
19
_x0(right._x0),
20
_x1(right._x1),
21
_baseline(right._baseline),
22
_height(right._height)
23
{
24
}
25
26
Rectangular::~Rectangular
() {
27
}
28
29
double
Rectangular::operator()
(
double
x)
const
{
30
if
(x<_x0.
getValue
()) {
31
return
_baseline.
getValue
();
32
}
33
else
if
(x<_x1.
getValue
()) {
34
return
_height.
getValue
();
35
}
36
else
{
37
return
_baseline.
getValue
();
38
}
39
}
40
41
Parameter
&
Rectangular::x0
() {
42
return
_x0;
43
}
44
45
Parameter
&
Rectangular::x1
() {
46
return
_x1;
47
}
48
49
Parameter
&
Rectangular::baseline
() {
50
return
_baseline;
51
}
52
53
Parameter
&
Rectangular::height
() {
54
return
_height;
55
}
56
57
const
Parameter
&
Rectangular::x0
()
const
{
58
return
_x0;
59
}
60
61
const
Parameter
&
Rectangular::x1
()
const
{
62
return
_x1;
63
}
64
65
const
Parameter
&
Rectangular::baseline
()
const
{
66
return
_baseline;
67
}
68
69
const
Parameter
&
Rectangular::height
()
const
{
70
return
_height;
71
}
72
73
74
Derivative
Rectangular::partial
(
unsigned
int
index)
const
{
75
assert(index==0);
76
const
AbsFunction
& fPrime =
FixedConstant
(0);;
77
return
Derivative
(&fPrime);
78
}
79
80
}
// namespace Genfun
Generated on Mon May 6 2013 04:04:11 for CLHEP by
1.8.1.2