Skip to content

Commit 1aaaa52

Browse files
committed
local ok version
1 parent 0b6a429 commit 1aaaa52

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717
///
1818

1919
#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"
2032
#if __has_include("SimulationDataFormat/MCGenStatus.h")
2133
#include "SimulationDataFormat/MCGenStatus.h"
2234
#else
@@ -25,12 +37,8 @@
2537
#if __has_include("SimulationDataFormat/MCUtils.h")
2638
#include "SimulationDataFormat/MCUtils.h"
2739
#endif
28-
#include "fairlogger/Logger.h"
29-
#include "TSystem.h"
30-
#include <fstream>
31-
#include "Generators/GeneratorPythia8Param.h"
32-
#include "Generators/DecayerPythia8Param.h"
3340
#endif
41+
3442
#if defined(__CLING__) && !defined(__ROOTCLING__)
3543
#if __has_include("SimulationDataFormat/MCGenStatus.h")
3644
#include "SimulationDataFormat/MCGenStatus.h"
@@ -42,13 +50,32 @@
4250
#endif
4351
#pragma cling load("libO2Generators")
4452
#endif
53+
4554
#include "Generators/GeneratorPythia8.h"
55+
#include "Generators/DecayerPythia8Param.h"
4656
#include <nlohmann/json.hpp>
47-
#include "generator_pythia8_longlived.C"
4857

4958
using namespace Pythia8;
5059
using namespace o2::mcgenstatus;
5160

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+
5279
class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8
5380
{
5481
public:
@@ -336,7 +363,7 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8
336363
mRapidityMin{rapidityMin},
337364
mRapidityMax{rapidityMax}
338365
{
339-
mMass = GeneratorPythia8LongLivedGun::getMass(mPdg);
366+
mMass = getMassFromPDG(mPdg);
340367
if (mMass <= 0) {
341368
LOG(fatal) << "Could not find mass for mPdg " << mPdg;
342369
}

0 commit comments

Comments
 (0)