Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions math/genvector/inc/Math/GenVector/Cylindrical3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef ROOT_Math_GenVector_Cylindrical3D
#define ROOT_Math_GenVector_Cylindrical3D 1

#include "Math/Math.h"
#include "TMath.h"

#include "Math/GenVector/eta.h"

Expand Down Expand Up @@ -109,7 +109,7 @@ public :
{rho=fRho; zz=fZ; phi=fPhi;}

private:
inline static Scalar pi() { return Scalar(M_PI); }
inline static Scalar pi() { return Scalar(TMath::Pi()); }
inline void Restrict()
{
using std::floor;
Expand Down
4 changes: 2 additions & 2 deletions math/genvector/inc/Math/GenVector/CylindricalEta3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "Math/GenVector/etaMax.h"


#include "TMath.h"
#include <limits>
#include <cmath>

Expand Down Expand Up @@ -125,7 +125,7 @@ public :
{rho=fRho; eta=fEta; phi=fPhi;}

private:
inline static Scalar pi() { return M_PI; }
inline static Scalar pi() { return TMath::Pi(); }
inline void Restrict() {
using std::floor;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - floor(fPhi / (2 * pi()) + .5) * 2 * pi();
Expand Down
3 changes: 2 additions & 1 deletion math/genvector/inc/Math/GenVector/EulerAngles.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Math/GenVector/PositionVector3D.h"
#include "Math/GenVector/LorentzVector.h"
#include "Math/GenVector/3DConversions.h"
#include "TMath.h"
#include <algorithm>
#include <cassert>

Expand Down Expand Up @@ -345,7 +346,7 @@ class EulerAngles {
double fTheta; // X rotation angle (second) defined only [0,PI]
double fPsi; // Z rotation angle (third) defined in [-PI,PI]

static double Pi() { return M_PI; }
static double Pi() { return TMath::Pi(); }

}; // EulerAngles

Expand Down
3 changes: 2 additions & 1 deletion math/genvector/inc/Math/GenVector/Polar2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define ROOT_Math_GenVector_Polar2D 1

#include "Math/Math.h"
#include "TMath.h"

#include "Math/GenVector/etaMax.h"

Expand Down Expand Up @@ -131,7 +132,7 @@ public :


private:
inline static double pi() { return M_PI; }
inline static double pi() { return TMath::Pi(); }

/**
restrict abgle hi to be between -PI and PI
Expand Down
3 changes: 2 additions & 1 deletion math/genvector/inc/Math/GenVector/Polar3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "Math/GenVector/eta.h"

#include "TMath.h"
#include <cmath>

namespace ROOT {
Expand Down Expand Up @@ -158,7 +159,7 @@ public :


private:
inline static Scalar pi() { return M_PI; }
inline static Scalar pi() { return TMath::Pi(); }
inline void Restrict() {
using std::floor;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - floor(fPhi / (2 * pi()) + .5) * 2 * pi();
Expand Down
3 changes: 2 additions & 1 deletion math/genvector/inc/Math/GenVector/PtEtaPhiM4D.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define ROOT_Math_GenVector_PtEtaPhiM4D 1

#include "Math/Math.h"
#include "TMath.h"

#include "Math/GenVector/etaMax.h"

Expand Down Expand Up @@ -250,7 +251,7 @@ public :
Scalar Et() const { using std::cosh; return E() / cosh(fEta); }

private:
inline static Scalar pi() { return M_PI; }
inline static Scalar pi() { return TMath::Pi(); }
inline void RestrictPhi() {
using std::floor;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - floor(fPhi / (2 * pi()) + .5) * 2 * pi();
Expand Down
11 changes: 6 additions & 5 deletions math/genvector/inc/Math/GenVector/RotationX.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "Math/GenVector/RotationXfwd.h"

#include <TMath.h>
#include <cmath>

namespace ROOT {
Expand Down Expand Up @@ -72,9 +73,9 @@ class RotationX {
Rectify makes sure the angle is in (-pi,pi]
*/
void Rectify() {
if ( std::fabs(fAngle) >= M_PI ) {
double x = fAngle / (2.0 * M_PI);
fAngle = (2.0 * M_PI) * ( x + std::floor(.5-x) );
if (std::fabs(fAngle) >= TMath::Pi()) {
double x = fAngle / TMath::TwoPi();
fAngle = TMath::TwoPi() * (x + std::floor(.5 - x));
fSin = std::sin(fAngle);
fCos = std::cos(fAngle);
}
Expand Down Expand Up @@ -195,8 +196,8 @@ class RotationX {
*/
RotationX operator * (const RotationX & r) const {
RotationX ans;
double x = (fAngle + r.fAngle) / (2.0 * M_PI);
ans.fAngle = (2.0 * M_PI) * ( x + std::floor(.5-x) );
double x = (fAngle + r.fAngle) / TMath::TwoPi();
ans.fAngle = TMath::TwoPi() * (x + std::floor(.5 - x));
ans.fSin = fSin*r.fCos + fCos*r.fSin;
ans.fCos = fCos*r.fCos - fSin*r.fSin;
return ans;
Expand Down
11 changes: 6 additions & 5 deletions math/genvector/inc/Math/GenVector/RotationY.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "Math/GenVector/RotationYfwd.h"

#include <cmath>
#include <TMath.h>

namespace ROOT {
namespace Math {
Expand Down Expand Up @@ -72,9 +73,9 @@ class RotationY {
Rectify makes sure the angle is in (-pi,pi]
*/
void Rectify() {
if ( std::fabs(fAngle) >= M_PI ) {
double x = fAngle / (2.0 * M_PI);
fAngle = (2.0 * M_PI) * ( x + std::floor(.5-x) );
if (std::fabs(fAngle) >= TMath::Pi()) {
double x = fAngle / TMath::TwoPi();
fAngle = TMath::TwoPi() * (x + std::floor(.5 - x));
fSin = std::sin(fAngle);
fCos = std::cos(fAngle);
}
Expand Down Expand Up @@ -195,8 +196,8 @@ class RotationY {
*/
RotationY operator * (const RotationY & r) const {
RotationY ans;
double x = (fAngle + r.fAngle) / (2.0 * M_PI);
ans.fAngle = (2.0 * M_PI) * ( x + std::floor(.5-x) );
double x = (fAngle + r.fAngle) / TMath::TwoPi();
ans.fAngle = TMath::TwoPi() * (x + std::floor(.5 - x));
ans.fSin = fSin*r.fCos + fCos*r.fSin;
ans.fCos = fCos*r.fCos - fSin*r.fSin;
return ans;
Expand Down
11 changes: 6 additions & 5 deletions math/genvector/inc/Math/GenVector/RotationZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "Math/GenVector/RotationZfwd.h"

#include "TMath.h"
#include <cmath>

namespace ROOT {
Expand Down Expand Up @@ -72,9 +73,9 @@ class RotationZ {
Rectify makes sure the angle is in (-pi,pi]
*/
void Rectify() {
if ( std::fabs(fAngle) >= M_PI ) {
double x = fAngle / (2.0 * M_PI);
fAngle = (2.0 * M_PI) * ( x + std::floor(.5-x) );
if (std::fabs(fAngle) >= TMath::Pi()) {
double x = fAngle / TMath::TwoPi();
fAngle = TMath::TwoPi() * (x + std::floor(.5 - x));
fSin = std::sin(fAngle);
fCos = std::cos(fAngle);
}
Expand Down Expand Up @@ -195,8 +196,8 @@ class RotationZ {
*/
RotationZ operator * (const RotationZ & r) const {
RotationZ ans;
double x = (fAngle + r.fAngle) / (2.0 * M_PI);
ans.fAngle = (2.0 * M_PI) * ( x + std::floor(.5-x) );
double x = (fAngle + r.fAngle) / TMath::TwoPi();
ans.fAngle = TMath::TwoPi() * (x + std::floor(.5 - x));
ans.fSin = fSin*r.fCos + fCos*r.fSin;
ans.fCos = fCos*r.fCos - fSin*r.fSin;
return ans;
Expand Down
3 changes: 2 additions & 1 deletion math/genvector/inc/Math/GenVector/RotationZYX.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "Math/GenVector/3DConversions.h"

#include "TMath.h"

#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -318,7 +319,7 @@ class RotationZYX {
double fTheta; // Y' rotation angle (pitch) defined in [-PI/2,PI/2]
double fPsi; // X'' rotation angle (roll) defined in (-PI,PI]

static double Pi() { return M_PI; }
static double Pi() { return TMath::Pi(); }

}; // RotationZYX

Expand Down
19 changes: 9 additions & 10 deletions math/genvector/inc/Math/GenVector/VectorUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#ifndef ROOT_Math_GenVector_VectorUtil
#define ROOT_Math_GenVector_VectorUtil 1

#include "Math/Math.h"

#include "TMath.h"

#include "Math/GenVector/Boost.h"

Expand Down Expand Up @@ -60,10 +59,10 @@ namespace ROOT {
template <class Vector1, class Vector2>
inline typename Vector1::Scalar DeltaPhi( const Vector1 & v1, const Vector2 & v2) {
typename Vector1::Scalar dphi = v2.Phi() - v1.Phi();
if ( dphi > M_PI ) {
dphi -= 2.0*M_PI;
} else if ( dphi <= -M_PI ) {
dphi += 2.0*M_PI;
if (dphi > TMath::Pi()) {
dphi -= 2.0 * TMath::Pi();
} else if (dphi <= -TMath::Pi()) {
dphi += 2.0 * TMath::Pi();
}
return dphi;
}
Expand Down Expand Up @@ -283,7 +282,7 @@ namespace ROOT {
*/
template <class Vector>
Vector RotateX(const Vector & v, double alpha) {
if (std::fmod(alpha, 2 * M_PI) == 0.)
if (std::fmod(alpha, 2 * TMath::Pi()) == 0.)
return v;
using std::sin;
double sina = sin(alpha);
Expand All @@ -304,7 +303,7 @@ namespace ROOT {
*/
template <class Vector>
Vector RotateY(const Vector & v, double alpha) {
if (std::fmod(alpha, 2 * M_PI) == 0.)
if (std::fmod(alpha, 2 * TMath::Pi()) == 0.)
return v;
using std::sin;
double sina = sin(alpha);
Expand All @@ -325,7 +324,7 @@ namespace ROOT {
*/
template <class Vector>
Vector RotateZ(const Vector & v, double alpha) {
if (std::fmod(alpha, 2 * M_PI) == 0.)
if (std::fmod(alpha, 2 * TMath::Pi()) == 0.)
return v;
using std::sin;
double sina = sin(alpha);
Expand All @@ -347,7 +346,7 @@ namespace ROOT {
template <class Vector>
Vector Rotate(const Vector &v, double alpha, const Vector &axis)
{
if (std::fmod(alpha, 2 * M_PI) == 0.)
if (std::fmod(alpha, 2 * TMath::Pi()) == 0.)
return v;
const double ll = std::sqrt(axis.X() * axis.X() + axis.Y() * axis.Y() + axis.Z() * axis.Z());
if (ll == 0.)
Expand Down
12 changes: 6 additions & 6 deletions math/genvector/src/3DConversions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "Math/GenVector/3DConversions.h"

#include "Math/Math.h"
#include "TMath.h"

#include "Math/GenVector/Rotation3D.h"
#include "Math/GenVector/AxisAngle.h"
Expand Down Expand Up @@ -73,7 +73,7 @@ void convert( Rotation3D const & from, AxisAngle & to)

u.SetCoordinates( uX, uY, uZ );

static const double pi = M_PI;
static const double pi = TMath::Pi();

double angle;
const double cosdelta = (m[kXX] + m[kYY] + m[kZZ] - 1.0) / 2.0;
Expand All @@ -93,7 +93,7 @@ void convert( Rotation3D const & from, AxisAngle & to)
} // convert to AxisAngle

static void correctByPi ( double& psi, double& phi ) {
static const double pi = M_PI;
static const double pi = TMath::Pi();
if (psi > 0) {
psi -= pi;
} else {
Expand All @@ -117,8 +117,8 @@ void convert( Rotation3D const & from, EulerAngles & to)

double phi, theta, psi;
double psiPlusPhi, psiMinusPhi;
static const double pi = M_PI;
static const double pi_2 = M_PI_2;
static const double pi = TMath::Pi();
static const double pi_2 = TMath::PiOver2();

theta = (std::fabs(r[kZZ]) <= 1.0) ? std::acos(r[kZZ]) :
(r[kZZ] > 0.0) ? 0 : pi;
Expand Down Expand Up @@ -260,7 +260,7 @@ void convert( Rotation3D const & from, RotationZYX & to)
// theta is assumed to be in range [-PI/2,PI/2].
// this is guaranteed by the Rectify function

static const double pi_2 = M_PI_2;
static const double pi_2 = TMath::PiOver2();

double r[9];
from.GetComponents(r,r+9);
Expand Down
6 changes: 3 additions & 3 deletions math/genvector/src/RotationZYX.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "Math/GenVector/RotationX.h"
#include "Math/GenVector/RotationY.h"
#include "Math/GenVector/RotationZ.h"

#include "Math/GenVector/AxisAnglefwd.h"
#include "TMath.h"

namespace ROOT {

Expand Down Expand Up @@ -111,7 +111,7 @@ void RotationZYX::Rectify()
// same as Euler- Angles, just here Theta is shifted by PI/2 with respect to
// the theta of the EulerAngles class

Scalar theta2 = fTheta + M_PI_2;
Scalar theta2 = fTheta + TMath::PiOver2();
if ( theta2 < 0 || theta2 > Pi() ) {
Scalar t = theta2 - std::floor( theta2/(2*Pi() ) ) * 2*Pi();
if ( t <= Pi() ) {
Expand All @@ -122,7 +122,7 @@ void RotationZYX::Rectify()
fPsi = fPsi + Pi();
}
// ftheta is shifted of PI/2 w.r.t theta2
fTheta = theta2 - M_PI_2;
fTheta = theta2 - TMath::PiOver2();
}

if ( fPhi <= -Pi()|| fPhi > Pi() ) {
Expand Down
Loading
Loading