Skip to content

Commit f5ab101

Browse files
authored
Allow multiple nuclei per event (#1896)
1 parent a63f6db commit f5ab101

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

MC/config/PWGLF/pythia8/generator_pythia8_coalescence.C

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ protected:
104104
const double coalescenceRadius{0.5 * 1.122462 * mCoalMomentum}; /// 1.122462 [2^(1/6)] from PRL 126, 101101 (2021), only for 3 body coalescence
105105

106106
auto coalescence = [&](int iC, int pdgCode, float mass, int iD1, int iD2, int iD3) {
107+
if (event[iD1].status() < 0 || event[iD2].status() < 0 || event[iD3].status() < 0)
108+
{
109+
return false;
110+
}
107111
auto p1 = event[iD1].p();
108112
auto p2 = event[iD2].p();
109113
auto p3 = event[iD3].p();
@@ -131,32 +135,27 @@ protected:
131135
return false;
132136
};
133137

138+
bool coalHappened = false;
134139
for (int iC{0}; iC < 2; ++iC)
135140
{
136141
for (int iP{0}; iP < protons[iC].size(); ++iP) {
137142
for (int iN{0}; iN < neutrons[iC].size(); ++iN) {
138143
/// H3L loop
139144
for (int iL{0}; iL < lambdas[iC].size(); ++iL) {
140-
if (coalescence(iC, 1010010030, 2.991134, protons[iC][iP], neutrons[iC][iN], lambdas[iC][iL])) {
141-
return true;
142-
}
145+
coalHappened |= coalescence(iC, 1010010030, 2.991134, protons[iC][iP], neutrons[iC][iN], lambdas[iC][iL]);
143146
}
144147
/// H3 loop
145148
for (int iN2{iN + 1}; iN2 < neutrons[iC].size(); ++iN2) {
146-
if (coalescence(iC, 1000010030, 2.80892113298, protons[iC][iP], neutrons[iC][iN], neutrons[iC][iN2])) {
147-
return true;
148-
}
149+
coalHappened |= coalescence(iC, 1000010030, 2.80892113298, protons[iC][iP], neutrons[iC][iN], neutrons[iC][iN2]);
149150
}
150151
/// He3 loop
151152
for (int iP2{iP + 1}; iP2 < protons[iC].size(); ++iP2) {
152-
if (coalescence(iC, 1000020030, 2.808391, protons[iC][iP], protons[iC][iP2], neutrons[iC][iN])) {
153-
return true;
154-
}
153+
coalHappened |= coalescence(iC, 1000020030, 2.808391, protons[iC][iP], protons[iC][iP2], neutrons[iC][iN]);
155154
}
156155
}
157156
}
158157
}
159-
return false;
158+
return coalHappened;
160159
}
161160

162161
private:

0 commit comments

Comments
 (0)