Thermal-FIST 1.5
Package for hadron resonance gas model applications
Loading...
Searching...
No Matches
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.
 
 ~ThermalModelFit (void)
 Destroy the Thermal Model Fit object.
 
void SetFitFlag (const std::string &name, bool flag)
 Set whether FitParameter with a given name should be fitted.
 
void SetData (const std::vector< FittedQuantity > &inData)
 Sets the data to fit.
 
void SetQuantities (const std::vector< FittedQuantity > &inQuantities)
 Same as SetData()
 
void AddData (const std::vector< FittedQuantity > &inData)
 Add more data to fit.
 
void AddQuantities (const std::vector< FittedQuantity > &inQuantities)
 Same as AddData()
 
void AddDataPoint (const FittedQuantity &inDataPoint)
 Add one more data point to fit.
 
void AddQuantity (const FittedQuantity &inQuantity)
 Same as AddDataPoint()
 
void ClearData ()
 Clear the fitted data.
 
void ClearQuantities ()
 Same as ClearData()
 
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.
 
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)
 
void PrintFitLog (std::string filename="", std::string comment="Thermal fit", bool asymm=false)
 Prints the result of the fitting procedure to a file.
 
ThermalModelFitParameters PerformFit (bool verbose=true, bool AsymmErrors=false)
 The thermal fit procedure.
 
int GetNdf () const
 Number of degrees of freedom in the fit.
 
void Increment ()
 Used by MINUIT.
 
const ThermalModelFitParametersParameters () const
 
void SetParameters (const ThermalModelFitParameters &params)
 Sets the fit parameters.
 
void SetParameter (const std::string &name, const FitParameter &param)
 Sets the fit parameter with a given name.
 
void SetParameter (const std::string &name, double val, double err, double xmin, double xmax)
 Sets the fit parameter with a given name.
 
void SetParameterValue (const std::string &name, double value)
 Sets the (initial) value for the fit parameter with a given name.
 
void SetParameterFitFlag (const std::string &name, bool toFit)
 Sets whether the fit parameter with a given name is fitted.
 
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)
 
void FixVcOverV (bool fix)
 
bool FixVcOverV () const
 
void SetVcOverV (double VcOverV)
 
double VcOverV () const
 
void UseTkin (bool YieldsAtTkin)
 Sets whether the yields should be evaluated at Tkin using partial chemical equilibrium.
 
bool UseTkin () const
 
void UseSahaForNuclei (bool UseSaha)
 Sets whether the nuclear abundances are evaluated in PCE using the Saha equation.
 
void PCEFreezeLongLived (bool FreezeLongLived)
 Sets whether the yields of long-lived resonance are frozen in the PCE.
 
void SetPCEWidthCut (double WidthCut)
 Sets the resonance width cut for freezeing the yields of long-lived resonances.
 
void PCEAnnihilation (bool Annihilation)
 Sets whether to include baryon annihilation in PCE.
 
void SetPCEPionAnnihilationNumber (double PionAnnihilationNumber)
 Sets the average number of pions in baryon annihilation.
 
std::pair< double, double > ModelDescriptionAccuracy () const
 Returns a relative error of the data description (and its uncertainty estimate)
 
int & Iters ()
 
double & Chi2 ()
 
double & BT ()
 
double & QT ()
 
double & ST ()
 
double & CT ()
 
double & ModelData (int index)
 
int ModelDataSize () const
 
void ClearModelData ()
 
int & Ndf ()
 

Static Public Member Functions

static std::vector< FittedQuantityloadExpDataFromFile (const std::string &filename)
 Load the experimental data from a file.
 
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

◆ ThermalModelFit()

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.

◆ ~ThermalModelFit()

thermalfist::ThermalModelFit::~ThermalModelFit ( void )

Destroy the Thermal Model Fit object.

Definition at line 222 of file ThermalModelFit.cpp.

Member Function Documentation

◆ AddData()

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.

◆ AddDataPoint()

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.

◆ AddMultiplicities()

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

Definition at line 146 of file ThermalModelFit.h.

◆ AddMultiplicity()

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

Definition at line 153 of file ThermalModelFit.h.

◆ AddQuantities()

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

Same as AddData()

Definition at line 98 of file ThermalModelFit.h.

◆ AddQuantity()

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

Same as AddDataPoint()

Definition at line 112 of file ThermalModelFit.h.

◆ AddRatio()

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

Definition at line 133 of file ThermalModelFit.h.

◆ AddRatios()

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

Definition at line 126 of file ThermalModelFit.h.

◆ BT()

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

Definition at line 275 of file ThermalModelFit.h.

◆ Chi2()

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

Definition at line 273 of file ThermalModelFit.h.

◆ ClearData()

void thermalfist::ThermalModelFit::ClearData ( )
inline

Clear the fitted data.

Definition at line 115 of file ThermalModelFit.h.

◆ ClearModelData()

void thermalfist::ThermalModelFit::ClearModelData ( )
inline

Definition at line 287 of file ThermalModelFit.h.

◆ ClearMultiplicities()

void thermalfist::ThermalModelFit::ClearMultiplicities ( )
inline

Definition at line 158 of file ThermalModelFit.h.

◆ ClearQuantities()

void thermalfist::ThermalModelFit::ClearQuantities ( )
inline

Same as ClearData()

Definition at line 118 of file ThermalModelFit.h.

◆ ClearRatios()

void thermalfist::ThermalModelFit::ClearRatios ( )
inline

Definition at line 138 of file ThermalModelFit.h.

◆ CT()

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

Definition at line 281 of file ThermalModelFit.h.

◆ ExtendedParameters()

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

Definition at line 226 of file ThermalModelFit.h.

◆ FittedQuantities()

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.

◆ FixVcOverV() [1/2]

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

Definition at line 296 of file ThermalModelFit.h.

◆ FixVcOverV() [2/2]

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.

◆ GetNdf()

int thermalfist::ThermalModelFit::GetNdf ( ) const

Number of degrees of freedom in the fit.

Definition at line 1425 of file ThermalModelFit.cpp.

◆ Increment()

void thermalfist::ThermalModelFit::Increment ( )
inline

Used by MINUIT.

Definition at line 204 of file ThermalModelFit.h.

◆ Iters()

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

Used for real-time monitoring in the GUI.

Definition at line 271 of file ThermalModelFit.h.

◆ loadExpDataFromFile()

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

Load the experimental data from a file.

Definition at line 1274 of file ThermalModelFit.cpp.

◆ model()

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

Pointer to a ThermalModelBase object implementing the HRG model used

Definition at line 230 of file ThermalModelFit.h.

◆ ModelData()

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

Definition at line 283 of file ThermalModelFit.h.

◆ ModelDataSize()

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

Definition at line 285 of file ThermalModelFit.h.

◆ ModelDescriptionAccuracy()

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

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

Definition at line 1243 of file ThermalModelFit.cpp.

◆ modelpce()

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.

◆ Multiplicities()

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.

◆ Ndf()

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

Definition at line 289 of file ThermalModelFit.h.

◆ Parameters()

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.

◆ PCEAnnihilation()

void thermalfist::ThermalModelFit::PCEAnnihilation ( bool Annihilation)
inline

Sets whether to include baryon annihilation in PCE.

Definition at line 322 of file ThermalModelFit.h.

◆ PCEFreezeLongLived()

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.

◆ PerformFit()

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 226 of file ThermalModelFit.cpp.

◆ PrintFitLog()

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 989 of file ThermalModelFit.cpp.

◆ PrintMultiplicities()

void thermalfist::ThermalModelFit::PrintMultiplicities ( )

Definition at line 601 of file ThermalModelFit.cpp.

◆ PrintParameters()

void thermalfist::ThermalModelFit::PrintParameters ( )

Print function.

Definition at line 582 of file ThermalModelFit.cpp.

◆ PrintRatios()

void thermalfist::ThermalModelFit::PrintRatios ( )

Definition at line 564 of file ThermalModelFit.cpp.

◆ PrintYields()

void thermalfist::ThermalModelFit::PrintYields ( )

Definition at line 633 of file ThermalModelFit.cpp.

◆ PrintYieldsLatex()

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

Definition at line 770 of file ThermalModelFit.cpp.

◆ PrintYieldsLatexAll()

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

Definition at line 829 of file ThermalModelFit.cpp.

◆ PrintYieldsTable()

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

Definition at line 686 of file ThermalModelFit.cpp.

◆ PrintYieldsTable2()

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

Definition at line 735 of file ThermalModelFit.cpp.

◆ QoverB()

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

Definition at line 255 of file ThermalModelFit.h.

◆ QT()

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

Definition at line 277 of file ThermalModelFit.h.

◆ Ratios()

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.

◆ saveExpDataToFile()

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

Definition at line 1383 of file ThermalModelFit.cpp.

◆ SetData()

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.

◆ SetFitFlag()

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.

◆ SetMultiplicities()

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

Definition at line 142 of file ThermalModelFit.h.

◆ SetParameter() [1/2]

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.

◆ SetParameter() [2/2]

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.

◆ SetParameterFitFlag()

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.

◆ SetParameters()

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

Sets the fit parameters.

Definition at line 211 of file ThermalModelFit.h.

◆ SetParameterValue()

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.

◆ SetPCEPionAnnihilationNumber()

void thermalfist::ThermalModelFit::SetPCEPionAnnihilationNumber ( double PionAnnihilationNumber)
inline

Sets the average number of pions in baryon annihilation.

Definition at line 325 of file ThermalModelFit.h.

◆ SetPCEWidthCut()

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.

◆ SetQBConstraint()

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.

◆ SetQuantities()

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.

◆ SetRatios()

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.

◆ SetSBConstraint()

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.

◆ SetVcOverV()

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.

◆ SoverB()

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

Definition at line 253 of file ThermalModelFit.h.

◆ ST()

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

Definition at line 279 of file ThermalModelFit.h.

◆ UseSahaForNuclei()

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.

◆ UseTkin() [1/2]

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

Definition at line 310 of file ThermalModelFit.h.

◆ UseTkin() [2/2]

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.

◆ VcOverV()

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: