File indexing completed on 2025-01-18 10:06:28
0001
0002
0003
0004
0005
0006 #ifndef PYTHIA_PARALLEL_H
0007 #define PYTHIA_PARALLEL_H
0008
0009 #include "Pythia8/Pythia.h"
0010 #include "Pythia8/PythiaStdlib.h"
0011
0012 namespace Pythia8 {
0013
0014
0015
0016
0017
0018 class PythiaParallel {
0019
0020 public:
0021
0022
0023 PythiaParallel(string xmlDir = "../share/Pythia8/xmldoc",
0024 bool printBanner = true);
0025
0026
0027 bool readString(string setting, bool warn = true) {
0028 return pythiaHelper.readString(setting, warn); }
0029
0030
0031 bool readFile(string fileName, bool warn = true,
0032 int subrun = SUBRUNDEFAULT);
0033 bool readFile(string fileName, int subrun) {
0034 return readFile(fileName, true, subrun); }
0035 bool readFile(istream& is = cin, bool warn = true,
0036 int subrun = SUBRUNDEFAULT);
0037 bool readFile(istream& is, int subrun) {
0038 return readFile(is, true, subrun);}
0039
0040
0041 bool init();
0042 bool init(function<bool(Pythia*)> additionalSetup);
0043
0044
0045 void foreach(function<void(Pythia*)> action);
0046
0047
0048 void foreachAsync(function<void(Pythia*)> action);
0049
0050
0051 void stat() { pythiaHelper.stat(); }
0052
0053
0054 vector<long> run(long nEvents, function<void(Pythia*)> callback);
0055 vector<long> run(function<void(Pythia*)> callback) {
0056 return run(settings.mode("Main:numberOfEvents"), callback); }
0057
0058
0059 Pythia pythiaHelper;
0060
0061
0062 double sigmaGen() const { return sigmaGenSave; }
0063
0064
0065 double weightSum() const { return weightSumSave; }
0066
0067
0068 Settings& settings;
0069
0070
0071 ParticleData& particleData;
0072
0073 private:
0074
0075
0076 Logger& logger;
0077
0078
0079 bool isInit = false;
0080
0081
0082 double weightSumSave, sigmaGenSave;
0083
0084
0085 int numThreads;
0086 bool processAsync;
0087 bool balanceLoad;
0088 bool doNext;
0089
0090
0091 vector<unique_ptr<Pythia> > pythiaObjects;
0092
0093 };
0094
0095
0096
0097 }
0098
0099 #endif