Thermal-FIST 1.5
Package for hadron resonance gas model applications
Loading...
Searching...
No Matches
BagModelFit.cpp
Go to the documentation of this file.
1/*
2 * Thermal-FIST package
3 *
4 * Copyright (c) 2014-2018 Volodymyr Vovchenko
5 *
6 * GNU General Public License (GPLv3 or later)
7 */
8#include <string.h>
9#include <fstream>
10#include <iostream>
11#include <iomanip>
12#include <ctime>
13#include <cstdio>
14
15#include "HRGBase.h"
16#include "HRGEV.h"
17#include "HRGFit.h"
18
19#include "ThermalFISTConfig.h"
20
21using namespace std;
22
23#ifdef ThermalFIST_USENAMESPACE
24using namespace thermalfist;
25#endif
26
27// Fits within the excluded-volume HRG in a bag model scaling, as in 1512.08046
28// First does the global fit
29// Then computes the chi2 profile
30// Usage: BagModelFit <rp> <Tmin> <Tmax> <dT>
31int main(int argc, char *argv[])
32{
33 // Proton radius
34 double radProton = 0.50;
35 if (argc>1)
36 radProton = atof(argv[1]);
37
38 // Minimum temperature for chi2 profile calculation [GeV]
39 double Tmin = 0.100;
40 if (argc>2)
41 Tmin = atof(argv[2]);
42
43 // Maximum temperature for chi2 profile calculation [GeV]
44 double Tmax = 0.301;
45 if (argc>3)
46 Tmax = atof(argv[3]);
47
48 // Step in temperature for chi2 profile calculation [GeV]
49 double dT = 0.001;
50 if (argc>4)
51 dT = atof(argv[4]);
52
53 // Create the hadron list instance and read the list from file
54 ThermalParticleSystem TPS(string(ThermalFIST_INPUT_FOLDER) + "/list/thermus23/list.dat");
55 //ThermalParticleSystem TPS(string(ThermalFIST_INPUT_FOLDER) + "/list/PDG2014/list.dat");
56
57 // Create the EV-HRG ThermalModel instance
58 ThermalModelEVDiagonal model(&TPS);
59
60 // Use finite resonance widths (energy-independent Breit-Wigner)
62
63 // Include quantum statistics
64 model.SetStatistics(true);
65
66 // All chemical potentials are zero
71
72 // Loop over all particles and set their EV parameters in accordance with the bag model
73 for (int i = 0; i < model.TPS()->Particles().size(); ++i) {
74 const ThermalParticle &part = model.TPS()->Particles()[i];
75 double mass = part.Mass(); // Mass of particle i
76 double rad = radProton * pow(mass / xMath::mnucleon(), 1. / 3.); // Radius parameter of particle i
77 model.SetRadius(i, rad); // Sets the radius
78 }
79
80 // Load the experimental data
81 vector<FittedQuantity> quantities = ThermalModelFit::loadExpDataFromFile(string(ThermalFIST_INPUT_FOLDER) + "/data/ALICE-PbPb2.76TeV-0-5-1512.08046.dat");
82
83
84 // Global fit
85 ThermalModelFit pfit(&model);
86
87 // By default T, muB, and R parameters are fitted, while others (gammaS etc.) are fixed
88 // Initial parameters values are taken from those currently set in a ThermalModel object
89 // Here we do not fit muB, which is set to zero
90 pfit.SetParameterFitFlag("muB", false); // Do not fit muB
91
92 // R is fitted by default
93 // We can still specify the initial value, the initial delta used by minuit,
94 // and the lower and upper limits using the SetParameter function
95 double Rinit = 10.0;
96 double Rdelta = 1.0;
97 double Rmin = 0.0;
98 double Rmax = 30.0;
99 pfit.SetParameter("R", Rinit, Rdelta, Rmin, Rmax);
100
101 pfit.SetQuantities(quantities); // Provide the data to be fitted
102
103 pfit.PerformFit(); // Performs the fit
104 pfit.PrintFitLog(); // Print the fit result
105
106
107 // Now perform the chi-square profile scan
108 printf("%15s%15s%15s\n", "T [GeV]", "R [fm]", "chi2");
109 pfit.SetParameterFitFlag("T", false); // We are not fitting T anymore
110
111 // Iterate over all the T values
112 for (double T = Tmin; T <= Tmax; T += dT) {
113 pfit.SetParameterValue("T", T); // Set the temperature
114 ThermalModelFitParameters result = pfit.PerformFit(false); // We still have to fit the radius, the argument suppresses the output during minimization
115 printf("%15lf%15lf%15lf\n", T, result.R.value, result.chi2);
116 }
117
118 return 0;
119}
120
121
int main(int argc, char *argv[])
void SetUseWidth(bool useWidth)
Sets whether finite resonance widths are used. Deprecated.
virtual void SetBaryonChemicalPotential(double muB)
Set the baryon chemical potential.
virtual void SetElectricChemicalPotential(double muQ)
Set the electric chemical potential.
virtual void SetStrangenessChemicalPotential(double muS)
Set the strangeness chemical potential.
virtual void SetCharmChemicalPotential(double muC)
Set the charm chemical potential.
virtual void SetStatistics(bool stats)
Class implementing the diagonal excluded-volume model.
void SetRadius(double rad)
Set the same excluded volume radius parameter for all species.
Class implementing the thermal model fit procedure.
void SetParameter(const std::string &name, const FitParameter &param)
Sets 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.
void PrintFitLog(std::string filename="", std::string comment="Thermal fit", bool asymm=false)
Prints the result of the fitting procedure to a file.
void SetQuantities(const std::vector< FittedQuantity > &inQuantities)
Same as SetData()
static std::vector< FittedQuantity > loadExpDataFromFile(const std::string &filename)
Load the experimental data from a file.
void SetParameterValue(const std::string &name, double value)
Sets the (initial) value for the fit parameter with a given name.
ThermalModelFitParameters PerformFit(bool verbose=true, bool AsymmErrors=false)
The thermal fit procedure.
Class containing all information about a particle specie.
double Mass() const
Particle's mass [GeV].
@ BWTwoGamma
Energy-independent Breit-Wigner in +-2\Gamma interval.
Class containing the particle list.
constexpr double mnucleon()
Nucleon's mass. Value as in UrQMD.
Definition xMath.h:34
The main namespace where all classes and functions of the Thermal-FIST library reside.
Definition CosmicEoS.h:9
Structure holding information about parameters of a thermal fit.