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

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 $
5#include <assert.h>
6
7namespace Genfun {
8FUNCTION_OBJECT_IMP(Rectangular)
9
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
18AbsFunction(right),
19_x0(right._x0),
20_x1(right._x1),
21_baseline(right._baseline),
22_height(right._height)
23{
24}
25
27}
28
29double 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
42 return _x0;
43}
44
46 return _x1;
47}
48
50 return _baseline;
51}
52
54 return _height;
55}
56
57const Parameter & Rectangular::x0() const {
58 return _x0;
59}
60
61const Parameter & Rectangular::x1() const {
62 return _x1;
63}
64
66 return _baseline;
67}
68
70 return _height;
71}
72
73
74Derivative 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
#define FUNCTION_OBJECT_IMP(classname)
virtual double getValue() const
Definition: Parameter.cc:27
Derivative partial(unsigned int) const
Definition: Rectangular.cc:74
const Parameter & height() const
Definition: Rectangular.cc:69
const Parameter & x1() const
Definition: Rectangular.cc:61
const Parameter & baseline() const
Definition: Rectangular.cc:65
virtual ~Rectangular()
Definition: Rectangular.cc:26
virtual double operator()(double argument) const
Definition: Rectangular.cc:29
const Parameter & x0() const
Definition: Rectangular.cc:57