Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
200f5ad
Create the Non-HFE–enhanced dataset.
rashigupt Nov 23, 2025
db1cd10
Create the Non-HFE–enhanced dataset
rashigupt Nov 23, 2025
abd70d4
Create the Non-HFE–enhanced dataset
rashigupt Nov 23, 2025
41fabe0
Update and rename GeneratorHF_Non_Hfe_enhance.ini to GeneratorHF_Non_…
rashigupt Dec 22, 2025
fa2d14d
Create generator_pythia8_gaptriggered_nonhfe.C
rashigupt Dec 22, 2025
64baf33
Update generator_pythia8_gaptriggered_nonhfe.C
rashigupt Jan 10, 2026
c31e83c
remove build error
rashigupt Jan 10, 2026
71e837a
Update generator_pythia8_gaptriggered_nonhfe.C
rashigupt Jan 10, 2026
c2bdacf
Correct name
rashigupt Jan 11, 2026
738d263
correct name
rashigupt Jan 11, 2026
9f8a12b
remove build error
rashigupt Jan 11, 2026
b5239c1
remove e and add pion , eta ID
rashigupt Jan 11, 2026
1ae8543
Remove build error
rashigupt Jan 11, 2026
35ccc9a
Update generator_pythia8_gaptriggered_nonhfe.C
rashigupt Jan 11, 2026
99fdf6a
Update GeneratorHF_Non_Hfe.ini
rashigupt Jan 12, 2026
11f2902
Replace 1/2 to 1/3
rashigupt Jan 15, 2026
20a6450
ncrease the tolerance to 10%
rashigupt Jan 16, 2026
310f1a6
Update and rename MC/config/PWGHF/external/generator/generator_pythia…
rashigupt Feb 9, 2026
ead9fb3
Update GeneratorHF_Non_Hfe.ini
rashigupt Feb 9, 2026
24328aa
Update pythia8_NonHfe.cfg
rashigupt Feb 9, 2026
eca0412
Update GeneratorHF_Non_Hfe.C
rashigupt Feb 9, 2026
76c6771
Update GeneratorHF_Non_Hfe.ini
rashigupt Feb 9, 2026
8aff829
Add correctly pDg cut
rashigupt Feb 9, 2026
620e774
Update GeneratorHF_Non_Hfe.ini
rashigupt Feb 9, 2026
998d36f
usetriggerexternal
rashigupt Feb 9, 2026
fc6613f
Rename MC/config/PWGHF/trigger/selectNonHfe.C to MC/config/PWGHF/exte…
rashigupt Feb 9, 2026
6fc3f71
Update GeneratorHF_Non_Hfe.ini
rashigupt Feb 9, 2026
88a1476
Update GeneratorHF_Non_Hfe.ini
rashigupt Feb 10, 2026
a7ef760
Rename MC/config/PWGHF/external/generator/selectNonHfe.C to MC/config…
rashigupt Feb 10, 2026
5dd0ba3
Update GeneratorHF_Non_Hfe.ini
rashigupt Feb 10, 2026
02149aa
Use triggerexternal
rashigupt Feb 10, 2026
495bcf9
use configuration file
rashigupt Feb 16, 2026
d2c268a
Create GeneratorHF_Non_Hfe.json
rashigupt Feb 16, 2026
5c9374a
Update GeneratorHF_Non_Hfe.C
rashigupt Feb 16, 2026
98b5f11
Rename MC/config/PWGHF/ini/hybrid/GeneratorHF_Non_Hfe.json to MC/conf…
rashigupt Feb 16, 2026
1ab1bc0
Rename MC/config/PWGHF/ini/hybrid/GeneratorHF_Non_Hfe.ini to MC/confi…
rashigupt Feb 16, 2026
ac0057c
Rename MC/config/PWGHF/ini/tests/GeneratorHF_Non_Hfe.C to MC/config/P…
rashigupt Feb 16, 2026
cf2d515
Rename GeneratorHF_Non_Hfe.C to GeneratorHF_Non_Hfe.C
rashigupt Feb 16, 2026
2cfbc16
Rename MC/config/PWGHF/hybrid/GeneratorHF_Non_Hfe.C to MC/config/PWGH…
rashigupt Feb 16, 2026
8688901
Rename GeneratorHF_Non_Hfe.ini to GeneratorHF_Non_Hfe.ini
rashigupt Feb 16, 2026
f289b78
Update pythia8_NonHfe.cfg
rashigupt Oct 12, 2026
e6655b5
Update and rename MC/config/PWGHF/trigger/selectNonHfe.C to MC/config…
rashigupt Oct 12, 2026
30e5bd0
Update GeneratorHF_Non_Hfe.ini
rashigupt Oct 12, 2026
e39aa01
Merge branch 'master' into rashigupta
rashigupt Oct 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 79 additions & 52 deletions MC/config/PWGHF/external/generator/selectNonHfe.C
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/// Select π⁰ and η within a given rapidity window for enhancement
/// pdgPartForAccCut: PDG of the particle to select (111=π⁰, 221=η)
/// minNb: minimum number of such particles per event for enhancement

//// authors: Rashi Gupta (rashi.gupta@cern.ch)
/// authors: Ravindra Singh (ravindra.singh@cern.ch)


#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "FairGenerator.h"
Expand All @@ -14,83 +7,117 @@
#include "TParticlePDG.h"
#include "TDatabasePDG.h"
#include "TMath.h"
#include <fairlogger/Logger.h>
#include <cmath>
#include <vector>
#endif

#include "Pythia8/Pythia.h"
using namespace Pythia8;

class GeneratorPythia8Box : public o2::eventgen::GeneratorPythia8
{
public:

GeneratorPythia8Box(std::vector<int> pdgList, int nInject = 3, float ptMin = 0.1, float ptMax = 50.0, float etaMin = -0.8, float etaMax = 0.8)
: mPdgList(pdgList), nParticles(nInject), genMinPt(ptMin), genMaxPt(ptMax), genMinEta(etaMin), genMaxEta(etaMax)

GeneratorPythia8Box(std::vector<int> pdgList, int nInject = 3,
float ptMin = 0.1, float ptMax = 50.0,
float etaMin = -0.8, float etaMax = 0.8)
: mPdgList(pdgList), nParticles(nInject),
genMinPt(ptMin), genMaxPt(ptMax),
genMinEta(etaMin), genMaxEta(etaMax)
{
// Initialize dedicated Pythia instance for injection/decay only
// Reuses same config as main Pythia; beam settings are ignored by moreDecays()
auto& param = o2::eventgen::GeneratorPythia8Param::Instance();
std::string cfg = gSystem->ExpandPathName(param.config.c_str());
if (!mPythiaGun.readFile(cfg, true)) {
LOG(fatal) << "Failed to read config for mPythiaGun: " << cfg;
}
if (!mPythiaGun.init()) {
LOG(fatal) << "Failed to init mPythiaGun";
}
}

~GeneratorPythia8Box() = default;

Bool_t generateEvent() override
{
bool hasElectron = false;

while (!hasElectron) {
mPythia.event.reset();
bool Init() override
{
return o2::eventgen::GeneratorPythia8::Init();
}

for (int i{0}; i < nParticles; ++i)
{
int currentPdg = mPdgList[gRandom->Integer(mPdgList.size())];
double mass = TDatabasePDG::Instance()->GetParticle(currentPdg)->Mass();
protected:

const double pt = gRandom->Uniform(genMinPt, genMaxPt);
const double eta = gRandom->Uniform(genMinEta, genMaxEta);
const double phi = gRandom->Uniform(0, TMath::TwoPi());
// ── generateEvent: MB + injection ──
Bool_t generateEvent() override
{
bool hasElectron = false;

while (!hasElectron) {
// ===== 1. Generate minimum-bias event =====
if (!mPythia.next()) continue;

// ===== 2. Inject π⁰/η into separate gun, decay only them =====
mPythiaGun.event.reset();
for (int i = 0; i < nParticles; ++i) {
int pdg = mPdgList[gRandom->Integer(mPdgList.size())];
auto* pPDG = TDatabasePDG::Instance()->GetParticle(pdg);
if (!pPDG) continue;
double mass = pPDG->Mass();

double pt = gRandom->Uniform(genMinPt, genMaxPt);
double eta = gRandom->Uniform(genMinEta, genMaxEta);
double phi = gRandom->Uniform(0., TMath::TwoPi());
double px = pt * cos(phi);
double py = pt * sin(phi);
double pz = pt * sinh(eta);
double e = sqrt(px * px + py * py + pz * pz + mass * mass);

mPythiaGun.event.append(pdg, 11, 0, 0, px, py, pz, e, mass);
}

const double px{pt * std::cos(phi)};
const double py{pt * std::sin(phi)};
const double pz{pt * std::sinh(eta)};
const double et{std::hypot(std::hypot(pt, pz), mass)};
mPythiaGun.moreDecays();


mPythia.event.append(currentPdg, 11, 0, 0, px, py, pz, et, mass);
// ===== 3. Check for electron from injection in acceptance =====
for (int i = 0; i < mPythiaGun.event.size(); ++i) {
auto& part = mPythiaGun.event[i];
if (std::abs(part.id()) == 11 && part.isFinal()) {
if (part.pT() > 0.1 && std::abs(part.eta()) < 1.2) {
hasElectron = true;
break;
}
}
}
}


if (!mPythia.next()) continue;
// ===== 4. Copy injection products to MB event with index offset =====
int offset = mPythia.event.size();


for (int i = 0; i < mPythia.event.size(); ++i) {
if (std::abs(mPythia.event[i].id()) == 11) {


double childPt = mPythia.event[i].pT();
double childEta = mPythia.event[i].eta();

if (childPt > 0.1 && std::abs(childEta) < 1.2) {
hasElectron = true; // Mil gaya!
break;
}
}
for (int i = 0; i < mPythiaGun.event.size(); ++i) {
auto part = mPythiaGun.event[i];
if (part.id() == 90) continue; // skip system placeholder
if (!part.isFinal() && part.id() != 111 && part.id() != 221) continue;

if (part.mother1() > 0) part.mother1(part.mother1() + offset - 1);
if (part.mother2() > 0) part.mother2(part.mother2() + offset - 1);
if (part.daughter1() > 0) part.daughter1(part.daughter1() + offset - 1);
if (part.daughter2() > 0) part.daughter2(part.daughter2() + offset - 1);

mPythia.event.append(part);
}

}

return true;
}
return true;
}

private:
std::vector<int> mPdgList;
double genMinPt, genMaxPt;
double genMinEta, genMaxEta;
int nParticles;

Pythia8::Pythia mPythiaGun;
};


FairGenerator *generatePythia8Box(float ptMin = 0.1, float ptMax = 50.0)
{

std::vector<int> pdgList = {111, 221};
return new GeneratorPythia8Box(pdgList, 3, ptMin, ptMax, -0.8, 0.8);
}
}
40 changes: 0 additions & 40 deletions MC/config/PWGHF/hybrid/GeneratorHF_Non_Hfe.json
Original file line number Diff line number Diff line change
@@ -1,40 +0,0 @@
{
"generators": [
{
"name": "pythia8",
"config": {
"config": "${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/generator/pythia8_NonHfe.cfg"
},
"triggers": {
"mode": "or",
"specs": [
{
"macro": "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/trigger/selectNonHfe.C",
"function": "selectPionEtaWithinAcc(\"111;221\",-1.5,1.5,1)"
}
]
}
},
{
"name": "boxgen",
"config": {
"pdg": 111,
"prange[0]": 0.1,
"prange[1]": 50.0,
"eta[0]": -0.8,
"eta[1]": 0.8
}
},
{
"name": "boxgen",
"config": {
"pdg": 221,
"prange[0]": 0.1,
"prange[1]": 50.0,
"eta[0]": -0.8,
"eta[1]": 0.8
}
}
],
"fractions": [1, 1, 1]
}
6 changes: 3 additions & 3 deletions MC/config/PWGHF/ini/GeneratorHF_Non_Hfe.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#### This configuration uses the Box generator to trigger π⁰/η production within the specified rapidity window
[GeneratorExternal]
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/external/generator/selectNonHfe.C
funcName = generatePythia8Box(0.1, 50.0)
funcName=generatePythia8Box(0.1,50.0)

[GeneratorPythia8]
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/pythia8/generator/pythia8_NonHfe.cfg
includePartonEvent=true
includePartonEvent=true
2 changes: 1 addition & 1 deletion MC/config/PWGHF/pythia8/generator/pythia8_NonHfe.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Beams:eCM 13600. # GeV

### processes

ProcessLevel:all = off

SoftQCD:inelastic = on
### decays
ParticleDecays:limitTau0 on
ParticleDecays:tau0Max 10.
Expand Down
Loading