#include <Landau.h>
Inheritance diagram for Landau:
This class represents a Landau distribution, as approximated by the Moyal formula
See J.E. Moyal, Theory of ionization fluctuations, Phil. Mag. 46 (1955) 263.
Note that this analytical approximation is too low in the tail.
In order to allow for a fit, we define
with x the dataset variable. and are fit parameters PAR(1) and PAR(2) respectively, and correspond to the mode and the width of the distribution. PAR(3) is a normalization factor, so that the concrete implemented formula is: .
Paul F. Kunz <Paul_Kunz@slac.stanford.edu> (C++ conversion)
Johann Cohen-Tanugi <johann.cohen@pi.infn.it> (fixed normalization)
Definition at line 47 of file Landau.h.
Public Member Functions | |
virtual void | addToComposite (FunctionBase *) |
Does nothing. | |
virtual FunctionBase * | clone () const |
Creates a new function object by copying an existing one. | |
virtual int | count () |
Returns 0. | |
virtual const std::vector< double > & | getParameters () |
Returns the values of the parameters as a vector. | |
virtual bool | hasDerivatives () const |
Returns true if function can calculate its partial derivatives. | |
virtual void | initialParameters (const FunctionHelper *helper) |
Sets the FunctionHelper so that the function can calculate a reasonable set of initial parameter values. | |
virtual double | integrate (double lower_limit, double upper_limit) const |
Returns the integral of the function from the lower limit to the higher limit. | |
virtual bool | isComposite () const |
Returns false . | |
Landau (double peak, double counts, double sigma) | |
This constructor takes the values of the parameters as an argument. | |
Landau () | |
The default constructor. | |
const std::string & | name () const |
Returns the name of the function. | |
virtual double | operator() (const std::vector< double > &v) const |
The function call operator for multi-dimension coordinate variable. | |
virtual double | operator() (double x) const |
The function call operator. | |
virtual const std::vector< std::string > & | parmNames () const |
Returns a reference to a vector of parameter names. | |
virtual void | removeFromComposite (FunctionBase *) |
Does nothing. | |
virtual std::vector< double >::const_iterator | setParameters (std::vector< double >::const_iterator it) |
Sets the parameter values to the value pointed to by the iterator. | |
virtual void | setParameters (const std::vector< double > &incr) |
Sets the parameter values. | |
void | setParmNames (const std::vector< std::string > &names) |
Sets the names of the parameters. | |
virtual int | size () const |
Returns the number of parameters. | |
Protected Member Functions | |
virtual double | derivByParm (int i, double x) const |
Returns the function's derivative at the coordinate value x with respect to the i-th parameter. | |
virtual void | initialize () |
Initializes the function and parameter names. | |
virtual void | resize () |
Resizes the appropriate vectors maintained in this base class. | |
void | setName (const char *) |
Sets the name of the function. | |
Protected Attributes | |
std::string | m_name |
The name of the function. | |
std::vector< std::string > | m_parm_names |
The names of the function parameters. | |
std::vector< double > | m_parms |
The parameter values. | |
Private Types | |
enum | { peak, norm, sigma } |
Indices to the parameter vectors. More... | |
Private Member Functions | |
double | calcY (double x) const |
compute the reduced variable: | |
double | calcZ (double x) const |
compute the helper variable for derivation: | |
double | derivByNorm (double x) const |
Calculates the derivative with respect to the counts parameter. | |
double | derivByPeak (double x) const |
Calculates the derivative with respect to the peak parameter. | |
double | derivBySigma (double x) const |
Calculates the derivative with respect to the sigma parameter. |
|
Indices to the parameter vectors.
|
|
The default constructor.
Definition at line 35 of file Landau.cxx. References initialize(). Referenced by clone(). |
|
This constructor takes the values of the parameters as an argument.
Definition at line 40 of file Landau.cxx. References initialize(), FunctionBase::m_parms, norm, peak, and sigma. |
|
Does nothing. Derived classes that are a composite of functions should override this member function and add functions to the composite. Reimplemented in LinearSumFunction. Definition at line 160 of file FunctionBase.cxx. Referenced by FunctionController::addFunctionRep(), and FunctionController::buildComposite(). |
|
compute the reduced variable:
Definition at line 84 of file Landau.h. References sigma. Referenced by operator()(). |
|
compute the helper variable for derivation:
Definition at line 91 of file Landau.h. References std::exp(). Referenced by derivByPeak(), and derivBySigma(). |
|
Creates a new function object by copying an existing one. The implementation raises an assertion as this member function should be reimplemented in s derived class.
Reimplemented from FunctionBase. Definition at line 60 of file Landau.cxx. References Landau(). |
|
Returns 0. Derived classes that are a composite of functions should override this member function to return the number of functions in the composite. Reimplemented in LinearSumFunction. Definition at line 168 of file FunctionBase.cxx. Referenced by FunctionController::removeFunction(). |
|
Calculates the derivative with respect to the counts parameter.
Definition at line 123 of file Landau.cxx. References FunctionBase::m_parms, norm, and operator()(). Referenced by derivByParm(). |
|
Returns the function's derivative at the coordinate value Derived classes must implement this function.
Reimplemented from FunctionBase. Definition at line 101 of file Landau.cxx. References derivByNorm(), derivByPeak(), derivBySigma(), norm, peak, and sigma. |
|
Calculates the derivative with respect to the peak parameter.
Definition at line 130 of file Landau.cxx. References calcZ(), FunctionBase::m_parms, operator()(), and sigma. Referenced by derivByParm(). |
|
Calculates the derivative with respect to the sigma parameter.
Definition at line 135 of file Landau.cxx. References calcZ(), FunctionBase::m_parms, operator()(), peak, and sigma. Referenced by derivByParm(). |
|
Returns the values of the parameters as a vector. The function is non-const because a derived class may need to create the vector. Reimplemented in LinearSumFunction. Definition at line 99 of file FunctionBase.cxx. References FunctionBase::m_parms. Referenced by FunctionProjectorXML::createElement(), FuncParmRep::drawProjectedValues(), hippodraw::Python::export_FunctionBase(), FunctionRep::parameters(), FunctionProjector::saveParameters(), and FunctionProjector::setParameters(). |
|
Returns
This base class implementation returns Reimplemented in LogNormal. Definition at line 124 of file FunctionBase.cxx. |
|
Initializes the function and parameter names.
Reimplemented from FunctionBase. Definition at line 49 of file Landau.cxx. References FunctionBase::m_name, FunctionBase::m_parm_names, and FunctionBase::resize(). Referenced by Landau(). |
|
Sets the FunctionHelper so that the function can calculate a reasonable set of initial parameter values.
Reimplemented from FunctionBase. Definition at line 94 of file Landau.cxx. References M_E, FunctionBase::m_parms, M_PI, FunctionHelper::maxValue(), FunctionHelper::meanCoord(), norm, peak, sigma, std::sqrt(), and FunctionHelper::stdCoord(). |
|
Returns the integral of the function from the lower limit to the higher limit. As of now all the integration is done here numerically using the trapezoidal rule. Derived class may implement an analytical expression in place of this numerical method. Definition at line 132 of file FunctionBase.cxx. References FunctionBase::operator()(). |
|
Returns
Derived classes that are a composite of functions should override this member function and return Reimplemented in LinearSumFunction. Definition at line 155 of file FunctionBase.cxx. Referenced by FunctionController::addFunctionRep(), FunctionRep::isComposite(), FunctionController::removeFunction(), FunctionController::restoreParameters(), and FunctionController::saveParameters(). |
|
Returns the name of the function.
Definition at line 81 of file FunctionBase.cxx. References FunctionBase::m_name. Referenced by FunctionController::addFunctionRep(), FunctionProjectorXML::createElement(), FunctionController::createNTuple(), FuncParmRep::drawProjectedValues(), hippodraw::Python::export_FunctionBase(), FunctionController::functionNames(), FunctionProjector::getTitle(), FunctionProjector::getYLabel(), and LinearSumFunction::parmNames(). |
|
The function call operator for multi-dimension coordinate variable. Returns the value of the function at coordinate represented by v. The implementation in this base class uses the first element of the vector and calls operator () ( double ). Reimplemented in FunctionWrap. Definition at line 175 of file FunctionBase.cxx. References FunctionBase::operator()(). |
|
The function call operator.
Reimplemented from FunctionBase. Definition at line 82 of file Landau.cxx. References calcY(), std::exp(), FunctionBase::m_parms, M_PI, norm, and std::sqrt(). Referenced by derivByNorm(), derivByPeak(), and derivBySigma(). |
|
Returns a reference to a vector of parameter names.
Reimplemented in LinearSumFunction. Definition at line 86 of file FunctionBase.cxx. References FunctionBase::m_parm_names. Referenced by FuncParmRep::drawProjectedValues(), hippodraw::Python::export_FunctionBase(), and FunctionRep::parmNames(). |
|
Does nothing. Derived classes that are a composite of functions should override this member function and remove functions from the composite. Reimplemented in LinearSumFunction. Definition at line 164 of file FunctionBase.cxx. Referenced by FunctionController::removeFunction(). |
|
Resizes the appropriate vectors maintained in this base class. Derived classes should call this member function after initializing the m_parm_names data member, as the new size is taken from that data member's size. Definition at line 71 of file FunctionBase.cxx. References FunctionBase::m_parm_names, FunctionBase::m_parms, and FunctionBase::size(). Referenced by Quadratic2::initialize(), Quadratic::initialize(), PowerLaw::initialize(), LogNormal::initialize(), Linear::initialize(), initialize(), Gaussian::initialize(), FunctionWrap::initialize(), Exponential::initialize(), Erfc::initialize(), ConstantF::initialize(), Chi2Dist::initialize(), BrokenPowerLaw::initialize(), FunctionWrap::setParmNames(), and FunctionBase::setParmNames(). |
|
Sets the name of the function.
Definition at line 66 of file FunctionBase.cxx. References FunctionBase::m_name. Referenced by FunctionWrap::setName(). |
|
Sets the parameter values to the value pointed to by the iterator. Returns an iterator to a data element one past the last used data element. Reimplemented in LinearSumFunction. Definition at line 112 of file FunctionBase.cxx. References FunctionBase::m_parms, and FunctionBase::size(). |
|
Sets the parameter values. Derived classes should implement this function by invoking incrementValues ( vector< double >::const_iterator ) so that they correctly work with the LinearSumFunction class. Definition at line 104 of file FunctionBase.cxx. Referenced by hippodraw::Python::export_FunctionBase(), FunctionProjector::restoreParameters(), FunctionProjectorXML::setAttributes(), and FunctionProjector::setParameters(). |
|
Sets the names of the parameters.
Reimplemented in FunctionWrap. Definition at line 93 of file FunctionBase.cxx. References FunctionBase::m_parm_names, and FunctionBase::resize(). |
|
Returns the number of parameters.
Reimplemented in LinearSumFunction. Definition at line 150 of file FunctionBase.cxx. References FunctionBase::m_parm_names. Referenced by LogNormal::initialParameters(), Gaussian::initialParameters(), FunctionBase::resize(), FunctionProjectorXML::setAttributes(), and FunctionBase::setParameters(). |
|
The name of the function.
Definition at line 105 of file FunctionBase.h. Referenced by FunctionBase::FunctionBase(), Quadratic2::initialize(), Quadratic::initialize(), PowerLaw::initialize(), LogNormal::initialize(), LinearSumFunction::initialize(), Linear::initialize(), initialize(), Gaussian::initialize(), Exponential::initialize(), Erfc::initialize(), ConstantF::initialize(), Chi2Dist::initialize(), BrokenPowerLaw::initialize(), FunctionBase::name(), and FunctionBase::setName(). |
|
The names of the function parameters.
Definition at line 108 of file FunctionBase.h. Referenced by Quadratic2::initialize(), Quadratic::initialize(), PowerLaw::initialize(), LogNormal::initialize(), Linear::initialize(), initialize(), Gaussian::initialize(), Exponential::initialize(), Erfc::initialize(), ConstantF::initialize(), Chi2Dist::initialize(), BrokenPowerLaw::initialize(), LinearSumFunction::parmNames(), FunctionBase::parmNames(), FunctionBase::resize(), FunctionWrap::setParmNames(), FunctionBase::setParmNames(), and FunctionBase::size(). |
|