Skip to content

Commit fc3d582

Browse files
committed
PWGEM/Dilepton: add phi protection in EMTrack.h
1 parent 68d5234 commit fc3d582

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

PWGEM/Dilepton/Utils/EMTrack.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ class EMPair : public EMTrack
186186
float pt = std::sqrt(px * px + py * py);
187187
float eta = std::atanh(pz / sqrt(std::pow(px, 2) + std::pow(py, 2) + std::pow(pz, 2)));
188188
float phi = std::atan2(py, px);
189+
if (phi < 0.f) {
190+
phi += 2.f * M_PI;
191+
}
189192

190193
fVPos.SetPt(pt);
191194
fVPos.SetEta(eta);
@@ -197,6 +200,9 @@ class EMPair : public EMTrack
197200
float pt = std::sqrt(px * px + py * py);
198201
float eta = std::atanh(pz / std::sqrt(pow(px, 2) + std::pow(py, 2) + std::pow(pz, 2)));
199202
float phi = std::atan2(py, px);
203+
if (phi < 0.f) {
204+
phi += 2.f * M_PI;
205+
}
200206

201207
fVNeg.SetPt(pt);
202208
fVNeg.SetEta(eta);

0 commit comments

Comments
 (0)