Skip to content

Commit e53e9a4

Browse files
committed
[math] Remove the GenVector namespace.
With free functions being added to for the GenVector package in #19618, it will be a problem to find these functions in the ROOT documentation. This is because of a name clash between the GenVector namespace vs the GenVector group. Doxygen links to the former, whereas the latter has all the documentation. Since the namespace was only wrapping the Throw function, GenVector::Throw can be replaced by GenVector_Throw, and the namespace can be removed. This should make the doxygen documentation more useful.
1 parent 8d7009b commit e53e9a4

File tree

13 files changed

+50
-65
lines changed

13 files changed

+50
-65
lines changed

math/genvector/inc/Math/GenVector/GenVector_exception.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ namespace Math {
2121

2222
class GenVector_exception;
2323
inline void Throw(GenVector_exception &e);
24-
namespace GenVector {
25-
inline void Throw(const char *);
26-
}
24+
inline void GenVector_Throw(const char *);
2725

2826
// ----------------------------------------------------------------------
2927
// GenVector_exception class definition
@@ -55,7 +53,7 @@ class GenVector_exception : public std::runtime_error {
5553

5654
private:
5755
friend void Throw(GenVector_exception &);
58-
friend void GenVector::Throw(const char *);
56+
friend void GenVector_Throw(const char *);
5957

6058
static bool &IsOn()
6159
{
@@ -75,16 +73,14 @@ inline void Throw(GenVector_exception &e)
7573
throw e;
7674
}
7775

78-
namespace GenVector {
7976
/// function throwing exception, by creating internally a GenVector_exception only when needed
80-
inline void Throw(const char *s)
77+
inline void GenVector_Throw(const char *s)
8178
{
8279
if (!GenVector_exception::IsOn())
8380
return;
8481
GenVector_exception e(s);
8582
throw e;
8683
}
87-
} // namespace GenVector
8884

8985
} // namespace Math
9086
} // namespace ROOT

math/genvector/inc/Math/GenVector/LorentzVector.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,14 @@ Pt (or rho) refers to transverse momentum, whereas eta refers to pseudorapidity.
627627
// to avoid Nan
628628
return 0;
629629
else {
630-
GenVector::Throw ("LorentzVector::Beta() - beta computed for LorentzVector with t = 0. Return an Infinite result");
630+
GenVector_Throw(
631+
"LorentzVector::Beta() - beta computed for LorentzVector with t = 0. Return an Infinite result");
631632
return 1./E();
632633
}
633634
}
634635
if ( M2() <= 0 ) {
635-
GenVector::Throw ("LorentzVector::Beta() - beta computed for non-timelike LorentzVector . Result is physically meaningless" );
636+
GenVector_Throw("LorentzVector::Beta() - beta computed for non-timelike LorentzVector . Result is "
637+
"physically meaningless");
636638
}
637639
return P() / E();
638640
}
@@ -646,16 +648,16 @@ Pt (or rho) refers to transverse momentum, whereas eta refers to pseudorapidity.
646648
if ( P2() == 0) {
647649
return 1;
648650
} else {
649-
GenVector::Throw ("LorentzVector::Gamma() - gamma computed for LorentzVector with t = 0. Return a zero result");
650-
651+
GenVector_Throw(
652+
"LorentzVector::Gamma() - gamma computed for LorentzVector with t = 0. Return a zero result");
651653
}
652654
}
653655
if ( t2 < v2 ) {
654-
GenVector::Throw ("LorentzVector::Gamma() - gamma computed for a spacelike LorentzVector. Imaginary result");
656+
GenVector_Throw("LorentzVector::Gamma() - gamma computed for a spacelike LorentzVector. Imaginary result");
655657
return 0;
656658
}
657659
else if ( t2 == v2 ) {
658-
GenVector::Throw ("LorentzVector::Gamma() - gamma computed for a lightlike LorentzVector. Infinite result");
660+
GenVector_Throw("LorentzVector::Gamma() - gamma computed for a lightlike LorentzVector. Infinite result");
659661
}
660662
using std::sqrt;
661663
return Scalar(1) / sqrt(Scalar(1) - v2 / t2);

math/genvector/inc/Math/GenVector/PtEtaPhiE4D.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ public :
170170
using std::sqrt;
171171
return sqrt(mm);
172172
} else {
173-
GenVector::Throw ("PtEtaPhiE4D::M() - Tachyonic:\n"
174-
" Pt and Eta give P such that P^2 > E^2, so the mass would be imaginary");
173+
GenVector_Throw("PtEtaPhiE4D::M() - Tachyonic:\n"
174+
" Pt and Eta give P such that P^2 > E^2, so the mass would be imaginary");
175175
using std::sqrt;
176176
return -sqrt(-mm);
177177
}
@@ -198,8 +198,8 @@ public :
198198
using std::sqrt;
199199
return sqrt(mm);
200200
} else {
201-
GenVector::Throw ("PtEtaPhiE4D::Mt() - Tachyonic:\n"
202-
" Pt and Eta give Pz such that Pz^2 > E^2, so the mass would be imaginary");
201+
GenVector_Throw("PtEtaPhiE4D::Mt() - Tachyonic:\n"
202+
" Pt and Eta give Pz such that Pz^2 > E^2, so the mass would be imaginary");
203203
using std::sqrt;
204204
return -sqrt(-mm);
205205
}

math/genvector/inc/Math/GenVector/PtEtaPhiM4D.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ public :
209209
using std::sqrt;
210210
return sqrt(mm);
211211
} else {
212-
GenVector::Throw ("PtEtaPhiM4D::Mt() - Tachyonic:\n"
213-
" Pz^2 > E^2 so the transverse mass would be imaginary");
212+
GenVector_Throw("PtEtaPhiM4D::Mt() - Tachyonic:\n"
213+
" Pz^2 > E^2 so the transverse mass would be imaginary");
214214
using std::sqrt;
215215
return -sqrt(-mm);
216216
}
@@ -241,7 +241,7 @@ public :
241241
inline void RestrictNegMass() {
242242
if (fM < 0) {
243243
if (P2() - fM * fM < 0) {
244-
GenVector::Throw("PtEtaPhiM4D::unphysical value of mass, set to closest physical value");
244+
GenVector_Throw("PtEtaPhiM4D::unphysical value of mass, set to closest physical value");
245245
fM = -P();
246246
}
247247
}
@@ -299,7 +299,7 @@ public :
299299
void Negate( ) {
300300
fPhi = ( (fPhi > 0) ? fPhi - pi() : fPhi + pi() );
301301
fEta = - fEta;
302-
GenVector::Throw ("PtEtaPhiM4D::Negate - cannot negate the energy - can negate only the spatial components");
302+
GenVector_Throw("PtEtaPhiM4D::Negate - cannot negate the energy - can negate only the spatial components");
303303
}
304304

305305
/**

math/genvector/inc/Math/GenVector/PxPyPzE4D.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public :
135135
using std::sqrt;
136136
return sqrt(mm);
137137
} else {
138-
GenVector::Throw ("PxPyPzE4D::M() - Tachyonic:\n"
139-
" P^2 > E^2 so the mass would be imaginary");
138+
GenVector_Throw("PxPyPzE4D::M() - Tachyonic:\n"
139+
" P^2 > E^2 so the mass would be imaginary");
140140
using std::sqrt;
141141
return -sqrt(-mm);
142142
}
@@ -170,8 +170,8 @@ public :
170170
using std::sqrt;
171171
return sqrt(mm);
172172
} else {
173-
GenVector::Throw ("PxPyPzE4D::Mt() - Tachyonic:\n"
174-
" Pz^2 > E^2 so the transverse mass would be imaginary");
173+
GenVector_Throw("PxPyPzE4D::Mt() - Tachyonic:\n"
174+
" Pz^2 > E^2 so the transverse mass would be imaginary");
175175
using std::sqrt;
176176
return -sqrt(-mm);
177177
}

math/genvector/inc/Math/GenVector/PxPyPzM4D.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ public :
198198
using std::sqrt;
199199
return sqrt(mm);
200200
} else {
201-
GenVector::Throw ("PxPyPzM4D::Mt() - Tachyonic:\n"
202-
" Pz^2 > E^2 so the transverse mass would be imaginary");
201+
GenVector_Throw("PxPyPzM4D::Mt() - Tachyonic:\n"
202+
" Pz^2 > E^2 so the transverse mass would be imaginary");
203203
using std::sqrt;
204204
return -sqrt(-mm);
205205
}
@@ -285,7 +285,7 @@ public :
285285
fX = -fX;
286286
fY = -fY;
287287
fZ = -fZ;
288-
GenVector::Throw ("PxPyPzM4D::Negate - cannot negate the energy - can negate only the spatial components");
288+
GenVector_Throw("PxPyPzM4D::Negate - cannot negate the energy - can negate only the spatial components");
289289
}
290290

291291
/**
@@ -340,7 +340,7 @@ public :
340340
inline void RestrictNegMass() {
341341
if ( fM >=0 ) return;
342342
if ( P2() - fM*fM < 0 ) {
343-
GenVector::Throw("PxPyPzM4D::unphysical value of mass, set to closest physical value");
343+
GenVector_Throw("PxPyPzM4D::unphysical value of mass, set to closest physical value");
344344
fM = - P();
345345
}
346346
return;

math/genvector/inc/Math/GenVector/Rotation3D.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ class Rotation3D {
356356
if (i < 3 && j < 3)
357357
return fM[i + 3 * j];
358358
else
359-
GenVector::Throw("Rotation3D::operator(size_t i, size_t j):\n"
360-
" indices i and j must range in {0,1,2}");
359+
GenVector_Throw("Rotation3D::operator(size_t i, size_t j):\n"
360+
" indices i and j must range in {0,1,2}");
361361
return 0.0;
362362
}
363363

math/genvector/inc/Math/GenVector/VectorUtil.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ namespace ROOT {
350350
return v;
351351
const double ll = std::sqrt(axis.X() * axis.X() + axis.Y() * axis.Y() + axis.Z() * axis.Z());
352352
if (ll == 0.)
353-
GenVector::Throw("Axis Vector has zero magnitude");
353+
GenVector_Throw("Axis Vector has zero magnitude");
354354
const double sa = std::sin(alpha);
355355
const double ca = std::cos(alpha);
356356
const double dx = axis.X() / ll;
@@ -407,7 +407,7 @@ namespace ROOT {
407407
double bz = b.Z();
408408
double b2 = bx*bx + by*by + bz*bz;
409409
if (b2 >= 1) {
410-
GenVector::Throw ( "Beta Vector supplied to set Boost represents speed >= c");
410+
GenVector_Throw("Beta Vector supplied to set Boost represents speed >= c");
411411
return LVector();
412412
}
413413
using std::sqrt;
@@ -433,7 +433,7 @@ namespace ROOT {
433433
template <class LVector, class T>
434434
LVector boostX(const LVector & v, T beta) {
435435
if (beta >= 1) {
436-
GenVector::Throw ("Beta Vector supplied to set Boost represents speed >= c");
436+
GenVector_Throw("Beta Vector supplied to set Boost represents speed >= c");
437437
return LVector();
438438
}
439439
using std::sqrt;
@@ -455,7 +455,7 @@ namespace ROOT {
455455
template <class LVector>
456456
LVector boostY(const LVector & v, double beta) {
457457
if (beta >= 1) {
458-
GenVector::Throw ("Beta Vector supplied to set Boost represents speed >= c");
458+
GenVector_Throw("Beta Vector supplied to set Boost represents speed >= c");
459459
return LVector();
460460
}
461461
using std::sqrt;
@@ -476,7 +476,7 @@ namespace ROOT {
476476
template <class LVector>
477477
LVector boostZ(const LVector & v, double beta) {
478478
if (beta >= 1) {
479-
GenVector::Throw ( "Beta Vector supplied to set Boost represents speed >= c");
479+
GenVector_Throw("Beta Vector supplied to set Boost represents speed >= c");
480480
return LVector();
481481
}
482482
using std::sqrt;

math/genvector/src/Boost.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ void Boost::SetComponents (Scalar bx, Scalar by, Scalar bz) {
7777
// set the boost beta as 3 components
7878
Scalar bp2 = bx*bx + by*by + bz*bz;
7979
if (bp2 >= 1) {
80-
GenVector::Throw (
81-
"Beta Vector supplied to set Boost represents speed >= c");
80+
GenVector_Throw("Beta Vector supplied to set Boost represents speed >= c");
8281
// SetIdentity();
8382
return;
8483
}
@@ -127,8 +126,7 @@ void Boost::Rectify() {
127126
// again.
128127

129128
if (fM[kTT] <= 0) {
130-
GenVector::Throw (
131-
"Attempt to rectify a boost with non-positive gamma");
129+
GenVector_Throw("Attempt to rectify a boost with non-positive gamma");
132130
return;
133131
}
134132
DisplacementVector3D< Cartesian3D<Scalar> > beta ( fM[kXT], fM[kYT], fM[kZT] );

math/genvector/src/BoostX.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ void BoostX::SetComponents (Scalar bx ) {
3434
// set component
3535
Scalar bp2 = bx*bx;
3636
if (bp2 >= 1) {
37-
GenVector::Throw (
38-
"Beta Vector supplied to set BoostX represents speed >= c");
37+
GenVector_Throw("Beta Vector supplied to set BoostX represents speed >= c");
3938
return;
4039
}
4140
fBeta = bx;
@@ -68,8 +67,7 @@ void BoostX::Rectify() {
6867
// again.
6968

7069
if (fGamma <= 0) {
71-
GenVector::Throw (
72-
"Attempt to rectify a boost with non-positive gamma");
70+
GenVector_Throw("Attempt to rectify a boost with non-positive gamma");
7371
return;
7472
}
7573
Scalar beta = fBeta;

0 commit comments

Comments
 (0)