Thermal-FIST 1.5
Package for hadron resonance gas model applications
Loading...
Searching...
No Matches
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
20namespace thermalfist {
21
29 template <typename T>
30 std::string to_string_fix(T value)
31 {
32 //create an output string stream
33 std::ostringstream os;
34
35 //throw the value into the string stream
36 os << value;
37
38 //convert the string stream into a string and return
39 return os.str();
40 }
41
51 std::vector<double> LorentzBoost(const std::vector<double>& fourvector, double vx, double vy, double vz);
52
121
124 {
125 public:
128
130 virtual ~EventGeneratorBase();
131
133 virtual void SetMomentumGenerators() {}
134
137
145 virtual std::pair< std::vector<int>, double > SampleYields() const;
146
153 virtual SimpleParticle SampleParticle(int id) const;
154
163 virtual SimpleParticle SampleParticleByPdg(long long pdgid) const;
164
175 virtual SimpleEvent SampleMomenta(const std::vector<int>& yields) const;
176
191 virtual SimpleEvent SampleMomentaWithShuffle(const std::vector<int>& yields) const;
192
203 virtual SimpleEvent GetEvent(bool PerformDecays = true) const;
204
213 DecayerFlags(bool in_propagateParticles = false) :
214 propagateParticles(in_propagateParticles)
215 {}
216 };
217
226 static SimpleEvent PerformDecays(const SimpleEvent& evtin, const ThermalParticleSystem* TPS, const DecayerFlags& decayerFlags = DecayerFlags());
227
233 virtual std::vector<double> GCEMeanYields() const;
234
238
244 void SetVolume(double V);
245
251 void RescaleCEMeans(double Vmod);
252
257
258
259 double ComputeWeight(const std::vector<int>& totals) const;
260 double ComputeWeightNew(const std::vector<int>& totals) const;
261
262 void SetEVUseSPR(bool EVfastmode) { m_Config.fUseEVUseSPRApproximation = EVfastmode; }
263 bool EVUseSPR() const { return m_Config.fUseEVUseSPRApproximation; }
264
266
269
270 protected:
280 const EventGeneratorConfiguration& config);
281
282
285 void PrepareMultinomials();
286
290 std::vector<int> GenerateTotals() const;
291
295 std::vector<int> GenerateTotalsGCE() const;
296
303 std::vector<int> GenerateTotalsCE() const;
304
311 std::vector<int> GenerateTotalsSCE() const;
312
319 std::vector<int> GenerateTotalsSCESubVolume(double VolumeSC) const;
320
327 std::vector<int> GenerateTotalsCCE() const;
328
335 std::vector<int> GenerateTotalsCCESubVolume(double VolumeSC) const;
336
339
341 std::vector<double> m_DensitiesIdeal;
342
344 std::vector<RandomGenerators::ParticleMomentumGenerator*> m_MomentumGens;
345
348 std::vector<RandomGenerators::ThermalBreitWignerGenerator*> m_BWGens;
349
352 virtual void SetParameters();
353
354 std::vector<std::vector<double>> ComputeEVRadii() const;
355
356 bool CheckEVOverlap(const std::vector<SimpleParticle>& evt,
357 const SimpleParticle& cand,
358 const std::vector<int>& ids = std::vector<int>(),
359 const std::vector<std::vector<double>>& radii = std::vector<std::vector<double>>()
360 ) const;
361
362 private:
363
365 //static SimpleEvent PerformDecaysAlternativeWay(const SimpleEvent& evtin, ThermalParticleSystem* TPS);
366
368
369 std::vector< std::pair<double, int> > m_Baryons;
370 std::vector< std::pair<double, int> > m_AntiBaryons;
371 std::vector< std::pair<double, int> > m_StrangeMesons;
372 std::vector< std::pair<double, int> > m_AntiStrangeMesons;
373 std::vector< std::pair<double, int> > m_ChargeMesons;
374 std::vector< std::pair<double, int> > m_AntiChargeMesons;
375 std::vector< std::pair<double, int> > m_CharmMesons;
376 std::vector< std::pair<double, int> > m_AntiCharmMesons;
377 std::vector< std::pair<double, int> > m_CharmAll;
378 std::vector< std::pair<double, int> > m_AntiCharmAll;
379
380 std::vector<double> m_BaryonsProbs;
381 std::vector<double> m_AntiBaryonsProbs;
382 std::vector<double> m_StrangeMesonsProbs;
383 std::vector<double> m_AntiStrangeMesonsProbs;
384 std::vector<double> m_ChargeMesonsProbs;
385 std::vector<double> m_AntiChargeMesonsProbs;
386 std::vector<double> m_CharmMesonsProbs;
387 std::vector<double> m_AntiCharmMesonsProbs;
388 std::vector<double> m_CharmAllProbs;
389 std::vector<double> m_AntiCharmAllProbs;
391
392 double m_MeanB, m_MeanAB;
393 double m_MeanSM, m_MeanASM;
394 double m_MeanCM, m_MeanACM;
395 double m_MeanCHRMM, m_MeanACHRMM;
396 double m_MeanCHRM, m_MeanACHRM;
397
398 std::vector<std::vector<double>> m_Radii;
399
400 static double m_LastWeight;
401 static double m_LastLogWeight;
402 static double m_LastNormWeight;
403 };
404
405} // namespace thermalfist
406
407#endif
std::vector< std::vector< double > > ComputeEVRadii() const
virtual std::vector< double > GCEMeanYields() const
The grand-canonical mean yields.
virtual SimpleParticle SampleParticleByPdg(long long pdgid) const
Samples the position and momentum of a particle species with given pdg code.
std::vector< RandomGenerators::ThermalBreitWignerGenerator * > m_BWGens
std::vector< int > GenerateTotalsSCESubVolume(double VolumeSC) const
static SimpleEvent PerformDecays(const SimpleEvent &evtin, const ThermalParticleSystem *TPS, const DecayerFlags &decayerFlags=DecayerFlags())
Performs decays of all unstable particles until only stable ones left.
const EventGeneratorConfiguration & GetConfiguration() const
virtual std::pair< std::vector< int >, double > SampleYields() const
Samples the primordial yields for each particle species.
virtual SimpleEvent GetEvent(bool PerformDecays=true) const
Generates a single event.
std::vector< RandomGenerators::ParticleMomentumGenerator * > m_MomentumGens
Vector of momentum generators for each particle species.
bool CheckEVOverlap(const std::vector< SimpleParticle > &evt, const SimpleParticle &cand, const std::vector< int > &ids=std::vector< int >(), const std::vector< std::vector< double > > &radii=std::vector< std::vector< double > >()) const
virtual SimpleParticle SampleParticle(int id) const
Samples the position and momentum of a particle species i.
void ClearMomentumGenerators()
Clears the momentum generators for all particles.
EventGeneratorConfiguration m_Config
virtual void SetMomentumGenerators()
Sets the momentum generators for all particles. Overloaded.
std::vector< int > GenerateTotalsCCESubVolume(double VolumeSC) const
virtual void CheckSetParameters()
Sets the hypersurface parameters.
double ComputeWeight(const std::vector< int > &totals) const
std::vector< double > m_DensitiesIdeal
Ideal gas densities used for sampling an interacting HRG.
virtual SimpleEvent SampleMomenta(const std::vector< int > &yields) const
Samples the momenta of the particles and returns the sampled list of particles as an event.
std::vector< int > GenerateTotalsGCE() const
std::vector< int > GenerateTotalsSCE() const
std::vector< int > GenerateTotalsCE() const
void SetConfiguration(ThermalParticleSystem *TPS, const EventGeneratorConfiguration &config)
Sets the event generator configuration.
double ComputeWeightNew(const std::vector< int > &totals) const
ThermalModelBase * ThermalModel()
Pointer to an underlying GCE Thermal Model.
std::vector< int > GenerateTotals() const
std::vector< int > GenerateTotalsCCE() const
virtual SimpleEvent SampleMomentaWithShuffle(const std::vector< int > &yields) const
Samples the momenta of the particles and returns the sampled list of particles as an event.
void SetVolume(double V)
Set system volume.
void RescaleCEMeans(double Vmod)
Rescale the precalculated GCE means.
virtual void SetParameters()
Sets up the event generator ready for production.
Abstract base class for an HRG model implementation.
Class containing the particle list.
The main namespace where all classes and functions of the Thermal-FIST library reside.
Definition CosmicEoS.h:9
std::string to_string_fix(T value)
Converts a value to a string.
std::vector< double > LorentzBoost(const std::vector< double > &fourvector, double vx, double vy, double vz)
Performs a Lorentz boost on a four-vector.
DecayerFlags(bool in_propagateParticles=false)
Structure containing the thermal event generator configuration.
Ensemble fEnsemble
The statistical ensemble used.
int B
The total values of conserved charges in the CE.
bool fUseEVRejectionMultiplicity
Whether to use rejection sampling instead of importance sampling for the EV multiplicity sampling.
std::vector< double > fPCEChems
PCE chemical potentials.
int RealGasExcludedVolumePrescription
The type of generalized excluded volume model prescription.
bool fUseEVUseSPRApproximation
Whether to use the SPR (single-particle rejection) approximation for the EV effects in coordinate spa...
std::vector< std::vector< double > > bij
The matrix of excluded volume coefficients .
ThermalModelParameters CFOParameters
The chemical freeze-out parameters.
bool CanonicalB
Mixed-canonical configuration (full canonical by default)
Ensemble
Enumerates the statistical ensembles.
ModelType fModelType
The type of interaction model.
bool fUsePCE
Whether partial chemical equilibrium (PCE) is used.
bool fUseEVRejectionCoordinates
Whether to use rejection sampling in the coordinate space to model EV effects.
std::vector< std::vector< double > > aij
The matrix of van der Waals attraction coefficients .
ModelType
Enumerates the different interaction models.
@ MeanFieldEV
Excluded-volume in the thermodynamic mean field approach (currently not used)
@ CrosstermsEV
Crossterms excluded-volume.
bool fUseGCEConservedCharges
Whether to calculate total conserved charge values from GCE.
Structure holding information about a single event in the event generator.
Definition SimpleEvent.h:20
Structure holding information about a single particle in the event generator.
Structure containing all thermal parameters of the model.
Contains some extra mathematical functions used in the code.