File indexing completed on 2025-09-16 09:03:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef Pythia8_Pythia_H
0010 #define Pythia8_Pythia_H
0011
0012
0013 #define PYTHIA_VERSION 8.315
0014 #define PYTHIA_VERSION_INTEGER 8315
0015
0016
0017 #include "Pythia8/Analysis.h"
0018 #include "Pythia8/Basics.h"
0019 #include "Pythia8/BeamParticle.h"
0020 #include "Pythia8/BeamSetup.h"
0021 #include "Pythia8/Event.h"
0022 #include "Pythia8/FragmentationFlavZpT.h"
0023 #include "Pythia8/HadronLevel.h"
0024 #include "Pythia8/HadronWidths.h"
0025 #include "Pythia8/Info.h"
0026 #include "Pythia8/JunctionSplitting.h"
0027 #include "Pythia8/LesHouches.h"
0028 #include "Pythia8/Logger.h"
0029 #include "Pythia8/SigmaLowEnergy.h"
0030 #include "Pythia8/Merging.h"
0031 #include "Pythia8/MergingHooks.h"
0032 #include "Pythia8/PartonLevel.h"
0033 #include "Pythia8/ParticleData.h"
0034 #include "Pythia8/PartonDistributions.h"
0035 #include "Pythia8/PartonSystems.h"
0036 #include "Pythia8/PartonVertex.h"
0037 #include "Pythia8/PhysicsBase.h"
0038 #include "Pythia8/ProcessLevel.h"
0039 #include "Pythia8/PythiaStdlib.h"
0040 #include "Pythia8/ResonanceWidths.h"
0041 #include "Pythia8/RHadrons.h"
0042 #include "Pythia8/Ropewalk.h"
0043 #include "Pythia8/Settings.h"
0044 #include "Pythia8/ShowerModel.h"
0045 #include "Pythia8/SigmaTotal.h"
0046 #include "Pythia8/SimpleSpaceShower.h"
0047 #include "Pythia8/SimpleTimeShower.h"
0048 #include "Pythia8/SpaceShower.h"
0049 #include "Pythia8/StandardModel.h"
0050 #include "Pythia8/StringInteractions.h"
0051 #include "Pythia8/SusyCouplings.h"
0052 #include "Pythia8/SLHAinterface.h"
0053 #include "Pythia8/TimeShower.h"
0054 #include "Pythia8/UserHooks.h"
0055 #include "Pythia8/VinciaCommon.h"
0056 #include "Pythia8/Weights.h"
0057
0058 namespace Pythia8 {
0059
0060
0061
0062
0063 class HeavyIons;
0064 class HIUserHooks;
0065
0066
0067 class PythiaParallel;
0068
0069
0070
0071 class Pythia {
0072
0073 public:
0074
0075
0076 Pythia(string xmlDir = "../share/Pythia8/xmldoc", bool printBanner = true);
0077
0078
0079
0080 Pythia(Settings& settingsIn, ParticleData& particleDataIn,
0081 bool printBanner = true);
0082
0083
0084 Pythia( istream& settingsStrings, istream& particleDataStrings,
0085 bool printBanner = true);
0086
0087
0088 ~Pythia() {}
0089
0090
0091 Pythia(const Pythia&) = delete;
0092 Pythia& operator=(const Pythia&) = delete;
0093
0094
0095 bool checkVersion();
0096
0097
0098 inline bool readString(string line, bool warn = true,
0099 int subrun = SUBRUNDEFAULT) {
0100 return isConstructed ? settings.readString(line, warn, subrun) : false;}
0101
0102
0103 inline bool readFile(string fileName, bool warn = true,
0104 int subrun = SUBRUNDEFAULT) {
0105 return isConstructed ? settings.readFile(fileName, warn, subrun) : false;}
0106 inline bool readFile(string fileName, int subrun) {
0107 return readFile(fileName, true, subrun);}
0108 inline bool readFile(istream& is = cin, bool warn = true,
0109 int subrun = SUBRUNDEFAULT) {
0110 return isConstructed ? settings.readFile(is, warn, subrun) : false;}
0111 inline bool readFile(istream& is, int subrun) {
0112 return readFile(is, true, subrun);}
0113
0114
0115 inline bool setPDFPtr(PDFPtr pdfAPtrIn, PDFPtr pdfBPtrIn,
0116 PDFPtr pdfHardAPtrIn = nullptr, PDFPtr pdfHardBPtrIn = nullptr,
0117 PDFPtr pdfPomAPtrIn = nullptr, PDFPtr pdfPomBPtrIn = nullptr,
0118 PDFPtr pdfGamAPtrIn = nullptr, PDFPtr pdfGamBPtrIn = nullptr,
0119 PDFPtr pdfHardGamAPtrIn = nullptr, PDFPtr pdfHardGamBPtrIn = nullptr,
0120 PDFPtr pdfUnresAPtrIn = nullptr, PDFPtr pdfUnresBPtrIn = nullptr,
0121 PDFPtr pdfUnresGamAPtrIn = nullptr, PDFPtr pdfUnresGamBPtrIn = nullptr,
0122 PDFPtr pdfVMDAPtrIn = nullptr, PDFPtr pdfVMDBPtrIn = nullptr) {
0123 return beamSetup.setPDFPtr( pdfAPtrIn, pdfBPtrIn, pdfHardAPtrIn,
0124 pdfHardBPtrIn, pdfPomAPtrIn, pdfPomBPtrIn, pdfGamAPtrIn, pdfGamBPtrIn,
0125 pdfHardGamAPtrIn, pdfHardGamBPtrIn, pdfUnresAPtrIn, pdfUnresBPtrIn,
0126 pdfUnresGamAPtrIn, pdfUnresGamBPtrIn, pdfVMDAPtrIn, pdfVMDBPtrIn); }
0127 inline bool setPDFAPtr( PDFPtr pdfAPtrIn ) {
0128 return beamSetup.setPDFAPtr( pdfAPtrIn); }
0129 inline bool setPDFBPtr( PDFPtr pdfBPtrIn ) {
0130 return beamSetup.setPDFBPtr( pdfBPtrIn); }
0131
0132
0133 inline bool setPhotonFluxPtr(PDFPtr photonFluxAIn, PDFPtr photonFluxBIn) {
0134 return beamSetup.setPhotonFluxPtr( photonFluxAIn, photonFluxBIn); }
0135
0136
0137 inline bool setLHAupPtr(LHAupPtr lhaUpPtrIn) {
0138 lhaUpPtr = lhaUpPtrIn;
0139 useNewLHA = false;
0140 return beamSetup.setLHAupPtr(lhaUpPtrIn);}
0141
0142
0143 inline bool setDecayPtr(DecayHandlerPtr decayHandlePtrIn,
0144 vector<int> handledParticlesIn = {}) {
0145 decayHandlePtr = decayHandlePtrIn;
0146 handledParticles = handledParticlesIn.size() == 0 ?
0147 decayHandlePtrIn->handledParticles() : handledParticlesIn; return true;}
0148
0149
0150 inline bool setRndmEnginePtr(RndmEnginePtr rndmEnginePtrIn) {
0151 return rndm.rndmEnginePtr(rndmEnginePtrIn);}
0152
0153
0154 inline bool setUserHooksPtr(UserHooksPtr userHooksPtrIn) {
0155 userHooksPtr = userHooksPtrIn; return true;}
0156
0157
0158 inline bool addUserHooksPtr(UserHooksPtr userHooksPtrIn) {
0159 if ( !userHooksPtrIn ) return false;
0160 if ( !userHooksPtr ) return setUserHooksPtr(userHooksPtrIn);
0161 shared_ptr<UserHooksVector> uhv =
0162 dynamic_pointer_cast<UserHooksVector>(userHooksPtr);
0163 if ( !uhv ) { uhv = make_shared<UserHooksVector>();
0164 uhv->hooks.push_back(userHooksPtr); userHooksPtr = uhv; }
0165 uhv->hooks.push_back(userHooksPtrIn); return true;}
0166
0167
0168 inline bool insertUserHooksPtr(int idx, UserHooksPtr userHooksPtrIn) {
0169 if ( !userHooksPtrIn || !userHooksPtr ) return false;
0170 shared_ptr<UserHooksVector> uhv =
0171 dynamic_pointer_cast<UserHooksVector>(userHooksPtr);
0172 if ( !uhv || idx < 0 || idx > (int)uhv->hooks.size() ) return false;
0173 uhv->hooks.insert(uhv->hooks.begin() + idx, userHooksPtrIn); return true;}
0174
0175
0176 inline bool setMergingPtr(MergingPtr mergingPtrIn) {
0177 mergingPtr = mergingPtrIn; return true;}
0178
0179
0180 inline bool setMergingHooksPtr(MergingHooksPtr mergingHooksPtrIn) {
0181 mergingHooksPtr = mergingHooksPtrIn; return true;}
0182
0183
0184 inline bool setBeamShapePtr(BeamShapePtr beamShapePtrIn) {
0185 return beamSetup.setBeamShapePtr(beamShapePtrIn);}
0186
0187
0188
0189 inline bool setSigmaPtr(SigmaProcessPtr sigmaPtrIn,
0190 PhaseSpacePtr phaseSpacePtrIn = nullptr) {
0191 sigmaPtrs.resize(0), phaseSpacePtrs.resize(0);
0192 sigmaPtrs.push_back(sigmaPtrIn);
0193 phaseSpacePtrs.push_back(phaseSpacePtrIn); return true;}
0194
0195
0196 inline bool addSigmaPtr(SigmaProcessPtr sigmaPtrIn,
0197 PhaseSpacePtr phaseSpacePtrIn = nullptr) {
0198 sigmaPtrs.push_back(sigmaPtrIn);
0199 phaseSpacePtrs.push_back(phaseSpacePtrIn); return true;}
0200
0201
0202
0203 inline bool insertSigmaPtr(int idx, SigmaProcessPtr sigmaPtrIn,
0204 PhaseSpacePtr phaseSpacePtrIn = nullptr) {
0205 if (idx < 0 || idx > (int)sigmaPtrs.size()) return false;
0206 sigmaPtrs.insert(sigmaPtrs.begin() + idx, sigmaPtrIn);
0207 phaseSpacePtrs.insert(phaseSpacePtrs.begin() + idx, phaseSpacePtrIn);
0208 return true;}
0209
0210
0211 inline bool setResonancePtr(ResonanceWidthsPtr resonancePtrIn) {
0212 resonancePtrs.resize(0);
0213 resonancePtrs.push_back( resonancePtrIn); return true;}
0214
0215
0216 inline bool addResonancePtr(ResonanceWidthsPtr resonancePtrIn) {
0217 resonancePtrs.push_back( resonancePtrIn); return true;}
0218
0219
0220 inline bool insertResonancePtr(int idx, ResonanceWidthsPtr resonancePtrIn) {
0221 if (idx < 0 || idx > (int)resonancePtrs.size()) return false;
0222 resonancePtrs.insert( resonancePtrs.begin() + idx, resonancePtrIn);
0223 return true;}
0224
0225
0226 inline bool setShowerModelPtr(ShowerModelPtr showerModelPtrIn) {
0227 showerModelPtr = showerModelPtrIn; return true;}
0228
0229
0230 inline bool setFragmentationPtr(FragmentationModelPtr fragmentationPtrIn) {
0231 fragPtrs.resize(0);
0232 fragPtrs.push_back(fragmentationPtrIn); return true;}
0233
0234
0235 inline bool addFragmentationPtr(FragmentationModelPtr fragmentationPtrIn) {
0236 fragPtrs.push_back(fragmentationPtrIn); return true;}
0237
0238
0239 inline bool insertFragmentationPtr(int idx,
0240 FragmentationModelPtr fragmentationPtrIn) {
0241 if (idx < 0 || idx > (int)fragPtrs.size()) return false;
0242 fragPtrs.insert( fragPtrs.begin() + idx, fragmentationPtrIn);
0243 return true;}
0244
0245
0246 inline bool setHeavyIonsPtr(HeavyIonsPtr heavyIonsPtrIn) {
0247 heavyIonsPtr = heavyIonsPtrIn; return true;}
0248
0249
0250
0251 inline bool setHIHooks(HIUserHooksPtr hiHooksPtrIn) {
0252 hiHooksPtr = hiHooksPtrIn; return true; }
0253
0254
0255
0256 inline HeavyIonsPtr getHeavyIonsPtr() { return heavyIonsPtr;}
0257
0258
0259 inline BeamShapePtr getBeamShapePtr() { return beamSetup.getBeamShapePtr();}
0260
0261
0262 inline ShowerModelPtr getShowerModelPtr() { return showerModelPtr;}
0263
0264
0265 inline LHAupPtr getLHAupPtr() { return lhaUpPtr;}
0266
0267
0268 inline bool setPartonVertexPtr( PartonVertexPtr partonVertexPtrIn) {
0269 partonVertexPtr = partonVertexPtrIn; return true;}
0270
0271
0272 bool init();
0273
0274
0275 inline bool next() { return next(0); }
0276 bool next(int procTypeIn);
0277
0278
0279 bool setBeamIDs( int idAin, int idBin = 0);
0280
0281
0282 bool setKinematics(double eCMIn);
0283 bool setKinematics(double eAIn, double eBIn);
0284 bool setKinematics(double pxAIn, double pyAIn, double pzAIn,
0285 double pxBIn, double pyBIn, double pzBIn);
0286 bool setKinematics(Vec4 pAIn, Vec4 pBIn);
0287
0288
0289 inline int forceTimeShower( int iBeg, int iEnd, double pTmax,
0290 int nBranchMax = 0) {
0291 if (!isInit) {
0292 logger.ERROR_MSG("Pythia is not properly initialized");
0293 return 0;
0294 }
0295 partonSystems.clear();
0296 infoPrivate.setScalup( 0, pTmax);
0297 return timesDecPtr->shower(iBeg, iEnd, event, pTmax, nBranchMax);}
0298
0299
0300 bool forceHadronLevel( bool findJunctions = true);
0301
0302
0303 bool moreDecays() {return hadronLevel.moreDecays(event);}
0304 bool moreDecays(int index) {return hadronLevel.decay(index, event);}
0305
0306
0307 bool forceRHadronDecays() {return doRHadronDecays();}
0308
0309
0310 inline bool doLowEnergyProcess(int i1, int i2, int procTypeIn) {
0311 if (!isInit) {
0312 logger.ERROR_MSG("Pythia is not properly initialized"); return false; }
0313 return hadronLevel.doLowEnergyProcess( i1, i2, procTypeIn, event); }
0314
0315
0316 inline double getSigmaTotal() {
0317 return getSigmaTotal(beamSetup.idA, beamSetup.idB, beamSetup.eCM, 0);}
0318 inline double getSigmaTotal(double eCM12, int mixLoHi = 0) {
0319 return getSigmaTotal(beamSetup.idA, beamSetup.idB, eCM12, mixLoHi);}
0320 inline double getSigmaTotal(int id1, int id2, double eCM12,
0321 int mixLoHi = 0) {
0322 return getSigmaTotal(id1, id2, eCM12, particleData.m0(id1),
0323 particleData.m0(id2), mixLoHi); }
0324 inline double getSigmaTotal(int id1, int id2, double eCM12, double m1,
0325 double m2, int mixLoHi = 0) {
0326 if (!isInit) {
0327 logger.ERROR_MSG("Pythia is not properly initialized"); return 0.; }
0328 return sigmaCmb.sigmaTotal(id1, id2, eCM12, m1, m2, mixLoHi); }
0329
0330
0331
0332 inline double getSigmaPartial(int procTypeIn) {
0333 return getSigmaPartial(beamSetup.idA, beamSetup.idB, beamSetup.eCM,
0334 procTypeIn, 0); }
0335 inline double getSigmaPartial(double eCM12, int procTypeIn,
0336 int mixLoHi = 0) {return getSigmaPartial(
0337 beamSetup.idA, beamSetup.idB, eCM12, procTypeIn, mixLoHi); }
0338 inline double getSigmaPartial(int id1, int id2, double eCM12, int procTypeIn,
0339 int mixLoHi = 0) {return getSigmaPartial(id1, id2, eCM12,
0340 particleData.m0(id1), particleData.m0(id2), procTypeIn, mixLoHi); }
0341 inline double getSigmaPartial(int id1, int id2, double eCM12, double m1,
0342 double m2, int procTypeIn, int mixLoHi = 0) {
0343 if (!isInit) {
0344 logger.ERROR_MSG("Pythia is not properly initialized"); return 0.;}
0345 return sigmaCmb.sigmaPartial(
0346 id1, id2, eCM12, m1, m2, procTypeIn, mixLoHi);}
0347
0348
0349 inline PDFPtr getPDFPtr(int idIn, int sequence = 1, string beam = "A",
0350 bool resolved = true) {
0351 return beamSetup.getPDFPtr( idIn, sequence, beam, resolved); }
0352
0353
0354 inline void LHAeventList() { if (lhaUpPtr != 0) lhaUpPtr->listEvent();}
0355
0356
0357 inline bool LHAeventSkip(int nSkip) {
0358 if (lhaUpPtr != 0) return lhaUpPtr->skipEvent(nSkip);
0359 return false;}
0360
0361
0362 void stat();
0363
0364
0365 bool flag(string key) {return settings.flag(key);}
0366 int mode(string key) {return settings.mode(key);}
0367 double parm(string key) {return settings.parm(key);}
0368 string word(string key) {return settings.word(key);}
0369
0370
0371 Event process = {};
0372
0373
0374 Event event = {};
0375
0376
0377 const Info& info = infoPrivate;
0378
0379
0380 Logger logger = {};
0381
0382
0383 Settings settings = {};
0384
0385
0386 ParticleData particleData = {};
0387
0388
0389 Rndm rndm = {};
0390
0391
0392 CoupSM coupSM = {};
0393
0394
0395 CoupSUSY coupSUSY = {};
0396
0397
0398 SLHAinterface slhaInterface = {};
0399
0400
0401 PartonSystems partonSystems = {};
0402
0403
0404 MergingPtr mergingPtr = {};
0405
0406
0407
0408 MergingHooksPtr mergingHooksPtr;
0409
0410
0411 HeavyIonsPtr heavyIonsPtr = {};
0412
0413
0414 HIUserHooksPtr hiHooksPtr = {};
0415
0416
0417 HadronWidths hadronWidths = {};
0418
0419
0420 const BeamParticle& beamA = beamSetup.beamA;
0421 const BeamParticle& beamB = beamSetup.beamB;
0422
0423 private:
0424
0425
0426 friend class PythiaParallel;
0427
0428
0429
0430 WeightContainer weightContainer = {};
0431
0432
0433
0434
0435 Info infoPrivate = {};
0436
0437
0438 void initPtrs();
0439
0440
0441 void initPlugins();
0442
0443
0444 void beginEvent();
0445 void endEvent(PhysicsBase::Status status);
0446
0447
0448 inline void registerPhysicsBase(PhysicsBase &pb) {
0449 if (find(physicsPtrs.begin(), physicsPtrs.end(), &pb) != physicsPtrs.end())
0450 return;
0451 pb.initInfoPtr(infoPrivate);
0452 physicsPtrs.push_back(&pb);
0453 }
0454
0455
0456
0457 void pushInfo();
0458
0459
0460 static const double VERSIONNUMBERHEAD, VERSIONNUMBERCODE;
0461
0462
0463 static const int NTRY = 10;
0464
0465
0466 string xmlPath = {};
0467 bool doProcessLevel = {}, doPartonLevel = {}, doHadronLevel = {},
0468 doLowEnergy = {}, doSoftQCDall = {}, doSoftQCDinel = {},
0469 doCentralDiff = {}, doDiffraction = {}, doSoftQCD = {},
0470 doHardDiff = {}, doResDec = {}, doFSRinRes = {}, decayRHadrons = {},
0471 doPartonVertex = {}, abortIfVeto = {}, checkEvent = {},
0472 checkHistory = {}, doNonPert = {};
0473 int nErrList = {};
0474 double epTolErr = {}, epTolWarn = {}, mTolErr = {}, mTolWarn = {};
0475
0476
0477 bool isConstructed = {}, isInit = {}, showSaV = {}, showMaD = {},
0478 doReconnect = {}, forceHadronLevelCR = {};
0479 int nCount = {}, nShowLHA = {}, nShowInfo = {}, nShowProc = {},
0480 nShowEvt = {}, reconnectMode = {};
0481
0482
0483 int nErrEvent = {};
0484 vector<int> iErrId = {}, iErrCol = {}, iErrEpm = {}, iErrNan = {},
0485 iErrNanVtx = {};
0486
0487
0488 BeamSetup beamSetup = {};
0489
0490
0491 bool doLHA = false;
0492 bool useNewLHA = false;
0493 LHAupPtr lhaUpPtr = {};
0494
0495
0496 DecayHandlerPtr decayHandlePtr = {};
0497 vector<int> handledParticles = {};
0498
0499
0500 UserHooksPtr userHooksPtr = {};
0501 bool doVetoProcess = {}, doVetoPartons = {},
0502 retryPartonLevel = {}, canVetoHadronization = {};
0503
0504
0505 BeamShapePtr beamShapePtr = {};
0506 bool doVertexSpread = {};
0507 double eMinPert = {}, eWidthPert = {};
0508
0509
0510 vector<SigmaProcessPtr> sigmaPtrs = {};
0511
0512
0513
0514 vector<PhaseSpacePtr> phaseSpacePtrs = {};
0515
0516
0517 vector<ResonanceWidthsPtr> resonancePtrs = {};
0518
0519
0520
0521
0522
0523
0524 ShowerModelPtr showerModelPtr = {};
0525 TimeShowerPtr timesDecPtr = {};
0526 TimeShowerPtr timesPtr = {};
0527 SpaceShowerPtr spacePtr = {};
0528
0529
0530 vector<FragmentationModelPtr> fragPtrs = {};
0531
0532
0533 PartonVertexPtr partonVertexPtr;
0534
0535
0536 ProcessLevel processLevel = {};
0537
0538
0539 PartonLevel partonLevel = {};
0540
0541
0542 PartonLevel trialPartonLevel = {};
0543
0544
0545 bool doMerging = {};
0546
0547
0548 StringIntPtr stringInteractionsPtr;
0549
0550
0551 ColRecPtr colourReconnectionPtr = {};
0552
0553
0554 JunctionSplitting junctionSplitting = {};
0555
0556
0557 HadronLevel hadronLevel = {};
0558
0559
0560 SigmaTotal sigmaTot = {};
0561 SigmaLowEnergy sigmaLowEnergy;
0562 NucleonExcitations nucleonExcitations = {};
0563 SigmaCombined sigmaCmb = {};
0564
0565
0566 LundFragmentationPtr fragPtr{};
0567
0568
0569 RHadronsPtr rHadronsPtr{};
0570
0571
0572 bool hasHeavyIons = {}, doHeavyIons = {};
0573
0574
0575 void banner();
0576
0577
0578 void checkSettings();
0579
0580
0581 bool nextNonPert(int procTypeIn = 0);
0582
0583
0584 bool doRHadronDecays();
0585
0586
0587 bool check();
0588
0589
0590 bool initSLHA();
0591 stringstream particleDataBuffer;
0592
0593
0594 vector<PhysicsBase*> physicsPtrs = {};
0595
0596 };
0597
0598
0599
0600 }
0601
0602 #endif