Thermal-FIST  1.3
Package for hadron resonance gas model applications
Public Member Functions | Static Public Member Functions | List of all members
thermalfist::ThermalModelFit Class Reference

Class implementing the thermal model fit procedure. More...

#include <ThermalModelFit.h>

Public Member Functions

 ThermalModelFit (ThermalModelBase *model)
 Construct a new ThermalModelFit object. More...
 
 ~ThermalModelFit (void)
 Destroy the Thermal Model Fit object. More...
 
void SetFitFlag (const std::string &name, bool flag)
 Set whether FitParameter with a given name should be fitted. More...
 
void SetData (const std::vector< FittedQuantity > &inData)
 Sets the data to fit. More...
 
void SetQuantities (const std::vector< FittedQuantity > &inQuantities)
 Same as SetData() More...
 
void AddData (const std::vector< FittedQuantity > &inData)
 Add more data to fit. More...
 
void AddQuantities (const std::vector< FittedQuantity > &inQuantities)
 Same as AddData() More...
 
void AddDataPoint (const FittedQuantity &inDataPoint)
 Add one more data point to fit. More...
 
void AddQuantity (const FittedQuantity &inQuantity)
 Same as AddDataPoint() More...
 
void ClearData ()
 Clear the fitted data. More...
 
void ClearQuantities ()
 Same as ClearData() More...
 
void PrintFitLog (std::string filename="", std::string comment="Thermal fit", bool asymm=false)
 Prints the result of the fitting procedure to a file. More...
 
ThermalModelFitParameters PerformFit (bool verbose=true, bool AsymmErrors=false)
 The thermal fit procedure. More...
 
int GetNdf () const
 Number of degrees of freedom in the fit. More...
 
void Increment ()
 Used by MINUIT. More...
 
const ThermalModelFitParametersParameters () const
 
void SetParameters (const ThermalModelFitParameters &params)
 Sets the fit parameters. More...
 
void SetParameter (const std::string &name, const FitParameter &param)
 Sets the fit parameter with a given name. More...
 
void SetParameter (const std::string &name, double val, double err, double xmin, double xmax)
 Sets the fit parameter with a given name. More...
 
void SetParameterValue (const std::string &name, double value)
 Sets the (initial) value for the fit parameter with a given name. More...
 
void SetParameterFitFlag (const std::string &name, bool toFit)
 Sets whether the fit parameter with a given name is fitted. More...
 
const ThermalModelFitParametersExtendedExtendedParameters () const
 
ThermalModelBasemodel ()
 
ThermalModelPCEmodelpce ()
 
void SetSBConstraint (double SB)
 
void SetQBConstraint (double QB)
 
double SoverB () const
 
double QoverB () const
 
const std::vector< ExperimentMultiplicity > & Multiplicities () const
 
const std::vector< ExperimentRatio > & Ratios () const
 
const std::vector< FittedQuantity > & FittedQuantities () const
 Return a vector of the fitted quantities (data) More...
 
void UseTkin (bool YieldsAtTkin)
 Sets whether the yields should be evaluated at Tkin using partial chemical equilibrium. More...
 
bool UseTkin () const
 
void UseSahaForNuclei (bool UseSaha)
 Sets whether the nuclear abundances are evaluated in PCE using the Saha equation. More...
 
void PCEFreezeLongLived (bool FreezeLongLived)
 Sets whether the yields of long-lived resonance are frozen in the PCE. More...
 
void SetPCEWidthCut (double WidthCut)
 Sets the resonance width cut for freezeing the yields of long-lived resonances. More...
 
std::pair< double, double > ModelDescriptionAccuracy () const
 Returns a relative error of the data description (and its uncertainty estimate) More...
 
void SetRatios (const std::vector< ExperimentRatio > &inRatios)
 
void AddRatios (const std::vector< ExperimentRatio > &inRatios)
 
void AddRatio (const ExperimentRatio &inRatio)
 
void ClearRatios ()
 
void PrintRatios ()
 
void SetMultiplicities (const std::vector< ExperimentMultiplicity > &inMultiplicities)
 
void AddMultiplicities (const std::vector< ExperimentMultiplicity > &inMultiplicities)
 
void AddMultiplicity (const ExperimentMultiplicity &inMultiplicity)
 
void ClearMultiplicities ()
 
void PrintParameters ()
 Print function. More...
 
void PrintMultiplicities ()
 
void PrintYields ()
 
void PrintYieldsTable (std::string filename="Yield.dat")
 
void PrintYieldsTable2 (std::string filename="Yield.dat")
 
void PrintYieldsLatex (std::string filename="Yield.dat", std::string name="A+A")
 
void PrintYieldsLatexAll (std::string filename="Yield.dat", std::string name="A+A", bool asymm=false)
 
int & Iters ()
 
double & Chi2 ()
 
double & BT ()
 
double & QT ()
 
double & ST ()
 
double & CT ()
 
double & ModelData (int index)
 
int ModelDataSize () const
 
void ClearModelData ()
 
int & Ndf ()
 
void FixVcOverV (bool fix)
 
bool FixVcOverV () const
 
void SetVcOverV (double VcOverV)
 
double VcOverV () const
 

Static Public Member Functions

static std::vector< FittedQuantityloadExpDataFromFile (const std::string &filename)
 Load the experimental data from a file. More...
 
static void saveExpDataToFile (const std::vector< FittedQuantity > &outQuantities, const std::string &filename)
 

Detailed Description

Class implementing the thermal model fit procedure.

Performs a fit within a generic HRG model to a set of measured multiplicities and/or yield ratios. This is achieved by minimizing

\[ \chi^2 = \frac{\chi^2}{N_{\rm dof}} ~=~\frac{1}{N_{\rm dof}}\sum_{i=1}^N\frac{\left(N_i^{\rm exp}~-~N_i^{\rm HRG}\right)^2}{\sigma_i^2} \]

with MINUIT2.

The actual HRG model to use is provided through a pointer to the corresponding thermalfist::ThermalModelBase object in the constructor.

The fitted thermal parameters can be specified in a thermalfist::ThermalModelFitParameters object and should be provided through the SetParameters() method.

The data to fit can be specified as vector of FittedQuantity objects. It can be provided through the SetQuantities() method, the data can be read from a file with loadExpDataFromFile().

Finally, the fit procedure is invoked through the PerformFit() method.

Examples:
BagModelFit.cpp, cpc2-chi2-vs-T.cpp, and cpc3-chi2NEQ.cpp.

Definition at line 51 of file ThermalModelFit.h.

Constructor & Destructor Documentation

thermalfist::ThermalModelFit::ThermalModelFit ( ThermalModelBase model)

Construct a new ThermalModelFit object.

Parameters
modelPointer to the ThermalModelBase object which implements the HRG model to use in fits

Definition at line 214 of file ThermalModelFit.cpp.

thermalfist::ThermalModelFit::~ThermalModelFit ( void  )

Destroy the Thermal Model Fit object.

Definition at line 221 of file ThermalModelFit.cpp.

Member Function Documentation

void thermalfist::ThermalModelFit::AddData ( const std::vector< FittedQuantity > &  inData)
inline

Add more data to fit.

Parameters
inDataA vector of additional measurements to fit

Definition at line 92 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::AddDataPoint ( const FittedQuantity inDataPoint)
inline

Add one more data point to fit.

Parameters
inDataPointData point to fit

Definition at line 103 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::AddMultiplicities ( const std::vector< ExperimentMultiplicity > &  inMultiplicities)
inline

Definition at line 146 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::AddMultiplicity ( const ExperimentMultiplicity inMultiplicity)
inline

Definition at line 153 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::AddQuantities ( const std::vector< FittedQuantity > &  inQuantities)
inline

Same as AddData()

Definition at line 98 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::AddQuantity ( const FittedQuantity inQuantity)
inline

Same as AddDataPoint()

Definition at line 112 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::AddRatio ( const ExperimentRatio inRatio)
inline

Definition at line 133 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::AddRatios ( const std::vector< ExperimentRatio > &  inRatios)
inline

Definition at line 126 of file ThermalModelFit.h.

double& thermalfist::ThermalModelFit::BT ( )
inline

Definition at line 275 of file ThermalModelFit.h.

double& thermalfist::ThermalModelFit::Chi2 ( )
inline

Definition at line 273 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::ClearData ( )
inline

Clear the fitted data.

Definition at line 115 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::ClearModelData ( )
inline

Definition at line 287 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::ClearMultiplicities ( )
inline

Definition at line 158 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::ClearQuantities ( )
inline

Same as ClearData()

Definition at line 118 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::ClearRatios ( )
inline

Definition at line 138 of file ThermalModelFit.h.

double& thermalfist::ThermalModelFit::CT ( )
inline

Definition at line 281 of file ThermalModelFit.h.

const ThermalModelFitParametersExtended& thermalfist::ThermalModelFit::ExtendedParameters ( ) const
inline

Definition at line 226 of file ThermalModelFit.h.

const std::vector<FittedQuantity>& thermalfist::ThermalModelFit::FittedQuantities ( ) const
inline

Return a vector of the fitted quantities (data)

Definition at line 266 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::FixVcOverV ( bool  fix)
inline

Whether the correlation volume is tied to the total volume or an independent parameter.

Definition at line 295 of file ThermalModelFit.h.

bool thermalfist::ThermalModelFit::FixVcOverV ( ) const
inline

Definition at line 296 of file ThermalModelFit.h.

int thermalfist::ThermalModelFit::GetNdf ( ) const

Number of degrees of freedom in the fit.

Definition at line 1418 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::Increment ( )
inline

Used by MINUIT.

Definition at line 204 of file ThermalModelFit.h.

int& thermalfist::ThermalModelFit::Iters ( )
inline

Used for real-time monitoring in the GUI.

Definition at line 271 of file ThermalModelFit.h.

std::vector< FittedQuantity > thermalfist::ThermalModelFit::loadExpDataFromFile ( const std::string &  filename)
static

Load the experimental data from a file.

Definition at line 1267 of file ThermalModelFit.cpp.

ThermalModelBase* thermalfist::ThermalModelFit::model ( )
inline

Pointer to a ThermalModelBase object implementing the HRG model used

Definition at line 230 of file ThermalModelFit.h.

double& thermalfist::ThermalModelFit::ModelData ( int  index)
inline

Definition at line 283 of file ThermalModelFit.h.

int thermalfist::ThermalModelFit::ModelDataSize ( ) const
inline

Definition at line 285 of file ThermalModelFit.h.

std::pair< double, double > thermalfist::ThermalModelFit::ModelDescriptionAccuracy ( ) const

Returns a relative error of the data description (and its uncertainty estimate)

Definition at line 1236 of file ThermalModelFit.cpp.

ThermalModelPCE* thermalfist::ThermalModelFit::modelpce ( )
inline

Pointer to a ThermalModelBase object implementing the partial chemical equilibrium HRG model used

Definition at line 234 of file ThermalModelFit.h.

const std::vector<ExperimentMultiplicity>& thermalfist::ThermalModelFit::Multiplicities ( ) const
inline

Return a vector of the fitted multiplicities (yields) Ignores the ratios

Definition at line 259 of file ThermalModelFit.h.

int& thermalfist::ThermalModelFit::Ndf ( )
inline

Definition at line 289 of file ThermalModelFit.h.

const ThermalModelFitParameters& thermalfist::ThermalModelFit::Parameters ( ) const
inline

Current fit parameters. Contains the fit result after PerformFit() was called.

Definition at line 208 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::PCEFreezeLongLived ( bool  FreezeLongLived)
inline

Sets whether the yields of long-lived resonance are frozen in the PCE.

Definition at line 316 of file ThermalModelFit.h.

ThermalModelFitParameters thermalfist::ThermalModelFit::PerformFit ( bool  verbose = true,
bool  AsymmErrors = false 
)

The thermal fit procedure.

Performs a thermal fit of thermal parameters, specified by SetParameters(), to the experimental data, provided through SetQuantities(), within a HRG model provided by a pointer to thermalfist::ThermalModelBase in constructor.

Returns a thermalfist::ThermalModelFitParameters parameters object containing the values and errors of the fitted thermal parameters resulting from \( \chi^2 \) minimization.

Parameters
verboseIf true, additional output is shown on screen during the fitting
AsymmErrorsIf true, asymmetric error bars are computed
Returns
ThermalModelFitParameters The fitted parameters
Examples:
BagModelFit.cpp, cpc2-chi2-vs-T.cpp, and cpc3-chi2NEQ.cpp.

Definition at line 225 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintFitLog ( std::string  filename = "",
std::string  comment = "Thermal fit",
bool  asymm = false 
)

Prints the result of the fitting procedure to a file.

Examples:
BagModelFit.cpp.

Definition at line 982 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintMultiplicities ( )

Definition at line 594 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintParameters ( )

Print function.

Definition at line 575 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintRatios ( )

Definition at line 557 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintYields ( )

Definition at line 626 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintYieldsLatex ( std::string  filename = "Yield.dat",
std::string  name = "A+A" 
)

Definition at line 763 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintYieldsLatexAll ( std::string  filename = "Yield.dat",
std::string  name = "A+A",
bool  asymm = false 
)

Definition at line 822 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintYieldsTable ( std::string  filename = "Yield.dat")

Definition at line 679 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::PrintYieldsTable2 ( std::string  filename = "Yield.dat")

Definition at line 728 of file ThermalModelFit.cpp.

double thermalfist::ThermalModelFit::QoverB ( ) const
inline
Deprecated:

Definition at line 255 of file ThermalModelFit.h.

double& thermalfist::ThermalModelFit::QT ( )
inline

Definition at line 277 of file ThermalModelFit.h.

const std::vector<ExperimentRatio>& thermalfist::ThermalModelFit::Ratios ( ) const
inline

Return a vector of the fitted yield ratios Ignores the multiplicities

Definition at line 263 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::saveExpDataToFile ( const std::vector< FittedQuantity > &  outQuantities,
const std::string &  filename 
)
static

Definition at line 1376 of file ThermalModelFit.cpp.

void thermalfist::ThermalModelFit::SetData ( const std::vector< FittedQuantity > &  inData)
inline

Sets the data to fit.

Parameters
inDataA vector of measurements to fit

Definition at line 79 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetFitFlag ( const std::string &  name,
bool  flag 
)
inline

Set whether FitParameter with a given name should be fitted.

Parameters
nameFitParameter name
flagtrue – fitted, false – not fitted

Definition at line 71 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetMultiplicities ( const std::vector< ExperimentMultiplicity > &  inMultiplicities)
inline

Definition at line 142 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetParameter ( const std::string &  name,
const FitParameter param 
)
inline

Sets the fit parameter with a given name.

Examples:
BagModelFit.cpp, cpc2-chi2-vs-T.cpp, and cpc3-chi2NEQ.cpp.

Definition at line 214 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetParameter ( const std::string &  name,
double  val,
double  err,
double  xmin,
double  xmax 
)
inline

Sets the fit parameter with a given name.

Definition at line 217 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetParameterFitFlag ( const std::string &  name,
bool  toFit 
)
inline

Sets whether the fit parameter with a given name is fitted.

Examples:
BagModelFit.cpp, cpc2-chi2-vs-T.cpp, and cpc3-chi2NEQ.cpp.

Definition at line 223 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetParameters ( const ThermalModelFitParameters params)
inline

Sets the fit parameters.

Definition at line 211 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetParameterValue ( const std::string &  name,
double  value 
)
inline

Sets the (initial) value for the fit parameter with a given name.

Examples:
BagModelFit.cpp, and cpc2-chi2-vs-T.cpp.

Definition at line 220 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetPCEWidthCut ( double  WidthCut)
inline

Sets the resonance width cut for freezeing the yields of long-lived resonances.

Definition at line 319 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetQBConstraint ( double  QB)
inline

Set the electric-to-baryon charge ratio constraint for \(\mu_Q \)

Deprecated:
Electric-to-baryon charge ratio constraint should be set directly on a ThermalModelBase object

Definition at line 246 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetQuantities ( const std::vector< FittedQuantity > &  inQuantities)
inline

Same as SetData()

Examples:
BagModelFit.cpp, cpc2-chi2-vs-T.cpp, and cpc3-chi2NEQ.cpp.

Definition at line 87 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetRatios ( const std::vector< ExperimentRatio > &  inRatios)
inline
Deprecated:
Use SetQuantities(), AddQuantities(), and AddQuantity() instead

Definition at line 122 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetSBConstraint ( double  SB)
inline

Set the entropy per baryon constraint for \(\mu_B \)

Deprecated:
Entropy per baryon constraint should be set directly on a ThermalModelBase object

Definition at line 238 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::SetVcOverV ( double  VcOverV)
inline

The value of the correlation volume over the total volume ratio, \( V_c / V \). If FixVcOverV() is set to true this value is used fix \( V_c \) by the total volume.

Definition at line 304 of file ThermalModelFit.h.

double thermalfist::ThermalModelFit::SoverB ( ) const
inline
Deprecated:

Definition at line 253 of file ThermalModelFit.h.

double& thermalfist::ThermalModelFit::ST ( )
inline

Definition at line 279 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::UseSahaForNuclei ( bool  UseSaha)
inline

Sets whether the nuclear abundances are evaluated in PCE using the Saha equation.

Definition at line 313 of file ThermalModelFit.h.

void thermalfist::ThermalModelFit::UseTkin ( bool  YieldsAtTkin)
inline

Sets whether the yields should be evaluated at Tkin using partial chemical equilibrium.

Definition at line 309 of file ThermalModelFit.h.

bool thermalfist::ThermalModelFit::UseTkin ( ) const
inline

Definition at line 310 of file ThermalModelFit.h.

double thermalfist::ThermalModelFit::VcOverV ( ) const
inline

Definition at line 305 of file ThermalModelFit.h.


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