Skip to content

Commit 545fc72

Browse files
authored
Fix LF_rapidity generator by including generator_pythia8_longlived.C (#2190)
* added exotic particles in the gun * added exotic particles in the gun * rolled back to generator_pythia8_longlived.C script to get mass from PDG * removed formatting changes
1 parent 8ac5992 commit 545fc72

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# PDG N ptMin ptMax yMin yMax
2+
225 10 0.2 10 -1 1
3+
115 10 0.2 10 -1 1
4+
335 10 0.2 10 -1 1
5+
10331 10 0.2 10 -1 1

MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/// `o2-sim -g external --configKeyValues 'GeneratorExternal.fileName=generator_pythia8_LF_rapidity.C;GeneratorExternal.funcName=generateLFRapidity({{1000010020, 10, 0.5, 10, -1.0, 1.0}, {1000010030, 10, 0.5, 10, -1.0, 1.0}})'`
1313
/// Here PDG, Number injected, pT limits, rapidity limits are divided per particle
1414
/// or:
15-
/// `o2-sim -g external --configKeyValues 'GeneratorExternal.fileName=generator_pythia8_LF_rapidity.C;GeneratorExternal.funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei_rapidity.gun")'`
15+
/// `o2-sim -g external --configKeyValues 'GeneratorExternal.fileName=generator_pythia8_LF_rapidity.C;GeneratorExternal.funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exotic_nuclei_pp.gun")'`
1616
/// Here PDG, Number injected, pT limits, rapidity limits are provided via an intermediate configuration file
1717
///
1818

@@ -51,29 +51,30 @@
5151
#endif
5252
#pragma cling load("libO2Generators")
5353
#endif
54-
#include "Generators/GeneratorPythia8.h"
54+
// #include "Generators/GeneratorPythia8.h"
55+
#include "generator_pythia8_longlived.C"
5556
#include <nlohmann/json.hpp>
5657

5758
using namespace Pythia8;
5859
using namespace o2::mcgenstatus;
5960

60-
// Helper function to get mass from PDG code (copied from generator_pythia8_longlived.C to avoid include issues)
61-
namespace {
62-
double getMassFromPDG(int input_pdg)
63-
{
64-
double mass = 0;
65-
if (TDatabasePDG::Instance())
66-
{
67-
TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(input_pdg);
68-
if (particle) {
69-
mass = particle->Mass();
70-
} else {
71-
LOG(warning) << "Unknown particle requested with PDG " << input_pdg << ", mass set to 0";
72-
}
73-
}
74-
return mass;
75-
}
76-
}
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+
// }
7778

7879
class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8
7980
{
@@ -362,7 +363,8 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8
362363
mRapidityMin{rapidityMin},
363364
mRapidityMax{rapidityMax}
364365
{
365-
mMass = getMassFromPDG(mPdg);
366+
// mMass = getMassFromPDG(mPdg);
367+
mMass = GeneratorPythia8LongLivedGun::getMass(mPdg);
366368
if (mMass <= 0) {
367369
LOG(fatal) << "Could not find mass for mPdg " << mPdg;
368370
}
@@ -533,7 +535,7 @@ FairGenerator* generateLFRapidity(std::vector<GeneratorPythia8LFRapidity::Config
533535

534536
///___________________________________________________________
535537
/// Create generator via input file
536-
FairGenerator* generateLFRapidity(std::string configuration = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei_rapidity.gun",
538+
FairGenerator* generateLFRapidity(std::string configuration = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exotic_nuclei_pp.gun",
537539
bool injectOnePDGPerEvent = true,
538540
int gapBetweenInjection = 0,
539541
bool useTrigger = false,
@@ -587,7 +589,7 @@ FairGenerator* generateLFRapidity(std::string configuration = "${O2DPG_MC_CONFIG
587589

588590
///___________________________________________________________
589591
/// Create generator via input file for the triggered mode
590-
FairGenerator* generateLFRapidityTriggered(std::string configuration = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei_rapidity.gun",
592+
FairGenerator* generateLFRapidityTriggered(std::string configuration = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exotic_nuclei_pp.gun",
591593
int gapBetweenInjection = 0,
592594
std::string pythiaCfgMb = "",
593595
std::string pythiaCfgSignal = "")

0 commit comments

Comments
 (0)