Skip to content

Commit e0a94a9

Browse files
committed
bugfix in deltaPhi normalisation
1 parent cdeb351 commit e0a94a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

PWGUD/Tasks/upcRhoAnalysis.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,10 @@ struct UpcRhoAnalysis {
674674
double deltaPhi(const ROOT::Math::PxPyPzMVector& p1, const ROOT::Math::PxPyPzMVector& p2)
675675
{
676676
double dPhi = p1.Phi() - p2.Phi();
677-
dPhi = std::fmod(dPhi + o2::constants::math::PI, o2::constants::math::TwoPI) - o2::constants::math::PI; // normalize to (-pi, pi)
677+
while (dPhi > o2::constants::math::PI)
678+
dPhi -= o2::constants::math::TwoPI;
679+
while (dPhi < -o2::constants::math::PI)
680+
dPhi += o2::constants::math::TwoPI;
678681
return dPhi;
679682
}
680683

0 commit comments

Comments
 (0)