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 
7 namespace Genfun {
8 FUNCTION_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 
18 AbsFunction(right),
19 _x0(right._x0),
20 _x1(right._x1),
21 _baseline(right._baseline),
22 _height(right._height)
23 {
24 }
25 
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 
42  return _x0;
43 }
44 
46  return _x1;
47 }
48 
50  return _baseline;
51 }
52 
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 
66  return _baseline;
67 }
68 
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
const Parameter & x0() const
Definition: Rectangular.cc:57
virtual double operator()(double argument) const
Definition: Rectangular.cc:29
virtual ~Rectangular()
Definition: Rectangular.cc:26
const Parameter & height() const
Definition: Rectangular.cc:69
const Parameter & baseline() const
Definition: Rectangular.cc:65
#define FUNCTION_OBJECT_IMP(classname)
Derivative partial(unsigned int) const
Definition: Rectangular.cc:74
const Parameter & x1() const
Definition: Rectangular.cc:61
virtual double getValue() const
Definition: Parameter.cc:27