CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: Rectangular.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ 00003 #include "CLHEP/GenericFunctions/Rectangular.hh" 00004 #include "CLHEP/GenericFunctions/FixedConstant.hh" 00005 #include <assert.h> 00006 00007 namespace Genfun { 00008 FUNCTION_OBJECT_IMP(Rectangular) 00009 00010 Rectangular::Rectangular(): 00011 _x0("x0", -1.0, -10, 0), 00012 _x1("x1", 1.0, 0, 10), 00013 _baseline("baseline", 0,-10, 10), 00014 _height("height",1, -10, 10) 00015 {} 00016 00017 Rectangular::Rectangular(const Rectangular & right) : 00018 _x0(right._x0), 00019 _x1(right._x1), 00020 _baseline(right._baseline), 00021 _height(right._height) 00022 { 00023 } 00024 00025 Rectangular::~Rectangular() { 00026 } 00027 00028 double Rectangular::operator() (double x) const { 00029 if (x<_x0.getValue()) { 00030 return _baseline.getValue(); 00031 } 00032 else if (x<_x1.getValue()) { 00033 return _height.getValue(); 00034 } 00035 else { 00036 return _baseline.getValue(); 00037 } 00038 } 00039 00040 Parameter & Rectangular::x0() { 00041 return _x0; 00042 } 00043 00044 Parameter & Rectangular::x1() { 00045 return _x1; 00046 } 00047 00048 Parameter & Rectangular::baseline() { 00049 return _baseline; 00050 } 00051 00052 Parameter & Rectangular::height() { 00053 return _height; 00054 } 00055 00056 const Parameter & Rectangular::x0() const { 00057 return _x0; 00058 } 00059 00060 const Parameter & Rectangular::x1() const { 00061 return _x1; 00062 } 00063 00064 const Parameter & Rectangular::baseline() const { 00065 return _baseline; 00066 } 00067 00068 const Parameter & Rectangular::height() const{ 00069 return _height; 00070 } 00071 00072 00073 Derivative Rectangular::partial(unsigned int index) const { 00074 assert(index==0); 00075 const AbsFunction & fPrime = FixedConstant(0);; 00076 return Derivative(&fPrime); 00077 } 00078 00079 } // namespace Genfun