File indexing completed on 2025-01-18 10:06:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef Pythia8_ParticleData_H
0012 #define Pythia8_ParticleData_H
0013
0014 #include "Pythia8/Basics.h"
0015 #include "Pythia8/Info.h"
0016 #include "Pythia8/PythiaStdlib.h"
0017 #include "Pythia8/Settings.h"
0018 #include "Pythia8/StandardModel.h"
0019
0020 namespace Pythia8 {
0021
0022
0023
0024
0025 class ParticleData;
0026 class ResonanceWidths;
0027 class CoupSM;
0028 class CoupSUSY;
0029 class SUSYResonanceWidths;
0030
0031
0032
0033
0034
0035 class DecayChannel {
0036
0037 public:
0038
0039
0040 DecayChannel(int onModeIn = 0, double bRatioIn = 0., int meModeIn = 0,
0041 int prod0 = 0, int prod1 = 0, int prod2 = 0, int prod3 = 0,
0042 int prod4 = 0, int prod5 = 0, int prod6 = 0, int prod7 = 0)
0043 : onModeSave(onModeIn), bRatioSave(bRatioIn), currentBRSave(0.),
0044 onShellWidthSave(0.), openSecPos(1.), openSecNeg(1.),
0045 meModeSave(meModeIn), nProd(0), prod(), hasChangedSave(true) {
0046 prod[0] = prod0; prod[1] = prod1; prod[2] = prod2; prod[3] = prod3;
0047 prod[4] = prod4; prod[5] = prod5; prod[6] = prod6; prod[7] = prod7;
0048 for (int j = 0; j < 8; ++j) if (prod[j] != 0 && j == nProd) ++nProd; }
0049
0050
0051 DecayChannel( const DecayChannel& oldDC) {
0052 onModeSave = oldDC.onModeSave; bRatioSave = oldDC.bRatioSave;
0053 currentBRSave = oldDC.currentBRSave;
0054 onShellWidthSave = oldDC.onShellWidthSave; openSecPos = oldDC.openSecPos;
0055 openSecNeg = oldDC.openSecNeg; meModeSave = oldDC.meModeSave;
0056 nProd = oldDC.nProd; for (int j = 0; j < 8; ++j) prod[j] = oldDC.prod[j];
0057 hasChangedSave = oldDC.hasChangedSave; }
0058
0059
0060 DecayChannel& operator=( const DecayChannel& oldDC) { if (this != &oldDC) {
0061 onModeSave = oldDC.onModeSave; bRatioSave = oldDC.bRatioSave;
0062 currentBRSave = oldDC.currentBRSave;
0063 onShellWidthSave = oldDC.onShellWidthSave; openSecPos = oldDC.openSecPos;
0064 openSecNeg = oldDC.openSecNeg; meModeSave = oldDC.meModeSave;
0065 nProd = oldDC.nProd; for (int j = 0; j < 8; ++j) prod[j] = oldDC.prod[j];
0066 hasChangedSave = oldDC.hasChangedSave; } return *this; }
0067
0068
0069 void onMode(int onModeIn) {onModeSave = onModeIn; hasChangedSave = true;}
0070 void bRatio(double bRatioIn, bool countAsChanged = true) {
0071 bRatioSave = bRatioIn; if (countAsChanged) hasChangedSave = true;}
0072 void rescaleBR(double fac) {bRatioSave *= fac; hasChangedSave = true;}
0073 void meMode(int meModeIn) {meModeSave = meModeIn; hasChangedSave = true;}
0074 void multiplicity(int multIn) {nProd = multIn; hasChangedSave = true;}
0075 void product(int i, int prodIn) {prod[i] = prodIn; nProd = 0;
0076 for (int j = 0; j < 8; ++j) if (prod[j] != 0 && j == nProd) ++nProd;
0077 hasChangedSave = true;}
0078 void setHasChanged(bool hasChangedIn) {hasChangedSave = hasChangedIn;}
0079
0080
0081 int onMode() const {return onModeSave;}
0082 double bRatio() const {return bRatioSave;}
0083 int meMode() const {return meModeSave;}
0084 int multiplicity() const {return nProd;}
0085 int product(int i) const {return (i >= 0 && i < nProd) ? prod[i] : 0;}
0086 bool hasChanged() const { return hasChangedSave;}
0087
0088
0089 bool contains(int id1) const;
0090 bool contains(int id1, int id2) const;
0091 bool contains(int id1, int id2, int id3) const;
0092
0093
0094
0095 void currentBR(double currentBRIn) {currentBRSave = currentBRIn;}
0096 double currentBR() const {return currentBRSave;}
0097
0098
0099 void onShellWidth(double onShellWidthIn) {
0100 onShellWidthSave = onShellWidthIn;}
0101 double onShellWidth() const {return onShellWidthSave;}
0102 void onShellWidthFactor(double factor) {onShellWidthSave *= factor;}
0103
0104
0105 void openSec(int idSgn, double openSecIn) {
0106 if (idSgn > 0) openSecPos = openSecIn; else openSecNeg = openSecIn;}
0107 double openSec(int idSgn) const {
0108 return (idSgn > 0) ? openSecPos : openSecNeg;}
0109
0110 private:
0111
0112
0113 int onModeSave;
0114 double bRatioSave, currentBRSave, onShellWidthSave, openSecPos,
0115 openSecNeg;
0116 int meModeSave, nProd, prod[8];
0117 bool hasChangedSave;
0118
0119 };
0120
0121
0122
0123
0124
0125 class ParticleDataEntry {
0126
0127 public:
0128
0129
0130 ParticleDataEntry(int idIn = 0, string nameIn = " ",
0131 int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0,
0132 double m0In = 0., double mWidthIn = 0., double mMinIn = 0.,
0133 double mMaxIn = 0., double tau0In = 0., bool varWidthIn = false)
0134 : idSave(abs(idIn)), nameSave(nameIn), antiNameSave("void"),
0135 spinTypeSave(spinTypeIn), chargeTypeSave(chargeTypeIn),
0136 colTypeSave(colTypeIn), m0Save(m0In), mWidthSave (mWidthIn),
0137 mMinSave(mMinIn), mMaxSave(mMaxIn), tau0Save(tau0In),
0138 constituentMassSave(), hasAntiSave(false), isResonanceSave(),
0139 mayDecaySave(), tauCalcSave(true), varWidthSave(varWidthIn),
0140 doExternalDecaySave(), isVisibleSave(), doForceWidthSave(),
0141 hasChangedSave(true), hasChangedMMinSave(false),
0142 hasChangedMMaxSave(false), modeBWnow(), modeTau0now(), atanLow(),
0143 atanDif(), mThr(), currentBRSum(), resonancePtr(0), particleDataPtr() {
0144 setDefaults();}
0145 ParticleDataEntry(int idIn, string nameIn, string antiNameIn,
0146 int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0,
0147 double m0In = 0., double mWidthIn = 0., double mMinIn = 0.,
0148 double mMaxIn = 0., double tau0In = 0., bool varWidthIn = false)
0149 : idSave(abs(idIn)), nameSave(nameIn), antiNameSave(antiNameIn),
0150 spinTypeSave(spinTypeIn), chargeTypeSave(chargeTypeIn),
0151 colTypeSave(colTypeIn), m0Save(m0In), mWidthSave (mWidthIn),
0152 mMinSave(mMinIn), mMaxSave(mMaxIn), tau0Save(tau0In),
0153 constituentMassSave(), hasAntiSave(true), isResonanceSave(),
0154 mayDecaySave(), tauCalcSave(true), varWidthSave(varWidthIn),
0155 doExternalDecaySave(), isVisibleSave(), doForceWidthSave(),
0156 hasChangedSave(true), hasChangedMMinSave(false),
0157 hasChangedMMaxSave(false), modeBWnow(), modeTau0now(), atanLow(),
0158 atanDif(), mThr(), currentBRSum(), resonancePtr(0), particleDataPtr() {
0159 setDefaults(); if (toLower(antiNameIn) == "void") hasAntiSave = false;}
0160
0161
0162 ParticleDataEntry( const ParticleDataEntry& oldPDE) {idSave = oldPDE.idSave;
0163 nameSave = oldPDE.nameSave; antiNameSave = oldPDE.antiNameSave;
0164 spinTypeSave = oldPDE.spinTypeSave; chargeTypeSave = oldPDE.chargeTypeSave;
0165 colTypeSave = oldPDE.colTypeSave; m0Save = oldPDE.m0Save;
0166 mWidthSave = oldPDE.mWidthSave; mMinSave = oldPDE.mMinSave;
0167 mMaxSave = oldPDE.mMaxSave; tau0Save = oldPDE.tau0Save;
0168 varWidthSave = oldPDE.varWidthSave;
0169 constituentMassSave = oldPDE.constituentMassSave;
0170 hasAntiSave = oldPDE.hasAntiSave; isResonanceSave = oldPDE.isResonanceSave;
0171 mayDecaySave = oldPDE.mayDecaySave; tauCalcSave = oldPDE.tauCalcSave;
0172 doExternalDecaySave = oldPDE.doExternalDecaySave; isVisibleSave
0173 = oldPDE.isVisibleSave; doForceWidthSave = oldPDE.doForceWidthSave;
0174 hasChangedSave = oldPDE.hasChangedSave; hasChangedMMinSave
0175 = oldPDE.hasChangedMMinSave; hasChangedMMaxSave
0176 = oldPDE.hasChangedMMaxSave; modeTau0now = oldPDE.modeTau0now; modeBWnow
0177 = oldPDE.modeBWnow; atanLow = oldPDE.atanLow; atanDif = oldPDE.atanDif;
0178 mThr = oldPDE.mThr;
0179 for (int i = 0; i < int(oldPDE.channels.size()); ++i) {
0180 DecayChannel oldDC = oldPDE.channels[i]; channels.push_back(oldDC); }
0181 currentBRSum = oldPDE.currentBRSum; resonancePtr = oldPDE.resonancePtr;
0182 particleDataPtr = oldPDE.particleDataPtr; }
0183
0184
0185 ParticleDataEntry& operator=( const ParticleDataEntry& oldPDE) {
0186 if (this != &oldPDE) { idSave = oldPDE.idSave;
0187 nameSave = oldPDE.nameSave; antiNameSave = oldPDE.antiNameSave;
0188 spinTypeSave = oldPDE.spinTypeSave; chargeTypeSave = oldPDE.chargeTypeSave;
0189 colTypeSave = oldPDE.colTypeSave; m0Save = oldPDE.m0Save;
0190 mWidthSave = oldPDE.mWidthSave; mMinSave = oldPDE.mMinSave;
0191 mMaxSave = oldPDE.mMaxSave; tau0Save = oldPDE.tau0Save;
0192 varWidthSave = oldPDE.varWidthSave;
0193 constituentMassSave = oldPDE.constituentMassSave;
0194 hasAntiSave = oldPDE.hasAntiSave; isResonanceSave = oldPDE.isResonanceSave;
0195 mayDecaySave = oldPDE.mayDecaySave; tauCalcSave = oldPDE.tauCalcSave;
0196 doExternalDecaySave = oldPDE.doExternalDecaySave; isVisibleSave
0197 = oldPDE.isVisibleSave; doForceWidthSave = oldPDE.doForceWidthSave;
0198 hasChangedSave = oldPDE.hasChangedSave; hasChangedMMinSave
0199 = oldPDE.hasChangedMMinSave; hasChangedMMaxSave
0200 = oldPDE.hasChangedMMaxSave; modeBWnow = oldPDE.modeBWnow; atanLow
0201 = oldPDE.atanLow; atanDif = oldPDE.atanDif; mThr = oldPDE.mThr;
0202 for (int i = 0; i < int(oldPDE.channels.size()); ++i) {
0203 DecayChannel oldDC = oldPDE.channels[i]; channels.push_back(oldDC); }
0204 currentBRSum = oldPDE.currentBRSum; resonancePtr = 0;
0205 particleDataPtr = 0; } return *this; }
0206
0207
0208 void setDefaults();
0209
0210
0211 void initPtr( ParticleData* particleDataPtrIn) {
0212 particleDataPtr = particleDataPtrIn;}
0213
0214
0215 void setAll(string nameIn, string antiNameIn, int spinTypeIn = 0,
0216 int chargeTypeIn = 0, int colTypeIn = 0, double m0In = 0.,
0217 double mWidthIn = 0., double mMinIn = 0., double mMaxIn = 0.,
0218 double tau0In = 0., bool varWidthIn = false)
0219 {nameSave = nameIn; antiNameSave = antiNameIn; hasAntiSave = true;
0220 if (toLower(antiNameIn) == "void") hasAntiSave = false;
0221 spinTypeSave = spinTypeIn; chargeTypeSave = chargeTypeIn;
0222 colTypeSave = colTypeIn; m0Save = m0In; mWidthSave = mWidthIn;
0223 setMMin(mMinIn); setMMax(mMaxIn); tau0Save = tau0In;
0224 varWidthSave = varWidthIn; setDefaults(); hasChangedSave = true;}
0225
0226
0227
0228 void setName(string nameIn) {nameSave = nameIn; hasChangedSave = true;}
0229 void setAntiName(string antiNameIn) {antiNameSave = antiNameIn;
0230 hasAntiSave = (toLower(antiNameIn) != "void"); hasChangedSave = true;}
0231 void setNames(string nameIn, string antiNameIn) {nameSave = nameIn;
0232 antiNameSave = antiNameIn; hasAntiSave = (toLower(antiNameIn) != "void");
0233 hasChangedSave = true;}
0234 void setSpinType(int spinTypeIn) {spinTypeSave = spinTypeIn;
0235 hasChangedSave = true;}
0236 void setChargeType(int chargeTypeIn) {chargeTypeSave = chargeTypeIn;
0237 hasChangedSave = true;}
0238 void setColType(int colTypeIn) {colTypeSave = colTypeIn;
0239 hasChangedSave = true;}
0240 void setM0(double m0In) {m0Save = m0In; setConstituentMass();
0241 hasChangedSave = true;}
0242 void setMWidth(double mWidthIn, bool countAsChanged = true) {
0243 mWidthSave = mWidthIn; if (countAsChanged) hasChangedSave = true;}
0244 void setMMin(double mMinIn) {mMinSave = mMinIn; hasChangedSave = true;
0245 hasChangedMMinSave=true;}
0246 void setMMax(double mMaxIn) {mMaxSave = mMaxIn; hasChangedSave = true;
0247 hasChangedMMaxSave=true;}
0248
0249 void setMMinNoChange(double mMinIn) {mMinSave = mMinIn;}
0250 void setMMaxNoChange(double mMaxIn) {mMaxSave = mMaxIn;}
0251 void setTau0(double tau0In, bool countAsChanged = true)
0252 {tau0Save = tau0In; if (countAsChanged) hasChangedSave = true;}
0253 void setVarWidth(bool varWidthIn) {varWidthSave = varWidthIn;}
0254 void setIsResonance(bool isResonanceIn) {isResonanceSave = isResonanceIn;
0255 hasChangedSave = true;}
0256 void setMayDecay(bool mayDecayIn, bool countAsChanged = true) {
0257 mayDecaySave = mayDecayIn; if (countAsChanged) hasChangedSave = true;}
0258 void setTauCalc(bool tauCalcIn, bool countAsChanged = true) {
0259 tauCalcSave = tauCalcIn; if (countAsChanged) hasChangedSave = true;}
0260 void setDoExternalDecay(bool doExternalDecayIn)
0261 {doExternalDecaySave = doExternalDecayIn; hasChangedSave = true;}
0262 void setIsVisible(bool isVisibleIn) {isVisibleSave = isVisibleIn;
0263 hasChangedSave = true;}
0264 void setDoForceWidth(bool doForceWidthIn) {doForceWidthSave = doForceWidthIn;
0265 hasChangedSave = true;}
0266 void setHasChanged(bool hasChangedIn) {hasChangedSave = hasChangedIn;
0267 for (int i = 0; i < int(channels.size()); ++i)
0268 channels[i].setHasChanged(hasChangedIn);
0269 if (!hasChangedIn) {hasChangedMMinSave=false; hasChangedMMaxSave=false;}}
0270
0271
0272 int id() const { return idSave; }
0273 int antiId() const {
0274 return hasAntiSave ? -idSave : idSave; }
0275 bool hasAnti() const { return hasAntiSave; }
0276 string name(int idIn = 1) const {
0277 return (idIn > 0) ? nameSave : antiNameSave; }
0278 int spinType() const {return spinTypeSave; }
0279 int chargeType(int idIn = 1) const {
0280 return (idIn > 0) ? chargeTypeSave : -chargeTypeSave; }
0281 double charge(int idIn = 1) const {
0282 return (idIn > 0) ? chargeTypeSave / 3. : -chargeTypeSave / 3.; }
0283 int colType(int idIn = 1) const {
0284 if (colTypeSave == 2) return colTypeSave;
0285 return (idIn > 0) ? colTypeSave : -colTypeSave; }
0286 double m0() const { return m0Save; }
0287 double mWidth() const { return mWidthSave; }
0288 double mMin() const { return mMinSave; }
0289 double mMax() const { return mMaxSave; }
0290 double m0Min() const {
0291 return (modeBWnow == 0) ? m0Save : mMinSave; }
0292 double m0Max() const {
0293 return (modeBWnow == 0) ? m0Save : mMaxSave; }
0294 double tau0() const { return tau0Save; }
0295 bool isResonance() const { return isResonanceSave; }
0296 bool varWidth() const { return varWidthSave; }
0297 bool mayDecay() const { return mayDecaySave; }
0298 bool tauCalc() const { return tauCalcSave; }
0299 bool doExternalDecay() const { return doExternalDecaySave; }
0300 bool isVisible() const { return isVisibleSave; }
0301 bool doForceWidth() const { return doForceWidthSave; }
0302 bool hasChanged() const { if (hasChangedSave) return true;
0303 for (int i = 0; i < int(channels.size()); ++i)
0304 if (channels[i].hasChanged()) return true;
0305 return false;}
0306 bool hasChangedMMin() const { return hasChangedMMinSave; }
0307 bool hasChangedMMax() const { return hasChangedMMaxSave; }
0308
0309
0310 void initBWmass();
0311 double constituentMass() const { return constituentMassSave; }
0312 double mSel() const;
0313 double mRun(double mH) const;
0314
0315
0316 bool useBreitWigner() const { return (modeBWnow > 0); }
0317 bool canDecay() const { return (channels.size() > 0)
0318 || varWidthSave; }
0319 bool isLepton() const { return (idSave > 10 && idSave < 19);}
0320 bool isQuark() const { return (idSave != 0 && idSave < 9);}
0321 bool isGluon() const { return (idSave == 21);}
0322 bool isDiquark() const { return (idSave > 1000 && idSave < 10000
0323 && (idSave/10)%10 == 0);}
0324
0325 bool isParton() const { return ( idSave == 21
0326 || (idSave != 0 && idSave < 6)
0327 || (idSave > 1000 && idSave < 5510 && (idSave/10)%10 == 0)
0328 || (idSave > 4900100 && idSave < 4900109)
0329 || (idSave > 4901000 && idSave < 4909000 && (idSave/10)%10 == 0) );}
0330 bool isHadron() const;
0331 bool isMeson() const;
0332 bool isBaryon() const;
0333 bool isOnium() const;
0334 bool isExotic() const;
0335
0336
0337 bool isOctetHadron() const {return idSave >= 9940000
0338 && idSave < 9960000; }
0339 int heaviestQuark(int idIn = 1) const;
0340 int baryonNumberType(int idIn = 1) const;
0341 int nQuarksInCode(int idQIn) const;
0342
0343
0344 void clearChannels() {channels.resize(0);}
0345
0346
0347 void addChannel(int onMode = 0, double bRatio = 0., int meMode = 0,
0348 int prod0 = 0, int prod1 = 0, int prod2 = 0, int prod3 = 0,
0349 int prod4 = 0, int prod5 = 0, int prod6 = 0, int prod7 = 0) {
0350 channels.push_back( DecayChannel( onMode, bRatio, meMode, prod0,
0351 prod1, prod2, prod3, prod4, prod5, prod6, prod7) ); }
0352
0353
0354 int sizeChannels() const {return channels.size();}
0355
0356
0357 DecayChannel& channel(int i){return channels[i];}
0358 const DecayChannel& channel(int i) const {return channels[i];}
0359
0360
0361 void rescaleBR(double newSumBR = 1.);
0362
0363
0364 bool preparePick(int idSgn, double mHat = 0., int idInFlav = 0);
0365 DecayChannel& pickChannel();
0366
0367
0368 void setResonancePtr(ResonanceWidthsPtr resonancePtrIn) {
0369 resonancePtr = resonancePtrIn;}
0370 ResonanceWidthsPtr getResonancePtr() {return resonancePtr;}
0371 void resInit(Info* infoPtrIn);
0372 double resWidth(int idSgn, double mHat, int idIn = 0,
0373 bool openOnly = false, bool setBR = false);
0374 double resWidthOpen(int idSgn, double mHat, int idIn = 0);
0375 double resWidthStore(int idSgn, double mHat, int idIn = 0);
0376 double resOpenFrac(int idSgn);
0377 double resWidthRescaleFactor();
0378 double resWidthChan(double mHat, int idAbs1 = 0, int idAbs2 = 0);
0379
0380 private:
0381
0382
0383 static const int INVISIBLENUMBER, INVISIBLETABLE[80], KNOWNNOWIDTH[3];
0384 static const double MAXTAU0FORDECAY,MINMASSRESONANCE, NARROWMASS,
0385 CONSTITUENTMASSTABLE[10];
0386
0387
0388 int idSave;
0389 string nameSave, antiNameSave;
0390 int spinTypeSave, chargeTypeSave, colTypeSave;
0391 double m0Save, mWidthSave, mMinSave, mMaxSave, tau0Save,
0392 constituentMassSave;
0393 bool hasAntiSave, isResonanceSave, mayDecaySave, tauCalcSave, varWidthSave,
0394 doExternalDecaySave, isVisibleSave, doForceWidthSave, hasChangedSave,
0395 hasChangedMMinSave, hasChangedMMaxSave;
0396
0397
0398 int modeBWnow, modeTau0now;
0399 double atanLow, atanDif, mThr;
0400
0401
0402 vector<DecayChannel> channels;
0403
0404
0405 double currentBRSum;
0406
0407
0408 ResonanceWidthsPtr resonancePtr;
0409
0410
0411 ParticleData* particleDataPtr;
0412
0413
0414 void setConstituentMass();
0415
0416 };
0417
0418
0419
0420
0421
0422 class ParticleData {
0423
0424 public:
0425
0426
0427 ParticleData() : setRapidDecayVertex(), modeBreitWigner(), maxEnhanceBW(),
0428 mQRun(), Lambda5Run(), intermediateTau0(), infoPtr(nullptr),
0429 settingsPtr(nullptr), rndmPtr(nullptr), coupSMPtr(nullptr),
0430 particlePtr(nullptr), isInit(false), readingFailedSave(false) {}
0431
0432
0433 ParticleData( const ParticleData& oldPD) {
0434 modeBreitWigner = oldPD.modeBreitWigner; maxEnhanceBW = oldPD.maxEnhanceBW;
0435 for (int i = 0; i < 7; ++i) mQRun[i] = oldPD.mQRun[i];
0436 Lambda5Run = oldPD.Lambda5Run; infoPtr = nullptr; settingsPtr = nullptr;
0437 rndmPtr = nullptr; coupSMPtr = nullptr;
0438 for (auto pde = oldPD.pdt.begin(); pde != oldPD.pdt.end(); pde++) {
0439 int idTmp = pde->first;
0440 pdt[idTmp] = make_shared<ParticleDataEntry>(*pde->second);
0441 pdt[idTmp]->initPtr(this); }
0442 particlePtr = nullptr; isInit = oldPD.isInit;
0443 readingFailedSave = oldPD.readingFailedSave; }
0444
0445
0446 ParticleData& operator=( const ParticleData& oldPD) { if (this != &oldPD) {
0447 modeBreitWigner = oldPD.modeBreitWigner; maxEnhanceBW = oldPD.maxEnhanceBW;
0448 for (int i = 0; i < 7; ++i) mQRun[i] = oldPD.mQRun[i];
0449 Lambda5Run = oldPD.Lambda5Run; infoPtr = nullptr; settingsPtr = nullptr;
0450 rndmPtr = nullptr; coupSMPtr = nullptr;
0451 for (auto pde = oldPD.pdt.begin(); pde != oldPD.pdt.end(); pde++) {
0452 int idTmp = pde->first;
0453 pdt[idTmp] = make_shared<ParticleDataEntry>(*pde->second);
0454 pdt[idTmp]->initPtr(this); }
0455 particlePtr = nullptr; isInit = oldPD.isInit;
0456 readingFailedSave = oldPD.readingFailedSave; } return *this; }
0457
0458
0459 void initPtrs(Info* infoPtrIn) {infoPtr = infoPtrIn;
0460 settingsPtr = infoPtr->settingsPtr; loggerPtr = infoPtr->loggerPtr;
0461 rndmPtr = infoPtr->rndmPtr; coupSMPtr = infoPtr->coupSMPtr;}
0462
0463
0464 bool init(string startFile = "../share/Pythia8/xmldoc/ParticleData.xml") {
0465 initCommon(); return readXML(startFile);}
0466
0467
0468 bool init(const ParticleData& particleDataIn) {
0469 initCommon(); return copyXML(particleDataIn);}
0470
0471
0472 bool init(istream& is) { initCommon(); return readXML(is);}
0473
0474
0475 bool reInit(string startFile, bool xmlFormat = true) { initCommon();
0476 return (xmlFormat) ? readXML(startFile) : readFF(startFile);}
0477
0478
0479 void initWidths(vector<ResonanceWidthsPtr> resonancePtrs);
0480
0481
0482 bool readXML(string inFile, bool reset = true) ;
0483 void listXML(string outFile);
0484 bool readXML(istream& is, bool reset=true);
0485
0486
0487 bool copyXML(const ParticleData &particleDataIn);
0488
0489
0490 bool loadXML(string inFile, bool reset = true) ;
0491 bool loadXML(istream& is, bool reset=true);
0492 bool processXML(bool reset = true) ;
0493
0494
0495 bool readFF(string inFile, bool reset = true) ;
0496 bool readFF(istream& is, bool reset = true);
0497 void listFF(string outFile);
0498
0499
0500 bool readString(string lineIn, bool warn = true) ;
0501
0502
0503 bool readingFailed() {return readingFailedSave;}
0504
0505
0506 void listAll(ostream& stream) {list(stream, false, true);}
0507 void listAll() {listAll(cout);}
0508 void listChanged(bool changedRes = false) {list(true, changedRes);}
0509 void list(ostream& stream, bool chargedOnly = false, bool changedRes = true);
0510 void list(bool changedOnly = false, bool changedRes = true) {
0511 list(cout, changedOnly, changedRes); }
0512
0513
0514 void list(int idList) {vector<int> idListTemp;
0515 idListTemp.push_back(idList); list( idListTemp);}
0516 void list(vector<int> idList);
0517
0518
0519
0520 vector<string> getReadHistory(int subrun=-999) {
0521 if (subrun == -999) return readStringHistory;
0522 else if (readStringSubrun.find(subrun) != readStringSubrun.end())
0523 return readStringSubrun[subrun];
0524 else return vector<string>();
0525 }
0526
0527
0528 void checkTable(int verbosity = 1) ;
0529
0530
0531 void addParticle(int idIn, string nameIn = " ", int spinTypeIn = 0,
0532 int chargeTypeIn = 0, int colTypeIn = 0, double m0In = 0.,
0533 double mWidthIn = 0., double mMinIn = 0., double mMaxIn = 0.,
0534 double tau0In = 0., bool varWidthIn = false) {
0535 pdt[abs(idIn)] = make_shared<ParticleDataEntry>(idIn, nameIn, spinTypeIn,
0536 chargeTypeIn, colTypeIn, m0In, mWidthIn, mMinIn, mMaxIn, tau0In,
0537 varWidthIn);
0538 pdt[abs(idIn)]->initPtr(this); }
0539 void addParticle(int idIn, string nameIn, string antiNameIn,
0540 int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0,
0541 double m0In = 0., double mWidthIn = 0., double mMinIn = 0.,
0542 double mMaxIn = 0., double tau0In = 0., bool varWidthIn = false) {
0543 pdt[abs(idIn)] = make_shared<ParticleDataEntry>(idIn, nameIn, antiNameIn,
0544 spinTypeIn, chargeTypeIn, colTypeIn, m0In, mWidthIn, mMinIn, mMaxIn,
0545 tau0In, varWidthIn);
0546 pdt[abs(idIn)]->initPtr(this); }
0547
0548
0549 void setAll(int idIn, string nameIn, string antiNameIn,
0550 int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0,
0551 double m0In = 0., double mWidthIn = 0., double mMinIn = 0.,
0552 double mMaxIn = 0.,double tau0In = 0.,bool varWidthIn = false) {
0553 ParticleDataEntryPtr ptr = findParticle(idIn);
0554 if ( ptr ) ptr->setAll( nameIn, antiNameIn, spinTypeIn, chargeTypeIn,
0555 colTypeIn, m0In, mWidthIn, mMinIn, mMaxIn, tau0In, varWidthIn); }
0556
0557
0558 bool isParticle(int idIn) const {
0559 auto found = pdt.find( abs(idIn) );
0560 if ( found == pdt.end() ) return false;
0561 if ( idIn > 0 || found->second->hasAnti() ) return true;
0562 return false;
0563 }
0564
0565
0566 ParticleDataEntryPtr findParticle(int idIn) {
0567 auto found = pdt.find( abs(idIn) );
0568 if( found == pdt.end() ) return nullptr;
0569 if ( idIn > 0 || found->second->hasAnti() ) return found->second;
0570 return nullptr;
0571 }
0572
0573
0574 const ParticleDataEntryPtr findParticle(int idIn) const {
0575 auto found = pdt.find( abs(idIn) );
0576 if( found == pdt.end() ) return nullptr;
0577 if ( idIn > 0 || found->second->hasAnti() ) return found->second;
0578 return nullptr;
0579 }
0580
0581
0582 int nextId(int idIn) const;
0583
0584
0585 map<int, ParticleDataEntryPtr>::iterator begin() { return pdt.begin(); }
0586 map<int, ParticleDataEntryPtr>::iterator end() { return pdt.end(); }
0587
0588
0589 void name(int idIn, string nameIn) {
0590 ParticleDataEntryPtr ptr = findParticle(idIn);
0591 if ( ptr ) ptr->setName(nameIn); }
0592 void antiName(int idIn, string antiNameIn) {
0593 ParticleDataEntryPtr ptr = findParticle(idIn);
0594 if ( ptr ) ptr->setAntiName(antiNameIn); }
0595 void names(int idIn, string nameIn, string antiNameIn) {
0596 ParticleDataEntryPtr ptr = findParticle(idIn);
0597 if ( ptr ) ptr->setNames(nameIn, antiNameIn); }
0598 void spinType(int idIn, int spinTypeIn) {
0599 ParticleDataEntryPtr ptr = findParticle(idIn);
0600 if ( ptr ) ptr->setSpinType(spinTypeIn); }
0601 void chargeType(int idIn, int chargeTypeIn) {
0602 ParticleDataEntryPtr ptr = findParticle(idIn);
0603 if ( ptr ) ptr->setChargeType(chargeTypeIn); }
0604 void colType(int idIn, int colTypeIn) {
0605 ParticleDataEntryPtr ptr = findParticle(idIn);
0606 if ( ptr ) ptr->setColType(colTypeIn); }
0607 void m0(int idIn, double m0In) {
0608 ParticleDataEntryPtr ptr = findParticle(idIn);
0609 if ( ptr ) ptr->setM0(m0In); }
0610 void mWidth(int idIn, double mWidthIn) {
0611 ParticleDataEntryPtr ptr = findParticle(idIn);
0612 if ( ptr ) ptr->setMWidth(mWidthIn); }
0613 void mMin(int idIn, double mMinIn) {
0614 ParticleDataEntryPtr ptr = findParticle(idIn);
0615 if ( ptr ) ptr->setMMin(mMinIn); }
0616 void mMax(int idIn, double mMaxIn) {
0617 ParticleDataEntryPtr ptr = findParticle(idIn);
0618 if ( ptr ) ptr->setMMax(mMaxIn); }
0619 void tau0(int idIn, double tau0In) {
0620 ParticleDataEntryPtr ptr = findParticle(idIn);
0621 if ( ptr ) ptr->setTau0(tau0In); }
0622 void isResonance(int idIn, bool isResonanceIn) {
0623 ParticleDataEntryPtr ptr = findParticle(idIn);
0624 if ( ptr ) ptr->setIsResonance(isResonanceIn); }
0625 void mayDecay(int idIn, bool mayDecayIn) {
0626 ParticleDataEntryPtr ptr = findParticle(idIn);
0627 if ( ptr ) ptr->setMayDecay(mayDecayIn); }
0628 void tauCalc(int idIn, bool tauCalcIn) {
0629 ParticleDataEntryPtr ptr = findParticle(idIn);
0630 if ( ptr ) ptr->setTauCalc(tauCalcIn); }
0631 void doExternalDecay(int idIn, bool doExternalDecayIn) {
0632 ParticleDataEntryPtr ptr = findParticle(idIn);
0633 if ( ptr ) ptr->setDoExternalDecay(doExternalDecayIn); }
0634 void varWidth(int idIn, bool varWidthIn) {
0635 ParticleDataEntryPtr ptr = findParticle(idIn);
0636 if ( ptr ) ptr->setVarWidth(varWidthIn); }
0637 void isVisible(int idIn, bool isVisibleIn) {
0638 ParticleDataEntryPtr ptr = findParticle(idIn);
0639 if ( ptr ) ptr->setIsVisible(isVisibleIn); }
0640 void doForceWidth(int idIn, bool doForceWidthIn) {
0641 ParticleDataEntryPtr ptr = findParticle(idIn);
0642 if ( ptr ) ptr->setDoForceWidth(doForceWidthIn); }
0643 void hasChanged(int idIn, bool hasChangedIn) {
0644 ParticleDataEntryPtr ptr = findParticle(idIn);
0645 if ( ptr ) ptr->setHasChanged(hasChangedIn); }
0646
0647
0648 bool hasAnti(int idIn) const {
0649 const ParticleDataEntryPtr ptr = findParticle(idIn);
0650 return ( ptr ) ? ptr->hasAnti() : false; }
0651 int antiId(int idIn) const {
0652 if (idIn < 0) return -idIn;
0653 const ParticleDataEntryPtr ptr = findParticle(idIn);
0654 return ( ptr ) ? ptr->antiId() : 0; }
0655 string name(int idIn) const {
0656 const ParticleDataEntryPtr ptr = findParticle(idIn);
0657 return ( ptr ) ? ptr->name(idIn) : " "; }
0658 int spinType(int idIn) const {
0659 const ParticleDataEntryPtr ptr = findParticle(idIn);
0660 return ( ptr ) ? ptr->spinType() : 0; }
0661 int chargeType(int idIn) const {
0662 const ParticleDataEntryPtr ptr = findParticle(idIn);
0663 return ( ptr ) ? ptr->chargeType(idIn) : 0; }
0664 double charge(int idIn) const {
0665 const ParticleDataEntryPtr ptr = findParticle(idIn);
0666 return ( ptr ) ? ptr->charge(idIn) : 0; }
0667 int colType(int idIn) const {
0668 const ParticleDataEntryPtr ptr = findParticle(idIn);
0669 return ( ptr ) ? ptr->colType(idIn) : 0 ; }
0670 double m0(int idIn) const {
0671 const ParticleDataEntryPtr ptr = findParticle(idIn);
0672 return ( ptr ) ? ptr->m0() : 0. ; }
0673 double mWidth(int idIn) const {
0674 const ParticleDataEntryPtr ptr = findParticle(idIn);
0675 return ( ptr ) ? ptr->mWidth() : 0. ; }
0676 double mMin(int idIn) const {
0677 const ParticleDataEntryPtr ptr = findParticle(idIn);
0678 return ( ptr ) ? ptr->mMin() : 0. ; }
0679 double m0Min(int idIn) const {
0680 const ParticleDataEntryPtr ptr = findParticle(idIn);
0681 return ( ptr ) ? ptr->m0Min() : 0. ; }
0682 double mMax(int idIn) const {
0683 const ParticleDataEntryPtr ptr = findParticle(idIn);
0684 return ( ptr ) ? ptr->mMax() : 0. ; }
0685 double m0Max(int idIn) const {
0686 const ParticleDataEntryPtr ptr = findParticle(idIn);
0687 return ( ptr ) ? ptr->m0Max() : 0. ; }
0688 double tau0(int idIn) const {
0689 const ParticleDataEntryPtr ptr = findParticle(idIn);
0690 return ( ptr ) ? ptr->tau0() : 0. ; }
0691 bool isResonance(int idIn) const {
0692 const ParticleDataEntryPtr ptr = findParticle(idIn);
0693 return ( ptr ) ? ptr->isResonance() : false ; }
0694 bool mayDecay(int idIn) const {
0695 const ParticleDataEntryPtr ptr = findParticle(idIn);
0696 return ( ptr ) ? ptr->mayDecay() : false ; }
0697 bool tauCalc(int idIn) const {
0698 const ParticleDataEntryPtr ptr = findParticle(idIn);
0699 return ( ptr ) ? ptr->tauCalc() : false ; }
0700 bool doExternalDecay(int idIn) const {
0701 const ParticleDataEntryPtr ptr = findParticle(idIn);
0702 return ( ptr ) ? ptr->doExternalDecay() : false ; }
0703 bool isVisible(int idIn) const {
0704 const ParticleDataEntryPtr ptr = findParticle(idIn);
0705 return ( ptr ) ? ptr->isVisible() : false ; }
0706 bool doForceWidth(int idIn) const {
0707 const ParticleDataEntryPtr ptr = findParticle(idIn);
0708 return ( ptr ) ? ptr->doForceWidth() : false ; }
0709 bool hasChanged(int idIn) const {
0710 const ParticleDataEntryPtr ptr = findParticle(idIn);
0711 return ( ptr ) ? ptr->hasChanged() : false ; }
0712 bool hasChangedMMin(int idIn) const {
0713 const ParticleDataEntryPtr ptr = findParticle(idIn);
0714 return ( ptr ) ? ptr->hasChangedMMin() : false ; }
0715 bool hasChangedMMax(int idIn) const {
0716 const ParticleDataEntryPtr ptr = findParticle(idIn);
0717 return ( ptr ) ? ptr->hasChangedMMax() : false ; }
0718
0719
0720 bool useBreitWigner(int idIn) const {
0721 const ParticleDataEntryPtr ptr = findParticle(idIn);
0722 return ( ptr ) ? ptr->useBreitWigner() : false ; }
0723 bool varWidth(int idIn) const {
0724 const ParticleDataEntryPtr ptr = findParticle(idIn);
0725 return ( ptr ) ? ptr->varWidth() : false; }
0726 double constituentMass(int idIn) const {
0727 const ParticleDataEntryPtr ptr = findParticle(idIn);
0728 return ( ptr ) ? ptr->constituentMass() : 0. ; }
0729 double mSel(int idIn) const {
0730 const ParticleDataEntryPtr ptr = findParticle(idIn);
0731 return ( ptr ) ? ptr->mSel() : 0. ; }
0732 double mRun(int idIn, double mH) const {
0733 const ParticleDataEntryPtr ptr = findParticle(idIn);
0734 return ( ptr ) ? ptr->mRun(mH) : 0. ; }
0735
0736
0737 bool canDecay(int idIn) const {
0738 const ParticleDataEntryPtr ptr = findParticle(idIn);
0739 return ( ptr ) ? ptr->canDecay() : false ; }
0740 bool isLepton(int idIn) const {
0741 const ParticleDataEntryPtr ptr = findParticle(idIn);
0742 return ( ptr ) ? ptr->isLepton() : false ; }
0743 bool isQuark(int idIn) const {
0744 const ParticleDataEntryPtr ptr = findParticle(idIn);
0745 return ( ptr ) ? ptr->isQuark() : false ; }
0746 bool isGluon(int idIn) const {
0747 const ParticleDataEntryPtr ptr = findParticle(idIn);
0748 return ( ptr ) ? ptr->isGluon() : false ; }
0749 bool isDiquark(int idIn) const {
0750 const ParticleDataEntryPtr ptr = findParticle(idIn);
0751 return ( ptr ) ? ptr->isDiquark() : false ; }
0752 bool isParton(int idIn) const {
0753 const ParticleDataEntryPtr ptr = findParticle(idIn);
0754 return ( ptr ) ? ptr->isParton() : false ; }
0755 bool isHadron(int idIn) const {
0756 const ParticleDataEntryPtr ptr = findParticle(idIn);
0757 return ( ptr ) ? ptr->isHadron() : false ; }
0758 bool isMeson(int idIn) const {
0759 const ParticleDataEntryPtr ptr = findParticle(idIn);
0760 return ( ptr ) ? ptr->isMeson() : false ; }
0761 bool isBaryon(int idIn) const {
0762 const ParticleDataEntryPtr ptr = findParticle(idIn);
0763 return ( ptr ) ? ptr->isBaryon() : false ; }
0764 bool isOnium(int idIn) const {
0765 const ParticleDataEntryPtr ptr = findParticle(idIn);
0766 return ( ptr ) ? ptr->isOnium() : false ; }
0767 bool isExotic(int idIn) const {
0768 const ParticleDataEntryPtr ptr = findParticle(idIn);
0769 return ( ptr ) ? ptr->isExotic() : false ; }
0770 bool isOctetHadron(int idIn) const {
0771 const ParticleDataEntryPtr ptr = findParticle(idIn);
0772 return ( ptr ) ? ptr->isOctetHadron() : false ; }
0773 int heaviestQuark(int idIn) const {
0774 const ParticleDataEntryPtr ptr = findParticle(idIn);
0775 return ( ptr ) ? ptr->heaviestQuark(idIn) : 0 ; }
0776 int baryonNumberType(int idIn) const {
0777 const ParticleDataEntryPtr ptr = findParticle(idIn);
0778 return ( ptr ) ? ptr->baryonNumberType(idIn) : 0 ; }
0779 int nQuarksInCode(int idIn, int idQIn) const {
0780 const ParticleDataEntryPtr ptr = findParticle(idIn);
0781 return ( ptr ) ? ptr->nQuarksInCode(idQIn) : 0 ; }
0782
0783
0784 void rescaleBR(int idIn, double newSumBR = 1.) {
0785 ParticleDataEntryPtr ptr = findParticle(idIn);
0786 if ( ptr ) ptr->rescaleBR(newSumBR); }
0787
0788
0789 void setResonancePtr(int idIn, ResonanceWidthsPtr resonancePtrIn) {
0790 ParticleDataEntryPtr ptr = findParticle(idIn);
0791 if ( ptr ) ptr->setResonancePtr( resonancePtrIn);}
0792 void resInit(int idIn) {
0793 ParticleDataEntryPtr ptr = findParticle(idIn);
0794 if ( ptr ) ptr->resInit(infoPtr);}
0795 double resWidth(int idIn, double mHat, int idInFlav = 0,
0796 bool openOnly = false, bool setBR = false) {
0797 ParticleDataEntryPtr ptr = findParticle(idIn);
0798 return ( ptr ) ? ptr->resWidth(idIn, mHat,
0799 idInFlav, openOnly, setBR) : 0.;}
0800 double resWidthOpen(int idIn, double mHat, int idInFlav = 0) {
0801 ParticleDataEntryPtr ptr = findParticle(idIn);
0802 return ( ptr ) ? ptr->resWidthOpen(idIn, mHat, idInFlav) : 0.;}
0803 double resWidthStore(int idIn, double mHat, int idInFlav = 0) {
0804 ParticleDataEntryPtr ptr = findParticle(idIn);
0805 return ( ptr ) ? ptr->resWidthStore(idIn, mHat, idInFlav) : 0.;}
0806 double resOpenFrac(int id1In, int id2In = 0, int id3In = 0);
0807 double resWidthRescaleFactor(int idIn) {
0808 ParticleDataEntryPtr ptr = findParticle(idIn);
0809 return ( ptr ) ? ptr->resWidthRescaleFactor() : 0.;}
0810 double resWidthChan(int idIn, double mHat, int idAbs1 = 0,
0811 int idAbs2 = 0) {
0812 ParticleDataEntryPtr ptr = findParticle(idIn);
0813 return ( ptr ) ? ptr->resWidthChan( mHat, idAbs1, idAbs2) : 0.;}
0814
0815
0816 ParticleDataEntryPtr particleDataEntryPtr(int idIn) {
0817 ParticleDataEntryPtr ptr = findParticle(idIn);
0818 return ( ptr ) ? ptr : pdt[0]; }
0819
0820
0821 bool getIsInit() {return isInit;}
0822
0823 private:
0824
0825
0826 bool setRapidDecayVertex;
0827 int modeBreitWigner;
0828 double maxEnhanceBW, mQRun[7], Lambda5Run, intermediateTau0;
0829
0830
0831 friend class ParticleDataEntry;
0832
0833
0834 Info* infoPtr;
0835
0836
0837 Settings* settingsPtr;
0838
0839
0840 Logger* loggerPtr;
0841
0842
0843 Rndm* rndmPtr;
0844
0845
0846 CoupSM* coupSMPtr;
0847
0848
0849 map<int, ParticleDataEntryPtr> pdt;
0850
0851
0852 ParticleDataEntryPtr particlePtr;
0853
0854
0855 bool isInit, readingFailedSave;
0856
0857
0858 void initCommon();
0859
0860
0861 bool boolString(string tag) { string tagLow = toLower(tag);
0862 return ( tagLow == "true" || tagLow == "1" || tagLow == "on"
0863 || tagLow == "yes" || tagLow == "ok" ); }
0864
0865
0866 string attributeValue(string line, string attribute);
0867 bool boolAttributeValue(string line, string attribute);
0868 int intAttributeValue(string line, string attribute);
0869 double doubleAttributeValue(string line, string attribute);
0870
0871
0872 vector<string> xmlFileSav;
0873
0874
0875 vector<string> readStringHistory;
0876 map<int, vector<string> > readStringSubrun;
0877
0878 };
0879
0880
0881
0882 }
0883
0884 #endif