Thermal-FIST  1.3
Package for hadron resonance gas model applications
ThermalModelFitParameters.cpp
Go to the documentation of this file.
1 /*
2  * Thermal-FIST package
3  *
4  * Copyright (c) 2019 Volodymyr Vovchenko
5  *
6  * GNU General Public License (GPLv3 or later)
7  */
9 
10 namespace thermalfist {
11 
13  {
14  T.value = model->Parameters().T;
15  muB.value = model->Parameters().muB;
16  muS.value = model->Parameters().muS;
17  muQ.value = model->Parameters().muQ;
18  muC.value = model->Parameters().muC;
19  gammaq.value = model->Parameters().gammaq;
20  gammaS.value = model->Parameters().gammaS;
21  gammaC.value = model->Parameters().gammaC;
22  //R.value = model->Parameters.R;
23  R.value = 0.;
24  Rc.value = 0.;
25  Tkin.value = model->Parameters().T;
26  nH.value = model->CalculateHadronDensity();
29  en.value = model->CalculateEnergyDensity();
31  pressure.value = model->CalculatePressure();
32  }
33 
35  {
36  T = FitParameter("T", true, params.T, 0.05, 0.02, 0.300);
37  muB = FitParameter("muB", true, params.muB, 0.05, -0.100, 0.900);
38  muS = FitParameter("muS", false, params.muS, 0.05, -0.450, 0.450);
39  muQ = FitParameter("muQ", false, params.muQ, 0.05, -0.130, 0.130);
40  muC = FitParameter("muC", false, params.muC);
41  gammaq = FitParameter("gammaq", false, params.gammaq, 0.5, 0.01, 3.);
42  gammaS = FitParameter("gammaS", false, params.gammaS, 0.5, 0.01, 3.);
43  gammaC = FitParameter("gammaC", false, params.gammaC, 0.5, 0.01, 50.);
44  //V = FitParameter("V", true, V_, 2000., 1., 20000.); // Volume no longer used
45  R = FitParameter("R", true, pow(3. * params.V / 16. / xMath::Pi(), 1. / 3.), 1.0, 0., 25.0);
46  Rc = FitParameter("Rc", true, pow(3. * params.SVc / 16. / xMath::Pi(), 1. / 3.), 1.0, 0., 10.0);
47  B = params.B;
48  Q = params.Q;
49  S = params.S;
50  C = params.C;
51 
52  Tkin = FitParameter("Tkin", false, params.T, 0.05, 0.02, 0.300);
53 
54  FillParameterList();
55  }
56 
58  GCE(op.GCE), T(op.T), muB(op.muB), muS(op.muS), muQ(op.muQ), muC(op.muC),
59  gammaq(op.gammaq), gammaS(op.gammaS), gammaC(op.gammaC), R(op.R), Rc(op.Rc),
60  Tkin(op.Tkin),
61  B(op.B), S(op.S), Q(op.Q), C(op.C), chi2(op.chi2), chi2ndf(op.chi2ndf),
62  ndf(op.ndf)
63  {
65  }
66 
68  {
69  GCE = op.GCE;
70  T = op.T;
71  muB = op.muB;
72  muS = op.muS;
73  muQ = op.muQ;
74  muC = op.muC;
75  gammaq = op.gammaq;
76  gammaS = op.gammaS;
77  gammaC = op.gammaC;
78  R = op.R;
79  Rc = op.Rc;
80  B = op.B;
81  S = op.S;
82  Q = op.Q;
83  C = op.C;
84  chi2 = op.chi2;
85  chi2ndf = op.chi2ndf;
86  ndf = op.ndf;
87 
88  Tkin = op.Tkin;
89 
91  return *this;
92  }
93 
95  {
96  ParameterList.clear();
97  ParameterList.push_back(&T);
98  ParameterList.push_back(&R);
99  ParameterList.push_back(&Rc);
100  ParameterList.push_back(&muB);
101  ParameterList.push_back(&muQ);
102  ParameterList.push_back(&muS);
103  ParameterList.push_back(&muC);
104  ParameterList.push_back(&gammaq);
105  ParameterList.push_back(&gammaS);
106  ParameterList.push_back(&gammaC);
107 
108  ParameterList.push_back(&Tkin);
109  }
110 
111  int ThermalModelFitParameters::IndexByName(const std::string & name) const
112  {
113  int ret = -1;
114  for (size_t i = 0; i < ParameterList.size(); ++i)
115  if (ParameterList[i]->name == name)
116  ret = i;
117  return ret;
118  }
119 
121  {
122  int ind = IndexByName(name);
123  if (ind != -1)
124  return *ParameterList[ind];
125  // return T by default
126  return T;
127  }
128 
130  {
131  int ind = IndexByName(name);
132  if (ind != -1)
133  return *ParameterList[ind];
134  // return T by default
135  return T;
136  }
137 
139  {
140  if (index >= 0 && index < static_cast<int>(ParameterList.size()))
141  return *ParameterList[index];
142  // return T by default
143  return T;
144  }
145 
147  {
148  if (index >= 0 && index < static_cast<int>(ParameterList.size()))
149  return *ParameterList[index];
150  // return T by default
151  return T;
152  }
153 
154  void ThermalModelFitParameters::SetParameter(const std::string & name, const FitParameter & param)
155  {
156  int ind = IndexByName(name);
157  if (ind != -1)
158  *ParameterList[ind] = param;
159  }
160 
161  void ThermalModelFitParameters::SetParameter(const std::string & name, double val, double err, double xmin, double xmax)
162  {
163  int ind = IndexByName(name);
164  if (ind != -1)
165  *ParameterList[ind] = FitParameter(name, ParameterList[ind]->toFit, val, err, xmin, xmax);
166  }
167 
168  void ThermalModelFitParameters::SetParameterValue(const std::string & name, double value)
169  {
170  int ind = IndexByName(name);
171  if (ind != -1)
172  ParameterList[ind]->value = value;
173  }
174 
175  void ThermalModelFitParameters::SetParameterFitFlag(const std::string & name, bool toFit)
176  {
177  int ind = IndexByName(name);
178  if (ind != -1)
179  ParameterList[ind]->toFit = toFit;
180  }
181 
183  {
185  ret.SVc = 4. / 3. * xMath::Pi() * Rc.value * Rc.value * Rc.value;
186  ret.gammaq = gammaq.value;
187  ret.muC = muC.value;
188  ret.gammaC = gammaC.value;
189  ret.B = B;
190  ret.Q = Q;
191  ret.S = S;
192  ret.C = C;
193  return ret;
194  }
195 
196 } // namespace thermalfist
Abstract base class for an HRG model implementation.
ThermalModelFitParameters(const ThermalModelParameters &params=ThermalModelParameters())
Default constructor.
FitParameter T
All the fit parameters.
int IndexByName(const std::string &name) const
Find the index of the parameter with a given name in the ParameterList.
double Pi()
Pi constant.
Definition: xMath.h:24
ThermalModelParameters GetThermalModelParameters()
Return ThermalModelParameters corresponding to the this ThermalModelFitParameters.
int ndf
Number of degrees of freedom.
Structure containing all thermal parameters of the model.
FitParameter GetParameter(const std::string &name) const
Get the FitParameter by its name.
virtual double CalculateEnergyDensity()=0
virtual double CalculateEntropyDensity()=0
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.
std::vector< FitParameter * > ParameterList
Vector of pointer to all the parameters.
Structure for an arbitrary fit parameter.
virtual double CalculatePressure()=0
Implementation of the equation of state functions.
void FillParameterList()
Fill ParameterList with pointers to all the parameters.
FitParameter Tkin
Since version 1.3: Kinetic freeze-out temperature.
ThermalModelFitParameters & operator=(const ThermalModelFitParameters &op)
Assignment operator.
void SetParameterValue(const std::string &name, double value)
Set the value of the FitParameter with a given name.
const ThermalModelParameters & Parameters() const
The main namespace where all classes and functions of the Thermal-FIST library reside.
void SetParameter(const std::string &name, const FitParameter &param)
Set the FitParameter with a given name from a copy.