#include <NCFitter.h>
Inheritance diagram for NC::Fitter::PenalizerInt:

Public Member Functions | |
| PenalizerInt (ICallableInt *g, std::vector< NCParameter > ps) | |
| virtual double | EvalAt (const CoordInt &r) const |
Protected Attributes | |
| ICallableInt * | fFunc |
| std::vector< NCParameter > | fParams |
|
||||||||||||
|
Definition at line 83 of file NCFitter.h.
|
|
|
Reimplemented from NC::Fitter::ICallableInt. Definition at line 110 of file NCFitter.cxx. References NC::Fitter::CoordInt, NC::Fitter::ICallableInt::EvalAt(), fFunc, fParams, 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 }
|
|
|
Definition at line 87 of file NCFitter.h. Referenced by EvalAt(). |
|
|
Definition at line 88 of file NCFitter.h. Referenced by EvalAt(). |
1.3.9.1