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

Rectangular.cc

Go to the documentation of this file.
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 AbsFunction(right),
00019 _x0(right._x0),
00020 _x1(right._x1),
00021 _baseline(right._baseline),
00022 _height(right._height)
00023 {
00024 }
00025 
00026 Rectangular::~Rectangular() {
00027 }
00028 
00029 double Rectangular::operator() (double x) const {
00030   if (x<_x0.getValue()) {
00031     return _baseline.getValue();
00032   }
00033   else if (x<_x1.getValue()) {
00034     return _height.getValue();
00035   }
00036   else {
00037     return _baseline.getValue();
00038   }
00039 }
00040 
00041 Parameter & Rectangular::x0() {
00042   return _x0;
00043 }
00044 
00045 Parameter & Rectangular::x1() {
00046   return _x1;
00047 }
00048 
00049 Parameter & Rectangular::baseline() {
00050   return _baseline;
00051 }
00052 
00053 Parameter & Rectangular::height() {
00054   return _height;
00055 }
00056 
00057 const Parameter & Rectangular::x0() const {
00058   return _x0;
00059 }
00060 
00061 const Parameter & Rectangular::x1() const {
00062   return _x1;
00063 }
00064 
00065 const Parameter & Rectangular::baseline() const {
00066   return _baseline;
00067 }
00068 
00069 const Parameter & Rectangular::height() const{
00070   return _height;
00071 }
00072 
00073 
00074 Derivative Rectangular::partial(unsigned int index) const {
00075   assert(index==0);
00076   const AbsFunction & fPrime  = FixedConstant(0);;
00077   return Derivative(&fPrime);
00078 }
00079 
00080 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7