Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
76a8f9d
Template the GenVector Plane3D, Transform3D and Translation3D classes…
cjones051073 Feb 25, 2017
7e9c2b7
Use the 'using namespace std' trick with Cartesian3D and Plane3D to f…
cjones051073 Feb 25, 2017
b15d62a
Extend the 'using namespace std' trick to a few more classes
cjones051073 Feb 25, 2017
2b2fc17
Change class to typename
cjones051073 Feb 25, 2017
2e74f0d
Explicitly cast some constants to the scalar type (needed for Vc types)
cjones051073 Feb 25, 2017
c3175c6
Remove empty implementation files
cjones051073 Feb 25, 2017
9bdfb8e
Template the Boost classes
cjones051073 Feb 25, 2017
c97245c
Remove empty implementation files for Boost classes
cjones051073 Feb 25, 2017
f12d368
Clean up some indentations
cjones051073 Feb 25, 2017
bbbbbd0
Add some missing template types to the Boost classes
cjones051073 Feb 25, 2017
9a0ee77
Remove empty Boost implementation file
cjones051073 Feb 25, 2017
371d50d
Small cleanups
cjones051073 Feb 25, 2017
dcb0b30
Clean up some initialisations
cjones051073 Feb 25, 2017
29e7e30
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Feb 27, 2017
14e73b4
Add Scalar/Vector Plane3D::Normalise() methods using SFINAE
cjones051073 Feb 27, 2017
27bbb57
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Feb 27, 2017
196a00b
Roll back some changes for now, as they are causing problems in the t…
cjones051073 Feb 27, 2017
0ad5828
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Feb 27, 2017
1928c75
Add specific vectorised implementations of a few methods
cjones051073 Feb 28, 2017
5ccdaea
Extend ostream operator for Displacement and Position vectors to supp…
cjones051073 Feb 28, 2017
ef1aea9
Fix the vector abs method (not fabs) and Vector Unit() for vectorised…
cjones051073 Feb 28, 2017
6cac16a
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Feb 28, 2017
68ba28a
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Mar 1, 2017
939b7cb
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Mar 4, 2017
d9b810b
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Mar 6, 2017
776ce1a
Add override qualifier
cjones051073 Mar 6, 2017
fbe74d2
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Mar 10, 2017
12b43b0
Fix initialisation bug
cjones051073 Mar 10, 2017
8367bdf
remove space
cjones051073 Mar 10, 2017
0f404ba
Some small changes following review comments
cjones051073 Mar 10, 2017
65a701d
remove spaces
cjones051073 Mar 10, 2017
4ba8a1b
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Mar 10, 2017
ff94a5a
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Mar 11, 2017
b8ca822
Fix formatting using clang-format
cjones051073 Mar 11, 2017
b32cb6a
some more 'using namespace std' updates
cjones051073 Mar 11, 2017
febe783
Fix more clang format issues
cjones051073 Mar 11, 2017
a628a2a
fix (hopefully) one more clang format issue
cjones051073 Mar 11, 2017
89b2d26
clang format is picky...
cjones051073 Mar 11, 2017
6bf0368
Merge branch 'master' of github.com:root-mirror/root into GenVector-A…
cjones051073 Mar 11, 2017
bd96bd0
revert changes in VectorUtils.h
cjones051073 Mar 13, 2017
dea8d05
Add new test for GenVector with Vc types
cjones051073 Mar 13, 2017
a18221a
extend test to 96 photons
cjones051073 Mar 13, 2017
eb0b8ed
reorder headers
cjones051073 Mar 13, 2017
7da1945
remove comment that number of test photons must be multiple of 8, as …
cjones051073 Mar 13, 2017
a271eab
Add <cmath> header includes
cjones051073 Mar 13, 2017
decbe11
revert back to using std:: as it seems to cause issues with gcc build…
cjones051073 Mar 14, 2017
58c6315
Include Vc before ROOT in test application. Needed for std:: support...
cjones051073 Mar 14, 2017
17f42a3
Add some more missing std::
cjones051073 Mar 14, 2017
434396d
More math updates
cjones051073 Mar 14, 2017
b145899
Change enable_if implementation in GenVector
cjones051073 Mar 14, 2017
ad8d3a5
update comment
cjones051073 Mar 14, 2017
b018a03
Extend the GenVector Vc test with a timing test that asserts that the…
cjones051073 Mar 14, 2017
bb1e386
add fabs on timing diff and extend Vc genvector expected diff to 25%
cjones051073 Mar 14, 2017
1786383
do not return a failure from the Vc speed test, as test could be run …
cjones051073 Mar 14, 2017
380dd35
Update enable_if pattern in GenVector Vc test
cjones051073 Mar 15, 2017
ccd81f3
resolve conflicts
cjones051073 Mar 15, 2017
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
Prev Previous commit
Next Next commit
revert back to using std:: as it seems to cause issues with gcc build…
…s. Works with Vc as long as Vc's headers are included first...
  • Loading branch information
cjones051073 committed Mar 14, 2017
commit decbe11b36df7bf862a67a50738b2e9667ea229d
29 changes: 9 additions & 20 deletions math/genvector/inc/Math/GenVector/Cartesian2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,8 @@ public :
Scalar X() const { return fX;}
Scalar Y() const { return fY;}
Scalar Mag2() const { return fX*fX + fY*fY; }
Scalar R() const
{
using namespace std;
return sqrt(Mag2());
}
Scalar Phi() const
{
using namespace std;
return (fX == Scalar(0) && fY == Scalar(0)) ? Scalar(0) : atan2(fY, fX);
}
Scalar R() const { return std::sqrt(Mag2()); }
Scalar Phi() const { return (fX == Scalar(0) && fY == Scalar(0)) ? Scalar(0) : std::atan2(fY, fX); }

/**
set the x coordinate value keeping y constant
Expand Down Expand Up @@ -132,10 +124,9 @@ public :
rotate by an angle
*/
void Rotate(Scalar angle) {
using namespace std;
const Scalar s = sin(angle);
const Scalar c = cos(angle);
SetCoordinates( c*fX - s*fY, s*fX + c * fY );
const Scalar s = std::sin(angle);
const Scalar c = std::cos(angle);
SetCoordinates(c * fX - s * fY, s * fX + c * fY);
}

/**
Expand Down Expand Up @@ -170,11 +161,10 @@ public :
template <class T2>
explicit Cartesian2D( const Polar2D<T2> & v )
{
using namespace std;
const Scalar r = v.R(); // re-using this instead of calling v.X() and v.Y()
// is the speed improvement
fX = r * cos(v.Phi());
fY = r * sin(v.Phi());
fX = r * std::cos(v.Phi());
fY = r * std::sin(v.Phi());
}
// Technical note: This works even though only Polar2Dfwd.h is
// included (and in fact, including Polar2D.h would cause circularity
Expand All @@ -184,10 +174,9 @@ public :
template <class T2>
Cartesian2D & operator = (const Polar2D<T2> & v)
{
using namespace std;
const Scalar r = v.R();
fX = r * cos(v.Phi());
fY = r * sin(v.Phi());
fX = r * std::cos(v.Phi());
fY = r * std::sin(v.Phi());
return *this;
}

Expand Down
31 changes: 8 additions & 23 deletions math/genvector/inc/Math/GenVector/Cartesian3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,13 @@ public :
Scalar Z() const { return fZ;}
Scalar Mag2() const { return fX*fX + fY*fY + fZ*fZ;}
Scalar Perp2() const { return fX*fX + fY*fY ;}
Scalar Rho() const
{
using namespace std;
return sqrt(Perp2());
}
Scalar R() const
{
using namespace std;
return sqrt(Mag2());
}
Scalar Rho() const { return std::sqrt(Perp2()); }
Scalar R() const { return std::sqrt(Mag2()); }
Scalar Theta() const
{
using namespace std;
return (fX == Scalar(0) && fY == Scalar(0) && fZ == Scalar(0)) ? Scalar(0) : atan2(Rho(), Z());
}
Scalar Phi() const
{
using namespace std;
return (fX == Scalar(0) && fY == Scalar(0)) ? Scalar(0) : atan2(fY, fX);
return (fX == Scalar(0) && fY == Scalar(0) && fZ == Scalar(0)) ? Scalar(0) : std::atan2(Rho(), Z());
}
Scalar Phi() const { return (fX == Scalar(0) && fY == Scalar(0)) ? Scalar(0) : std::atan2(fY, fX); }

// pseudorapidity
Scalar Eta() const {
Expand Down Expand Up @@ -208,12 +195,11 @@ public :
template <class T2>
explicit Cartesian3D( const Polar3D<T2> & v ) : fZ (v.Z())
{
using namespace std;
const T rho = v.Rho();
// re-using this instead of calling v.X() and v.Y()
// is the speed improvement
fX = rho * cos(v.Phi());
fY = rho * sin(v.Phi());
fX = rho * std::cos(v.Phi());
fY = rho * std::sin(v.Phi());
}
// Technical note: This works even though only Polar3Dfwd.h is
// included (and in fact, including Polar3D.h would cause circularity
Expand All @@ -223,10 +209,9 @@ public :
template <class T2>
Cartesian3D & operator = (const Polar3D<T2> & v)
{
using namespace std;
const T rho = v.Rho();
fX = rho * cos(v.Phi());
fY = rho * sin(v.Phi());
fX = rho * std::cos(v.Phi());
fY = rho * std::sin(v.Phi());
fZ = v.Z();
return *this;
}
Expand Down
28 changes: 5 additions & 23 deletions math/genvector/inc/Math/GenVector/Cylindrical3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ public :
inline static Scalar pi() { return Scalar(M_PI); }
inline void Restrict()
{
using namespace std;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - floor(fPhi / (2 * pi()) + .5) * 2 * pi();
return;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - std::floor(fPhi / (2 * pi()) + .5) * 2 * pi();
}
public:

Expand All @@ -121,29 +119,13 @@ public :
Scalar Z() const { return fZ; }
Scalar Phi() const { return fPhi; }

Scalar X() const
{
using namespace std;
return fRho * cos(fPhi);
}
Scalar Y() const
{
using namespace std;
return fRho * sin(fPhi);
}
Scalar X() const { return fRho * std::cos(fPhi); }
Scalar Y() const { return fRho * std::sin(fPhi); }

Scalar Mag2() const { return fRho*fRho + fZ*fZ; }
Scalar R() const
{
using namespace std;
return sqrt(Mag2());
}
Scalar R() const { return std::sqrt(Mag2()); }
Scalar Perp2() const { return fRho*fRho; }
Scalar Theta() const
{
using namespace std;
return (fRho == Scalar(0) && fZ == Scalar(0)) ? Scalar(0) : atan2(fRho, fZ);
}
Scalar Theta() const { return (fRho == Scalar(0) && fZ == Scalar(0)) ? Scalar(0) : std::atan2(fRho, fZ); }

// pseudorapidity - use same implementation as in Cartesian3D
Scalar Eta() const {
Expand Down
32 changes: 10 additions & 22 deletions math/genvector/inc/Math/GenVector/CylindricalEta3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public :
explicit CylindricalEta3D( const CoordSystem & v ) :
fRho(v.Rho() ), fEta(v.Eta() ), fPhi(v.Phi() )
{
using namespace std;
static Scalar bigEta = Scalar(-0.3) * log(std::numeric_limits<Scalar>::epsilon());
if (fabs(fEta) > bigEta) {
// This gives a small absolute adjustment in rho,
Expand Down Expand Up @@ -126,8 +125,7 @@ public :
private:
inline static Scalar pi() { return M_PI; }
inline void Restrict() {
using namespace std;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - floor(fPhi / (2 * pi()) + .5) * 2 * pi();
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - std::floor(fPhi / (2 * pi()) + .5) * 2 * pi();
return;
}
public:
Expand All @@ -137,34 +135,24 @@ public :
T Rho() const { return fRho; }
T Eta() const { return fEta; }
T Phi() const { return fPhi; }
T X() const
{
using namespace std;
return fRho * cos(fPhi);
}
T Y() const
{
using namespace std;
return fRho * sin(fPhi);
}
T X() const { return fRho * std::cos(fPhi); }
T Y() const { return fRho * std::sin(fPhi); }
T Z() const
{
using namespace std;
return fRho > 0 ? fRho * sinh(fEta) : fEta == 0 ? 0 : fEta > 0 ? fEta - etaMax<T>() : fEta + etaMax<T>();
return fRho > 0 ? fRho * std::sinh(fEta) : fEta == 0 ? 0 : fEta > 0 ? fEta - etaMax<T>() : fEta + etaMax<T>();
}
T R() const
{
using namespace std;
return fRho > 0 ? fRho * cosh(fEta)
return fRho > 0 ? fRho * std::cosh(fEta)
: fEta > etaMax<T>() ? fEta - etaMax<T>() : fEta < -etaMax<T>() ? -fEta - etaMax<T>() : 0;
}
T Mag2() const { return R()*R(); }
T Perp2() const { return fRho*fRho; }
T Theta() const
T Mag2() const
{
using namespace std;
return fRho > 0 ? 2 * atan(exp(-fEta)) : (fEta >= 0 ? 0 : pi());
const Scalar r = R();
return r * r;
}
T Perp2() const { return fRho*fRho; }
T Theta() const { return fRho > 0 ? 2 * std::atan(exp(-fEta)) : (fEta >= 0 ? 0 : pi()); }

// setters (only for data members)

Expand Down
21 changes: 9 additions & 12 deletions math/genvector/inc/Math/GenVector/LorentzVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,9 @@ namespace ROOT {
// TODO - It would be good to check that E > Pz and use the Throw()
// mechanism or at least load a NAN if not.
// We should then move the code to a .cpp file.
using namespace std;
Scalar ee = E();
Scalar ppz = Pz();
return Scalar(0.5) * log((ee + ppz) / (ee - ppz));
const Scalar ee = E();
const Scalar ppz = Pz();
return Scalar(0.5) * std::log((ee + ppz) / (ee - ppz));
}

/**
Expand All @@ -500,10 +499,9 @@ namespace ROOT {
Scalar ColinearRapidity() const {
// TODO - It would be good to check that E > P and use the Throw()
// mechanism or at least load a NAN if not.
using namespace std;
Scalar ee = E();
Scalar pp = P();
return Scalar(0.5) * log((ee + pp) / (ee - pp));
const Scalar ee = E();
const Scalar pp = P();
return Scalar(0.5) * std::log((ee + pp) / (ee - pp));
}

/**
Expand Down Expand Up @@ -599,9 +597,8 @@ namespace ROOT {
Return Gamma scalar value
*/
Scalar Gamma() const {
using namespace std;
Scalar v2 = P2();
Scalar t2 = E()*E();
const Scalar v2 = P2();
const Scalar t2 = std::pow(E(), 2);
if (E() == 0) {
if ( P2() == 0) {
return 1;
Expand All @@ -617,7 +614,7 @@ namespace ROOT {
else if ( t2 == v2 ) {
GenVector::Throw ("LorentzVector::Gamma() - gamma computed for a lightlike LorentzVector. Infinite result");
}
return Scalar(1) / sqrt(Scalar(1) - v2 / t2);
return Scalar(1) / std::sqrt(Scalar(1) - v2 / t2);
} /* gamma */


Expand Down
16 changes: 3 additions & 13 deletions math/genvector/inc/Math/GenVector/Polar2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,8 @@ public :

Scalar R() const { return fR;}
Scalar Phi() const { return fPhi; }
Scalar X() const
{
using namespace std;
return fR * cos(fPhi);
}
Scalar Y() const
{
using namespace std;
return fR * sin(fPhi);
}
Scalar X() const { return fR * std::cos(fPhi); }
Scalar Y() const { return fR * std::sin(fPhi); }
Scalar Mag2() const { return fR*fR;}


Expand Down Expand Up @@ -142,9 +134,7 @@ public :
restrict abgle hi to be between -PI and PI
*/
inline void Restrict() {
using namespace std;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - floor(fPhi / (2 * pi()) + .5) * 2 * pi();
return;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - std::floor(fPhi / (2 * pi()) + .5) * 2 * pi();
}

public:
Expand Down
38 changes: 8 additions & 30 deletions math/genvector/inc/Math/GenVector/Polar3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,32 +110,12 @@ public :
Scalar R() const { return fR;}
Scalar Phi() const { return fPhi; }
Scalar Theta() const { return fTheta; }
Scalar Rho() const
{
using namespace std;
return fR * sin(fTheta);
}
Scalar X() const
{
using namespace std;
return Rho() * cos(fPhi);
}
Scalar Y() const
{
using namespace std;
return Rho() * sin(fPhi);
}
Scalar Z() const
{
using namespace std;
return fR * cos(fTheta);
}
Scalar Rho() const { return fR * std::sin(fTheta); }
Scalar X() const { return Rho() * std::cos(fPhi); }
Scalar Y() const { return Rho() * std::sin(fPhi); }
Scalar Z() const { return fR * std::cos(fTheta); }
Scalar Mag2() const { return fR*fR;}
Scalar Perp2() const
{
const Scalar r = Rho();
return r * r;
}
Scalar Perp2() const { return std::pow(Rho(), 2); }

// pseudorapidity
Scalar Eta() const
Expand Down Expand Up @@ -177,9 +157,7 @@ public :
private:
inline static Scalar pi() { return M_PI; }
inline void Restrict() {
using namespace std;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - floor(fPhi / (2 * pi()) + .5) * 2 * pi();
return;
if (fPhi <= -pi() || fPhi > pi()) fPhi = fPhi - std::floor(fPhi / (2 * pi()) + .5) * 2 * pi();
}

public:
Expand Down Expand Up @@ -229,8 +207,8 @@ public :

// The following make this coordinate system look enough like a CLHEP
// vector that an assignment member template can work with either
T x() const { return X();}
T y() const { return Y();}
T x() const { return X(); }
T y() const { return Y(); }
T z() const { return Z(); }

// ============= Specializations for improved speed ==================
Expand Down
Loading