Skip to content

Commit 46c370b

Browse files
authored
Update replaceParticle to include status code check
Refactor replaceParticle function to check status code before replacing particles.
1 parent 9b37b4b commit 46c370b

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

MC/config/PWGHF/external/generator/generator_pythia8_gaptriggered_hf.C

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,14 @@ protected:
258258

259259
bool replaceParticle(int iPartToReplace, int pdgCodeNew) {
260260

261-
auto mothers = mPythia.event[iPartToReplace].motherList();
262-
263-
std::array<int, 25> pdgDiquarks = {1103, 2101, 2103, 2203, 3101, 3103, 3201, 3203, 3303, 4101, 4103, 4201, 4203, 4301, 4303, 4403, 5101, 5103, 5201, 5203, 5301, 5303, 5401, 5403, 5503};
264-
265-
for (auto const& mother: mothers) {
266-
auto pdgMother = std::abs(mPythia.event[mother].id());
267-
if (pdgMother > 100 && std::find(pdgDiquarks.begin(), pdgDiquarks.end(), pdgMother) == pdgDiquarks.end()) {
268-
return false;
269-
}
261+
// Check status code: particles with status 91-99 come from decays and should not be replaced
262+
int statusMother = std::abs(mPythia.event[iPartToReplace].status());
263+
if (statusMother >= 91 && statusMother <= 99) {
264+
return false;
270265
}
271266

267+
auto mothers = mPythia.event[iPartToReplace].motherList();
268+
272269
int charge = mPythia.event[iPartToReplace].id() / std::abs(mPythia.event[iPartToReplace].id());
273270
float px = mPythia.event[iPartToReplace].px();
274271
float py = mPythia.event[iPartToReplace].py();

0 commit comments

Comments
 (0)