Skip to content

Commit 5ca7311

Browse files
committed
Custom phi injected resonance
1 parent 3e9d3ee commit 5ca7311

3 files changed

Lines changed: 48 additions & 37 deletions

File tree

‎MC/config/PWGLF/ini/GeneratorLF_phiphiInvMass.ini‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[GeneratorExternal]
22
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/GeneratorLF_phiphi.C
3-
funcName=generatePhiResonanceGun(999999, 0.0, 50.0, 100.0, -1.0, 1.0, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", 3)
3+
funcName=generatePhiResonanceGun(999999, 888888, 0.0, 50.0, 100.0, -1.0, 1.0, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", 3)
44

55
[GeneratorPythia8]
66
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg

‎MC/config/PWGLF/ini/tests/GeneratorLF_phiphiInvMass.C‎

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,34 @@ int External()
7676
for (int k = phiTrack.getFirstDaughterTrackId(); k <= phiTrack.getLastDaughterTrackId(); ++k)
7777
{
7878
auto grandDauPdg = tracks->at(k).GetPdgCode();
79-
if (grandDauPdg == 321) ++nKPlusFromResonancePhi;
80-
if (grandDauPdg == -321) ++nKMinusFromResonancePhi;
79+
if (grandDauPdg == 321)
80+
++nKPlusFromResonancePhi;
81+
if (grandDauPdg == -321)
82+
++nKMinusFromResonancePhi;
8183
}
8284
}
8385
}
8486
}
8587
}
8688

89+
else if (pdg == 888888)
90+
{
91+
++nDirectInjectedPhi;
92+
hasInjection = true;
93+
94+
if (track.getFirstDaughterTrackId() >= 0)
95+
{
96+
for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j)
97+
{
98+
auto dauPdg = tracks->at(j).GetPdgCode();
99+
if (dauPdg == 321)
100+
++nKPlusFromDirectPhi;
101+
if (dauPdg == -321)
102+
++nKMinusFromDirectPhi;
103+
}
104+
}
105+
}
106+
87107
// 2. Process Phi (333) Mesons
88108
else if (pdg == 333)
89109
{
@@ -96,36 +116,18 @@ int External()
96116
continue;
97117
}
98118

99-
bool isDirectInjected = (motherId < 0);
119+
// Minimum Bias Phi
120+
++nMBPhi;
100121

101-
if (isDirectInjected)
122+
if (track.getFirstDaughterTrackId() >= 0)
102123
{
103-
++nDirectInjectedPhi;
104-
hasInjection = true;
105-
106-
if (track.getFirstDaughterTrackId() >= 0)
124+
for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j)
107125
{
108-
for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j)
109-
{
110-
auto dauPdg = tracks->at(j).GetPdgCode();
111-
if (dauPdg == 321) ++nKPlusFromDirectPhi;
112-
if (dauPdg == -321) ++nKMinusFromDirectPhi;
113-
}
114-
}
115-
}
116-
else
117-
{
118-
// Minimum Bias Phi
119-
++nMBPhi;
120-
121-
if (track.getFirstDaughterTrackId() >= 0)
122-
{
123-
for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j)
124-
{
125-
auto dauPdg = tracks->at(j).GetPdgCode();
126-
if (dauPdg == 321) ++nKPlusFromMBPhi;
127-
if (dauPdg == -321) ++nKMinusFromMBPhi;
128-
}
126+
auto dauPdg = tracks->at(j).GetPdgCode();
127+
if (dauPdg == 321)
128+
++nKPlusFromMBPhi;
129+
if (dauPdg == -321)
130+
++nKMinusFromMBPhi;
129131
}
130132
}
131133
}

‎MC/config/PWGLF/pythia8/GeneratorLF_phiphi.C‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,29 @@ class GeneratorPhiResonance : public o2::eventgen::GeneratorPythia8
2525
{
2626
public:
2727
GeneratorPhiResonance(int resoPDG = 999999,
28+
int customPhiPDG = 888888,
2829
float ptMin = 0.0, float ptMax = 50.0, float ptMaxPhi = 100.0,
2930
float yMin = -1.0, float yMax = 1.0,
3031
std::string pythiaCfgMb = "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg",
3132
int signalInterval = 3)
32-
: GeneratorPythia8(), mResoPDG(resoPDG), mPtMin(ptMin), mPtMaxPhiPhi(ptMax), mPtMaxPhi(ptMaxPhi), mYMin(yMin), mYMax(yMax), mSignalInterval(signalInterval)
33+
: GeneratorPythia8(), mResoPDG(resoPDG), mCustomPhiPDG(customPhiPDG), mPtMin(ptMin), mPtMaxPhiPhi(ptMax), mPtMaxPhi(ptMaxPhi), mYMin(yMin), mYMax(yMax), mSignalInterval(signalInterval)
3334
{
35+
// 1. Define Custom Directly Injected Phi (PDG: 888888) with mass, width, and decay to kaons
36+
std::string createCustomPhi = std::to_string(mCustomPhiPDG) + ":new = custom_phi custom_phi 3 0 0 1.019461 0.004249 0.980 1.100 0.0";
37+
std::string customPhiMayDecay = std::to_string(mCustomPhiPDG) + ":mayDecay = on";
38+
std::string addPhiDecayKPlusKMinus = std::to_string(mCustomPhiPDG) + ":addChannel = 1 0.492 0 321 -321";
3439

35-
// 1. Define Custom Signal Resonance (PDG: 999999) decay into standard Phis (333 333)
40+
// 2. Define Custom Signal Resonance (PDG: 999999) decay into standard Phis (333 333)
3641
std::string createReso = std::to_string(mResoPDG) + ":new = f2_Custom void 5 0 0 2.714 0.012 2.05 3.50 0.0";
3742
std::string resoMayDecay = std::to_string(mResoPDG) + ":mayDecay = on";
3843
std::string addResoDecay = std::to_string(mResoPDG) + ":addChannel = 1 1.0 0 333 333";
3944

4045
// Helper lambda to load custom particle definitions across ALL Pythia engines
4146
auto applyCustomParticles = [&](Pythia8::Pythia &pythiaInst)
4247
{
48+
pythiaInst.readString(createCustomPhi);
49+
pythiaInst.readString(customPhiMayDecay);
50+
pythiaInst.readString(addPhiDecayKPlusKMinus);
4351
pythiaInst.readString(createReso);
4452
pythiaInst.readString(resoMayDecay);
4553
pythiaInst.readString(addResoDecay);
@@ -98,8 +106,8 @@ public:
98106
}
99107
else
100108
{
101-
// Directly injected uncorrelated Phi
102-
injectParticle(333, 2, false);
109+
// Directly injected uncorrelated Phi -> Uses Custom PDG 888888
110+
injectParticle(mCustomPhiPDG, 2, false);
103111
}
104112

105113
// 4. Force Decay of injected particles using Pythia's Decayer
@@ -168,7 +176,7 @@ private:
168176
}
169177
else
170178
{
171-
mass = mPythiaGun.particleData.mSel(pdg);
179+
mass = mPythiaGun.particleData.mSel(333); // Use standard phi mass for directly injected custom phi
172180
}
173181

174182
double pt;
@@ -206,6 +214,7 @@ private:
206214

207215
int mEventCounter = 0;
208216
int mResoPDG;
217+
int mCustomPhiPDG;
209218
int mSignalInterval;
210219
float mPtMin, mPtMaxPhiPhi, mPtMaxPhi, mYMin, mYMax;
211220

@@ -214,7 +223,7 @@ private:
214223
};
215224

216225
/// Entry point for o2-sim
217-
FairGenerator *generatePhiResonanceGun(int resoPDG = 999999, float ptMin = 0.0, float ptMax = 50.0, float ptMaxPhi = 100.0, float yMin = -1.0, float yMax = 1.0, std::string pythiaCfgMb = "", int signalInterval = 3)
226+
FairGenerator *generatePhiResonanceGun(int resoPDG = 999999, int customPhiPDG = 888888, float ptMin = 0.0, float ptMax = 50.0, float ptMaxPhi = 100.0, float yMin = -1.0, float yMax = 1.0, std::string pythiaCfgMb = "", int signalInterval = 3)
218227
{
219-
return new GeneratorPhiResonance(resoPDG, ptMin, ptMax, ptMaxPhi, yMin, yMax, pythiaCfgMb, signalInterval);
228+
return new GeneratorPhiResonance(resoPDG, customPhiPDG, ptMin, ptMax, ptMaxPhi, yMin, yMax, pythiaCfgMb, signalInterval);
220229
}

0 commit comments

Comments
 (0)