|
17 | 17 | /// |
18 | 18 |
|
19 | 19 | #if !defined(__CLING__) || defined(__ROOTCLING__) |
| 20 | +#include <cmath> |
| 21 | +#include <fstream> |
| 22 | +#include "Pythia8/Pythia.h" |
| 23 | +#include "FairGenerator.h" |
| 24 | +#include "Generators/GeneratorPythia8.h" |
| 25 | +#include "Generators/GeneratorPythia8Param.h" |
| 26 | +#include "TRandom3.h" |
| 27 | +#include "TParticlePDG.h" |
| 28 | +#include "TDatabasePDG.h" |
| 29 | +#include "TMath.h" |
| 30 | +#include "TSystem.h" |
| 31 | +#include "fairlogger/Logger.h" |
20 | 32 | #if __has_include("SimulationDataFormat/MCGenStatus.h") |
21 | 33 | #include "SimulationDataFormat/MCGenStatus.h" |
22 | 34 | #else |
|
25 | 37 | #if __has_include("SimulationDataFormat/MCUtils.h") |
26 | 38 | #include "SimulationDataFormat/MCUtils.h" |
27 | 39 | #endif |
28 | | -#include "fairlogger/Logger.h" |
29 | | -#include "TSystem.h" |
30 | | -#include <fstream> |
31 | | -#include "Generators/GeneratorPythia8Param.h" |
32 | | -#include "Generators/DecayerPythia8Param.h" |
33 | 40 | #endif |
| 41 | + |
34 | 42 | #if defined(__CLING__) && !defined(__ROOTCLING__) |
35 | 43 | #if __has_include("SimulationDataFormat/MCGenStatus.h") |
36 | 44 | #include "SimulationDataFormat/MCGenStatus.h" |
|
42 | 50 | #endif |
43 | 51 | #pragma cling load("libO2Generators") |
44 | 52 | #endif |
| 53 | + |
45 | 54 | #include "Generators/GeneratorPythia8.h" |
| 55 | +#include "Generators/DecayerPythia8Param.h" |
46 | 56 | #include <nlohmann/json.hpp> |
47 | | -#include "generator_pythia8_longlived.C" |
48 | 57 |
|
49 | 58 | using namespace Pythia8; |
50 | 59 | using namespace o2::mcgenstatus; |
51 | 60 |
|
| 61 | +// Helper function to get mass from PDG code (copied from generator_pythia8_longlived.C to avoid include issues) |
| 62 | +namespace { |
| 63 | +double getMassFromPDG(int input_pdg) |
| 64 | +{ |
| 65 | + double mass = 0; |
| 66 | + if (TDatabasePDG::Instance()) |
| 67 | + { |
| 68 | + TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(input_pdg); |
| 69 | + if (particle) { |
| 70 | + mass = particle->Mass(); |
| 71 | + } else { |
| 72 | + LOG(warning) << "Unknown particle requested with PDG " << input_pdg << ", mass set to 0"; |
| 73 | + } |
| 74 | + } |
| 75 | + return mass; |
| 76 | +} |
| 77 | +} |
| 78 | + |
52 | 79 | class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 |
53 | 80 | { |
54 | 81 | public: |
@@ -336,7 +363,7 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 |
336 | 363 | mRapidityMin{rapidityMin}, |
337 | 364 | mRapidityMax{rapidityMax} |
338 | 365 | { |
339 | | - mMass = GeneratorPythia8LongLivedGun::getMass(mPdg); |
| 366 | + mMass = getMassFromPDG(mPdg); |
340 | 367 | if (mMass <= 0) { |
341 | 368 | LOG(fatal) << "Could not find mass for mPdg " << mPdg; |
342 | 369 | } |
|
0 commit comments