StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FragmentationFlavZpT.h
1 // FragmentationFlavZpT.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2012 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 "Basics.h"
15 #include "ParticleData.h"
16 #include "PythiaStdlib.h"
17 #include "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 
32 
33 public:
34 
35  // Constructor.
36  FlavContainer(int idIn = 0, int rankIn = 0, int nPopIn = 0,
37  int idPopIn = 0, int idVtxIn = 0) : id(idIn), rank(rankIn),
38  nPop(nPopIn), idPop(idPopIn), idVtx(idVtxIn) {}
39 
40  // Overloaded equal operator.
41  FlavContainer& operator=(const FlavContainer& flav) { if (this != &flav) {
42  id = flav.id; rank = flav.rank; nPop = flav.nPop; idPop = flav.idPop;
43  idVtx = flav.idVtx; } return *this; }
44 
45  // Invert flavour.
46  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  FlavContainer& anti(const FlavContainer& flav) { if (this != &flav) {
53  id = -flav.id; rank = flav.rank; nPop = flav.nPop; idPop = flav.idPop;
54  idVtx = flav.idVtx; } return *this; }
55 
56  // Check whether is diquark.
57  bool isDiquark() {int idAbs = abs(id);
58  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  StringFlav() {}
75 
76  // Destructor.
77  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  int pickLightQ() { double rndmFlav = probQandS * rndmPtr->flat();
84  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  // Assign popcorn quark inside an original (= rank 0) diquark.
93  void assignPopQ(FlavContainer& flav);
94 
95  // Combine two quarks to produce a diquark.
96  int makeDiquark(int id1, int id2, int idHad = 0);
97 
98 protected:
99 
100  // Pointer to the random number generator.
101  Rndm* rndmPtr;
102 
103 private:
104 
105  // Constants: could only be changed in the code itself.
106  static const int mesonMultipletCode[6];
107  static const double baryonCGOct[6], baryonCGDec[6];
108 
109  // Initialization data, to be read from Settings.
110  bool suppressLeadingB;
111  double probQQtoQ, probStoUD, probSQtoQQ, probQQ1toQQ0, probQandQQ,
112  probQandS, probQandSinQQ, probQQ1corr, probQQ1corrInv, probQQ1norm,
113  mesonRate[4][6], mesonRateSum[4], mesonMix1[2][6], mesonMix2[2][6],
114  etaSup, etaPrimeSup, decupletSup, baryonCGSum[6], baryonCGMax[6],
115  popcornRate, popcornSpair, popcornSmeson, scbBM[3], popFrac,
116  popS[3], dWT[3][7], lightLeadingBSup, heavyLeadingBSup;
117 
118 };
119 
120 //==========================================================================
121 
122 // The StringZ class is used to sample the fragmentation function f(z).
123 
124 class StringZ {
125 
126 public:
127 
128  // Constructor.
129  StringZ() {}
130 
131  // Destructor.
132  virtual ~StringZ() {}
133 
134  // Initialize data members.
135  virtual void init(Settings& settings, ParticleData& particleData,
136  Rndm* rndmPtrIn);
137 
138  // Fragmentation function: top-level to determine parameters.
139  virtual double zFrag( int idOld, int idNew = 0, double mT2 = 1.);
140 
141  // Parameters for stopping in the middle; overloaded for Hidden Valley.
142  virtual double stopMass() {return stopM;}
143  virtual double stopNewFlav() {return stopNF;}
144  virtual double stopSmear() {return stopS;}
145 
146  // b fragmentation parameter needed to weight final two solutions.
147  virtual double bAreaLund() {return bLund;}
148 
149 protected:
150 
151  // Constants: could only be changed in the code itself.
152  static const double CFROMUNITY, AFROMZERO, AFROMC, EXPMAX;
153 
154  // Initialization data, to be read from Settings.
155  bool usePetersonC, usePetersonB, usePetersonH;
156  double mc2, mb2, aLund, bLund, aExtraDiquark, rFactC, rFactB, rFactH,
157  epsilonC, epsilonB, epsilonH, stopM, stopNF, stopS;
158 
159  // Fragmentation function: select z according to provided parameters.
160  double zLund( double a, double b, double c = 1.);
161  double zPeterson( double epsilon);
162 
163  // Pointer to the random number generator.
164  Rndm* rndmPtr;
165 
166 };
167 
168 //==========================================================================
169 
170 // The StringPT class is used to select select transverse momenta.
171 
172 class StringPT {
173 
174 public:
175 
176  // Constructor.
177  StringPT() {}
178 
179  // Destructor.
180  virtual ~StringPT() {}
181 
182  // Initialize data members.
183  virtual void init(Settings& settings, ParticleData& particleData,
184  Rndm* rndmPtrIn);
185 
186  // Return px and py as a pair in the same call.
187  pair<double, double> pxy();
188 
189  // Gaussian suppression of given pT2; used in MiniStringFragmentation.
190  double suppressPT2(double pT2) { return exp( -pT2 / sigma2Had); }
191 
192 protected:
193 
194  // Constants: could only be changed in the code itself.
195  static const double SIGMAMIN;
196 
197  // Initialization data, to be read from Settings.
198  double sigmaQ, enhancedFraction, enhancedWidth, sigma2Had;
199 
200  // Pointer to the random number generator.
201  Rndm* rndmPtr;
202 
203 };
204 
205 //==========================================================================
206 
207 } // end namespace Pythia8
208 
209 #endif // Pythia8_FragmentationFlavZpT_H