CMS 3D CMS Logo

SmoothStepFunction.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_Utilities_SmoothStepFunction_h
00002 #define PhysicsTools_Utilities_SmoothStepFunction_h
00003 #include "PhysicsTools/Utilities/interface/Parameter.h"
00004 #include <boost/shared_ptr.hpp>
00005 #include <cmath>
00006 
00007 namespace function {
00008   
00009   struct SmoothStepFunction {
00010     static const unsigned int arguments = 1;
00011     SmoothStepFunction(const Parameter & t) : 
00012       trend(t.ptr()) { }
00013     SmoothStepFunction(boost::shared_ptr<double> t): 
00014       trend(t) { }
00015     SmoothStepFunction(double t): 
00016       trend(new double(t)){}
00017     double operator()(double x) const {
00018       double z = (x - 40)*(*trend);
00019       if(fabs(z)<0) return 0;
00020       return 2/(1+exp(-z)) -1;
00021     }
00022     boost::shared_ptr<double> trend;
00023   };
00024 
00025 }
00026 
00027 #endif

Generated on Tue Jun 9 17:34:17 2009 for CMSSW by  doxygen 1.5.4