11 #ifndef Pythia8_FragmentationFlavZpT_H
12 #define Pythia8_FragmentationFlavZpT_H
14 #include "Pythia8/Basics.h"
15 #include "Pythia8/ParticleData.h"
16 #include "Pythia8/PythiaStdlib.h"
17 #include "Pythia8/Settings.h"
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) {}
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; }
46 FlavContainer& anti() {
id = -id;
return *
this;}
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; }
57 bool isDiquark() {
int idAbs = abs(
id);
58 return (idAbs > 1000 && idAbs < 10000 && (idAbs/10)%10 == 0);}
61 int id, rank, nPop, idPop, idVtx;
76 hadronIDwin = 0; idNewWin = 0; hadronMassWin = -1.0;
80 virtual ~StringFlav() {}
83 virtual void init(Settings& settings, ParticleData* particleDataPtrIn,
84 Rndm* rndmPtrIn, Info* infoPtrIn);
87 int pickLightQ() {
double rndmFlav = probQandS * rndmPtr->flat();
88 if (rndmFlav < 1.)
return 1;
89 if (rndmFlav < 2.)
return 2;
94 virtual FlavContainer pick(FlavContainer& flavOld,
double pT = -1.0,
95 double nNSP = 0.0) { hadronIDwin = 0; idNewWin = 0; hadronMassWin = -1.0;
96 if ( (thermalModel || mT2suppression) && (pT >= 0.0) )
97 return pickThermal(flavOld, pT, nNSP);
98 return pickGauss(flavOld); }
99 virtual FlavContainer pickGauss(FlavContainer& flavOld);
100 virtual FlavContainer pickThermal(FlavContainer& flavOld,
101 double pT,
double nNSP);
104 virtual int combine(FlavContainer& flav1, FlavContainer& flav2);
107 virtual int combineId(
int id1,
int id2,
bool keepTrying =
true) {
108 FlavContainer flag1(id1); FlavContainer flag2(id2);
109 for (
int i = 0; i < 100; ++i) {
int idNew = combine( flag1, flag2);
110 if (idNew != 0 || !keepTrying)
return idNew;}
return 0;}
113 virtual int getHadronIDwin() {
return hadronIDwin; }
117 virtual int combineLastThermal(FlavContainer& flav1, FlavContainer& flav2,
118 double pT,
double nNSP);
122 virtual int getHadronID(FlavContainer& flav1, FlavContainer& flav2,
123 double pT = -1.0,
double nNSP = 0,
bool finalTwo =
false) {
124 if (finalTwo)
return ((thermalModel || mT2suppression) ?
125 combineLastThermal(flav1, flav2, pT, nNSP) : combine(flav1, flav2));
126 if ((thermalModel || mT2suppression)&& (hadronIDwin != 0)
127 && (idNewWin != 0))
return getHadronIDwin();
128 return combine(flav1, flav2); }
131 virtual double getHadronMassWin(
int idHad) {
return
132 ((hadronMassWin < 0.0) ? particleDataPtr->mSel(idHad) : hadronMassWin); }
135 void assignPopQ(FlavContainer& flav);
138 int makeDiquark(
int id1,
int id2,
int idHad = 0);
141 void addQuarkDiquark(vector< pair<int,int> >& quarkCombis,
142 int qID,
int diqID,
int hadronID) {
144 for (
int iCombi = 0; iCombi < int(quarkCombis.size()); iCombi++)
145 if ( (qID == quarkCombis[iCombi].first ) &&
146 (diqID == quarkCombis[iCombi].second) ) allowed =
false;
147 if (allowed) quarkCombis.push_back( (hadronID > 0) ?
148 make_pair( qID, diqID) : make_pair(-qID, -diqID) ); }
151 int getMesonSpinCounter(
int hadronID) { hadronID = abs(hadronID);
152 int j = (hadronID % 10);
153 if (hadronID < 1000)
return ((j==1) ? 0 : ( (j==3) ? 1 : 5 ));
154 if (hadronID < 20000)
return ((j==1) ? 3 : 2);
155 if (hadronID > 20000)
return 4;
164 ParticleData* particleDataPtr;
170 static const int mesonMultipletCode[6];
171 static const double baryonCGOct[6], baryonCGDec[6];
174 bool suppressLeadingB, mT2suppression, useWidthPre;
175 double probQQtoQ, probStoUD, probSQtoQQ, probQQ1toQQ0, probQandQQ,
176 probQandS, probQandSinQQ, probQQ1corr, probQQ1corrInv, probQQ1norm,
177 probQQ1join[4], mesonRate[4][6], mesonRateSum[4], mesonMix1[2][6],
178 mesonMix2[2][6], etaSup, etaPrimeSup, decupletSup, baryonCGSum[6],
179 baryonCGMax[6], popcornRate, popcornSpair, popcornSmeson, scbBM[3],
180 popFrac, popS[3], dWT[3][7], lightLeadingBSup, heavyLeadingBSup;
181 double sigmaHad, widthPreStrange, widthPreDiquark;
184 bool thermalModel, mesonNonetL1;
185 double temperature, tempPreFactor;
187 double mesMixRate1[2][6], mesMixRate2[2][6], mesMixRate3[2][6];
188 double baryonOctWeight[6][6][6][2], baryonDecWeight[6][6][6][2];
192 double exponentMPI, exponentNSP;
195 map< int, vector< pair<int,int> > > hadronConstIDs;
198 map< int, vector< pair<int,int> > > possibleHadrons;
200 map< int, vector<double> > possibleRatePrefacs;
202 map< pair<int,int>, vector< pair<int,int> > > possibleHadronsLast;
203 map< pair<int,int>, vector<double> > possibleRatePrefacsLast;
206 int hadronIDwin, idNewWin;
207 double hadronMassWin;
224 virtual double f(vector<double> args) {
225 if (args.size() < 5)
return -1.;
227 if (z <= 0. || z >= 1.)
return 0.;
231 double mT2 = args[4];
232 return pow(1. - z, a) / pow(z, c) * exp(-b * mT2 / z);
251 virtual double f(vector<double> argsIn) {
254 if (argsIn.size() < 4)
return -1.;
256 if (argsIn.size() >= 5) tol = argsIn[4];
258 double numerator = 0.;
261 vector<double> args(1);
262 args.insert(args.end(), argsIn.begin(), argsIn.end());
263 check = lundFF.integrateGauss(denom, 0, 0., 1., args, tol);
264 if ( !check || denom <= 0. )
return -1.;
268 check = lundFF.integrateGauss(numerator, 0, 0., 1., args, tol);
269 if ( !check || numerator < 0. )
return -1.;
270 return numerator/denom;
291 virtual ~StringZ() {}
294 virtual void init(Settings& settings, ParticleData& particleData,
295 Rndm* rndmPtrIn, Info* infoPtrIn);
298 virtual double zFrag(
int idOld,
int idNew = 0,
double mT2 = 1.);
301 virtual double stopMass() {
return stopM;}
302 virtual double stopNewFlav() {
return stopNF;}
303 virtual double stopSmear() {
return stopS;}
306 virtual double aAreaLund() {
return aLund;}
307 virtual double bAreaLund() {
return bLund;}
310 bool deriveBLund(Settings& settings, ParticleData& particleData);
315 static const double CFROMUNITY, AFROMZERO, AFROMC, EXPMAX;
318 bool useNonStandC, useNonStandB, useNonStandH,
319 usePetersonC, usePetersonB, usePetersonH;
320 double mc2, mb2, aLund, bLund, aExtraSQuark, aExtraDiquark, rFactC,
321 rFactB, rFactH, aNonC, aNonB, aNonH, bNonC, bNonB, bNonH,
322 epsilonC, epsilonB, epsilonH, stopM, stopNF, stopS;
325 double zLund(
double a,
double b,
double c = 1.);
326 double zPeterson(
double epsilon);
348 virtual ~StringPT() {}
351 virtual void init(Settings& settings, ParticleData* particleDataPtr,
352 Rndm* rndmPtrIn, Info* infoPtrIn);
356 pair<double, double> pxy(
int idIn,
double nNSP = 0.0) {
357 return (thermalModel ? pxyThermal(idIn, nNSP) :
358 pxyGauss(idIn, nNSP)); }
359 pair<double, double> pxyGauss(
int idIn = 0,
double nNSP = 0.0);
360 pair<double, double> pxyThermal(
int idIn,
double nNSP = 0.0);
363 double suppressPT2(
double pT2) {
return (thermalModel ?
364 exp(-sqrt(pT2)/temperature) : exp(-pT2/sigma2Had)); }
369 static const double SIGMAMIN;
374 double sigmaQ, enhancedFraction, enhancedWidth, sigma2Had,
375 widthPreStrange, widthPreDiquark;
378 double temperature, tempPreFactor, fracSmallX;
381 double exponentMPI, exponentNSP;
384 ParticleData* particleDataPtr;
395 double BesselK14(
double x);
403 #endif // Pythia8_FragmentationFlavZpT_H