Skip to content

Commit 790e7c5

Browse files
committed
optimize the rapidity calculation
1 parent e5d93a4 commit 790e7c5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/FSSW.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,10 +1972,11 @@ int FSSW::sample_momemtum_from_a_fluid_cell(
19721972

19731973
// assigned to the return variables
19741974
// if E and p^z are too close, resample one
1975-
double y = 0.5*log((pLab[0] + pLab[3])/(pLab[0] - pLab[3]));
1975+
pT = sqrt(pLab[1]*pLab[1] + pLab[2]*pLab[2]);
1976+
phi = atan2(pLab[2], pLab[1]);
1977+
double mT = sqrt(mass*mass + pT*pT);
1978+
double y = asinh(pLab[3]/mT);
19761979
if (!std::isnan(y) && !std::isinf(y)) {
1977-
pT = sqrt(pLab[1]*pLab[1] + pLab[2]*pLab[2]);
1978-
phi = atan2(pLab[2], pLab[1]);
19791980
y_minus_eta_s = y - surf->eta;
19801981
return(1);
19811982
}

0 commit comments

Comments
 (0)