All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | List of all members
ana::IConstrainedFitVar Class Referenceabstract

Base class for variables with constraints. Apply penalty outside range. More...

#include <IFitVar.h>

Inheritance diagram for ana::IConstrainedFitVar:
ana::IFitVar ana::FitDmSq21 ana::FitDmSq32 ana::FitDmSq32Scaled ana::FitDmSqSterile ana::FitRho ana::FitSinSq2Theta12 ana::FitSinSq2Theta13 ana::FitSinSq2Theta14Sterile ana::FitSinSq2Theta23 ana::FitSinSq2Theta24Sterile ana::FitSinSq2Theta34Sterile ana::FitSinSqTheta13Sterile ana::FitSinSqTheta14Sterile ana::FitSinSqTheta23 ana::FitSinSqTheta23Sterile ana::FitSinSqTheta24Sterile ana::FitSinSqTheta34Sterile ana::FitTanSqTheta12 ana::FitTheta13InDegreesSterile ana::FitTheta13Sterile ana::FitTheta14InDegreesSterile ana::FitTheta14Sterile ana::FitTheta23InDegreesSterile ana::FitTheta23Sterile ana::FitTheta24InDegreesSterile ana::FitTheta24Sterile ana::FitTheta34InDegreesSterile ana::FitTheta34Sterile

Public Member Functions

virtual double Penalty (double val, osc::IOscCalcAdjustable *) const
 
virtual double LowLimit () const =0
 
virtual double HighLimit () const =0
 
- Public Member Functions inherited from ana::IFitVar
virtual double GetValue (const osc::IOscCalcAdjustable *osc) const =0
 
virtual void SetValue (osc::IOscCalcAdjustable *osc, double val) const =0
 
virtual std::string ShortName () const =0
 
virtual std::string LatexName () const =0
 

Protected Member Functions

double Clamp (double val) const
 

Detailed Description

Base class for variables with constraints. Apply penalty outside range.

Definition at line 28 of file IFitVar.h.

Member Function Documentation

double ana::IConstrainedFitVar::Clamp ( double  val) const
protected

Definition at line 31 of file IFitVar.cxx.

32  {
33  return std::max(LowLimit(), std::min(val, HighLimit()));
34  }
virtual double LowLimit() const =0
virtual double HighLimit() const =0
virtual double ana::IConstrainedFitVar::HighLimit ( ) const
pure virtual
virtual double ana::IConstrainedFitVar::LowLimit ( ) const
pure virtual
double ana::IConstrainedFitVar::Penalty ( double  val,
osc::IOscCalcAdjustable  
) const
virtual

Reimplemented from ana::IFitVar.

Definition at line 10 of file IFitVar.cxx.

12  {
13  const double lo = LowLimit();
14  const double hi = HighLimit();
15 
16  if(val >= lo && val <= hi) return 0;
17 
18  // Try to direct fit back towards centre of the space. Engineer penalty to
19  // be zero at the limits.
20  const double mean = (lo+hi)/2;
21  const double rad = (hi-lo)/2;
22  return util::sqr((val-mean)/rad)-1;
23 
24 
25  // if(val < lo) return util::sqr(lo-val);
26  // if(val > hi) return util::sqr(val-hi);
27  // return 0;
28  }
virtual double LowLimit() const =0
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
virtual double HighLimit() const =0

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