PYTHIA  8.316
ThermalFragmentation.h
1 // ThermalFragmerntation.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2025 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // This file contains helper classes for thermal fragmentation.
7 // ThermalStringFlav is used to select quark and hadron flavours.
8 // ThermalStringPT is used to select transverse momenta.
9 // ThermalStringEnd described fragmentation from one end of the string.
10 // ThermalFragmentation is the top-level class for this model.
11 
12 #ifndef Pythia8_ThermalFragmentation_H
13 #define Pythia8_ThermalFragmentation_H
14 
15 #include "Pythia8/FragmentationModel.h"
16 #include "Pythia8/MiniStringFragmentation.h"
17 #include "Pythia8/StringFragmentation.h"
18 
19 namespace Pythia8 {
20 
21 //==========================================================================
22 
23 // The ThermalStringFlav class is used to select quark and hadron flavours.
24 
25 class ThermalStringFlav : public StringFlav {
26 
27 public:
28 
29  // Constructor.
30  ThermalStringFlav() : mesonNonetL1(), temperature(), tempPreFactor(),
31  nNewQuark(), mesMixRate1(), mesMixRate2(), mesMixRate3(),
32  baryonOctWeight(), baryonDecWeight(), hadronConstIDs(), possibleHadrons(),
33  possibleRatePrefacs(), possibleHadronsLast(), possibleRatePrefacsLast(),
34  hadronIDwin(), quarkIDwin(), hadronMassWin() {}
35 
36  // Destructor.
38 
39  // Initialize data members.
40  void init() override;
41 
42  // Pick a new flavour (including diquarks) given an incoming one.
44  double pT, double kappaModifier, bool allowPop) override;
45 
46  // Return chosen hadron in case of thermal model.
47  virtual int getHadronIDwin() { return hadronIDwin; }
48 
49  // Return hadron mass. Used one if present, pick otherwise.
50  double getHadronMassWin(int idHad) override { return
51  ((hadronMassWin < 0.0) ? particleDataPtr->mSel(idHad) : hadronMassWin); }
52 
53  // Combine two flavours into hadron for last two remaining flavours
54  // for thermal model.
56  double pT, double kappaModifier);
57 
58  // Return already set hadron id or combination of the two flavours.
59  int getHadronID(FlavContainer& flav1, FlavContainer& flav2, double pT = -1.0,
60  double kappaModifier = -1.0, bool finalTwo = false) override {
61  if (finalTwo) return combineLastThermal(flav1, flav2, pT, kappaModifier);
62  if ( (hadronIDwin != 0) && (quarkIDwin != 0)) return getHadronIDwin();
63  return combine(flav1, flav2); }
64 
65  // Check if quark-diquark combination should be added. If so add.
66  void addQuarkDiquark(vector< pair<int,int> >& quarkCombis,
67  int qID, int diqID, int hadronID) {
68  bool allowed = true;
69  for (int iCombi = 0; iCombi < int(quarkCombis.size()); iCombi++)
70  if ( (qID == quarkCombis[iCombi].first ) &&
71  (diqID == quarkCombis[iCombi].second) ) allowed = false;
72  if (allowed) quarkCombis.push_back( (hadronID > 0) ?
73  make_pair( qID, diqID) : make_pair(-qID, -diqID) ); }
74 
75 protected:
76 
77  // Settings for thermal model.
79  double temperature, tempPreFactor;
80  int nNewQuark;
81  double mesMixRate1[2][6], mesMixRate2[2][6], mesMixRate3[2][6];
82  double baryonOctWeight[6][6][6][2], baryonDecWeight[6][6][6][2];
83 
84  // Key = hadron id, value = list of constituent ids.
85  map< int, vector< pair<int,int> > > hadronConstIDs;
86  // Key = initial (di)quark id, value = list of possible hadron ids
87  // + nr in hadronConstIDs.
88  map< int, vector< pair<int,int> > > possibleHadrons;
89  // Key = initial (di)quark id, value = prefactor to multiply rate.
90  map< int, vector<double> > possibleRatePrefacs;
91  // Similar, but for combining the last two (di)quarks. Key = (di)quark pair.
92  map< pair<int,int>, vector< pair<int,int> > > possibleHadronsLast;
93  map< pair<int,int>, vector<double> > possibleRatePrefacsLast;
94 
95  // Selection in thermal model.
96  int hadronIDwin, quarkIDwin;
97  double hadronMassWin;
98 
99 };
100 
101 //==========================================================================
102 
103 // The ThermalStringPT class is used to select transverse momenta.
104 
105 class ThermalStringPT : public StringPT {
106 
107 public:
108 
109  // Constructor.
110  ThermalStringPT() : temperature(), tempPreFactor(), fracSmallX() {}
111 
112  // Destructor.
114 
115  // Initialize data members.
116  void init() override;
117 
118  // Return px and py as a pair.
119  pair<double, double> pxy(int idIn = 0, double kappaModifier = -1.0) override;
120 
121  // Exponential suppression of given pT2; used in MiniStringFragmentation.
122  double suppressPT2(double pT2) override {
123  return exp(-sqrt(pT2)/temperature); }
124 
125 protected:
126 
127  // Initialization data, to be read from Settings.
128  double temperature, tempPreFactor, fracSmallX;
129 
130 private:
131 
132  // Evaluate Bessel function K_{1/4}(x).
133  double BesselK14(double x);
134 
135 };
136 
137 //==========================================================================
138 
139 // The ThermalFragmentation class handles the alternative fragmentation,
140 // using both the StringFragmentation and MiniStringFragmentation classes.
141 
143 
144 public:
145 
146  // Constructor (creates string, string-end and mini-string pointers).
148 
149  // Destructor (deletes string, string-end and mini-string pointers).
150  ~ThermalFragmentation() override;
151 
152  // Initialize and save pointers.
153  bool init(StringFlav* flavSelPtrIn = nullptr,
154  StringPT* pTSelPtrIn = nullptr, StringZ* zSelPtrIn = nullptr,
155  FragModPtr fragModPtrIn = nullptr) override;
156 
157  // Do the fragmentation: driver routine.
158  bool fragment(int iSub, ColConfig& colConfig, Event& event,
159  bool isDiff = false, bool systemRecoil = true) override;
160 
161  // Classes for flavour, pT and z generation.
162  ThermalStringFlav* thermalFlavSelPtr{};
163  ThermalStringPT* thermalPTSelPtr{};
164  StringZ* zSelPtr{};
165 
166  // Internal StringFragmentation and MiniStringFragmentation objects.
167  StringFragmentation* stringFragPtr{};
168  MiniStringFragmentation* ministringFragPtr{};
169 
170 private:
171 
172  // Parameters controlling the fragmentation.
173  double mStringMin{};
174  bool tryMiniAfterFailedFrag{};
175 
176 };
177 
178 //==========================================================================
179 
180 } // end namespace Pythia8
181 
182 #endif // Pythia8_ThermalFragmentation_H
virtual int combine(FlavContainer &flav1, FlavContainer &flav2)
Combine two flavours (including diquarks) to produce a hadron.
Definition: FragmentationFlavZpT.cc:300
double suppressPT2(double pT2) override
Exponential suppression of given pT2; used in MiniStringFragmentation.
Definition: ThermalFragmentation.h:122
The Event class holds all info on the generated event.
Definition: Event.h:408
void addQuarkDiquark(vector< pair< int, int > > &quarkCombis, int qID, int diqID, int hadronID)
Check if quark-diquark combination should be added. If so add.
Definition: ThermalFragmentation.h:66
map< int, vector< pair< int, int > > > possibleHadrons
Definition: ThermalFragmentation.h:88
map< int, vector< pair< int, int > > > hadronConstIDs
Key = hadron id, value = list of constituent ids.
Definition: ThermalFragmentation.h:85
The StringPT class is used to select select transverse momenta.
Definition: FragmentationFlavZpT.h:284
Definition: StringFragmentation.h:106
~ThermalStringPT()
Destructor.
Definition: ThermalFragmentation.h:113
void init() override
Initialize data members.
Definition: ThermalFragmentation.cc:21
int hadronIDwin
Selection in thermal model.
Definition: ThermalFragmentation.h:96
~ThermalStringFlav()
Destructor.
Definition: ThermalFragmentation.h:37
ParticleData * particleDataPtr
Pointer to the particle data table.
Definition: PhysicsBase.h:88
double temperature
Initialization data, to be read from Settings.
Definition: ThermalFragmentation.h:128
The StringZ class is used to sample the fragmentation function f(z).
Definition: FragmentationFlavZpT.h:219
FlavContainer pick(FlavContainer &flavOld, double pT, double kappaModifier, bool allowPop) override
Pick a new flavour (including diquarks) given an incoming one.
Definition: ThermalFragmentation.cc:562
virtual int getHadronIDwin()
Return chosen hadron in case of thermal model.
Definition: ThermalFragmentation.h:47
int getHadronID(FlavContainer &flav1, FlavContainer &flav2, double pT=-1.0, double kappaModifier=-1.0, bool finalTwo=false) override
Return already set hadron id or combination of the two flavours.
Definition: ThermalFragmentation.h:59
The ThermalStringPT class is used to select transverse momenta.
Definition: ThermalFragmentation.h:105
int combineLastThermal(FlavContainer &flav1, FlavContainer &flav2, double pT, double kappaModifier)
Definition: ThermalFragmentation.cc:673
The ColConfig class describes the colour configuration of the whole event.
Definition: FragmentationSystems.h:60
Definition: FragmentationFlavZpT.h:33
FragmentationModel is the base class for handling fragmentation algorithms.
Definition: FragmentationModel.h:28
ThermalStringPT()
Constructor.
Definition: ThermalFragmentation.h:110
ThermalStringFlav()
Constructor.
Definition: ThermalFragmentation.h:30
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
bool mesonNonetL1
Settings for thermal model.
Definition: ThermalFragmentation.h:78
The StringFlav class is used to select quark and hadron flavours.
Definition: FragmentationFlavZpT.h:76
map< pair< int, int >, vector< pair< int, int > > > possibleHadronsLast
Similar, but for combining the last two (di)quarks. Key = (di)quark pair.
Definition: ThermalFragmentation.h:92
double getHadronMassWin(int idHad) override
Return hadron mass. Used one if present, pick otherwise.
Definition: ThermalFragmentation.h:50
The ThermalStringFlav class is used to select quark and hadron flavours.
Definition: ThermalFragmentation.h:25
Definition: ThermalFragmentation.h:142
Definition: MiniStringFragmentation.h:22
map< int, vector< double > > possibleRatePrefacs
Key = initial (di)quark id, value = prefactor to multiply rate.
Definition: ThermalFragmentation.h:90