9 #ifndef Pythia8_VinciaCommon_H
10 #define Pythia8_VinciaCommon_H
16 #include "Pythia8/Event.h"
17 #include "Pythia8/Info.h"
18 #include "Pythia8/ParticleData.h"
19 #include "Pythia8/PartonSystems.h"
20 #include "Pythia8/PythiaStdlib.h"
21 #include "Pythia8/StandardModel.h"
33 const double TINY = 1.0e-9;
34 const double TINYMASS = 1.0e-6;
35 const double SMALL = 1.0e-3;
38 const double CA = 3.0;
39 const double CF = 8.0/3.0;
40 const double TR = 1.0;
41 const double NC = 3.0;
44 const int iQQemitFF = 0;
45 const int iQGemitFF = 1;
46 const int iGQemitFF = 2;
47 const int iGGemitFF = 3;
48 const int iGXsplitFF = 4;
51 const int iQQemitRF = 5;
52 const int iQGemitRF = 6;
53 const int iXGsplitRF = 7;
56 const int iQQemitII = 0;
57 const int iGQemitII = 1;
58 const int iGGemitII = 2;
59 const int iQXsplitII = 3;
60 const int iGXconvII = 4;
63 const int iQQemitIF = 5;
64 const int iQGemitIF = 6;
65 const int iGQemitIF = 7;
66 const int iGGemitIF = 8;
67 const int iQXsplitIF = 9;
68 const int iGXconvIF = 10;
69 const int iXGsplitIF = 11;
72 const double gammaE = 0.577215664901532860606512090082402431042;
81 const int quiteloud = 3;
83 const int veryloud = 5;
86 const int louddebug = 7;
87 const int verylouddebug = 8;
88 const int superdebug = 9;
97 using namespace Vincia;
103 typedef unsigned int uint;
148 #ifndef __METHOD_NAME__
150 #ifndef VINCIA_FUNCTION
151 #if ( defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) \
152 || (defined(__ICC) && (__ICC >= 600)) )
153 # define VINCIA_FUNCTION __PRETTY_FUNCTION__
154 #elif defined(__DMC__) && (__DMC__ >= 0x810)
155 # define VINCIA_FUNCTION __PRETTY_FUNCTION__
156 #elif defined(__FUNCSIG__)
157 # define VINCIA_FUNCTION __FUNCSIG__
158 #elif ( (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) \
159 || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) )
160 # define VINCIA_FUNCTION __FUNCTION__
161 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
162 # define VINCIA_FUNCTION __FUNC__
163 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
164 # define VINCIA_FUNCTION __func__
166 # define VINCIA_FUNCTION "unknown"
168 #endif // end VINCIA_FUNCTION
170 inline std::string methodName(
const std::string& prettyFunction) {
171 size_t colons = prettyFunction.find(
"::");
172 size_t begin = prettyFunction.substr(0,colons).rfind(
" ") + 1;
173 size_t end = prettyFunction.rfind(
"(") - begin;
174 return prettyFunction.substr(begin,end) +
"()";
178 #define __METHOD_NAME__ methodName(VINCIA_FUNCTION)
179 #endif // end __METHOD_NAME__
190 virtual double operator()(
double) = 0;
201 TXiFunctor(vector<double> mIn, vector<double> energiesIn);
202 double operator() (
double);
206 vector<double> energies;
214 TPtrFunctor(
double (*fPtrIn)(
double) ){ fPtr = fPtrIn; };
215 double operator() (
double arg) {
return fPtr(arg); };
220 double (*fPtr)(double);
229 void printOut(
string,
string);
232 string num2str(
int,
int width=4) ;
233 string num2str(
double,
int width=9) ;
234 string bool2str(
bool,
int width=3) ;
237 inline string replaceString(
string subject,
const string& search,
238 const string& replace) {
239 string::size_type pos = 0;
240 while ((pos = subject.find(search, pos)) != string::npos) {
241 subject.replace(pos, search.length(), replace);
242 pos += replace.length();
249 inline string sanitizeFileName(
string fileName) {
250 map<string, string> rep;
252 rep[
":"] =
"_colon_";
253 string retVal = fileName;
254 for (map<string, string>::const_iterator it = rep.begin(); it != rep.end();
256 retVal = replaceString(retVal, it->first, it->second);
263 inline bool fileExists(
const std::string& name) {
264 if (FILE *file = fopen(name.c_str(),
"r")) {
274 double m (
const Vec4&);
275 double m2 (
const Vec4&);
276 double m2 (
const Vec4&,
const Vec4&,
const Vec4&);
277 double m2 (
const Vec4&,
const Vec4&,
const Vec4&,
const Vec4&);
278 double m2 (
const Particle&,
const Particle&,
const Particle&);
279 double dot4 (
const Particle&,
const Particle&);
280 double getCosTheta(
double E1,
double E2,
double m1,
double m2,
double s12);
283 double gramDet(
double s01tilde,
double s12tilde,
double s02tilde,
284 double m0,
double m1,
double m2);
285 double gramDet(Vec4 p0, Vec4 p1, Vec4 p2);
288 double Li2 (
const double,
const double kmax = 100.0,
289 const double xerr = Vincia::TINY);
290 double factorial(
const int);
291 int binomial (
const int,
int);
292 double LambertW (
const double x);
296 double zbrent(TFunctor&,
double,
double,
double,
double);
312 Rambo() { rndmPtr=
nullptr; isInitPtr=
false;}
315 Rambo(
Rndm* rndmPtrIn) { initPtr(rndmPtrIn); }
321 void initPtr(
Rndm* rndmPtrIn) {rndmPtr = rndmPtrIn; isInitPtr =
true;}
325 double genPoint(
double eCM,
int nOut,vector<Vec4>& pOut);
330 double genPoint(
double eCM,vector<double> mIn,vector<Vec4>& pOut);
353 Colour() {isInitPtr=
false; isInit=
false;}
359 void initPtr(
Info* infoPtrIn) {
361 particleDataPtr = infoPtr->particleDataPtr;
362 settingsPtr = infoPtr->settingsPtr;
363 partonSystemsPtr = infoPtr->partonSystemsPtr;
364 rndmPtr = infoPtr->rndmPtr;
374 bool colourise(
int iSys,
Event& event);
384 vector<int> colourSort(vector<Particle*>);
387 void makeColourMaps(
const int iSysIn,
const Event& event,
388 map<int,int>& indexOfAcol, map<int,int>& indexOfCol,
389 vector< pair<int,int> >& antLC,
const bool findFF,
const bool findIX);
392 bool inherit01(
double s01,
double s12);
395 void setVerbose(
int verboseIn) {verbose = verboseIn;};
403 bool isInitPtr, isInit;
432 void initPtr(
Settings* settingsPtrIn) {
433 settingsPtr = settingsPtrIn;
464 double findSector(vector<int>& iSec, vector<Particle> state,
int nFmin = 1);
467 void setVerbose(
int verboseIn) {verbose = verboseIn;}
472 bool isInitPtr{
false}, isInit{
false};
478 int nFlavZeroMassSav{};
501 bool initPtr(
Info* infoPtrIn) {
503 particleDataPtr = infoPtr->particleDataPtr;
504 settingsPtr = infoPtr->settingsPtr;
505 rndmPtr = infoPtr->rndmPtr;
515 double mHadMin(
const int id1,
const int id2);
519 bool showerChecks(
Event& event,
bool ISR);
525 void resetCounters() {
532 for (
int i=0; i<2; i++) {
533 nUnmatchedMass[i] = 0;
539 int getNf(
double q) {
540 if (q <= mc)
return 3;
541 else if (q <= mb)
return 4;
542 else if (q <= mt)
return 5;
547 double getShowerStartingScale(
int iSys,
PartonSystems* partonSystemsPtr,
548 const Event& event,
double sbbSav);
551 bool map3to2FFmassive(vector<Vec4>& pClu, vector<Vec4> pIn,
552 int kMapType,
int a=0,
int r=1,
int b=2,
double mI=0.0,
double mK=0.0);
553 bool map3to2FFmassless(vector<Vec4>& pClu, vector<Vec4> pIn,
554 int kMapType,
int a=0,
int r=1,
int b=2);
555 bool map3to2IFmassive(vector<Vec4>& pClu, vector<Vec4>& pIn,
556 double saj,
double sjk,
double sak);
557 bool map3to2IImassive(vector<Vec4>& pClu, vector<Vec4>& pIn,
558 vector<Vec4>& pRec,
double saj,
double sjb,
double sab,
bool doBoost);
562 bool map2to3FF(vector<Vec4>& pNew,
const vector<Vec4>& pOld,
int kMapType,
563 const vector<double>& invariants,
double phi, vector<double> masses) {
564 if ( masses.size() <= 2 || ( masses[0] == 0.0 && masses[1] == 0.0
565 && masses[2] == 0.0 )) {
566 return map2to3FFmassless(pNew, pOld, kMapType, invariants, phi);
568 return map2to3FFmassive(pNew, pOld, kMapType, invariants, phi, masses);
571 bool map2to3FFmassive(vector<Vec4>& pNew,
const vector<Vec4>& pOld,
572 int kMapType,
const vector<double>& invariants,
double phi,
573 vector<double> masses);
574 bool map2to3FFmassless(vector<Vec4>& pNew,
const vector<Vec4>& pOld,
575 int kMapType,
const vector<double>& invariants,
double phi);
579 bool map2to3II(vector<Vec4>& pNew, vector<Vec4>& pRec,
580 vector<Vec4>& pOld,
double sAB,
double saj,
double sjb,
double sab,
581 double phi,
double m2j = 0.0);
582 bool map2to3IImassless(vector<Vec4>& pNew, vector<Vec4>& pRec,
583 vector<Vec4>& pOld,
double sAB,
double saj,
double sjb,
double sab,
588 bool map2to3IFlocal(vector<Vec4>& pNew, vector<Vec4>& pOld,
589 double sOldAK,
double saj,
double sjk,
double sak,
double phi,
590 double m2oldK,
double m2j,
double m2k);
591 bool map2to3IFglobal(vector<Vec4>& pNew, vector<Vec4>& pRec,
592 vector<Vec4>& pOld,
Vec4 &pB,
593 double sAK,
double saj,
double sjk,
double sak,
double phi,
594 double mK2,
double mj2,
double mk2);
597 bool map2to3RFmassive(vector<Vec4>& pThree, vector<Vec4> pTwo,
598 vector<double> invariants,
double phi,
599 vector<double> masses);
600 bool map2toNRFmassive(vector<Vec4>& pAfter, vector<Vec4> pBefore,
601 unsigned int posR,
unsigned int posF,
602 vector<double> invariants,
double phi,
603 vector<double> masses);
606 bool map2to3RFmassive(vector<Vec4>& pNew, vector<Vec4>& pRec,
607 vector<Vec4> pOld,
double saj,
double sjk,
double phi,
608 double m2oldA,
double m2j,
double m2oldK);
611 bool onShellCM(
Vec4& p1,
Vec4& p2,
double m1,
double m2,
double tol = 1e-6);
619 bool mapToMassive(
Vec4& p1,
Vec4& p2,
double m1,
double m2) {
620 return (!onShellCM(p1,p2,m1,m2,1e-9));
624 int getVerbose() {
return verbose; };
625 void setVerbose(
int verboseIn) { verbose = verboseIn;};
629 AlphaStrong alphaStrong, alphaStrongCMW, alphaStrongDef, alphaStrongDefCMW;
634 double mu2freeze, mu2min, alphaSmax;
637 double ms, mc, mb, mt;
641 double epTolErr, epTolWarn, mTolErr, mTolWarn;
652 int nUnkownPDG, nIncorrectCol, nNAN, nVertex, nChargeCons, nMotDau;
653 vector<int> nUnmatchedMass, nEPcons;
656 bool isInitPtr, isInit;
665 #endif // Pythia8_VinciaCommon_H