From 55ea501f89733234e1a590ed855ef22b957594ba Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Mon, 16 Feb 2026 16:38:02 +0530 Subject: [PATCH 01/20] use of GeneratorPYTHIA8 for background events in injection scheme --- .../pythia8/generator_pythia8_LF_rapidity.C | 333 +++++++++++------- 1 file changed, 213 insertions(+), 120 deletions(-) diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C index 26c088b0e..11cb54dfe 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C @@ -60,7 +60,7 @@ using namespace o2::mcgenstatus; class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 { - public: +public: /// Parametric constructor GeneratorPythia8LFRapidity(bool injOnePerEvent = true, int gapBetweenInjection = 0, @@ -68,10 +68,10 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 bool useRapidity = false, std::string pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_minbias.cfg", std::string pythiaCfgSignal = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_signal.cfg") : GeneratorPythia8{}, - mOneInjectionPerEvent{injOnePerEvent}, - mGapBetweenInjection{gapBetweenInjection}, - mUseTriggering{useTrigger}, - mUseRapidity{useRapidity} + mOneInjectionPerEvent{injOnePerEvent}, + mGapBetweenInjection{gapBetweenInjection}, + mUseTriggering{useTrigger}, + mUseRapidity{useRapidity} { LOG(info) << "GeneratorPythia8LFRapidity constructor"; LOG(info) << "++ mOneInjectionPerEvent: " << mOneInjectionPerEvent; @@ -81,16 +81,19 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 LOG(info) << "++ pythiaCfgMb: " << pythiaCfgMb; LOG(info) << "++ pythiaCfgSignal: " << pythiaCfgSignal; gRandom->SetSeed(0); - if (useTrigger) { + if (useTrigger) + { mPythia.readString("ProcessLevel:all off"); - if (pythiaCfgMb == "") { // If no configuration file is provided, use the one from the Pythia8Param - auto& param = o2::eventgen::GeneratorPythia8Param::Instance(); + if (pythiaCfgMb == "") + { // If no configuration file is provided, use the one from the Pythia8Param + auto ¶m = o2::eventgen::GeneratorPythia8Param::Instance(); LOG(info) << "Instance LFRapidity \'Pythia8\' generator with following parameters for MB event"; LOG(info) << param; pythiaCfgMb = param.config; } - if (pythiaCfgSignal == "") { // If no configuration file is provided, use the one from the Pythia8Param - auto& param = o2::eventgen::GeneratorPythia8Param::Instance(); + if (pythiaCfgSignal == "") + { // If no configuration file is provided, use the one from the Pythia8Param + auto ¶m = o2::eventgen::GeneratorPythia8Param::Instance(); LOG(info) << "Instance LFRapidity \'Pythia8\' generator with following parameters for signal event"; LOG(info) << param; pythiaCfgSignal = param.config; @@ -98,44 +101,54 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 pythiaCfgMb = gSystem->ExpandPathName(pythiaCfgMb.c_str()); pythiaCfgSignal = gSystem->ExpandPathName(pythiaCfgSignal.c_str()); LOG(info) << " ++ Using trigger, initializing Pythia8 for trigger"; - if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) { + if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) + { LOG(fatal) << "Could not pythiaObjectMinimumBias.readFile(\"" << pythiaCfgMb << "\")"; } pythiaObjectMinimumBias.readString("Random:setSeed = on"); pythiaObjectMinimumBias.readString("Random:seed =" + std::to_string(gRandom->Integer(900000000 - 2) + 1)); // FIX: Init signal pythia object - if (!pythiaObjectSignal.readFile(pythiaCfgSignal)) { + if (!pythiaObjectSignal.readFile(pythiaCfgSignal)) + { LOG(fatal) << "Could not pythiaObjectSignal.readFile(\"" << pythiaCfgSignal << "\")"; } pythiaObjectSignal.readString("Random:setSeed = on"); pythiaObjectSignal.readString("Random:seed =" + std::to_string(gRandom->Integer(900000000 - 2) + 1)); - if (!pythiaObjectMinimumBias.init()) { + if (!pythiaObjectMinimumBias.init()) + { LOG(fatal) << "Could not pythiaObjectMinimumBias.init() from " << pythiaCfgMb; } - if (!pythiaObjectSignal.init()) { + if (!pythiaObjectSignal.init()) + { LOG(fatal) << "Could not pythiaObjectSignal.init() from " << pythiaCfgSignal; } - } else { // Using simple injection with internal decay (if needed). Fetching the parameters from the configuration file of the PythiaDecayer + } + else + { // Using simple injection with internal decay (if needed). Fetching the parameters from the configuration file of the PythiaDecayer - if (pythiaCfgMb == "") { // If no configuration file is provided, use the one from the Pythia8Param - auto& param = o2::eventgen::GeneratorPythia8Param::Instance(); + if (pythiaCfgMb == "") + { // If no configuration file is provided, use the one from the Pythia8Param + auto ¶m = o2::eventgen::GeneratorPythia8Param::Instance(); LOG(info) << "Instance LFRapidity \'Pythia8\' generator with following parameters for MB event"; LOG(info) << param; pythiaCfgMb = param.config; } // FIX: Fallback if still empty to default minbias - if (pythiaCfgMb == "") { - pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_minbias.cfg"; + if (pythiaCfgMb == "") + { + pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_minbias.cfg"; } pythiaCfgMb = gSystem->ExpandPathName(pythiaCfgMb.c_str()); - if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) { + if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) + { LOG(fatal) << "Could not pythiaObjectMinimumBias.readFile(\"" << pythiaCfgMb << "\")"; } pythiaObjectMinimumBias.readString("Random:setSeed = on"); pythiaObjectMinimumBias.readString("Random:seed =" + std::to_string(gRandom->Integer(900000000 - 2) + 1)); - if (!pythiaObjectMinimumBias.init()) { + if (!pythiaObjectMinimumBias.init()) + { LOG(fatal) << "Could not pythiaObjectMinimumBias.init() from " << pythiaCfgMb; } @@ -143,21 +156,24 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 mPythiaGun.readString("ProcessLevel:all off"); /** config **/ - auto& paramGen = o2::eventgen::GeneratorPythia8Param::Instance(); + /* auto& paramGen = o2::eventgen::GeneratorPythia8Param::Instance(); if (!paramGen.config.empty()) { LOG(fatal) << "Configuration file provided for \'GeneratorPythia8\' should be empty for this injection scheme"; return; - } - auto& param = o2::eventgen::DecayerPythia8Param::Instance(); + } */ + auto ¶m = o2::eventgen::DecayerPythia8Param::Instance(); LOG(info) << "Init \'GeneratorPythia8LFRapidity\' with following parameters"; LOG(info) << param; - for (int i = 0; i < 8; ++i) { - if (param.config[i].empty()) { + for (int i = 0; i < 8; ++i) + { + if (param.config[i].empty()) + { continue; } std::string config = gSystem->ExpandPathName(param.config[i].c_str()); LOG(info) << "GeneratorPythia8LFRapidity Reading configuration from file: " << config; - if (!mPythiaGun.readFile(config, true)) { + if (!mPythiaGun.readFile(config, true)) + { LOG(fatal) << "Failed to init \'DecayerPythia8\': problems with configuration file " << config; return; @@ -165,18 +181,23 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 } /** show changed particle data **/ - if (param.showChanged) { + if (param.showChanged) + { mPythiaGun.readString(std::string("Init:showChangedParticleData on")); - } else { + } + else + { mPythiaGun.readString(std::string("Init:showChangedParticleData off")); } /** initialise **/ - if (!mPythiaGun.init()) { + if (!mPythiaGun.init()) + { LOG(fatal) << "Failed to init \'DecayerPythia8\': init returned with error"; return; } - if (pythiaCfgSignal != "") { + if (pythiaCfgSignal != "") + { LOG(fatal) << "Cannot use simple injection and have a configuration file. pythiaCfgSignal= `" << pythiaCfgSignal << "` must be empty"; } } @@ -188,26 +209,34 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 //__________________________________________________________________ Bool_t generateEvent() override { - if (!mUseTriggering) { // Injected mode: Embedding into MB + if (!mUseTriggering) + { // Injected mode: Embedding into MB // 1. Generate Background (MB) // LOG(info) << "Generating background event " << mEventCounter; + bool lGenerationOK = false; - while (!lGenerationOK) { + while (!lGenerationOK) + { lGenerationOK = pythiaObjectMinimumBias.next(); } - mPythia.event = pythiaObjectMinimumBias.event; // Copy MB event to main event + mPythia.event = pythiaObjectMinimumBias.event; // 2. Determine if we inject specific particles (Gap logic) bool doInjection = true; - if (mGapBetweenInjection > 0) { - if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) { + if (mGapBetweenInjection > 0) + { + if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) + { doInjection = false; - } else if (mEventCounter % mGapBetweenInjection != 0) { + } + else if (mEventCounter % mGapBetweenInjection != 0) + { doInjection = false; } } - if (!doInjection) { + if (!doInjection) + { LOG(info) << "Skipping injection for event " << mEventCounter; return true; } @@ -216,7 +245,8 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 LOG(info) << "generateEvent (Injection) " << mEventCounter; // For Triggered mode, we start clean. For Injected mode, we have MB in mPythia.event - if (mUseTriggering) { + if (mUseTriggering) + { mPythia.event.reset(); } @@ -225,31 +255,39 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 bool injectedForThisEvent = false; int nConfig = mGunConfigs.size(); // We start counting from the configurations of the transport decayed particles - for (const ConfigContainer& cfg : mGunConfigsGenDecayed) { + for (const ConfigContainer &cfg : mGunConfigsGenDecayed) + { nConfig++; - if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) { + if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) + { continue; } LOG(info) << "Using config container "; cfg.print(); - if (mUseTriggering) { // Do the triggering + if (mUseTriggering) + { // Do the triggering bool doSignal{mEventCounter % (mGapBetweenInjection + 1) == 0}; // Do signal or gap - if (doSignal) { + if (doSignal) + { LOG(info) << "Generating triggered signal event for particle"; cfg.print(); bool satisfiesTrigger = false; int nTries = 0; - while (!satisfiesTrigger) { - if (!pythiaObjectSignal.next()) { + while (!satisfiesTrigger) + { + if (!pythiaObjectSignal.next()) + { continue; } // Check if triggered condition satisfied - for (int j = 0; j < pythiaObjectSignal.event.size(); j++) { - const int& pypid = pythiaObjectSignal.event[j].id(); - const float& pyeta = mUseRapidity ? pythiaObjectSignal.event[j].y() : pythiaObjectSignal.event[j].eta(); - const float& pypt = pythiaObjectSignal.event[j].pT(); - if (pypid == cfg.mPdg && cfg.mMin < pyeta && pyeta < cfg.mMax && pypt > cfg.mPtMin && pypt < cfg.mPtMax) { + for (int j = 0; j < pythiaObjectSignal.event.size(); j++) + { + const int &pypid = pythiaObjectSignal.event[j].id(); + const float &pyeta = mUseRapidity ? pythiaObjectSignal.event[j].y() : pythiaObjectSignal.event[j].eta(); + const float &pypt = pythiaObjectSignal.event[j].pT(); + if (pypid == cfg.mPdg && cfg.mMin < pyeta && pyeta < cfg.mMax && pypt > cfg.mPtMin && pypt < cfg.mPtMax) + { LOG(info) << "Found particle " << j << " " << pypid << " with " << (mUseRapidity ? "rapidity" : "eta") << " " << pyeta << " and pT " << pypt << " in event " << mEventCounter << " after " << nTries << " tries"; satisfiesTrigger = true; break; @@ -258,11 +296,14 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 nTries++; } mPythia.event = pythiaObjectSignal.event; - } else { + } + else + { LOG(info) << "Generating background event " << mEventCounter; // Generate minimum-bias event bool lGenerationOK = false; - while (!lGenerationOK) { + while (!lGenerationOK) + { lGenerationOK = pythiaObjectMinimumBias.next(); } mPythia.event = pythiaObjectMinimumBias.event; @@ -273,7 +314,8 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 // Do the injection // Use mPythiaGun for separate generation and decay mPythiaGun.event.reset(); - for (int i{0}; i < cfg.mNInject; ++i) { + for (int i{0}; i < cfg.mNInject; ++i) + { const double pt = gRandom->Uniform(cfg.mPtMin, cfg.mPtMax); const double eta = gRandom->Uniform(cfg.mMin, cfg.mMax); const double phi = gRandom->Uniform(0, TMath::TwoPi()); @@ -283,12 +325,15 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 double pz = 0; double et = 0; - if (mUseRapidity) { + if (mUseRapidity) + { // Rapidty Case const double mT = std::sqrt(cfg.mMass * cfg.mMass + pt * pt); pz = mT * std::sinh(eta); et = mT * std::cosh(eta); - } else { + } + else + { // Eta Case pz = pt * std::sinh(eta); const double p = pt * std::cosh(eta); @@ -317,8 +362,9 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 int offset = mPythia.event.size(); LOG(info) << "Merging " << mPythiaGun.event.size() - 1 << " injected particles into MB event of size " << offset; - for (int i = 1; i < mPythiaGun.event.size(); ++i) { // Skip system particle 0 - Particle& p = mPythiaGun.event[i]; + for (int i = 1; i < mPythiaGun.event.size(); ++i) + { // Skip system particle 0 + Particle &p = mPythiaGun.event[i]; // Adjust history indices int mother1 = p.mother1(); int mother2 = p.mother2(); @@ -350,7 +396,8 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 // But if we are in embedding mode, we just need to ensure the MB event is there. // The mGunConfigs are handled in importParticles. - if (mVerbose) { + if (mVerbose) + { LOG(info) << "Eventlisting"; mPythia.event.list(1); mPythia.stat(); @@ -361,12 +408,17 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 //__________________________________________________________________ Bool_t importParticles() override { - if (!mUseTriggering) { // If the triggering is used we handle the the gap when generating the signal - if (mGapBetweenInjection > 0) { - if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) { + if (!mUseTriggering) + { // If the triggering is used we handle the the gap when generating the signal + if (mGapBetweenInjection > 0) + { + if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) + { LOG(info) << "Skipping importParticles event " << mEventCounter++; return true; - } else if (mEventCounter % mGapBetweenInjection != 0) { + } + else if (mEventCounter % mGapBetweenInjection != 0) + { LOG(info) << "Skipping importParticles event " << mEventCounter++; return true; } @@ -375,14 +427,17 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 LOG(info) << "importParticles " << mEventCounter++; GeneratorPythia8::importParticles(); int nConfig = 0; - for (const ConfigContainer& cfg : mGunConfigs) { + for (const ConfigContainer &cfg : mGunConfigs) + { nConfig++; - if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) { + if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) + { continue; } LOGF(info, "Injecting %i particles with PDG %i, pT in [%f, %f], %s in [%f, %f]", cfg.mNInject, cfg.mPdg, cfg.mPtMin, cfg.mPtMax, (mUseRapidity ? "rapidity" : "eta"), cfg.mMin, cfg.mMax); - for (int i{0}; i < cfg.mNInject; ++i) { + for (int i{0}; i < cfg.mNInject; ++i) + { const double pt = gRandom->Uniform(cfg.mPtMin, cfg.mPtMax); const double eta = gRandom->Uniform(cfg.mMin, cfg.mMax); const double phi = gRandom->Uniform(0, TMath::TwoPi()); @@ -391,11 +446,14 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 double pz = 0; double et = 0; - if (mUseRapidity) { + if (mUseRapidity) + { const double mT = std::sqrt(cfg.mMass * cfg.mMass + pt * pt); pz = mT * std::sinh(eta); et = mT * std::cosh(eta); - } else { + } + else + { pz = pt * std::sinh(eta); const double p = pt * std::cosh(eta); et = std::sqrt(p * p + cfg.mMass * cfg.mMass); @@ -420,17 +478,20 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 } nConfig++; } - if (mVerbose) { + if (mVerbose) + { LOG(info) << "Printing particles that are appended"; int n = 0; - for (const auto& p : mParticles) { + for (const auto &p : mParticles) + { LOG(info) << "Particle " << n++ << " is a " << p.GetPdgCode() << " with status " << p.GetStatusCode() << " and px = " << p.Py() << " py = " << p.Py() << " pz = " << p.Pz(); } } return true; } - struct ConfigContainer { + struct ConfigContainer + { ConfigContainer(int input_pdg = 0, int n = 1, float ptMin = 1, float ptMax = 10, float min = -1, float max = 1) : mPdg{input_pdg}, @@ -442,14 +503,15 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 { // mMass = getMassFromPDG(mPdg); mMass = GeneratorPythia8LongLivedGun::getMass(mPdg); - if (mMass <= 0) { + if (mMass <= 0) + { LOG(fatal) << "Could not find mass for mPdg " << mPdg; } LOGF(info, "ConfigContainer: mPdg = %i, mNInject = %i, mPtMin = %f, mPtMax = %f, mMin = %f, mMax = %f, mMass = %f", mPdg, mNInject, mPtMin, mPtMax, mMin, mMax, mMass); }; - ConfigContainer(TObjArray* arr) : ConfigContainer(atoi(arr->At(0)->GetName()), + ConfigContainer(TObjArray *arr) : ConfigContainer(atoi(arr->At(0)->GetName()), atoi(arr->At(1)->GetName()), atof(arr->At(2)->GetName()), atof(arr->At(3)->GetName()), @@ -457,31 +519,38 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 atof(arr->At(5)->GetName())) { bool hasGenDecayed = false; - for (int i = 0; i < arr->GetEntries(); i++) { + for (int i = 0; i < arr->GetEntries(); i++) + { const TString n = arr->At(i)->GetName(); std::cout << n << std::endl; - if (n == "genDecayed") { + if (n == "genDecayed") + { hasGenDecayed = true; break; } } - if (hasGenDecayed) { - if (arr->GetEntries() != 7) { + if (hasGenDecayed) + { + if (arr->GetEntries() != 7) + { LOG(fatal) << "Wrong number of entries in the configuration array, should be 7, is " << arr->GetEntries(); } - } else { - if (arr->GetEntries() != 6) { + } + else + { + if (arr->GetEntries() != 6) + { LOG(fatal) << "Wrong number of entries in the configuration array, should be 6, is " << arr->GetEntries(); } } }; - ConfigContainer(TString line) : ConfigContainer(line.Tokenize(" ")){}; - ConfigContainer(const nlohmann::json& jsonParams, bool useRapidity = false) : ConfigContainer(jsonParams["pdg"], - jsonParams["n"], - jsonParams["ptMin"], - jsonParams["ptMax"], - (useRapidity && jsonParams.contains("rapidityMin")) ? jsonParams["rapidityMin"] : (jsonParams.contains("min") ? jsonParams["min"] : jsonParams["etaMin"]), - (useRapidity && jsonParams.contains("rapidityMax")) ? jsonParams["rapidityMax"] : (jsonParams.contains("max") ? jsonParams["max"] : jsonParams["etaMax"])){}; + ConfigContainer(TString line) : ConfigContainer(line.Tokenize(" ")) {}; + ConfigContainer(const nlohmann::json &jsonParams, bool useRapidity = false) : ConfigContainer(jsonParams["pdg"], + jsonParams["n"], + jsonParams["ptMin"], + jsonParams["ptMax"], + (useRapidity && jsonParams.contains("rapidityMin")) ? jsonParams["rapidityMin"] : (jsonParams.contains("min") ? jsonParams["min"] : jsonParams["etaMin"]), + (useRapidity && jsonParams.contains("rapidityMax")) ? jsonParams["rapidityMax"] : (jsonParams.contains("max") ? jsonParams["max"] : jsonParams["etaMax"])) {}; // Data Members const int mPdg = 0; @@ -507,7 +576,8 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 //__________________________________________________________________ ConfigContainer addGun(int input_pdg, int nInject = 1, float ptMin = 1, float ptMax = 10, float min = 1, float max = 10) { - if (mUseTriggering) { // If in trigger mode, every particle needs to be generated from pythia + if (mUseTriggering) + { // If in trigger mode, every particle needs to be generated from pythia return addGunGenDecayed(input_pdg, nInject, ptMin, ptMax, min, max); } ConfigContainer cfg{input_pdg, nInject, ptMin, ptMax, min, max}; @@ -538,13 +608,15 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 LOG(info) << "GeneratorPythia8LFRapidity configuration with " << getNGuns() << " guns:"; LOG(info) << "Particles decayed by the transport:"; int n = 0; - for (const auto& cfg : mGunConfigs) { + for (const auto &cfg : mGunConfigs) + { LOG(info) << n++ << "/" << mGunConfigs.size() << ":"; cfg.print(); } n = 0; LOG(info) << "Particles decayed by the generator:"; - for (const auto& cfg : mGunConfigsGenDecayed) { + for (const auto &cfg : mGunConfigsGenDecayed) + { LOG(info) << n++ << "/" << mGunConfigs.size() << ":"; cfg.print(); } @@ -552,7 +624,7 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 void setVerbose(bool verbose = true) { mVerbose = verbose; } - private: +private: // Configuration const bool mOneInjectionPerEvent = true; // if true, only one injection per event is performed, i.e. if multiple PDG (including antiparticles) are requested to be injected only one will be done per event const bool mUseTriggering = false; // if true, use triggering instead of injection @@ -573,15 +645,17 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 ///___________________________________________________________ /// Create generator via arrays of entries. By default injecting in every event and all particles -FairGenerator* generateLFRapidity(std::vector PDGs, std::vector nInject, std::vector ptMin, std::vector ptMax, std::vector min, std::vector max, bool useRapidity = false) +FairGenerator *generateLFRapidity(std::vector PDGs, std::vector nInject, std::vector ptMin, std::vector ptMax, std::vector min, std::vector max, bool useRapidity = false) { const std::vector entries = {PDGs.size(), nInject.size(), ptMin.size(), ptMax.size(), min.size(), max.size()}; - if (!std::equal(entries.begin() + 1, entries.end(), entries.begin())) { + if (!std::equal(entries.begin() + 1, entries.end(), entries.begin())) + { LOGF(fatal, "Not equal number of entries, check configuration"); return nullptr; } - GeneratorPythia8LFRapidity* multiGun = new GeneratorPythia8LFRapidity(false, 0, false, useRapidity, "", ""); - for (unsigned long i = 0; i < entries[0]; i++) { + GeneratorPythia8LFRapidity *multiGun = new GeneratorPythia8LFRapidity(false, 0, false, useRapidity, "", ""); + for (unsigned long i = 0; i < entries[0]; i++) + { multiGun->addGun(PDGs[i], nInject[i], ptMin[i], ptMax[i], min[i], max[i]); } return multiGun; @@ -589,7 +663,7 @@ FairGenerator* generateLFRapidity(std::vector PDGs, std::vector nInjec ///___________________________________________________________ /// Create generator via an array of configurations -FairGenerator* generateLFRapidity(std::vector cfg, +FairGenerator *generateLFRapidity(std::vector cfg, std::vector cfgGenDecayed, bool injectOnePDGPerEvent = true, int gapBetweenInjection = 0, @@ -598,13 +672,15 @@ FairGenerator* generateLFRapidity(std::vectorgetNGuns()); c.print(); multiGun->addGun(c); } - for (const auto& c : cfgGenDecayed) { + for (const auto &c : cfgGenDecayed) + { LOGF(info, "Adding gun %i, particle will be decayed by the generator", multiGun->getNGuns()); c.print(); multiGun->addGunGenDecayed(c); @@ -615,7 +691,7 @@ FairGenerator* generateLFRapidity(std::vector(), param}); - if (param["genDecayed"]) { + if (param["genDecayed"]) + { cfgVecGenDecayed.push_back(GeneratorPythia8LFRapidity::ConfigContainer{param, useRapidity}); - } else { + } + else + { cfgVec.push_back(GeneratorPythia8LFRapidity::ConfigContainer{param, useRapidity}); } } - } else { + } + else + { std::string l; int n = 0; - while (getline(inputFile, l)) { + while (getline(inputFile, l)) + { TString line = l; line.Strip(TString::kBoth, ' '); std::cout << n++ << " '" << line << "'" << endl; - if (line.IsNull() || line.IsWhitespace()) { + if (line.IsNull() || line.IsWhitespace()) + { continue; } - if (line.BeginsWith("#")) { + if (line.BeginsWith("#")) + { std::cout << "Skipping\n"; continue; } - if (line.Contains("genDecayed")) { + if (line.Contains("genDecayed")) + { cfgVecGenDecayed.push_back(GeneratorPythia8LFRapidity::ConfigContainer{line}); - } else { + } + else + { cfgVec.push_back(GeneratorPythia8LFRapidity::ConfigContainer{line}); } } @@ -670,7 +760,7 @@ FairGenerator* generateLFRapidity(std::string configuration = "${O2DPG_MC_CONFIG ///___________________________________________________________ /// Create generator via input file for the triggered mode -FairGenerator* generateLFRapidityTriggered(std::string configuration = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exotic_nuclei_pp.gun", +FairGenerator *generateLFRapidityTriggered(std::string configuration = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exotic_nuclei_pp.gun", int gapBetweenInjection = 0, bool useRapidity = false, std::string pythiaCfgMb = "", @@ -680,16 +770,18 @@ FairGenerator* generateLFRapidityTriggered(std::string configuration = "${O2DPG_ } ///___________________________________________________________ -void generator_pythia8_LF_rapidity(bool testInj = true, bool testTrg = false, bool useRapidity = false, const char* particleListFile = "cfg_rapidity.json") +void generator_pythia8_LF_rapidity(bool testInj = true, bool testTrg = false, bool useRapidity = false, const char *particleListFile = "cfg_rapidity.json") { LOG(info) << "Compiled correctly!"; - if (!testInj && !testTrg) { + if (!testInj && !testTrg) + { return; } // Injected mode - if (testInj) { + if (testInj) + { LOG(info) << "Testing the injected mode"; - auto* gen = static_cast(generateLFRapidity(particleListFile, true, 0, false, useRapidity)); + auto *gen = static_cast(generateLFRapidity(particleListFile, true, 0, false, useRapidity)); gen->setVerbose(); gen->Print(); gen->print(); @@ -699,13 +791,14 @@ void generator_pythia8_LF_rapidity(bool testInj = true, bool testTrg = false, bo } // Triggered mode - if (testTrg) { + if (testTrg) + { LOG(info) << "Testing the triggered mode"; - GeneratorPythia8LFRapidity* gen = static_cast(generateLFRapidityTriggered(particleListFile, - /*gapBetweenInjection=*/0, - useRapidity, - /*pythiaCfgMb=*/"inel136tev.cfg", - /*pythiaCfgSignal=*/"inel136tev.cfg")); + GeneratorPythia8LFRapidity *gen = static_cast(generateLFRapidityTriggered(particleListFile, + /*gapBetweenInjection=*/0, + useRapidity, + /*pythiaCfgMb=*/"inel136tev.cfg", + /*pythiaCfgSignal=*/"inel136tev.cfg")); gen->setVerbose(); gen->Print(); gen->print(); From 874b37f7d88dacc07130f2145b950a17207682c4 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Mon, 16 Feb 2026 16:39:34 +0530 Subject: [PATCH 02/20] add new decay logic for lambda1520 --- MC/config/PWGLF/pythia8/generator/lambda1520.cfg | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 MC/config/PWGLF/pythia8/generator/lambda1520.cfg diff --git a/MC/config/PWGLF/pythia8/generator/lambda1520.cfg b/MC/config/PWGLF/pythia8/generator/lambda1520.cfg new file mode 100644 index 000000000..b98d9f43c --- /dev/null +++ b/MC/config/PWGLF/pythia8/generator/lambda1520.cfg @@ -0,0 +1,10 @@ +### Define resonance +ProcessLevel:all = off # will not look for the 'process' + +# id::all = name antiName spinType chargeType colType m0 mWidth mMin mMax tau0 +102134:all = Lambda1520 Lambda1520bar 4 0 0 1.51950 0.01560 1.47 1.60 0 + +### add Resonance decays absent in PYTHIA8 decay table and set BRs from PDG for other +102134:oneChannel = 1 1.000 0 2212 -321 +102134:onMode = off +102134:onIfMatch = 2212 -321 \ No newline at end of file From 76630b70bc8fdecc467fd9673fd2daf840d34f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 16 Feb 2026 12:51:52 +0100 Subject: [PATCH 03/20] Format --- .../pythia8/generator_pythia8_LF_rapidity.C | 321 +++++++----------- 1 file changed, 117 insertions(+), 204 deletions(-) diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C index 11cb54dfe..affd291f9 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C @@ -17,13 +17,15 @@ /// #if !defined(__CLING__) || defined(__ROOTCLING__) -#include "Pythia8/Pythia.h" #include "FairGenerator.h" -#include "Generators/GeneratorPythia8.h" -#include "TRandom3.h" -#include "TParticlePDG.h" + #include "TDatabasePDG.h" #include "TMath.h" +#include "TParticlePDG.h" +#include "TRandom3.h" + +#include "Generators/GeneratorPythia8.h" +#include "Pythia8/Pythia.h" #if __has_include("SimulationDataFormat/MCGenStatus.h") #include "SimulationDataFormat/MCGenStatus.h" #else @@ -32,11 +34,13 @@ #if __has_include("SimulationDataFormat/MCUtils.h") #include "SimulationDataFormat/MCUtils.h" #endif -#include "fairlogger/Logger.h" #include "TSystem.h" -#include + #include "Generators/GeneratorPythia8Param.h" +#include "fairlogger/Logger.h" + #include +#include #endif // DecayerPythia8Param needs to be included after the #endif to work with Cling #include "Generators/DecayerPythia8Param.h" @@ -53,6 +57,7 @@ #endif // #include "Generators/GeneratorPythia8.h" #include "generator_pythia8_longlived.C" + #include using namespace Pythia8; @@ -60,7 +65,7 @@ using namespace o2::mcgenstatus; class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 { -public: + public: /// Parametric constructor GeneratorPythia8LFRapidity(bool injOnePerEvent = true, int gapBetweenInjection = 0, @@ -81,19 +86,16 @@ public: LOG(info) << "++ pythiaCfgMb: " << pythiaCfgMb; LOG(info) << "++ pythiaCfgSignal: " << pythiaCfgSignal; gRandom->SetSeed(0); - if (useTrigger) - { + if (useTrigger) { mPythia.readString("ProcessLevel:all off"); - if (pythiaCfgMb == "") - { // If no configuration file is provided, use the one from the Pythia8Param - auto ¶m = o2::eventgen::GeneratorPythia8Param::Instance(); + if (pythiaCfgMb == "") { // If no configuration file is provided, use the one from the Pythia8Param + auto& param = o2::eventgen::GeneratorPythia8Param::Instance(); LOG(info) << "Instance LFRapidity \'Pythia8\' generator with following parameters for MB event"; LOG(info) << param; pythiaCfgMb = param.config; } - if (pythiaCfgSignal == "") - { // If no configuration file is provided, use the one from the Pythia8Param - auto ¶m = o2::eventgen::GeneratorPythia8Param::Instance(); + if (pythiaCfgSignal == "") { // If no configuration file is provided, use the one from the Pythia8Param + auto& param = o2::eventgen::GeneratorPythia8Param::Instance(); LOG(info) << "Instance LFRapidity \'Pythia8\' generator with following parameters for signal event"; LOG(info) << param; pythiaCfgSignal = param.config; @@ -101,54 +103,44 @@ public: pythiaCfgMb = gSystem->ExpandPathName(pythiaCfgMb.c_str()); pythiaCfgSignal = gSystem->ExpandPathName(pythiaCfgSignal.c_str()); LOG(info) << " ++ Using trigger, initializing Pythia8 for trigger"; - if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) - { + if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) { LOG(fatal) << "Could not pythiaObjectMinimumBias.readFile(\"" << pythiaCfgMb << "\")"; } pythiaObjectMinimumBias.readString("Random:setSeed = on"); pythiaObjectMinimumBias.readString("Random:seed =" + std::to_string(gRandom->Integer(900000000 - 2) + 1)); // FIX: Init signal pythia object - if (!pythiaObjectSignal.readFile(pythiaCfgSignal)) - { + if (!pythiaObjectSignal.readFile(pythiaCfgSignal)) { LOG(fatal) << "Could not pythiaObjectSignal.readFile(\"" << pythiaCfgSignal << "\")"; } pythiaObjectSignal.readString("Random:setSeed = on"); pythiaObjectSignal.readString("Random:seed =" + std::to_string(gRandom->Integer(900000000 - 2) + 1)); - if (!pythiaObjectMinimumBias.init()) - { + if (!pythiaObjectMinimumBias.init()) { LOG(fatal) << "Could not pythiaObjectMinimumBias.init() from " << pythiaCfgMb; } - if (!pythiaObjectSignal.init()) - { + if (!pythiaObjectSignal.init()) { LOG(fatal) << "Could not pythiaObjectSignal.init() from " << pythiaCfgSignal; } - } - else - { // Using simple injection with internal decay (if needed). Fetching the parameters from the configuration file of the PythiaDecayer + } else { // Using simple injection with internal decay (if needed). Fetching the parameters from the configuration file of the PythiaDecayer - if (pythiaCfgMb == "") - { // If no configuration file is provided, use the one from the Pythia8Param - auto ¶m = o2::eventgen::GeneratorPythia8Param::Instance(); + if (pythiaCfgMb == "") { // If no configuration file is provided, use the one from the Pythia8Param + auto& param = o2::eventgen::GeneratorPythia8Param::Instance(); LOG(info) << "Instance LFRapidity \'Pythia8\' generator with following parameters for MB event"; LOG(info) << param; pythiaCfgMb = param.config; } // FIX: Fallback if still empty to default minbias - if (pythiaCfgMb == "") - { + if (pythiaCfgMb == "") { pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_minbias.cfg"; } pythiaCfgMb = gSystem->ExpandPathName(pythiaCfgMb.c_str()); - if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) - { + if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) { LOG(fatal) << "Could not pythiaObjectMinimumBias.readFile(\"" << pythiaCfgMb << "\")"; } pythiaObjectMinimumBias.readString("Random:setSeed = on"); pythiaObjectMinimumBias.readString("Random:seed =" + std::to_string(gRandom->Integer(900000000 - 2) + 1)); - if (!pythiaObjectMinimumBias.init()) - { + if (!pythiaObjectMinimumBias.init()) { LOG(fatal) << "Could not pythiaObjectMinimumBias.init() from " << pythiaCfgMb; } @@ -161,19 +153,16 @@ public: LOG(fatal) << "Configuration file provided for \'GeneratorPythia8\' should be empty for this injection scheme"; return; } */ - auto ¶m = o2::eventgen::DecayerPythia8Param::Instance(); + auto& param = o2::eventgen::DecayerPythia8Param::Instance(); LOG(info) << "Init \'GeneratorPythia8LFRapidity\' with following parameters"; LOG(info) << param; - for (int i = 0; i < 8; ++i) - { - if (param.config[i].empty()) - { + for (int i = 0; i < 8; ++i) { + if (param.config[i].empty()) { continue; } std::string config = gSystem->ExpandPathName(param.config[i].c_str()); LOG(info) << "GeneratorPythia8LFRapidity Reading configuration from file: " << config; - if (!mPythiaGun.readFile(config, true)) - { + if (!mPythiaGun.readFile(config, true)) { LOG(fatal) << "Failed to init \'DecayerPythia8\': problems with configuration file " << config; return; @@ -181,23 +170,18 @@ public: } /** show changed particle data **/ - if (param.showChanged) - { + if (param.showChanged) { mPythiaGun.readString(std::string("Init:showChangedParticleData on")); - } - else - { + } else { mPythiaGun.readString(std::string("Init:showChangedParticleData off")); } /** initialise **/ - if (!mPythiaGun.init()) - { + if (!mPythiaGun.init()) { LOG(fatal) << "Failed to init \'DecayerPythia8\': init returned with error"; return; } - if (pythiaCfgSignal != "") - { + if (pythiaCfgSignal != "") { LOG(fatal) << "Cannot use simple injection and have a configuration file. pythiaCfgSignal= `" << pythiaCfgSignal << "` must be empty"; } } @@ -209,34 +193,27 @@ public: //__________________________________________________________________ Bool_t generateEvent() override { - if (!mUseTriggering) - { // Injected mode: Embedding into MB + if (!mUseTriggering) { // Injected mode: Embedding into MB // 1. Generate Background (MB) // LOG(info) << "Generating background event " << mEventCounter; bool lGenerationOK = false; - while (!lGenerationOK) - { + while (!lGenerationOK) { lGenerationOK = pythiaObjectMinimumBias.next(); } mPythia.event = pythiaObjectMinimumBias.event; // 2. Determine if we inject specific particles (Gap logic) bool doInjection = true; - if (mGapBetweenInjection > 0) - { - if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) - { + if (mGapBetweenInjection > 0) { + if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) { doInjection = false; - } - else if (mEventCounter % mGapBetweenInjection != 0) - { + } else if (mEventCounter % mGapBetweenInjection != 0) { doInjection = false; } } - if (!doInjection) - { + if (!doInjection) { LOG(info) << "Skipping injection for event " << mEventCounter; return true; } @@ -245,8 +222,7 @@ public: LOG(info) << "generateEvent (Injection) " << mEventCounter; // For Triggered mode, we start clean. For Injected mode, we have MB in mPythia.event - if (mUseTriggering) - { + if (mUseTriggering) { mPythia.event.reset(); } @@ -255,39 +231,31 @@ public: bool injectedForThisEvent = false; int nConfig = mGunConfigs.size(); // We start counting from the configurations of the transport decayed particles - for (const ConfigContainer &cfg : mGunConfigsGenDecayed) - { + for (const ConfigContainer& cfg : mGunConfigsGenDecayed) { nConfig++; - if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) - { + if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) { continue; } LOG(info) << "Using config container "; cfg.print(); - if (mUseTriggering) - { // Do the triggering + if (mUseTriggering) { // Do the triggering bool doSignal{mEventCounter % (mGapBetweenInjection + 1) == 0}; // Do signal or gap - if (doSignal) - { + if (doSignal) { LOG(info) << "Generating triggered signal event for particle"; cfg.print(); bool satisfiesTrigger = false; int nTries = 0; - while (!satisfiesTrigger) - { - if (!pythiaObjectSignal.next()) - { + while (!satisfiesTrigger) { + if (!pythiaObjectSignal.next()) { continue; } // Check if triggered condition satisfied - for (int j = 0; j < pythiaObjectSignal.event.size(); j++) - { - const int &pypid = pythiaObjectSignal.event[j].id(); - const float &pyeta = mUseRapidity ? pythiaObjectSignal.event[j].y() : pythiaObjectSignal.event[j].eta(); - const float &pypt = pythiaObjectSignal.event[j].pT(); - if (pypid == cfg.mPdg && cfg.mMin < pyeta && pyeta < cfg.mMax && pypt > cfg.mPtMin && pypt < cfg.mPtMax) - { + for (int j = 0; j < pythiaObjectSignal.event.size(); j++) { + const int& pypid = pythiaObjectSignal.event[j].id(); + const float& pyeta = mUseRapidity ? pythiaObjectSignal.event[j].y() : pythiaObjectSignal.event[j].eta(); + const float& pypt = pythiaObjectSignal.event[j].pT(); + if (pypid == cfg.mPdg && cfg.mMin < pyeta && pyeta < cfg.mMax && pypt > cfg.mPtMin && pypt < cfg.mPtMax) { LOG(info) << "Found particle " << j << " " << pypid << " with " << (mUseRapidity ? "rapidity" : "eta") << " " << pyeta << " and pT " << pypt << " in event " << mEventCounter << " after " << nTries << " tries"; satisfiesTrigger = true; break; @@ -296,14 +264,11 @@ public: nTries++; } mPythia.event = pythiaObjectSignal.event; - } - else - { + } else { LOG(info) << "Generating background event " << mEventCounter; // Generate minimum-bias event bool lGenerationOK = false; - while (!lGenerationOK) - { + while (!lGenerationOK) { lGenerationOK = pythiaObjectMinimumBias.next(); } mPythia.event = pythiaObjectMinimumBias.event; @@ -314,8 +279,7 @@ public: // Do the injection // Use mPythiaGun for separate generation and decay mPythiaGun.event.reset(); - for (int i{0}; i < cfg.mNInject; ++i) - { + for (int i{0}; i < cfg.mNInject; ++i) { const double pt = gRandom->Uniform(cfg.mPtMin, cfg.mPtMax); const double eta = gRandom->Uniform(cfg.mMin, cfg.mMax); const double phi = gRandom->Uniform(0, TMath::TwoPi()); @@ -325,15 +289,12 @@ public: double pz = 0; double et = 0; - if (mUseRapidity) - { + if (mUseRapidity) { // Rapidty Case const double mT = std::sqrt(cfg.mMass * cfg.mMass + pt * pt); pz = mT * std::sinh(eta); et = mT * std::cosh(eta); - } - else - { + } else { // Eta Case pz = pt * std::sinh(eta); const double p = pt * std::cosh(eta); @@ -362,9 +323,8 @@ public: int offset = mPythia.event.size(); LOG(info) << "Merging " << mPythiaGun.event.size() - 1 << " injected particles into MB event of size " << offset; - for (int i = 1; i < mPythiaGun.event.size(); ++i) - { // Skip system particle 0 - Particle &p = mPythiaGun.event[i]; + for (int i = 1; i < mPythiaGun.event.size(); ++i) { // Skip system particle 0 + Particle& p = mPythiaGun.event[i]; // Adjust history indices int mother1 = p.mother1(); int mother2 = p.mother2(); @@ -396,8 +356,7 @@ public: // But if we are in embedding mode, we just need to ensure the MB event is there. // The mGunConfigs are handled in importParticles. - if (mVerbose) - { + if (mVerbose) { LOG(info) << "Eventlisting"; mPythia.event.list(1); mPythia.stat(); @@ -408,17 +367,12 @@ public: //__________________________________________________________________ Bool_t importParticles() override { - if (!mUseTriggering) - { // If the triggering is used we handle the the gap when generating the signal - if (mGapBetweenInjection > 0) - { - if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) - { + if (!mUseTriggering) { // If the triggering is used we handle the the gap when generating the signal + if (mGapBetweenInjection > 0) { + if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) { LOG(info) << "Skipping importParticles event " << mEventCounter++; return true; - } - else if (mEventCounter % mGapBetweenInjection != 0) - { + } else if (mEventCounter % mGapBetweenInjection != 0) { LOG(info) << "Skipping importParticles event " << mEventCounter++; return true; } @@ -427,17 +381,14 @@ public: LOG(info) << "importParticles " << mEventCounter++; GeneratorPythia8::importParticles(); int nConfig = 0; - for (const ConfigContainer &cfg : mGunConfigs) - { + for (const ConfigContainer& cfg : mGunConfigs) { nConfig++; - if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) - { + if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) { continue; } LOGF(info, "Injecting %i particles with PDG %i, pT in [%f, %f], %s in [%f, %f]", cfg.mNInject, cfg.mPdg, cfg.mPtMin, cfg.mPtMax, (mUseRapidity ? "rapidity" : "eta"), cfg.mMin, cfg.mMax); - for (int i{0}; i < cfg.mNInject; ++i) - { + for (int i{0}; i < cfg.mNInject; ++i) { const double pt = gRandom->Uniform(cfg.mPtMin, cfg.mPtMax); const double eta = gRandom->Uniform(cfg.mMin, cfg.mMax); const double phi = gRandom->Uniform(0, TMath::TwoPi()); @@ -446,14 +397,11 @@ public: double pz = 0; double et = 0; - if (mUseRapidity) - { + if (mUseRapidity) { const double mT = std::sqrt(cfg.mMass * cfg.mMass + pt * pt); pz = mT * std::sinh(eta); et = mT * std::cosh(eta); - } - else - { + } else { pz = pt * std::sinh(eta); const double p = pt * std::cosh(eta); et = std::sqrt(p * p + cfg.mMass * cfg.mMass); @@ -478,20 +426,17 @@ public: } nConfig++; } - if (mVerbose) - { + if (mVerbose) { LOG(info) << "Printing particles that are appended"; int n = 0; - for (const auto &p : mParticles) - { + for (const auto& p : mParticles) { LOG(info) << "Particle " << n++ << " is a " << p.GetPdgCode() << " with status " << p.GetStatusCode() << " and px = " << p.Py() << " py = " << p.Py() << " pz = " << p.Pz(); } } return true; } - struct ConfigContainer - { + struct ConfigContainer { ConfigContainer(int input_pdg = 0, int n = 1, float ptMin = 1, float ptMax = 10, float min = -1, float max = 1) : mPdg{input_pdg}, @@ -503,15 +448,14 @@ public: { // mMass = getMassFromPDG(mPdg); mMass = GeneratorPythia8LongLivedGun::getMass(mPdg); - if (mMass <= 0) - { + if (mMass <= 0) { LOG(fatal) << "Could not find mass for mPdg " << mPdg; } LOGF(info, "ConfigContainer: mPdg = %i, mNInject = %i, mPtMin = %f, mPtMax = %f, mMin = %f, mMax = %f, mMass = %f", mPdg, mNInject, mPtMin, mPtMax, mMin, mMax, mMass); }; - ConfigContainer(TObjArray *arr) : ConfigContainer(atoi(arr->At(0)->GetName()), + ConfigContainer(TObjArray* arr) : ConfigContainer(atoi(arr->At(0)->GetName()), atoi(arr->At(1)->GetName()), atof(arr->At(2)->GetName()), atof(arr->At(3)->GetName()), @@ -519,33 +463,26 @@ public: atof(arr->At(5)->GetName())) { bool hasGenDecayed = false; - for (int i = 0; i < arr->GetEntries(); i++) - { + for (int i = 0; i < arr->GetEntries(); i++) { const TString n = arr->At(i)->GetName(); std::cout << n << std::endl; - if (n == "genDecayed") - { + if (n == "genDecayed") { hasGenDecayed = true; break; } } - if (hasGenDecayed) - { - if (arr->GetEntries() != 7) - { + if (hasGenDecayed) { + if (arr->GetEntries() != 7) { LOG(fatal) << "Wrong number of entries in the configuration array, should be 7, is " << arr->GetEntries(); } - } - else - { - if (arr->GetEntries() != 6) - { + } else { + if (arr->GetEntries() != 6) { LOG(fatal) << "Wrong number of entries in the configuration array, should be 6, is " << arr->GetEntries(); } } }; ConfigContainer(TString line) : ConfigContainer(line.Tokenize(" ")) {}; - ConfigContainer(const nlohmann::json &jsonParams, bool useRapidity = false) : ConfigContainer(jsonParams["pdg"], + ConfigContainer(const nlohmann::json& jsonParams, bool useRapidity = false) : ConfigContainer(jsonParams["pdg"], jsonParams["n"], jsonParams["ptMin"], jsonParams["ptMax"], @@ -576,8 +513,7 @@ public: //__________________________________________________________________ ConfigContainer addGun(int input_pdg, int nInject = 1, float ptMin = 1, float ptMax = 10, float min = 1, float max = 10) { - if (mUseTriggering) - { // If in trigger mode, every particle needs to be generated from pythia + if (mUseTriggering) { // If in trigger mode, every particle needs to be generated from pythia return addGunGenDecayed(input_pdg, nInject, ptMin, ptMax, min, max); } ConfigContainer cfg{input_pdg, nInject, ptMin, ptMax, min, max}; @@ -608,15 +544,13 @@ public: LOG(info) << "GeneratorPythia8LFRapidity configuration with " << getNGuns() << " guns:"; LOG(info) << "Particles decayed by the transport:"; int n = 0; - for (const auto &cfg : mGunConfigs) - { + for (const auto& cfg : mGunConfigs) { LOG(info) << n++ << "/" << mGunConfigs.size() << ":"; cfg.print(); } n = 0; LOG(info) << "Particles decayed by the generator:"; - for (const auto &cfg : mGunConfigsGenDecayed) - { + for (const auto& cfg : mGunConfigsGenDecayed) { LOG(info) << n++ << "/" << mGunConfigs.size() << ":"; cfg.print(); } @@ -624,7 +558,7 @@ public: void setVerbose(bool verbose = true) { mVerbose = verbose; } -private: + private: // Configuration const bool mOneInjectionPerEvent = true; // if true, only one injection per event is performed, i.e. if multiple PDG (including antiparticles) are requested to be injected only one will be done per event const bool mUseTriggering = false; // if true, use triggering instead of injection @@ -645,17 +579,15 @@ private: ///___________________________________________________________ /// Create generator via arrays of entries. By default injecting in every event and all particles -FairGenerator *generateLFRapidity(std::vector PDGs, std::vector nInject, std::vector ptMin, std::vector ptMax, std::vector min, std::vector max, bool useRapidity = false) +FairGenerator* generateLFRapidity(std::vector PDGs, std::vector nInject, std::vector ptMin, std::vector ptMax, std::vector min, std::vector max, bool useRapidity = false) { const std::vector entries = {PDGs.size(), nInject.size(), ptMin.size(), ptMax.size(), min.size(), max.size()}; - if (!std::equal(entries.begin() + 1, entries.end(), entries.begin())) - { + if (!std::equal(entries.begin() + 1, entries.end(), entries.begin())) { LOGF(fatal, "Not equal number of entries, check configuration"); return nullptr; } - GeneratorPythia8LFRapidity *multiGun = new GeneratorPythia8LFRapidity(false, 0, false, useRapidity, "", ""); - for (unsigned long i = 0; i < entries[0]; i++) - { + GeneratorPythia8LFRapidity* multiGun = new GeneratorPythia8LFRapidity(false, 0, false, useRapidity, "", ""); + for (unsigned long i = 0; i < entries[0]; i++) { multiGun->addGun(PDGs[i], nInject[i], ptMin[i], ptMax[i], min[i], max[i]); } return multiGun; @@ -663,7 +595,7 @@ FairGenerator *generateLFRapidity(std::vector PDGs, std::vector nInjec ///___________________________________________________________ /// Create generator via an array of configurations -FairGenerator *generateLFRapidity(std::vector cfg, +FairGenerator* generateLFRapidity(std::vector cfg, std::vector cfgGenDecayed, bool injectOnePDGPerEvent = true, int gapBetweenInjection = 0, @@ -672,15 +604,13 @@ FairGenerator *generateLFRapidity(std::vectorgetNGuns()); c.print(); multiGun->addGun(c); } - for (const auto &c : cfgGenDecayed) - { + for (const auto& c : cfgGenDecayed) { LOGF(info, "Adding gun %i, particle will be decayed by the generator", multiGun->getNGuns()); c.print(); multiGun->addGunGenDecayed(c); @@ -691,7 +621,7 @@ FairGenerator *generateLFRapidity(std::vector(), param}); - if (param["genDecayed"]) - { + if (param["genDecayed"]) { cfgVecGenDecayed.push_back(GeneratorPythia8LFRapidity::ConfigContainer{param, useRapidity}); - } - else - { + } else { cfgVec.push_back(GeneratorPythia8LFRapidity::ConfigContainer{param, useRapidity}); } } - } - else - { + } else { std::string l; int n = 0; - while (getline(inputFile, l)) - { + while (getline(inputFile, l)) { TString line = l; line.Strip(TString::kBoth, ' '); std::cout << n++ << " '" << line << "'" << endl; - if (line.IsNull() || line.IsWhitespace()) - { + if (line.IsNull() || line.IsWhitespace()) { continue; } - if (line.BeginsWith("#")) - { + if (line.BeginsWith("#")) { std::cout << "Skipping\n"; continue; } - if (line.Contains("genDecayed")) - { + if (line.Contains("genDecayed")) { cfgVecGenDecayed.push_back(GeneratorPythia8LFRapidity::ConfigContainer{line}); - } - else - { + } else { cfgVec.push_back(GeneratorPythia8LFRapidity::ConfigContainer{line}); } } @@ -760,7 +676,7 @@ FairGenerator *generateLFRapidity(std::string configuration = "${O2DPG_MC_CONFIG ///___________________________________________________________ /// Create generator via input file for the triggered mode -FairGenerator *generateLFRapidityTriggered(std::string configuration = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exotic_nuclei_pp.gun", +FairGenerator* generateLFRapidityTriggered(std::string configuration = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exotic_nuclei_pp.gun", int gapBetweenInjection = 0, bool useRapidity = false, std::string pythiaCfgMb = "", @@ -770,18 +686,16 @@ FairGenerator *generateLFRapidityTriggered(std::string configuration = "${O2DPG_ } ///___________________________________________________________ -void generator_pythia8_LF_rapidity(bool testInj = true, bool testTrg = false, bool useRapidity = false, const char *particleListFile = "cfg_rapidity.json") +void generator_pythia8_LF_rapidity(bool testInj = true, bool testTrg = false, bool useRapidity = false, const char* particleListFile = "cfg_rapidity.json") { LOG(info) << "Compiled correctly!"; - if (!testInj && !testTrg) - { + if (!testInj && !testTrg) { return; } // Injected mode - if (testInj) - { + if (testInj) { LOG(info) << "Testing the injected mode"; - auto *gen = static_cast(generateLFRapidity(particleListFile, true, 0, false, useRapidity)); + auto* gen = static_cast(generateLFRapidity(particleListFile, true, 0, false, useRapidity)); gen->setVerbose(); gen->Print(); gen->print(); @@ -791,14 +705,13 @@ void generator_pythia8_LF_rapidity(bool testInj = true, bool testTrg = false, bo } // Triggered mode - if (testTrg) - { + if (testTrg) { LOG(info) << "Testing the triggered mode"; - GeneratorPythia8LFRapidity *gen = static_cast(generateLFRapidityTriggered(particleListFile, - /*gapBetweenInjection=*/0, - useRapidity, - /*pythiaCfgMb=*/"inel136tev.cfg", - /*pythiaCfgSignal=*/"inel136tev.cfg")); + GeneratorPythia8LFRapidity* gen = static_cast(generateLFRapidityTriggered(particleListFile, + /*gapBetweenInjection=*/0, + useRapidity, + /*pythiaCfgMb=*/"inel136tev.cfg", + /*pythiaCfgSignal=*/"inel136tev.cfg")); gen->setVerbose(); gen->Print(); gen->print(); From 98ebe55c200c55c48385413e211d30c381d213f9 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Tue, 17 Feb 2026 14:43:07 +0530 Subject: [PATCH 04/20] Update Pythia8 configuration file path --- MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C index affd291f9..e70981608 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C @@ -71,7 +71,7 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 int gapBetweenInjection = 0, bool useTrigger = false, bool useRapidity = false, - std::string pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_minbias.cfg", + std::string pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", std::string pythiaCfgSignal = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_signal.cfg") : GeneratorPythia8{}, mOneInjectionPerEvent{injOnePerEvent}, mGapBetweenInjection{gapBetweenInjection}, @@ -132,7 +132,7 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 } // FIX: Fallback if still empty to default minbias if (pythiaCfgMb == "") { - pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_minbias.cfg"; + pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg"; } pythiaCfgMb = gSystem->ExpandPathName(pythiaCfgMb.c_str()); if (!pythiaObjectMinimumBias.readFile(pythiaCfgMb)) { From 5521facf71f9994550f6a3f8507f23d91a07a7c4 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Tue, 17 Feb 2026 14:47:53 +0530 Subject: [PATCH 05/20] Modify funcName parameters in GeneratorLF config --- MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini index 86503c6ab..b2ee68ee6 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun.json", true, 4, true, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg") +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun.json", true, 4, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg") -# [GeneratorPythia8] # if triggered then this will be used as the background event -# config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg +[GeneratorPythia8] # if triggered then this will be used as the background event +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From 1de0d425a37235d648e60f5801859714e1416c65 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Tue, 17 Feb 2026 15:01:55 +0530 Subject: [PATCH 06/20] added lambda1520 gun for injection scheme --- .../pythia8/generator/lambda1520gun_inj.json | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 MC/config/PWGLF/pythia8/generator/lambda1520gun_inj.json diff --git a/MC/config/PWGLF/pythia8/generator/lambda1520gun_inj.json b/MC/config/PWGLF/pythia8/generator/lambda1520gun_inj.json new file mode 100644 index 000000000..f7e095729 --- /dev/null +++ b/MC/config/PWGLF/pythia8/generator/lambda1520gun_inj.json @@ -0,0 +1,24 @@ +{ + "Lambda(1520)0" : { + "pdg": 102134, + "n": 5, + "ptMin": 0.0, + "ptMax": 15, + "etaMin": -1.0, + "etaMax": 1.0, + "rapidityMin": -1.0, + "rapidityMax": 1.0, + "genDecayed": true + }, + "anti-Lambda(1520)0" : { + "pdg": -102134, + "n": 5, + "ptMin": 0.0, + "ptMax": 15, + "etaMin": -1.0, + "etaMax": 1.0, + "rapidityMin": -1.0, + "rapidityMax": 1.0, + "genDecayed": true + } +} From c9d992d2a815e9a2bca4fda0fd18d37d32602478 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Tue, 17 Feb 2026 15:03:58 +0530 Subject: [PATCH 07/20] Fix newline issue in lambda1520.cfg --- MC/config/PWGLF/pythia8/generator/lambda1520.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MC/config/PWGLF/pythia8/generator/lambda1520.cfg b/MC/config/PWGLF/pythia8/generator/lambda1520.cfg index b98d9f43c..df201689b 100644 --- a/MC/config/PWGLF/pythia8/generator/lambda1520.cfg +++ b/MC/config/PWGLF/pythia8/generator/lambda1520.cfg @@ -7,4 +7,4 @@ ProcessLevel:all = off # will not look for the 'process' ### add Resonance decays absent in PYTHIA8 decay table and set BRs from PDG for other 102134:oneChannel = 1 1.000 0 2212 -321 102134:onMode = off -102134:onIfMatch = 2212 -321 \ No newline at end of file +102134:onIfMatch = 2212 -321 From 64d028ba0c69a9e3ec87c02ffe7418c5f07e67eb Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:09:52 +0530 Subject: [PATCH 08/20] Fix pythiaCfgSignal path and clean up code Updated pythiaCfgSignal path and removed unused config code. --- MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C index e70981608..71156cd6a 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C @@ -72,7 +72,7 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 bool useTrigger = false, bool useRapidity = false, std::string pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", - std::string pythiaCfgSignal = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/pythia8_inel_signal.cfg") : GeneratorPythia8{}, + std::string pythiaCfgSignal = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg") : GeneratorPythia8{}, mOneInjectionPerEvent{injOnePerEvent}, mGapBetweenInjection{gapBetweenInjection}, mUseTriggering{useTrigger}, @@ -147,12 +147,6 @@ class GeneratorPythia8LFRapidity : public o2::eventgen::GeneratorPythia8 /** switch off process level **/ mPythiaGun.readString("ProcessLevel:all off"); - /** config **/ - /* auto& paramGen = o2::eventgen::GeneratorPythia8Param::Instance(); - if (!paramGen.config.empty()) { - LOG(fatal) << "Configuration file provided for \'GeneratorPythia8\' should be empty for this injection scheme"; - return; - } */ auto& param = o2::eventgen::DecayerPythia8Param::Instance(); LOG(info) << "Init \'GeneratorPythia8LFRapidity\' with following parameters"; LOG(info) << param; From 85dc74dc5135a1c2eb1536b9bb811d15a705def6 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:11:38 +0530 Subject: [PATCH 09/20] Update funcName in GeneratorLF_Resonances_pp900.ini --- MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini index b2ee68ee6..e1895740b 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900.ini @@ -1,6 +1,6 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun.json", true, 4, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg") +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_trig.json", true, 4, true, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg") [GeneratorPythia8] # if triggered then this will be used as the background event config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg From 9781f8f9fc274805f01f07a6d205ba9752547668 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:21:33 +0530 Subject: [PATCH 10/20] Update generator configuration for resonance injection --- .../PWGLF/ini/GeneratorLF_Resonances_pp900_injection.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900_injection.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900_injection.ini index 2e5c4a6d4..d172f034f 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900_injection.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp900_injection.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_inj.json", true, 4) +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_inj.json", true, 4, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg", "") -# [GeneratorPythia8] # if triggered then this will be used as the background event -# config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg +[GeneratorPythia8] # if triggered then this will be used as the background event +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_pp900gev.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From 6a9c0792278ea1cb672e551ea43f42da9a4bed87 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:22:58 +0530 Subject: [PATCH 11/20] Update generator function name and configuration --- MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360.ini index 345433715..543c0d7b2 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun.json", true, 4, true, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg") +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_trig.json", true, 4, true, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg") -# [GeneratorPythia8] # if triggered then this will be used as the background event -# config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg +[GeneratorPythia8] # if triggered then this will be used as the background event +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From 5b05a69e467032fa2338400dfb6bea8d911ff69b Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:24:08 +0530 Subject: [PATCH 12/20] Update generator function parameters in INI file --- .../PWGLF/ini/GeneratorLF_Resonances_pp1360_injection.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360_injection.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360_injection.ini index cf103d147..c8ad07a90 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360_injection.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp1360_injection.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_inj.json", true, 4) +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_inj.json", true, 1, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "") -# [GeneratorPythia8] # if triggered then this will be used as the background event -# config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg +[GeneratorPythia8] # if triggered then this will be used as the background event +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From fa087fff81d956c5d3799c444c13a6d0231efbe7 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:25:34 +0530 Subject: [PATCH 13/20] Uncomment GeneratorPythia8 configuration --- MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exotic.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exotic.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exotic.ini index f83430519..dc484ed6c 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exotic.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exotic.ini @@ -2,9 +2,9 @@ fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/gluelistgun.json", true, 4, true, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg") -# [GeneratorPythia8] # if triggered then this will be used as the background event -# config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg +[GeneratorPythia8] # if triggered then this will be used as the background event +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From 2372488e7401b5b0645c880d8d8b7281a48db849 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:26:30 +0530 Subject: [PATCH 14/20] Uncomment GeneratorPythia8 configuration --- MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini index b02959589..a7b24fd34 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini @@ -2,9 +2,9 @@ fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic.json", true, 4, true, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg") -# [GeneratorPythia8] # if triggered then this will be used as the background event -# config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg +[GeneratorPythia8] # if triggered then this will be used as the background event +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From 5de27f0c9da8f909bc50d0b5cd6e7849ae714f51 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:27:35 +0530 Subject: [PATCH 15/20] Update generator function and configuration in ini file --- MC/config/PWGLF/ini/GeneratorLF_Resonances_pp.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp.ini index 345433715..543c0d7b2 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun.json", true, 4, true, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg") +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_trig.json", true, 4, true, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg") -# [GeneratorPythia8] # if triggered then this will be used as the background event -# config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg +[GeneratorPythia8] # if triggered then this will be used as the background event +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From 86f01c5416537b660a66a237c3dbfb91084fd40c Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:30:03 +0530 Subject: [PATCH 16/20] Update generator configuration for PbPb resonances --- MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb.ini index 4586b3bb3..7c297054a 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_pbpb.json", true, 4, true, false, "${O2_ROOT}/share/Generators/egconfig/pythia8_hi.cfg", "${O2_ROOT}/share/Generators/egconfig/pythia8_hi.cfg") +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_trig.json", true, 4, true, false, "${O2_ROOT}/Generators/share/egconfig/pythia8_hi.cfg", "${O2_ROOT}/Generators/share/egconfig/pythia8_hi.cfg") -# [GeneratorPythia8] -# config=${O2_ROOT}/share/Generators/egconfig/pythia8_hi.cfg +[GeneratorPythia8] +config=${O2_ROOT}/Generators/share/egconfig/pythia8_hi.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From b234a515fc9c820d8d45c71b9ce093ba1ed1ef41 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:31:08 +0530 Subject: [PATCH 17/20] Update generator function parameters in ini file --- .../ini/GeneratorLF_Resonances_PbPb5360_injection.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb5360_injection.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb5360_injection.ini index 5050d1760..e4283438a 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb5360_injection.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb5360_injection.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_inj_pbpb.json", true, 4) +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_inj_pbpb.json", true, 1, false, false, "${O2_ROOT}/Generators/share/egconfig/pythia8_hi.cfg", "") -# [GeneratorPythia8] -# config=${O2_ROOT}/share/Generators/egconfig/pythia8_hi.cfg +[GeneratorPythia8] +config=${O2_ROOT}/Generators/share/egconfig/pythia8_hi.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From 59a657d10001f0be858777dbf8da6e38d3451931 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:33:07 +0530 Subject: [PATCH 18/20] Update generator configuration for PbPb exotic --- .../PWGLF/ini/GeneratorLF_Resonances_PbPb_exotic.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb_exotic.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb_exotic.ini index f5456c207..649300c2b 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb_exotic.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_PbPb_exotic.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic_pbpb.json", true, 4, true, false, "${O2_ROOT}/share/Generators/egconfig/pythia8_hi.cfg", "${O2_ROOT}/share/Generators/egconfig/pythia8_hi.cfg") +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic_pbpb.json", true, 4, false, false, "${O2_ROOT}/Generators/share/egconfig/pythia8_hi.cfg", "") -# [GeneratorPythia8] -# config=${O2_ROOT}/share/Generators/egconfig/pythia8_hi.cfg +[GeneratorPythia8] +config=${O2_ROOT}/Generators/share/egconfig/pythia8_hi.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From 6665788db1fcac103d6b3fb1fc1ff9499e72566d Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:33:55 +0530 Subject: [PATCH 19/20] Update generator function parameters in ini file --- .../PWGLF/ini/GeneratorLF_ExoticResonances_pp1360.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_ExoticResonances_pp1360.ini b/MC/config/PWGLF/ini/GeneratorLF_ExoticResonances_pp1360.ini index 3535d7cbe..abf18374a 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_ExoticResonances_pp1360.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_ExoticResonances_pp1360.ini @@ -1,10 +1,10 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exoticresonancegun.json", true, 4) +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/exoticresonancegun.json", true, 1, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "") -# [GeneratorPythia8] # if triggered then this will be used as the background event -# config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg +[GeneratorPythia8] # if triggered then this will be used as the background event +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg [DecayerPythia8] # after for transport code! config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg \ No newline at end of file +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances.cfg From bf6674c8593174bb4071427f23b7bddb706e7f3a Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 18 Feb 2026 12:35:10 +0530 Subject: [PATCH 20/20] fix --- MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C | 1 + 1 file changed, 1 insertion(+) diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C index 71156cd6a..b88a9a7a6 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C @@ -1,5 +1,6 @@ /// /// \file generator_pythia8_LF_rapidity.C +/// \author Hirak Kumar Koley hirak.koley@cern.ch /// \author Bong-Hwi Lim bong-hwi.lim@cern.ch /// \author Based on generator_pythia8_LF.C by Nicolò Jacazio /// \since 2025/08/18