8 #ifndef THERMALMODELFIT_H 9 #define THERMALMODELFIT_H 79 void SetData(
const std::vector<FittedQuantity> & inData) {
80 m_Quantities.resize(0);
82 m_Multiplicities.resize(0);
92 void AddData(
const std::vector<FittedQuantity> & inData) {
93 for (
size_t i = 0; i < inData.size(); ++i)
104 m_Quantities.push_back(inDataPoint);
106 m_Ratios.push_back(inDataPoint.
ratio);
108 m_Multiplicities.push_back(inDataPoint.
mult);
121 void SetRatios(
const std::vector<ExperimentRatio> & inRatios) {
126 void AddRatios(
const std::vector<ExperimentRatio> & inRatios) {
127 m_Ratios.insert(m_Ratios.end(), inRatios.begin(), inRatios.end());
128 for (
size_t i = 0; i < inRatios.size(); i++) {
134 m_Ratios.push_back(inRatio);
143 m_Multiplicities = inMultiplicities;
147 m_Multiplicities.insert(m_Multiplicities.end(), inMultiplicities.begin(), inMultiplicities.end());
148 for (
size_t i = 0; i < inMultiplicities.size(); i++) {
154 m_Multiplicities.push_back(inMultiplicity);
173 void PrintYieldsLatex(std::string filename =
"Yield.dat", std::string name =
"A+A");
175 void PrintYieldsLatexAll(std::string filename =
"Yield.dat", std::string name =
"A+A",
bool asymm =
false);
179 void PrintFitLog(std::string filename =
"", std::string comment =
"Thermal fit",
bool asymm =
false);
217 void SetParameter(
const std::string & name,
double val,
double err,
double xmin,
double xmax) { m_Parameters.
SetParameter(name, val, err, xmin, xmax); }
259 const std::vector<ExperimentMultiplicity>&
Multiplicities()
const {
return m_Multiplicities; }
263 const std::vector<ExperimentRatio>&
Ratios()
const {
return m_Ratios; }
273 double&
Chi2() {
return m_Chi2; }
275 double&
BT() {
return m_BT; }
277 double&
QT() {
return m_QT; }
279 double&
ST() {
return m_ST; }
281 double&
CT() {
return m_CT; }
283 double&
ModelData(
int index) {
return m_ModelData[index]; }
289 int&
Ndf() {
return m_Ndf; }
293 void FixVcOverV(
bool fix) { m_FixVcToV = fix; }
309 void UseTkin(
bool YieldsAtTkin) { m_YieldsAtTkin = YieldsAtTkin; }
310 bool UseTkin()
const {
return m_YieldsAtTkin; }
327 static void saveExpDataToFile(
const std::vector<FittedQuantity> & outQuantities,
const std::string & filename);
330 static std::string GetCurrentTime();
332 static std::vector<FittedQuantity> loadExpDataFromFile_OldFormat(std::fstream & fin);
334 static std::vector<FittedQuantity> loadExpDataFromFile_NewFormat(std::fstream & fin);
340 std::vector<ExperimentMultiplicity> m_Multiplicities;
341 std::vector<ExperimentRatio> m_Ratios;
342 std::vector<FittedQuantity> m_Quantities;
349 std::vector<double> m_ModelData;
355 bool m_SahaForNuclei;
356 bool m_PCEFreezeLongLived;
357 double m_PCEWidthCut;
Abstract base class for an HRG model implementation.
void Increment()
Used by MINUIT.
void SetVcOverV(double VcOverV)
void SetRatios(const std::vector< ExperimentRatio > &inRatios)
const std::vector< ExperimentRatio > & Ratios() const
void UseSahaForNuclei(bool UseSaha)
Sets whether the nuclear abundances are evaluated in PCE using the Saha equation. ...
int ModelDataSize() const
void SetSBConstraint(double SB)
Class implementing HRG in partial chemical equilibrium.
void ClearData()
Clear the fitted data.
void PrintMultiplicities()
Contains structures describing the yields and ratios used in thermal fits.
bool ConstrainMuB() const
void SetPCEWidthCut(double WidthCut)
Sets the resonance width cut for freezeing the yields of long-lived resonances.
FittedQuantityType type
Whether it is a yield (multiplicity) or a ratio.
void AddData(const std::vector< FittedQuantity > &inData)
Add more data to fit.
void SetParameter(const std::string &name, const FitParameter ¶m)
Sets the fit parameter with a given name.
void AddRatio(const ExperimentRatio &inRatio)
void ClearMultiplicities()
void SetQuantities(const std::vector< FittedQuantity > &inQuantities)
Same as SetData()
void ClearQuantities()
Same as ClearData()
const ThermalModelFitParametersExtended & ExtendedParameters() const
Structure describing the measurement to be fitted or compared to model.
~ThermalModelFit(void)
Destroy the Thermal Model Fit object.
ThermalModelBase * model()
void UseTkin(bool YieldsAtTkin)
Sets whether the yields should be evaluated at Tkin using partial chemical equilibrium.
void AddRatios(const std::vector< ExperimentRatio > &inRatios)
void AddMultiplicities(const std::vector< ExperimentMultiplicity > &inMultiplicities)
void PrintYieldsLatex(std::string filename="Yield.dat", std::string name="A+A")
void SetQoverB(double QB)
The electric-to-baryon charge ratio to be used to constrain the electric chemical potential...
Contains some extra mathematical functions used in the code.
void AddMultiplicity(const ExperimentMultiplicity &inMultiplicity)
Class implementing the thermal model fit procedure.
void PrintFitLog(std::string filename="", std::string comment="Thermal fit", bool asymm=false)
Prints the result of the fitting procedure to a file.
ExperimentMultiplicity mult
The yield data. Used if type is FittedQuantityType::Multiplicity.
void SetParameters(const ThermalModelFitParameters ¶ms)
Sets the fit parameters.
ExperimentRatio ratio
The ratio data. Used if type is FittedQuantityType::Ratio.
Structure containing the experimental ratio of yields to be fitted.
void PCEFreezeLongLived(bool FreezeLongLived)
Sets whether the yields of long-lived resonance are frozen in the PCE.
ThermalModelFit(ThermalModelBase *model)
Construct a new ThermalModelFit object.
const std::vector< ExperimentMultiplicity > & Multiplicities() const
Extended structure for calculating uncertainties in non-fit quantities resulting from uncertanties in...
const ThermalModelFitParameters & Parameters() const
double & ModelData(int index)
ThermalModelPCE * modelpce()
void SetParameterFitFlag(const std::string &name, bool toFit)
Sets whether the fit parameter with a given name is fitted.
int GetNdf() const
Number of degrees of freedom in the fit.
void SetParameterFitFlag(const std::string &name, bool toFit)
Set whether the FitParameter with a given name should be fitted.
Structure holding information about parameters of a thermal fit.
Structure for an arbitrary fit parameter.
bool ConstrainMuQ() const
void SetSoverB(double SB)
The entropy per baryon ratio to be used to constrain the baryon chemical potential.
void PrintYieldsTable2(std::string filename="Yield.dat")
void SetData(const std::vector< FittedQuantity > &inData)
Sets the data to fit.
void PrintYieldsLatexAll(std::string filename="Yield.dat", std::string name="A+A", bool asymm=false)
void AddQuantities(const std::vector< FittedQuantity > &inQuantities)
Same as AddData()
static std::vector< FittedQuantity > loadExpDataFromFile(const std::string &filename)
Load the experimental data from a file.
void SetQBConstraint(double QB)
void SetParameterValue(const std::string &name, double value)
Set the value of the FitParameter with a given name.
void SetMultiplicities(const std::vector< ExperimentMultiplicity > &inMultiplicities)
static void saveExpDataToFile(const std::vector< FittedQuantity > &outQuantities, const std::string &filename)
ThermalModelFitParameters PerformFit(bool verbose=true, bool AsymmErrors=false)
The thermal fit procedure.
void AddQuantity(const FittedQuantity &inQuantity)
Same as AddDataPoint()
void PrintYieldsTable(std::string filename="Yield.dat")
void SetFitFlag(const std::string &name, bool flag)
Set whether FitParameter with a given name should be fitted.
const std::vector< FittedQuantity > & FittedQuantities() const
Return a vector of the fitted quantities (data)
void PrintParameters()
Print function.
void AddDataPoint(const FittedQuantity &inDataPoint)
Add one more data point to fit.
Structure containing the experimental yield (multiplicity) to be fitted.
The main namespace where all classes and functions of the Thermal-FIST library reside.
void SetParameter(const std::string &name, double val, double err, double xmin, double xmax)
Sets the fit parameter with a given name.
void SetParameter(const std::string &name, const FitParameter ¶m)
Set the FitParameter with a given name from a copy.
void SetParameterValue(const std::string &name, double value)
Sets the (initial) value for the fit parameter with a given name.
std::pair< double, double > ModelDescriptionAccuracy() const
Returns a relative error of the data description (and its uncertainty estimate)