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

PeriodicRectangular.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: PeriodicRectangular.cc,v 1.4 2003/10/10 17:40:39 garren Exp $
00003 #include "CLHEP/GenericFunctions/PeriodicRectangular.hh"
00004 #include "CLHEP/GenericFunctions/FixedConstant.hh"
00005 #include <assert.h>
00006 #include <cmath>      // for floor()
00007 
00008 namespace Genfun {
00009 FUNCTION_OBJECT_IMP(PeriodicRectangular)
00010 
00011 PeriodicRectangular::PeriodicRectangular():
00012   _a("Size-of-valley (a)", 1.0, 1.0, 10),
00013   _b("Size-of-plateau (b)",  1.0, 1.0, 10),
00014   _height("height",1, 0,10)
00015 {}
00016 
00017 PeriodicRectangular::PeriodicRectangular(const PeriodicRectangular & right):
00018 AbsFunction(right),
00019 _a(right._a),
00020 _b(right._b),
00021 _height(right._height)
00022 {
00023 }
00024 
00025 PeriodicRectangular::~PeriodicRectangular() {
00026 }
00027 
00028 double PeriodicRectangular::operator() (double x) const {
00029   double xx = x/(_a.getValue()+_b.getValue());
00030   xx = xx - floor(xx);
00031   if (xx < _a.getValue()/(_a.getValue()+_b.getValue())) {
00032     return 0;
00033   }
00034   else {
00035     return _height.getValue();
00036   }
00037 }
00038 
00039 Parameter & PeriodicRectangular::a() {
00040   return _a;
00041 }
00042 
00043 Parameter & PeriodicRectangular::b() {
00044   return _b;
00045 }
00046 
00047 
00048 Parameter & PeriodicRectangular::height() {
00049   return _height;
00050 }
00051 
00052 
00053 
00054 Derivative PeriodicRectangular::partial(unsigned int index) const {
00055   assert(index==0);
00056   const AbsFunction & fPrime  = FixedConstant(0);
00057   return Derivative(&fPrime);
00058 }
00059 
00060 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7