Thermal-FIST  1.3
Package for hadron resonance gas model applications
EventGeneratorBase.h
Go to the documentation of this file.
1 /*
2  * Thermal-FIST package
3  *
4  * Copyright (c) 2014-2019 Volodymyr Vovchenko
5  *
6  * GNU General Public License (GPLv3 or later)
7  */
8 #ifndef EVENTGENERATORBASE_H
9 #define EVENTGENERATORBASE_H
10 
11 
12 #include <sstream>
13 
17 #include "HRGBase/xMath.h"
19 
20 namespace thermalfist {
21 
22  template <typename T>
23  std::string to_string_fix(T value)
24  {
25  //create an output string stream
26  std::ostringstream os;
27 
28  //throw the value into the string stream
29  os << value;
30 
31  //convert the string stream into a string and return
32  return os.str();
33  }
34 
38  enum Ensemble {
39  GCE,
40  CE,
41  SCE,
42  CCE
43  };
44 
46  enum ModelType {
52  };
53 
56 
59 
62 
64  int B, Q, S, C;
65 
67  bool CanonicalB;
68  bool CanonicalQ;
69  bool CanonicalS;
70  bool CanonicalC;
71 
73  std::vector< std::vector<double> > bij;
74 
76  std::vector< std::vector<double> > aij;
77 
79  bool fUsePCE;
80 
82  std::vector<double> fPCEChems;
83 
86  };
87 
90  {
91  public:
93  EventGeneratorBase() { m_THM = NULL; fCEAccepted = fCETotal = 0; }
94 
96  virtual ~EventGeneratorBase();
97 
99  void ClearMomentumGenerators();
100 
102  void SetCollisionKineticEnergy(double ekin) {
103  SetCollisionCMSEnergy(sqrt(2.*xMath::mnucleon()*(ekin + 2. * xMath::mnucleon())));
104  }
105 
107  void SetCollisionLabEnergy(double elab) {
108  SetCollisionCMSEnergy(sqrt(2.*xMath::mnucleon()*(elab + xMath::mnucleon())));
109  }
110 
112  void SetCollisionCMSEnergy(double ssqrt) {
113  m_ssqrt = ssqrt;
114  m_ekin = m_ssqrt * m_ssqrt / 2. / xMath::mnucleon() - 2. * xMath::mnucleon();
115  m_elab = xMath::mnucleon() + m_ekin;
116  double plab = sqrt(m_elab*m_elab - xMath::mnucleon() * xMath::mnucleon());
117  m_ycm = 0.5 * log((m_elab + xMath::mnucleon() + plab) / (m_elab + xMath::mnucleon() - plab));
118  }
119 
121  //std::vector<Acceptance::AcceptanceFunction>& GetAcceptance() { return m_acc; }
122 
124  //virtual void ReadAcceptance(std::string accfolder);
125 
127  double getYcm() const { return m_ycm; }
128 
136  std::pair< std::vector<int>, double > SampleYields() const;
137 
148  virtual SimpleEvent SampleMomenta(const std::vector<int>& yields) const;
149 
160  virtual SimpleEvent GetEvent(bool PerformDecays = true) const;
161 
169  static SimpleEvent PerformDecays(const SimpleEvent& evtin, ThermalParticleSystem* TPS);
170 
171 
172 
175  static int fCEAccepted, fCETotal;
176 
182  void SetVolume(double V);
183 
189  void RescaleCEMeans(double Vmod);
190 
191 
192  protected:
201  void SetConfiguration(ThermalParticleSystem *TPS,
202  const EventGeneratorConfiguration& config);
203 
206  void PrepareMultinomials();
207 
211  std::vector<int> GenerateTotals() const;
212 
216  std::vector<int> GenerateTotalsGCE() const;
217 
224  std::vector<int> GenerateTotalsCE() const;
225 
232  std::vector<int> GenerateTotalsSCE() const;
233 
240  std::vector<int> GenerateTotalsSCESubVolume(double VolumeSC) const;
241 
248  std::vector<int> GenerateTotalsCCE() const;
249 
256  std::vector<int> GenerateTotalsCCESubVolume(double VolumeSC) const;
257 
260 
262  std::vector<double> m_DensitiesIdeal;
263 
265  std::vector<RandomGenerators::ParticleMomentumGenerator*> m_MomentumGens;
266 
269  std::vector<RandomGenerators::ThermalBreitWignerGenerator*> m_BWGens;
270 
271  private:
272 
274  //static SimpleEvent PerformDecaysAlternativeWay(const SimpleEvent& evtin, ThermalParticleSystem* TPS);
275 
276  double m_ekin, m_ycm, m_ssqrt, m_elab;
277  // Acceptance discontinued
278  //std::vector<Acceptance::AcceptanceFunction> m_acc;
279 
281  std::vector< std::pair<double, int> > m_Baryons;
283  std::vector< std::pair<double, int> > m_AntiBaryons;
284  std::vector< std::pair<double, int> > m_StrangeMesons;
285  std::vector< std::pair<double, int> > m_AntiStrangeMesons;
286  std::vector< std::pair<double, int> > m_ChargeMesons;
287  std::vector< std::pair<double, int> > m_AntiChargeMesons;
288  std::vector< std::pair<double, int> > m_CharmMesons;
289  std::vector< std::pair<double, int> > m_AntiCharmMesons;
290  std::vector< std::pair<double, int> > m_CharmAll;
291  std::vector< std::pair<double, int> > m_AntiCharmAll;
292 
293  std::vector<double> m_BaryonsProbs;
294  std::vector<double> m_AntiBaryonsProbs;
295  std::vector<double> m_StrangeMesonsProbs;
296  std::vector<double> m_AntiStrangeMesonsProbs;
297  std::vector<double> m_ChargeMesonsProbs;
298  std::vector<double> m_AntiChargeMesonsProbs;
299  std::vector<double> m_CharmMesonsProbs;
300  std::vector<double> m_AntiCharmMesonsProbs;
301  std::vector<double> m_CharmAllProbs;
302  std::vector<double> m_AntiCharmAllProbs;
304 
305  double m_MeanB, m_MeanAB;
306  double m_MeanSM, m_MeanASM;
307  double m_MeanCM, m_MeanACM;
308  double m_MeanCHRMM, m_MeanACHRMM;
309  double m_MeanCHRM, m_MeanACHRM;
310 
311  static double m_LastWeight;
312  static double m_LastLogWeight;
313  static double m_LastNormWeight;
314  };
315 
316 } // namespace thermalfist
317 
318 #endif
Abstract base class for an HRG model implementation.
std::vector< RandomGenerators::ParticleMomentumGenerator * > m_MomentumGens
Vector of momentum generators for each particle species.
bool fUsePCE
Whether partial chemical equilibrium (PCE) is used.
void SetCollisionCMSEnergy(double ssqrt)
Sets the center of mass energy of the collision.
ModelType
Enumerates the different interaction models.
Ensemble fEnsemble
The statistical ensemble used.
EventGeneratorConfiguration()
Default configuration.
Class containing the particle list.
void SetCollisionKineticEnergy(double ekin)
Sets the projectile laboratory kinetic energy per nucleon of the collision.
Structure containing the thermal event generator configuration.
std::vector< double > m_DensitiesIdeal
Ideal gas densities used for sampling an interacting HRG.
int B
The total values of conserved charges in the CE.
Structure holding information about a single event in the event generator.
Definition: SimpleEvent.h:19
Structure containing all thermal parameters of the model.
Contains some extra mathematical functions used in the code.
ModelType fModelType
The type of interaction model.
std::vector< double > fPCEChems
PCE chemical potentials.
std::vector< std::vector< double > > bij
The matrix of excluded volume coefficients .
Ensemble
Enumerates the statistical ensembles.
EventGeneratorConfiguration m_Config
Excluded-volume in the thermodynamic mean field approach (currently not used)
Base class for generating events with the Thermal Event Generator.
double getYcm() const
The y-pT acceptance map (not used by default).
bool CanonicalB
Mixed-canonical configuration (full canonical by default)
void SetCollisionLabEnergy(double elab)
Sets the projectile laboratory energy per nucleon of the collision.
ThermalModelParameters CFOParameters
The chemical freeze-out parameters.
std::vector< RandomGenerators::ThermalBreitWignerGenerator * > m_BWGens
std::vector< std::vector< double > > aij
The matrix of van der Waals attraction coefficients .
std::string to_string_fix(T value)
double mnucleon()
Nucleon&#39;s mass. Value as in UrQMD.
Definition: xMath.h:36
The main namespace where all classes and functions of the Thermal-FIST library reside.