NC::Fitter::PenalizerInt Class Reference

#include <NCFitter.h>

Inheritance diagram for NC::Fitter::PenalizerInt:
NC::Fitter::ICallableInt

List of all members.

Public Member Functions

 PenalizerInt (ICallableInt *g, std::vector< NCParameter > ps)
virtual double EvalAt (const CoordInt &r) const

Protected Attributes

ICallableIntfFunc
std::vector< NCParameterfParams

Detailed Description

Definition at line 84 of file NCFitter.h.


Constructor & Destructor Documentation

NC::Fitter::PenalizerInt::PenalizerInt ( ICallableInt g,
std::vector< NCParameter ps 
) [inline]

Definition at line 87 of file NCFitter.h.

00088       : fFunc(g), fParams(ps){}


Member Function Documentation

double NC::Fitter::PenalizerInt::EvalAt ( const CoordInt r  )  const [virtual]

Reimplemented from NC::Fitter::ICallableInt.

Definition at line 110 of file NCFitter.cxx.

References NC::Fitter::ICallableInt::EvalAt(), fFunc, fParams, n, and SQR.

00111   {
00112     CoordInt reval = r;
00113 
00114     // If the point is outside the physical region - move it to the boundary
00115     for(unsigned int n = 0; n < fParams.size(); ++n){
00116       if(r[n] < 0) reval[n] = 0;
00117       if(r[n] > fParams[n].Steps()) reval[n] = fParams[n].Steps();
00118     }
00119 
00120     double ret = fFunc->EvalAt(reval);
00121 
00122     // If we had to move the point then apply a quadratic penalty term.
00123     // The factor of 1000 is fairly arbitrary.
00124     const double amplitude = 1e3;
00125     for(unsigned int n = 0; n < fParams.size(); ++n){
00126       const double wsqr = SQR(fParams[n].Steps());
00127       assert(wsqr);
00128       if(r[n] < 0)
00129         ret += amplitude*SQR(r[n])/wsqr;
00130       if(r[n] > fParams[n].Steps())
00131         ret += amplitude*SQR(r[n]-fParams[n].Steps())/wsqr;
00132     }
00133 
00134     return ret;
00135   }


Member Data Documentation

Definition at line 91 of file NCFitter.h.

Referenced by EvalAt().

Definition at line 92 of file NCFitter.h.

Referenced by EvalAt().


The documentation for this class was generated from the following files:

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1