Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ana::FitVarsProductMarg Class Reference

See the documentation for FitVarsProductMarg. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-01-16/CAFAna/Vars/FitVarsProduct.h"

Inheritance diagram for ana::FitVarsProductMarg:
ana::IConstrainedFitVar ana::IFitVar

Public Member Functions

 FitVarsProductMarg (const IConstrainedFitVar &x, const IConstrainedFitVar &y)
 
virtual double GetValue (const osc::IOscCalcAdjustable *osc) const
 
virtual void SetValue (osc::IOscCalcAdjustable *osc, double val) const
 
virtual double LowLimit () const
 
virtual double HighLimit () const
 
double Penalty (double val, osc::IOscCalcAdjustable *) const override
 Override the default implementation with one that pushes back towards the center of the constrained space. More...
 
const std::stringShortName () const
 
const std::stringLatexName () const
 

Protected Member Functions

template<typename T >
T Clamp (T val) const
 

Protected Attributes

const IConstrainedFitVarfVarX
 
const IConstrainedFitVarfVarY
 

Detailed Description

See the documentation for FitVarsProductMarg.

Definition at line 42 of file FitVarsProduct.h.

Constructor & Destructor Documentation

ana::FitVarsProductMarg::FitVarsProductMarg ( const IConstrainedFitVar x,
const IConstrainedFitVar y 
)

Definition at line 135 of file FitVarsProduct.cxx.

References ana::assert(), ana::IConstrainedFitVar::HighLimit(), and ana::IConstrainedFitVar::LowLimit().

137  : IConstrainedFitVar(x.ShortName()+"*"+y.ShortName()+"_marg",
138  "Marginalization parameter for "+x.LatexName()+y.LatexName()),
139  fVarX(x), fVarY(y)
140  {
141  assert(x.LowLimit() == 0 && x.HighLimit() == 1);
142  assert(y.LowLimit() == 0 && y.HighLimit() == 1);
143  }
const IConstrainedFitVar & fVarY
assert(nhit_max >=nhit_nbins)
const IConstrainedFitVar & fVarX

Member Function Documentation

template<typename T >
T ana::IConstrainedFitVar::Clamp ( T  val) const
inlineprotectedinherited
double ana::FitVarsProductMarg::GetValue ( const osc::IOscCalcAdjustable osc) const
virtual

Implements ana::IFitVar.

Definition at line 146 of file FitVarsProduct.cxx.

References beta, fVarX, fVarY, and ana::IFitVar::GetValue().

147  {
148  // Just evaluate the formula for beta.
149  double alpha, beta;
150  XYToAlphaBeta(fVarX.GetValue(osc), fVarY.GetValue(osc), alpha, beta);
151  return beta;
152  }
Double_t beta
const IConstrainedFitVar & fVarY
const IConstrainedFitVar & fVarX
virtual double GetValue(const osc::IOscCalcAdjustable *osc) const =0
virtual double ana::FitVarsProductMarg::HighLimit ( ) const
inlinevirtual

Implements ana::IConstrainedFitVar.

Definition at line 52 of file FitVarsProduct.h.

52 {return 1;}
const std::string& ana::IFitVar::LatexName ( ) const
inlineinherited
virtual double ana::FitVarsProductMarg::LowLimit ( ) const
inlinevirtual

Implements ana::IConstrainedFitVar.

Definition at line 51 of file FitVarsProduct.h.

51 {return 0;}
double ana::IConstrainedFitVar::Penalty ( double  val,
osc::IOscCalcAdjustable  
) const
overridevirtualinherited

Override the default implementation with one that pushes back towards the center of the constrained space.

Reimplemented from ana::IFitVar.

Definition at line 8 of file IFitVar.cxx.

References hi(), ana::IConstrainedFitVar::HighLimit(), lo(), ana::IConstrainedFitVar::LowLimit(), extractScale::mean, Munits::rad, and util::sqr().

Referenced by ana::SigmaDelta::SigmaPenalty().

10  {
11  const auto lo = LowLimit();
12  const auto hi = HighLimit();
13 
14  if (val >= lo && val <= hi) return 0;
15 
16  // Try to direct fit back towards centre of the space. Engineer penalty to
17  // be zero at the limits.
18  const auto mean = (lo + hi) / 2;
19  const auto rad = (hi - lo) / 2;
20  return util::sqr((val - mean) / rad) - 1;
21 
22 
23  // if(val < lo) return util::sqr(lo-val);
24  // if(val > hi) return util::sqr(val-hi);
25  // return 0;
26  }
virtual double HighLimit() const =0
TSpline3 lo("lo", xlo, ylo, 12,"0")
virtual double LowLimit() const =0
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
TSpline3 hi("hi", xhi, yhi, 18,"0")
static constexpr Double_t rad
Definition: Munits.h:162
void ana::FitVarsProductMarg::SetValue ( osc::IOscCalcAdjustable osc,
double  val 
) const
virtual

Implements ana::IFitVar.

Definition at line 155 of file FitVarsProduct.cxx.

References beta, ana::IConstrainedFitVar::Clamp(), fVarX, fVarY, ana::IFitVar::GetValue(), ana::IFitVar::SetValue(), submit_syst::x, and submit_syst::y.

156  {
157  // Switch to the other space, hold alpha constant and adjust beta, see
158  // where that leaves us.
159  double alpha, beta;
160  XYToAlphaBeta(fVarX.GetValue(osc), fVarY.GetValue(osc), alpha, beta);
161  beta = Clamp(val);
162 
163  double x, y;
164  AlphaBetaToXY(alpha, beta, x, y);
165  fVarX.SetValue(osc, x);
166  fVarY.SetValue(osc, y);
167  }
Double_t beta
T Clamp(T val) const
Definition: IFitVar.h:60
const IConstrainedFitVar & fVarY
virtual void SetValue(osc::IOscCalcAdjustable *osc, double val) const =0
const IConstrainedFitVar & fVarX
virtual double GetValue(const osc::IOscCalcAdjustable *osc) const =0
const std::string& ana::IFitVar::ShortName ( ) const
inlineinherited

Member Data Documentation

const IConstrainedFitVar& ana::FitVarsProductMarg::fVarX
protected

Definition at line 54 of file FitVarsProduct.h.

Referenced by GetValue(), and SetValue().

const IConstrainedFitVar& ana::FitVarsProductMarg::fVarY
protected

Definition at line 55 of file FitVarsProduct.h.

Referenced by GetValue(), and SetValue().


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