7 #ifndef Pythia8_PythiaCascade_H 8 #define Pythia8_PythiaCascade_H 10 #include "Pythia8/Pythia.h" 95 bool init(
double eMaxIn = 1e9,
bool listFinalIn =
false,
96 bool rapidDecaysIn =
false,
double smallTau0In = 1e-10,
97 int reuseMPI = 3,
string initFile =
"pythiaCascade.mpi") {
101 listFinal = listFinalIn;
102 rapidDecays = rapidDecaysIn;
103 smallTau0 = smallTau0In;
110 pythiaMain.
readString(
"ProcessLevel:all = off");
115 pythiaMain.
settings.
flag(
"ParticleDecays:limitTau0", rapidDecays);
116 pythiaMain.
settings.parm(
"ParticleDecays:tau0Max", smallTau0);
119 pythiaMain.
readString(
"Stat:showProcessLevel = off");
120 pythiaMain.
readString(
"Stat:showPartonLevel = off");
123 if (!pythiaMain.
init())
return false;
125 if ( reuseMPI < 0 ) {
132 pythiaColl.
readString(
"Beams:allowVariableEnergy = on");
133 pythiaColl.
readString(
"Beams:allowIDAswitch = on");
137 pythiaColl.
settings.parm(
"Beams:pzA", eMax);
142 pythiaColl.
readString(
"LowEnergyQCD:all = on");
152 pythiaColl.
readString(
"HadronLevel:Decay = off");
157 pythiaColl.
readString(
"Check:epTolErr = 0.01");
158 pythiaColl.
readString(
"Check:epTolWarn = 0.0001");
159 pythiaColl.
readString(
"Check:mTolErr = 0.01");
162 pythiaColl.
readString(
"Stat:showProcessLevel = off");
163 pythiaColl.
readString(
"Stat:showPartonLevel = off");
167 pythiaColl.
readString(
"MultipartonInteractions:reuseInit = 3");
168 else if (reuseMPI == 0)
169 pythiaColl.
readString(
"MultipartonInteractions:reuseInit = 1");
171 pythiaColl.
settings.word(
"MultipartonInteractions:initFile", initFile);
174 if (!pythiaColl.
init())
return false;
186 for (
int i = 0; i < nA; ++i) {
188 return (sigmaNow < tabBorder) ? 1. + tabSlopeLo[i] * sigmaNow
189 : 1. + tabOffset[i] + tabSlope[i] * sigmaNow;
190 }
else if (A < tabA[i]) {
191 double nColl1 = (sigmaNow < tabBorder) ? tabSlopeLo[i - 1] * sigmaNow
192 : tabOffset[i - 1] + tabSlope[i - 1] * sigmaNow;
193 double nColl2 = (sigmaNow < tabBorder) ? tabSlopeLo[i] * sigmaNow
194 : tabOffset[i] + tabSlope[i] * sigmaNow;
195 double wt1 = (tabA[i] - A) / (tabA[i] - tabA[i - 1]);
196 return 1. + wt1 * pow( A / tabA[i - 1], 2./3.) * nColl1
197 + (1. - wt1) * pow( A / tabA[i], 2./3.) * nColl2;
201 return numeric_limits<double>::quiet_NaN();
212 if (pNowIn.e() - mNowIn < eKinMin)
return false;
215 if (pNowIn.e() > eMax) {
216 logger.ERROR_MSG(
"too high energy");
227 eCMNow = (pNow +
Vec4(0, 0, 0, mp)).mCalc();
228 sigmaNow = pythiaColl.
getSigmaTotal(idNow, 2212, eCMNow, mNow, mp);
229 if (sigmaNow <= 0.) {
230 if (eCMNow - mNow - mp > eKinMin)
231 logger.ERROR_MSG(
"vanishing cross section");
249 if (A < 1 || A > 208) {
250 logger.ERROR_MSG(
"A is outside of valid range (1 <= A <= 208)");
276 if (Anow < 1 || Anow > 208) {
277 logger.ERROR_MSG(
"A is outside of valid range (1 <= A <= 208)");
282 eventMain.
append(90, -11, 0, 0, 1, 1, 0, 0, pNow, mNow);
283 int iHad = eventMain.
append(idNow, 12, 0, 0, 0, 0, 0, 0, pNow, mNow);
284 eventMain[iHad].vProd(vNow);
288 int nn = Anow - Znow;
291 Vec4 dirNow = pNow / pNow.pAbs();
295 double probMore = 1. - 1. /
nCollAvg(Anow);
298 for (
int iColl = 1; iColl <= Anow; ++iColl) {
299 if (iColl > 1 && rndm.
flat() > probMore)
break;
309 for (
int i = sizeOld; i < sizeNew; ++i)
310 if ( eventMain[i].isFinal() && eventMain[i].isHadron()) {
311 double pp =
dot3(dirNow, eventMain[i].p());
319 if ( iProj == 0 || eventMain[iProj].e() - eventMain[iProj].
m()
323 double eCMSub = (eventMain[iProj].p() +
Vec4(0, 0, 0, mp)).mCalc();
324 if (eCMSub > 10.) procType = (rndm.
flat() < probSD) ? 4 : 1;
328 int idProj = eventMain[iProj].id();
329 bool doProton = rndm.
flat() < (np / double(np + nn));
330 if (doProton) np -= 1;
332 int idNuc = (doProton) ? 2212 : 2112;
337 if (!pythiaColl.
next(procType)) {
344 int statusNuc = (iColl == 1) ? -181 : -182;
345 int iNuc = eventMain.
append( idNuc, statusNuc, 0, iProj, 0, 0, 0, 0,
347 eventMain[iNuc].vProdAdd(vNow);
350 eventMain[0].e( eventMain[0].e() + mp);
351 eventMain[0].m( eventMain[0].p().mCalc() );
355 sizeOld = eventMain.
size();
356 for (
int iSub = 3; iSub < eventColl.
size(); ++iSub) {
357 if (!eventColl[iSub].isFinal())
continue;
358 int iNew = eventMain.
append(eventColl[iSub]);
359 eventMain[iNew].mothers(iNuc, iProj);
360 eventMain[iNew].vProdAdd(vNow);
362 sizeNew = eventMain.
size();
365 eventMain[iProj].daughters(sizeOld, sizeNew - 1);
366 eventMain[iNuc].daughters(sizeOld, sizeNew - 1);
367 eventMain[iProj].statusNeg();
368 eventMain[iProj].tau(0.);
405 eventColl.
append(90, -11, 0, 0, 1, 1, 0, 0, pNow, mNow);
406 int iHad = eventColl.
append(idNow, 12, 0, 0, 0, 0, 0, 0, pNow, mNow);
407 eventColl[iHad].vProd(vNow);
410 if (!pythiaColl.
moreDecays(iHad))
return eventMain;
411 eventMain = eventColl;
434 int sizeOld = eventMain.
size();
439 for (
int i = 1; i < sizeOld; ++i)
if (eventMain[i].isFinal()) {
440 eventMain[sizeNew] = eventMain[i];
441 eventMain[sizeNew].mothers( 0, 0);
442 eventMain[sizeNew].daughters( 0, 0);
447 eventMain.
popBack( sizeOld - sizeNew);
468 Rndm& rndm() {
return pythiaMain.
rndm;}
477 Pythia pythiaMain, pythiaColl;
483 bool listFinal, rapidDecays;
485 double eMax, smallTau0, mp, mNow, eCMNow, sigmaNow;
489 static constexpr
double probSD = 0.3;
493 static constexpr
double eKinMin = 0.2;
498 static constexpr
int nA = 16;
499 static constexpr
double tabBorder = 20.;
500 static const double tabA[nA];
501 static const double tabOffset[nA];
502 static const double tabSlope[nA];
503 static const double tabSlopeLo[nA];
508 const double PythiaCascade::tabA[] = {1, 2, 4, 9, 12, 14, 16, 27, 40, 56,
509 63, 84, 107, 129, 197, 208};
510 const double PythiaCascade::tabOffset[] = {0., 0.03, 0.08, 0.15, 0.20, 0.20,
511 0.20, 0.26, 0.30, 0.34, 0.40, 0.40, 0.40, 0.50, 0.50, 0.60};
512 const double PythiaCascade::tabSlope[] = {0., 0.0016, 0.0033, 0.0075, 0.0092,
513 0.0105, 0.012, 0.017, 0.022, 0.027, 0.028, 0.034, 0.040, 0.044, 0.055,
515 const double PythiaCascade::tabSlopeLo[] = {0., 0.0031, 0.0073, 0.015, 0.0192,
516 0.0205, 0.022, 0.03, 0.037, 0.044, 0.048, 0.054, 0.06, 0.069, 0.08, 0.085};
double nCollAvg(int A)
Definition: PythiaCascade.h:185
bool flag(string keyIn)
Give back current value, with check that key exists.
Definition: Settings.cc:1599
PythiaCascade()=default
Default constructor, all setup is done in init().
Rndm rndm
Random number generator.
Definition: Pythia.h:380
bool readString(string line, bool warn=true, int subrun=SUBRUNDEFAULT)
Read in one update for a setting or particle data from a single line.
Definition: Pythia.h:98
ParticleData particleData
ParticleData: the particle data table/database.
Definition: Pythia.h:377
The Event class holds all info on the generated event.
Definition: Event.h:408
Settings settings
Settings: databases of flags/modes/parms/words to control run.
Definition: Pythia.h:374
void clear()
Clear event record.
Definition: Event.h:428
bool setKinematics(double eCMIn)
Switch beam kinematics.
Definition: Pythia.cc:1335
Event event
The event record for the complete event history.
Definition: Pythia.h:365
bool init()
Initialize.
Definition: Pythia.cc:402
double dot3(const Vec4 &v1, const Vec4 &v2)
Scalar and cross product of 3-vector parts.
Definition: Basics.cc:618
void stat()
Summary of aborts, errors and warnings.
Definition: PythiaCascade.h:455
double sigmahA(int A)
Definition: PythiaCascade.h:246
bool setBeamIDs(int idAin, int idBin=0)
Switch to new beam particle identities; for similar hadrons only.
Definition: Pythia.cc:1313
bool moreDecays()
Special routine to allow more decays if on/off switches changed.
Definition: Pythia.h:295
int append(Particle entryIn)
Put a new particle at the end of the event record; return index.
Definition: Event.h:462
Event & nextDecay(int idNowIn, Vec4 pNowIn, double mNowIn, Vec4 vNow=Vec4())
Definition: PythiaCascade.h:389
bool sigmaSetuphN(int idNowIn, Vec4 pNowIn, double mNowIn)
Definition: PythiaCascade.h:209
Intended flow:
Definition: PythiaCascade.h:61
void stat()
Main routine to provide final statistics on generation.
Definition: Pythia.cc:1663
void popBack(int nRemove=1)
Remove last n entries.
Definition: Event.h:516
int size() const
Event record size.
Definition: Event.h:459
bool readFile(string fileName, bool warn=true, int subrun=SUBRUNDEFAULT)
Read in updates for settings or particle data from user-defined file.
Definition: Pythia.h:102
double getSigmaTotal()
Get total cross section for two hadrons in the event record or standalone.
Definition: Pythia.h:308
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
The Pythia class contains the top-level routines to generate an event.
Definition: Pythia.h:71
double m(const Vec4 &v1)
Invariant mass and its square.
Definition: Basics.cc:588
void compress()
Definition: PythiaCascade.h:430
ParticleData & particleData()
Definition: PythiaCascade.h:466
bool next()
Generate the next event.
Definition: Pythia.h:271
double flat()
Generate next random number uniformly between 0 and 1.
Definition: Basics.cc:189
bool init(double eMaxIn=1e9, bool listFinalIn=false, bool rapidDecaysIn=false, double smallTau0In=1e-10, int reuseMPI=3, string initFile="pythiaCascade.mpi")
Initialize PythiaCascade for a given maximal incoming energy.
Definition: PythiaCascade.h:95
void errorStatistics() const
Print error statistics.
Definition: Logger.h:113
This class holds a map of all ParticleDataEntries.
Definition: ParticleData.h:422
Event & nextColl(int Znow, int Anow, Vec4 vNow=Vec4())
Definition: PythiaCascade.h:268