Line data Source code
1 : // FragmentationFlavZpT.h is a part of the PYTHIA event generator.
2 : // Copyright (C) 2015 Torbjorn Sjostrand.
3 : // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
4 : // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 :
6 : // This file contains helper classes for fragmentation.
7 : // StringFlav is used to select quark and hadron flavours.
8 : // StringPT is used to select transverse momenta.
9 : // StringZ is used to sample the fragmentation function f(z).
10 :
11 : #ifndef Pythia8_FragmentationFlavZpT_H
12 : #define Pythia8_FragmentationFlavZpT_H
13 :
14 : #include "Pythia8/Basics.h"
15 : #include "Pythia8/ParticleData.h"
16 : #include "Pythia8/PythiaStdlib.h"
17 : #include "Pythia8/Settings.h"
18 :
19 : namespace Pythia8 {
20 :
21 : //==========================================================================
22 :
23 : // The FlavContainer class is a simple container for flavour,
24 : // including the extra properties needed for popcorn baryon handling.
25 : // id = current flavour.
26 : // rank = current rank; 0 for endpoint flavour and then increase by 1.
27 : // nPop = number of popcorn mesons yet to be produced (1 or 0).
28 : // idPop = (absolute sign of) popcorn quark, shared between B and Bbar.
29 : // idVtx = (absolute sign of) vertex (= non-shared) quark in diquark.
30 :
31 : class FlavContainer {
32 :
33 : public:
34 :
35 : // Constructor.
36 : FlavContainer(int idIn = 0, int rankIn = 0, int nPopIn = 0,
37 0 : int idPopIn = 0, int idVtxIn = 0) : id(idIn), rank(rankIn),
38 0 : nPop(nPopIn), idPop(idPopIn), idVtx(idVtxIn) {}
39 :
40 : // Overloaded equal operator.
41 0 : FlavContainer& operator=(const FlavContainer& flav) { if (this != &flav) {
42 0 : id = flav.id; rank = flav.rank; nPop = flav.nPop; idPop = flav.idPop;
43 0 : idVtx = flav.idVtx; } return *this; }
44 :
45 : // Invert flavour.
46 0 : FlavContainer& anti() {id = -id; return *this;}
47 :
48 : // Read in a container into another, without/with id sign flip.
49 : FlavContainer& copy(const FlavContainer& flav) { if (this != &flav) {
50 : id = flav.id; rank = flav.rank; nPop = flav.nPop; idPop = flav.idPop;
51 : idVtx = flav.idVtx; } return *this; }
52 0 : FlavContainer& anti(const FlavContainer& flav) { if (this != &flav) {
53 0 : id = -flav.id; rank = flav.rank; nPop = flav.nPop; idPop = flav.idPop;
54 0 : idVtx = flav.idVtx; } return *this; }
55 :
56 : // Check whether is diquark.
57 0 : bool isDiquark() {int idAbs = abs(id);
58 0 : return (idAbs > 1000 && idAbs < 10000 && (idAbs/10)%10 == 0);}
59 :
60 : // Stored properties.
61 : int id, rank, nPop, idPop, idVtx;
62 :
63 : };
64 :
65 : //==========================================================================
66 :
67 : // The StringFlav class is used to select quark and hadron flavours.
68 :
69 : class StringFlav {
70 :
71 : public:
72 :
73 : // Constructor.
74 0 : StringFlav() {}
75 :
76 : // Destructor.
77 0 : virtual ~StringFlav() {}
78 :
79 : // Initialize data members.
80 : virtual void init(Settings& settings, Rndm* rndmPtrIn);
81 :
82 : // Pick a light d, u or s quark according to fixed ratios.
83 0 : int pickLightQ() { double rndmFlav = probQandS * rndmPtr->flat();
84 0 : if (rndmFlav < 1.) return 1; if (rndmFlav < 2.) return 2; return 3; }
85 :
86 : // Pick a new flavour (including diquarks) given an incoming one.
87 : virtual FlavContainer pick(FlavContainer& flavOld);
88 :
89 : // Combine two flavours (including diquarks) to produce a hadron.
90 : virtual int combine(FlavContainer& flav1, FlavContainer& flav2);
91 :
92 : // Ditto, simplified input argument for simple configurations.
93 : virtual int combine( int id1, int id2, bool keepTrying = true) {
94 0 : FlavContainer flag1(id1); FlavContainer flag2(id2);
95 0 : for (int i = 0; i < 100; ++i) { int idNew = combine( flag1, flag2);
96 0 : if (idNew != 0 || !keepTrying) return idNew;} return 0;}
97 :
98 : // Assign popcorn quark inside an original (= rank 0) diquark.
99 : void assignPopQ(FlavContainer& flav);
100 :
101 : // Combine two quarks to produce a diquark.
102 : int makeDiquark(int id1, int id2, int idHad = 0);
103 :
104 : protected:
105 :
106 : // Pointer to the random number generator.
107 : Rndm* rndmPtr;
108 :
109 : private:
110 :
111 : // Constants: could only be changed in the code itself.
112 : static const int mesonMultipletCode[6];
113 : static const double baryonCGOct[6], baryonCGDec[6];
114 :
115 : // Initialization data, to be read from Settings.
116 : bool suppressLeadingB;
117 : double probQQtoQ, probStoUD, probSQtoQQ, probQQ1toQQ0, probQandQQ,
118 : probQandS, probQandSinQQ, probQQ1corr, probQQ1corrInv, probQQ1norm,
119 : probQQ1join[4], mesonRate[4][6], mesonRateSum[4], mesonMix1[2][6],
120 : mesonMix2[2][6], etaSup, etaPrimeSup, decupletSup, baryonCGSum[6],
121 : baryonCGMax[6], popcornRate, popcornSpair, popcornSmeson, scbBM[3],
122 : popFrac, popS[3], dWT[3][7], lightLeadingBSup, heavyLeadingBSup;
123 :
124 : };
125 :
126 : //==========================================================================
127 :
128 : // The StringZ class is used to sample the fragmentation function f(z).
129 :
130 : class StringZ {
131 :
132 : public:
133 :
134 : // Constructor.
135 0 : StringZ() {}
136 :
137 : // Destructor.
138 0 : virtual ~StringZ() {}
139 :
140 : // Initialize data members.
141 : virtual void init(Settings& settings, ParticleData& particleData,
142 : Rndm* rndmPtrIn);
143 :
144 : // Fragmentation function: top-level to determine parameters.
145 : virtual double zFrag( int idOld, int idNew = 0, double mT2 = 1.);
146 :
147 : // Parameters for stopping in the middle; overloaded for Hidden Valley.
148 0 : virtual double stopMass() {return stopM;}
149 0 : virtual double stopNewFlav() {return stopNF;}
150 0 : virtual double stopSmear() {return stopS;}
151 :
152 : // b fragmentation parameter needed to weight final two solutions.
153 0 : virtual double bAreaLund() {return bLund;}
154 :
155 : protected:
156 :
157 : // Constants: could only be changed in the code itself.
158 : static const double CFROMUNITY, AFROMZERO, AFROMC, EXPMAX;
159 :
160 : // Initialization data, to be read from Settings.
161 : bool useNonStandC, useNonStandB, useNonStandH,
162 : usePetersonC, usePetersonB, usePetersonH;
163 : double mc2, mb2, aLund, bLund, aExtraSQuark, aExtraDiquark, rFactC,
164 : rFactB, rFactH, aNonC, aNonB, aNonH, bNonC, bNonB, bNonH,
165 : epsilonC, epsilonB, epsilonH, stopM, stopNF, stopS;
166 :
167 : // Fragmentation function: select z according to provided parameters.
168 : double zLund( double a, double b, double c = 1.);
169 : double zPeterson( double epsilon);
170 :
171 : // Pointer to the random number generator.
172 : Rndm* rndmPtr;
173 :
174 : };
175 :
176 : //==========================================================================
177 :
178 : // The StringPT class is used to select select transverse momenta.
179 :
180 : class StringPT {
181 :
182 : public:
183 :
184 : // Constructor.
185 0 : StringPT() {}
186 :
187 : // Destructor.
188 0 : virtual ~StringPT() {}
189 :
190 : // Initialize data members.
191 : virtual void init(Settings& settings, ParticleData& particleData,
192 : Rndm* rndmPtrIn);
193 :
194 : // Return px and py as a pair in the same call.
195 : pair<double, double> pxy();
196 :
197 : // Gaussian suppression of given pT2; used in MiniStringFragmentation.
198 0 : double suppressPT2(double pT2) { return exp( -pT2 / sigma2Had); }
199 :
200 : protected:
201 :
202 : // Constants: could only be changed in the code itself.
203 : static const double SIGMAMIN;
204 :
205 : // Initialization data, to be read from Settings.
206 : double sigmaQ, enhancedFraction, enhancedWidth, sigma2Had;
207 :
208 : // Pointer to the random number generator.
209 : Rndm* rndmPtr;
210 :
211 : };
212 :
213 : //==========================================================================
214 :
215 : } // end namespace Pythia8
216 :
217 : #endif // Pythia8_FragmentationFlavZpT_H
|