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 
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
Genfun::Parameter::getValue
virtual double getValue() const
Definition: Parameter.cc:27
Genfun::Rectangular::operator()
virtual double operator()(double argument) const
Definition: Rectangular.cc:29
Genfun::Derivative
FunctionNoop Derivative
Definition: CLHEP/GenericFunctions/AbsFunction.hh:40
Genfun::AbsFunction
Definition: CLHEP/GenericFunctions/AbsFunction.hh:48
Genfun::Rectangular::x0
const Parameter & x0() const
Definition: Rectangular.cc:41
Genfun::Rectangular::Rectangular
Rectangular()
Definition: Rectangular.cc:10
Genfun::Rectangular::baseline
const Parameter & baseline() const
Definition: Rectangular.cc:49
Rectangular.hh
Genfun::Rectangular::height
const Parameter & height() const
Definition: Rectangular.cc:53
Genfun::FunctionNoop
Definition: CLHEP/GenericFunctions/FunctionNoop.hh:19
FixedConstant.hh
Genfun::Parameter
Definition: CLHEP/GenericFunctions/Parameter.hh:35
Genfun::FixedConstant
Definition: CLHEP/GenericFunctions/FixedConstant.hh:23
x
any side effects of that construction would occur twice The semantics of throw x
Definition: whyZMthrowRethrows.txt:37
Genfun::Rectangular::x1
const Parameter & x1() const
Definition: Rectangular.cc:45
FUNCTION_OBJECT_IMP
#define FUNCTION_OBJECT_IMP(classname)
Definition: CLHEP/GenericFunctions/AbsFunction.hh:156
Genfun::Rectangular::partial
Derivative partial(unsigned int) const
Definition: Rectangular.cc:74
Genfun::Rectangular
Definition: CLHEP/GenericFunctions/Rectangular.hh:19
Genfun::Rectangular::~Rectangular
virtual ~Rectangular()
Definition: Rectangular.cc:26
Genfun
Definition: CLHEP/GenericFunctions/Abs.hh:14