ComPWA
Common Partial-Wave-Analysis Framework
ComPWA::Tools Namespace Reference

Namespaces

 Adapter
 
 Plotting
 

Classes

struct  FitFraction
 
class  FitFractions
 
struct  KahanSummation
 

Typedefs

using FitFractionList = std::vector< FitFraction >
 
using IntensityComponent = std::pair< std::string, std::shared_ptr< Intensity > >
 

Functions

std::ostream & operator<< (std::ostream &os, const FitFractionList &FFList)
 
KahanSummation KahanSum (KahanSummation accumulation, double value)
 KahanSummation keeps track of lost bits and reduced the uncertainty in the summation of many large/small numbers. More...
 
std::pair< double, double > integrateWithError (ComPWA::Intensity &intensity, const ComPWA::Data::DataSet &phspsample, double phspVolume=1.0)
 Calculate integral and its error. More...
 
double integrate (ComPWA::Intensity &intensity, const ComPWA::Data::DataSet &phspsample, double phspVolume)
 
double maximum (ComPWA::Intensity &intensity, const ComPWA::Data::DataSet &sample)
 
void updateParameterRangeByType (boost::property_tree::ptree &Tree, const std::string &ParameterType, double Min, double Max)
 Update range of specified parameters of a ptree. More...
 
void updateParameterRangeByName (boost::property_tree::ptree &Tree, const std::string &ParameterName, double Min, double Max)
 Update range of specified parameters of a ptree. More...
 
void updateParameterValue (boost::property_tree::ptree &Tree, const std::string ParameterName, double Value)
 Update value of specified parameters of a ptree. More...
 
void fixParameter (boost::property_tree::ptree &Tree, const std::string ParameterName, double Value=-999)
 Fix specified parameters of a ptree. More...
 
void releaseParameter (boost::property_tree::ptree &Tree, const std::string ParameterName, double Value=-999)
 Release specified parameters of a ptree. More...
 
void updateParameter (boost::property_tree::ptree &Tree, const std::string &KeyType, const std::string &KeyValue, double Value, bool Fix, double Min, double Max, bool UpdateValue, bool UpdateFix, bool UpdateRange)
 Update specified parameters of a ptree. More...
 
void updateParameter (boost::property_tree::ptree &Tree, const FitParameterList &FitParameters)
 Update value, range, fix status of parameters of a ptree, the new values comes from fitParameters. More...
 

Typedef Documentation

◆ FitFractionList

using ComPWA::Tools::FitFractionList = typedef std::vector<FitFraction>

Definition at line 29 of file FitFractions.hpp.

◆ IntensityComponent

using ComPWA::Tools::IntensityComponent = typedef std::pair<std::string, std::shared_ptr<Intensity> >

Definition at line 31 of file FitFractions.hpp.

Function Documentation

◆ fixParameter()

void ComPWA::Tools::fixParameter ( boost::property_tree::ptree &  Tree,
const std::string  ParameterName,
double  Value = -999 
)

Fix specified parameters of a ptree.

Parameters
TreeProperty tree which contains parameters.
ParameterNameParameters with same name will be updated.
ValueNew value of parameter. Default means fix to current value.

Definition at line 29 of file UpdatePTreeParameter.cpp.

◆ integrate()

double ComPWA::Tools::integrate ( ComPWA::Intensity intensity,
const ComPWA::Data::DataSet phspsample,
double  phspVolume 
)

Definition at line 70 of file Integration.cpp.

◆ integrateWithError()

std::pair< double, double > ComPWA::Tools::integrateWithError ( ComPWA::Intensity intensity,
const ComPWA::Data::DataSet phspsample,
double  phspVolume = 1.0 
)

Calculate integral and its error.

We follow https://en.wikipedia.org/wiki/Monte_Carlo_integration. The average intensity is given by:

\[ \langle f \rangle =\frac{1}{N} \sum_{i=1}^N f(\overline{\mathbf{x}}_i) \]

and the integral estimate Q_N using a sample size of N events is given by:

\[ I \approx Q_N = V*\langle f \rangle. \]

The variance is given by

\[ \mathrm{Var}(Q_N) = \frac{V^2}{N} \frac{1}{(N-1)} \sum_{i=1}^N \left (f(\overline{\mathbf{x}}_i) - \langle f \rangle \right )^2 \]

We use a Kahan summation to improve numerical stability. We return $ \sqrt{\mathrm{Var}(Q_N)} $ as error.

Definition at line 39 of file Integration.cpp.

◆ KahanSum()

KahanSummation ComPWA::Tools::KahanSum ( KahanSummation  accumulation,
double  value 
)

KahanSummation keeps track of lost bits and reduced the uncertainty in the summation of many large/small numbers.

See https://en.wikipedia.org/wiki/Kahan_summation_algorithm

Definition at line 29 of file Integration.cpp.

◆ maximum()

double ComPWA::Tools::maximum ( ComPWA::Intensity intensity,
const ComPWA::Data::DataSet sample 
)

Definition at line 75 of file Integration.cpp.

◆ operator<<()

std::ostream & ComPWA::Tools::operator<< ( std::ostream &  os,
const FitFractionList FFList 
)

Definition at line 15 of file FitFractions.cpp.

◆ releaseParameter()

void ComPWA::Tools::releaseParameter ( boost::property_tree::ptree &  Tree,
const std::string  ParameterName,
double  Value = -999 
)

Release specified parameters of a ptree.

Parameters
TreeProperty tree which contains parameters.
ParameterNameParameters with same name will be updated.
ValueNew value of parameter. Default means the current value.

Definition at line 42 of file UpdatePTreeParameter.cpp.

◆ updateParameter() [1/2]

void ComPWA::Tools::updateParameter ( boost::property_tree::ptree &  Tree,
const std::string &  KeyType,
const std::string &  KeyValue,
double  Value,
bool  Fix,
double  Min,
double  Max,
bool  UpdateValue,
bool  UpdateFix,
bool  UpdateRange 
)

Update specified parameters of a ptree.

Parameters
TreeProperty tree which contains parameters.
KeyTypeThe type(e.g., "Name" or "Type") of 'key' used to find parameter in the ptree.
KeyValueThe value of 'key' used to find parameter in the ptree.
ValueNew value of parameter.
FixParameter will be fixed or not.
MinLower range of the parameter
MaxUpper range of the parameter
UpdateValueIf update value of the parameter or not.
UpdateFixIf update fix status of the parameter or not.
UpdateRangeIf update range of the parameter or not.

Definition at line 55 of file UpdatePTreeParameter.cpp.

◆ updateParameter() [2/2]

void ComPWA::Tools::updateParameter ( boost::property_tree::ptree &  Tree,
const FitParameterList FitParameters 
)

Update value, range, fix status of parameters of a ptree, the new values comes from fitParameters.

Parameters
TreeProperty tree which contains parameters.
FitParametersTarget parameters' vector. Parameters appear both in Tree and FitParameters will be updated according the parameter in FitParameters

Definition at line 86 of file UpdatePTreeParameter.cpp.

◆ updateParameterRangeByName()

void ComPWA::Tools::updateParameterRangeByName ( boost::property_tree::ptree &  Tree,
const std::string &  ParameterName,
double  Min,
double  Max 
)

Update range of specified parameters of a ptree.

Parameters
TreeProperty tree which contains parameters.
ParameterNameParameters with same name will be updated.
MinMinimum value of the range.
MaxMaximum value of the range.

Definition at line 14 of file UpdatePTreeParameter.cpp.

◆ updateParameterRangeByType()

void ComPWA::Tools::updateParameterRangeByType ( boost::property_tree::ptree &  Tree,
const std::string &  ParameterType,
double  Min,
double  Max 
)

Update range of specified parameters of a ptree.

Parameters
TreeProperty tree which contains parameters.
ParameterTypeParameters with same type (e.g., Magnitude) will be updated.
MinMinimum value of the range.
MaxMaximum value of the range.

Definition at line 6 of file UpdatePTreeParameter.cpp.

◆ updateParameterValue()

void ComPWA::Tools::updateParameterValue ( boost::property_tree::ptree &  Tree,
const std::string  ParameterName,
double  Value 
)

Update value of specified parameters of a ptree.

Parameters
TreeProperty tree which contains parameters.
ParameterNameParameters with same name will be updated.
ValueNew value of parameter.

Definition at line 22 of file UpdatePTreeParameter.cpp.