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 _x0(right._x0),
19 _x1(right._x1),
20 _baseline(right._baseline),
21 _height(right._height)
22 {
23 }
24 
26 }
27 
28 double Rectangular::operator() (double x) const {
29  if (x<_x0.getValue()) {
30  return _baseline.getValue();
31  }
32  else if (x<_x1.getValue()) {
33  return _height.getValue();
34  }
35  else {
36  return _baseline.getValue();
37  }
38 }
39 
41  return _x0;
42 }
43 
45  return _x1;
46 }
47 
49  return _baseline;
50 }
51 
53  return _height;
54 }
55 
56 const Parameter & Rectangular::x0() const {
57  return _x0;
58 }
59 
60 const Parameter & Rectangular::x1() const {
61  return _x1;
62 }
63 
65  return _baseline;
66 }
67 
69  return _height;
70 }
71 
72 
73 Derivative Rectangular::partial(unsigned int index) const {
74  assert(index==0);
75  const AbsFunction & fPrime = FixedConstant(0);;
76  return Derivative(&fPrime);
77 }
78 
79 } // namespace Genfun