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) 2014 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  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  probQQ1join[4], mesonRate[4][6], mesonRateSum[4], mesonMix1[2][6],
114  mesonMix2[2][6], etaSup, etaPrimeSup, decupletSup, baryonCGSum[6],
115  baryonCGMax[6], popcornRate, popcornSpair, popcornSmeson, scbBM[3],
116  popFrac, 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 useNonStandC, useNonStandB, useNonStandH,
156  usePetersonC, usePetersonB, usePetersonH;
157  double mc2, mb2, aLund, bLund, aExtraSQuark, aExtraDiquark, rFactC,
158  rFactB, rFactH, aNonC, aNonB, aNonH, bNonC, bNonB, bNonH,
159  epsilonC, epsilonB, epsilonH, stopM, stopNF, stopS;
160 
161  // Fragmentation function: select z according to provided parameters.
162  double zLund( double a, double b, double c = 1.);
163  double zPeterson( double epsilon);
164 
165  // Pointer to the random number generator.
166  Rndm* rndmPtr;
167 
168 };
169 
170 //==========================================================================
171 
172 // The StringPT class is used to select select transverse momenta.
173 
174 class StringPT {
175 
176 public:
177 
178  // Constructor.
179  StringPT() {}
180 
181  // Destructor.
182  virtual ~StringPT() {}
183 
184  // Initialize data members.
185  virtual void init(Settings& settings, ParticleData& particleData,
186  Rndm* rndmPtrIn);
187 
188  // Return px and py as a pair in the same call.
189  pair<double, double> pxy();
190 
191  // Gaussian suppression of given pT2; used in MiniStringFragmentation.
192  double suppressPT2(double pT2) { return exp( -pT2 / sigma2Had); }
193 
194 protected:
195 
196  // Constants: could only be changed in the code itself.
197  static const double SIGMAMIN;
198 
199  // Initialization data, to be read from Settings.
200  double sigmaQ, enhancedFraction, enhancedWidth, sigma2Had;
201 
202  // Pointer to the random number generator.
203  Rndm* rndmPtr;
204 
205 };
206 
207 //==========================================================================
208 
209 } // end namespace Pythia8
210 
211 #endif // Pythia8_FragmentationFlavZpT_H