Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
+41 -32
View File
@@ -12,6 +12,7 @@
#define BASIC_VECTOR3D_H
#include <iosfwd>
#include <type_traits>
#include "CLHEP/Vector/ThreeVector.h"
namespace HepGeom {
@@ -50,19 +51,24 @@ namespace HepGeom {
BasicVector3D(T x1, T y1, T z1) { v_[0] = x1; v_[1] = y1; v_[2] = z1; }
/**
* Copy constructor.
* Note: BasicVector3D<double> has constructors
* from BasicVector3D<double> (provided by compiler) and
* from BasicVector3D<float> (defined in this file);
* BasicVector3D<float> has only the last one.
*/
* Copy constructor. */
BasicVector3D(const BasicVector3D<T> &) = default;
/**
* Constructor for BasicVector3D<double> from BasicVector3D<float>. */
template<typename U = T,
typename = typename std::enable_if<!std::is_same<U,float>::value >::type>
BasicVector3D(const BasicVector3D<float> & v) {
v_[0] = v.x(); v_[1] = v.y(); v_[2] = v.z();
}
/**
* Move constructor. */
BasicVector3D(BasicVector3D<T> &&) = default;
/**
* Destructor. */
virtual ~BasicVector3D() {}
virtual ~BasicVector3D() = default;
// -------------------------
// Interface to "good old C"
@@ -80,7 +86,7 @@ namespace HepGeom {
* Conversion (cast) to CLHEP::Hep3Vector.
* This operator is needed only for backward compatibility and
* in principle should not exit.
*/
*/
operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
// -----------------------------
@@ -90,6 +96,9 @@ namespace HepGeom {
/**
* Assignment. */
BasicVector3D<T> & operator= (const BasicVector3D<T> &) = default;
/**
* Move assignment. */
BasicVector3D<T> & operator= (BasicVector3D<T> &&) = default;
/**
* Addition. */
BasicVector3D<T> & operator+=(const BasicVector3D<T> & v) {
@@ -121,36 +130,36 @@ namespace HepGeom {
/**
* Gets components by index. */
T operator[](int i) const { return v_[i]; }
/**
* Sets components by index. */
T & operator()(int i) { return v_[i]; }
/**
* Sets components by index. */
T & operator[](int i) { return v_[i]; }
// ------------------------------------
// Cartesian coordinate system: x, y, z
// ------------------------------------
/**
* Gets x-component in cartesian coordinate system. */
* Gets x-component in cartesian coordinate system. */
T x() const { return v_[0]; }
/**
* Gets y-component in cartesian coordinate system. */
* Gets y-component in cartesian coordinate system. */
T y() const { return v_[1]; }
/**
* Gets z-component in cartesian coordinate system. */
* Gets z-component in cartesian coordinate system. */
T z() const { return v_[2]; }
/**
* Sets x-component in cartesian coordinate system. */
* Sets x-component in cartesian coordinate system. */
void setX(T a) { v_[0] = a; }
/**
* Sets y-component in cartesian coordinate system. */
* Sets y-component in cartesian coordinate system. */
void setY(T a) { v_[1] = a; }
/**
* Sets z-component in cartesian coordinate system. */
* Sets z-component in cartesian coordinate system. */
void setZ(T a) { v_[2] = a; }
/**
@@ -177,7 +186,7 @@ namespace HepGeom {
T factor = perp();
if (factor > 0) {
factor = rh/factor; v_[0] *= factor; v_[1] *= factor;
}
}
}
// ------------------------------------------
@@ -210,10 +219,10 @@ namespace HepGeom {
/**
* Gets r-component in spherical coordinate system */
T getR() const { return r(); }
/**
/**
* Gets phi-component in spherical coordinate system */
T getPhi() const { return phi(); }
/**
/**
* Gets theta-component in spherical coordinate system */
T getTheta() const { return theta(); }
@@ -223,7 +232,7 @@ namespace HepGeom {
T factor = mag();
if (factor > 0) {
factor = ma/factor; v_[0] *= factor; v_[1] *= factor; v_[2] *= factor;
}
}
}
/**
* Sets r-component in spherical coordinate system. */
@@ -297,7 +306,7 @@ namespace HepGeom {
// ---------------
/**
* Returns unit vector parallel to this. */
* Returns unit vector parallel to this. */
BasicVector3D<T> unit() const {
T len = mag();
return (len > 0) ?
@@ -305,7 +314,7 @@ namespace HepGeom {
}
/**
* Returns orthogonal vector. */
* Returns orthogonal vector. */
BasicVector3D<T> orthogonal() const {
T dx = x() < 0 ? -x() : x();
T dy = y() < 0 ? -y() : y();
@@ -338,9 +347,9 @@ namespace HepGeom {
};
/*************************************************************************
* *
* *
* Non-member functions for BasicVector3D<float> *
* *
* *
*************************************************************************/
/**
@@ -426,9 +435,9 @@ namespace HepGeom {
operator/(const BasicVector3D<float> & v, double a) {
return BasicVector3D<float>(v.x()/static_cast<float>(a), v.y()/static_cast<float>(a), v.z()/static_cast<float>(a));
}
/**
* Comparison of two vectors for equality.
* Comparison of two vectors for equality.
* @relates BasicVector3D
*/
inline bool
@@ -437,7 +446,7 @@ namespace HepGeom {
}
/**
* Comparison of two vectors for inequality.
* Comparison of two vectors for inequality.
* @relates BasicVector3D
*/
inline bool
@@ -446,9 +455,9 @@ namespace HepGeom {
}
/*************************************************************************
* *
* *
* Non-member functions for BasicVector3D<double> *
* *
* *
*************************************************************************/
/**
@@ -534,9 +543,9 @@ namespace HepGeom {
operator/(const BasicVector3D<double> & v, double a) {
return BasicVector3D<double>(v.x()/a, v.y()/a, v.z()/a);
}
/**
* Comparison of two vectors for equality.
* Comparison of two vectors for equality.
* @relates BasicVector3D
*/
inline bool
@@ -546,7 +555,7 @@ namespace HepGeom {
}
/**
* Comparison of two vectors for inequality.
* Comparison of two vectors for inequality.
* @relates BasicVector3D
*/
inline bool
+31 -16
View File
@@ -43,7 +43,7 @@ namespace HepGeom {
public:
/**
* Default constructor. */
Normal3D() {}
Normal3D() = default;
/**
* Constructor from three numbers. */
@@ -56,7 +56,11 @@ namespace HepGeom {
/**
* Copy constructor. */
Normal3D(const Normal3D<float> & v) : BasicVector3D<float>(v) {}
Normal3D(const Normal3D<float> &) = default;
/**
* Move constructor. */
Normal3D(Normal3D<float> &&) = default;
/**
* Constructor from BasicVector3D<float>. */
@@ -64,20 +68,23 @@ namespace HepGeom {
/**
* Destructor. */
~Normal3D() {}
~Normal3D() = default;
/**
* Assignment. */
Normal3D<float> & operator=(const Normal3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
Normal3D<float> & operator=(const Normal3D<float> &) = default;
/**
* Assignment from BasicVector3D<float>. */
Normal3D<float> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<float>::operator=(v);
return *this;
}
/**
* Move assignment. */
Normal3D<float> & operator=(Normal3D<float> &&) = default;
/**
* Transformation by Transform3D. */
Normal3D<float> & transform(const Transform3D & m);
@@ -101,7 +108,7 @@ namespace HepGeom {
public:
/**
* Default constructor. */
Normal3D() {}
Normal3D() = default;
/**
* Constructor from three numbers. */
@@ -119,7 +126,11 @@ namespace HepGeom {
/**
* Copy constructor. */
Normal3D(const Normal3D<double> & v) : BasicVector3D<double>(v) {}
Normal3D(const Normal3D<double> &) = default;
/**
* Move constructor. */
Normal3D(Normal3D<double> &&) = default;
/**
* Constructor from BasicVector3D<float>. */
@@ -131,7 +142,7 @@ namespace HepGeom {
/**
* Destructor. */
~Normal3D() {}
~Normal3D() = default;
/**
* Constructor from CLHEP::Hep3Vector.
@@ -145,27 +156,31 @@ namespace HepGeom {
* Conversion (cast) to CLHEP::Hep3Vector.
* This operator is needed only for backward compatibility and
* in principle should not exit.
*/
*/
operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
/**
* Assignment. */
Normal3D<double> & operator=(const Normal3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
Normal3D<double> & operator=(const Normal3D<double> &) = default;
/**
* Assignment from BasicVector3D<float>. */
Normal3D<double> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<double>::operator=(v);
return *this;
}
/**
* Assignment from BasicVector3D<double>. */
Normal3D<double> & operator=(const BasicVector3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<double>::operator=(v);
return *this;
}
/**
* Move assignment. */
Normal3D<double> & operator=(Normal3D<double> &&) = default;
/**
* Transformation by Transform3D. */
Normal3D<double> & transform(const Transform3D & m);
+18 -8
View File
@@ -28,7 +28,7 @@ namespace HepGeom {
class Plane3D {
protected:
T a_, b_, c_, d_;
public:
/**
* Default constructor - creates plane z=0. */
@@ -52,23 +52,33 @@ namespace HepGeom {
a_ = n.x(); b_ = n.y(); c_ = n.z(); d_ = -n*p1;
}
/** Copy constructor.
* Plane3D<double> has two constructors:
* from Plane3D<double> (provided by compiler) and
* from Plane3D<float> (defined in this file).
* Plane3D<float> has only the last one.
*/
/**
* Copy constructor. */
Plane3D(const Plane3D<T> &) = default;
/**
* Constructor for Plane3D<double> from Plane3D<float>. */
template<typename U = T,
typename = typename std::enable_if<!std::is_same<U,float>::value >::type>
Plane3D(const Plane3D<float> & p)
: a_(p.a_), b_(p.b_), c_(p.c_), d_(p.d_) {}
/**
* Move constructor. */
Plane3D(Plane3D<T> &&) = default;
/**
* Destructor. */
~Plane3D() {};
~Plane3D() = default;
/**
* Assignment. */
Plane3D<T> & operator=(const Plane3D<T> &) = default;
/**
* Move assignment. */
Plane3D<T> & operator=(Plane3D<T> &&) = default;
/**
* Returns the a-coefficient in the plane equation: a*x+b*y+c*z+d=0. */
T a() const { return a_; }
+31 -16
View File
@@ -43,7 +43,7 @@ namespace HepGeom {
public:
/**
* Default constructor. */
Point3D() {}
Point3D() = default;
/**
* Constructor from three numbers. */
@@ -56,7 +56,11 @@ namespace HepGeom {
/**
* Copy constructor. */
Point3D(const Point3D<float> & v) : BasicVector3D<float>(v) {}
Point3D(const Point3D<float> &) = default;
/**
* Move constructor. */
Point3D(Point3D<float> &&) = default;
/**
* Constructor from BasicVector3D<float>. */
@@ -64,20 +68,23 @@ namespace HepGeom {
/**
* Destructor. */
~Point3D() {}
~Point3D() = default;
/**
* Assignment. */
Point3D<float> & operator=(const Point3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
Point3D<float> & operator=(const Point3D<float> &) = default;
/**
* Assignment from BasicVector3D<float>. */
Point3D<float> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<float>::operator=(v);
return *this;
}
/**
* Move assignment. */
Point3D<float> & operator=(Point3D<float> &&) = default;
/**
* Returns distance to the origin squared. */
float distance2() const { return mag2(); }
@@ -122,7 +129,7 @@ namespace HepGeom {
public:
/**
* Default constructor. */
Point3D() {}
Point3D() = default;
/**
* Constructor from three numbers. */
@@ -140,7 +147,11 @@ namespace HepGeom {
/**
* Copy constructor. */
Point3D(const Point3D<double> & v) : BasicVector3D<double>(v) {}
Point3D(const Point3D<double> &) = default;
/**
* Move constructor. */
Point3D(Point3D<double> &&) = default;
/**
* Constructor from BasicVector3D<float>. */
@@ -152,7 +163,7 @@ namespace HepGeom {
/**
* Destructor. */
~Point3D() {}
~Point3D() = default;
/**
* Constructor from CLHEP::Hep3Vector.
@@ -166,27 +177,31 @@ namespace HepGeom {
* Conversion (cast) to CLHEP::Hep3Vector.
* This operator is needed only for backward compatibility and
* in principle should not exit.
*/
*/
operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
/**
* Assignment. */
Point3D<double> & operator=(const Point3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
Point3D<double> & operator=(const Point3D<double> &) = default;
/**
* Assignment from BasicVector3D<float>. */
Point3D<double> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<double>::operator=(v);
return *this;
}
/**
* Assignment from BasicVector3D<double>. */
Point3D<double> & operator=(const BasicVector3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<double>::operator=(v);
return *this;
}
/**
* Move assignment. */
Point3D<double> & operator=(Point3D<double> &&) = default;
/**
* Returns distance to the origin squared. */
double distance2() const { return mag2(); }
+61 -64
View File
@@ -60,7 +60,7 @@
// Scalings:
// Scale3D(sx,sy,sz) - general scaling with factors "sx","sy","sz"
// along X, Y and Z;
// Scale3D(s) - scaling with constant factor "s" along all
// Scale3D(s) - scaling with constant factor "s" along all
// directions;
// ScaleX3D(sx) - scale X;
// ScaleY3D(sy) - scale Y;
@@ -84,7 +84,7 @@
//
// The following table explains how different transformations affect
// point, vector and normal. "+" means affect, "-" means do not affect,
// "*" meas affect but in different way than "+"
// "*" meas affect but in different way than "+"
//
// Point Vector Normal
// -------------+-------+-------+-------
@@ -109,9 +109,9 @@
// 24.09.96 E.Chernyaev - initial version
//
// 26.02.97 E.Chernyaev
// - added global Identity by request of John Allison
// (to avoid problems with compilation on HP)
// - added getRotation and getTranslation
// - added global Identity by request of John Allison
// (to avoid problems with compilation on HP)
// - added getRotation and getTranslation
//
// 29.01.01 E.Chernyaev - added subscripting
// 11.06.01 E.Chernyaev - added getDecomposition
@@ -195,7 +195,7 @@ namespace HepGeom {
* Global identity transformation. */
DLL_API static const Transform3D Identity;
// Helper class for implemention of C-style subscripting r[i][j]
// Helper class for implemention of C-style subscripting r[i][j]
class Transform3D_row {
public:
inline Transform3D_row(const Transform3D &, int);
@@ -211,7 +211,7 @@ namespace HepGeom {
: xx_(1), xy_(0), xz_(0), dx_(0),
yx_(0), yy_(1), yz_(0), dy_(0),
zx_(0), zy_(0), zz_(1), dz_(0) {}
/**
* Constructor: rotation and then translation. */
inline Transform3D(const CLHEP::HepRotation & mt, const CLHEP::Hep3Vector & v);
@@ -227,21 +227,27 @@ namespace HepGeom {
/**
* Copy constructor. */
Transform3D(const Transform3D & mt)
: xx_(mt.xx_), xy_(mt.xy_), xz_(mt.xz_), dx_(mt.dx_),
yx_(mt.yx_), yy_(mt.yy_), yz_(mt.yz_), dy_(mt.dy_),
zx_(mt.zx_), zy_(mt.zy_), zz_(mt.zz_), dz_(mt.dz_) {}
Transform3D(const Transform3D & mt) = default;
/**
* Destructor.
* Virtual for now as some persistency mechanism needs that,
* in future releases this might go away again.
*/
~Transform3D() { /* nop */ }
* Move constructor. */
Transform3D(Transform3D && mt) = default;
/**
* Destructor. */
~Transform3D() = default;
/**
* Assignment. */
Transform3D & operator=(const Transform3D & mt) = default;
/**
* Move assignment. */
Transform3D & operator=(Transform3D && mt) = default;
/**
* Returns object of the helper class for C-style subscripting r[i][j] */
inline const Transform3D_row operator [] (int) const;
inline const Transform3D_row operator [] (int) const;
/** Fortran-style subscripting: returns (i,j) element of the matrix. */
double operator () (int, int) const;
@@ -264,7 +270,7 @@ namespace HepGeom {
/**
* Gets yz-element of the transformation matrix. */
double yz() const { return yz_; }
/**
/**
* Gets zx-element of the transformation matrix. */
double zx() const { return zx_; }
/**
@@ -282,30 +288,21 @@ namespace HepGeom {
/**
* Gets dz-element of the transformation matrix. */
double dz() const { return dz_; }
/**
* Assignment. */
Transform3D & operator=(const Transform3D &mt) {
xx_= mt.xx_; xy_= mt.xy_; xz_= mt.xz_; dx_= mt.dx_;
yx_= mt.yx_; yy_= mt.yy_; yz_= mt.yz_; dy_= mt.dy_;
zx_= mt.zx_; zy_= mt.zy_; zz_= mt.zz_; dz_= mt.dz_;
return *this;
}
/**
* Sets the Identity transformation. */
void setIdentity() {
void setIdentity() {
xy_= xz_= dx_= yx_= yz_= dy_= zx_= zy_= dz_= 0; xx_= yy_= zz_= 1;
}
/**
* Returns the inverse transformation. */
Transform3D inverse() const;
/**
* Transformation by another Transform3D. */
Transform3D operator*(const Transform3D & b) const;
/**
* Decomposition of general transformation.
* This function gets decomposition of the transformation
@@ -336,17 +333,17 @@ namespace HepGeom {
* This functions is obsolete - use getDecomposition() instead.
*/
inline CLHEP::HepRotation getRotation() const;
/**
* Extracts the translation vector.
* This functions is obsolete - use getDecomposition() instead.
*/
inline CLHEP::Hep3Vector getTranslation() const;
/**
* Test for equality. */
bool operator == (const Transform3D & transform) const;
/**
* Test for inequality. */
bool operator != (const Transform3D & transform) const {
@@ -360,7 +357,7 @@ namespace HepGeom {
* Constructs a rotation transformation.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -375,7 +372,7 @@ namespace HepGeom {
/**
* Default constructor: sets the Identity transformation. */
Rotate3D() : Transform3D() {}
/**
* Constructor from CLHEP::HepRotation. */
inline Rotate3D(const CLHEP::HepRotation &mt);
@@ -389,7 +386,7 @@ namespace HepGeom {
Rotate3D(double a,
const Point3D<double> & p1,
const Point3D<double> & p2);
/**
* Constructor from angle and axis.
* @param a angle of rotation
@@ -415,7 +412,7 @@ namespace HepGeom {
* Constructs a rotation around x-axis.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -430,11 +427,11 @@ namespace HepGeom {
/**
* Default constructor: sets the Identity transformation. */
RotateX3D() : Rotate3D() {}
/**
* Constructs a rotation around x-axis by angle a. */
RotateX3D(double a) {
double cosa = std::cos(a), sina = std::sin(a);
double cosa = std::cos(a), sina = std::sin(a);
setTransform(1,0,0,0, 0,cosa,-sina,0, 0,sina,cosa,0);
}
};
@@ -443,7 +440,7 @@ namespace HepGeom {
* Constructs a rotation around y-axis.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -458,11 +455,11 @@ namespace HepGeom {
/**
* Default constructor: sets the Identity transformation. */
RotateY3D() : Rotate3D() {}
/**
* Constructs a rotation around y-axis by angle a. */
RotateY3D(double a) {
double cosa = std::cos(a), sina = std::sin(a);
double cosa = std::cos(a), sina = std::sin(a);
setTransform(cosa,0,sina,0, 0,1,0,0, -sina,0,cosa,0);
}
};
@@ -471,7 +468,7 @@ namespace HepGeom {
* Constructs a rotation around z-axis.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -486,22 +483,22 @@ namespace HepGeom {
/**
* Default constructor: sets the Identity transformation. */
RotateZ3D() : Rotate3D() {}
/**
* Constructs a rotation around z-axis by angle a. */
RotateZ3D(double a) {
double cosa = std::cos(a), sina = std::sin(a);
double cosa = std::cos(a), sina = std::sin(a);
setTransform(cosa,-sina,0,0, sina,cosa,0,0, 0,0,1,0);
}
};
// T R A N S L A T I O N S
/**
* Constructs a translation transformation.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -516,11 +513,11 @@ namespace HepGeom {
/**
* Default constructor: sets the Identity transformation. */
Translate3D() : Transform3D() {}
/**
* Constructor from CLHEP::Hep3Vector. */
inline Translate3D(const CLHEP::Hep3Vector &v);
/**
* Constructor from three numbers. */
Translate3D(double x, double y, double z)
@@ -531,7 +528,7 @@ namespace HepGeom {
* Constructs a translation along x-axis.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -546,7 +543,7 @@ namespace HepGeom {
/**
* Default constructor: sets the Identity transformation. */
TranslateX3D() : Translate3D() {}
/**
* Constructor from a number. */
TranslateX3D(double x) : Translate3D(x, 0, 0) {}
@@ -556,7 +553,7 @@ namespace HepGeom {
* Constructs a translation along y-axis.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -581,7 +578,7 @@ namespace HepGeom {
* Constructs a translation along z-axis.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -608,7 +605,7 @@ namespace HepGeom {
* Constructs a reflection transformation.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -646,7 +643,7 @@ namespace HepGeom {
* Constructs reflection in a plane x=const.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -662,12 +659,12 @@ namespace HepGeom {
* Constructor from a number. */
ReflectX3D(double x=0) : Reflect3D(-1,0,0,x+x, 0,1,0,0, 0,0,1,0) {}
};
/**
* Constructs reflection in a plane y=const.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -683,12 +680,12 @@ namespace HepGeom {
* Constructor from a number. */
ReflectY3D(double y=0) : Reflect3D(1,0,0,0, 0,-1,0,y+y, 0,0,1,0) {}
};
/**
* Constructs reflection in a plane z=const.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -704,14 +701,14 @@ namespace HepGeom {
* Constructor from a number. */
ReflectZ3D(double z=0) : Reflect3D(1,0,0,0, 0,1,0,0, 0,0,-1,z+z) {}
};
// S C A L I N G S
/**
* Constructs a scaling transformation.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -743,7 +740,7 @@ namespace HepGeom {
* Constructs a scaling transformation in x-direction.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
@@ -768,7 +765,7 @@ namespace HepGeom {
* Constructs a scaling transformation in y-direction.
* This class provides additional constructors for Transform3D
* and should not be used as a separate class.
*
*
* Example of use:
* @code
* Transform3D m;
+31 -16
View File
@@ -43,7 +43,7 @@ namespace HepGeom {
public:
/**
* Default constructor. */
Vector3D() {}
Vector3D() = default;
/**
* Constructor from three numbers. */
@@ -56,7 +56,11 @@ namespace HepGeom {
/**
* Copy constructor. */
Vector3D(const Vector3D<float> & v) : BasicVector3D<float>(v) {}
Vector3D(const Vector3D<float> &) = default;
/**
* Move constructor. */
Vector3D(Vector3D<float> &&) = default;
/**
* Constructor from BasicVector3D<float>. */
@@ -64,20 +68,23 @@ namespace HepGeom {
/**
* Destructor. */
~Vector3D() {}
~Vector3D() = default;
/**
* Assignment. */
Vector3D<float> & operator=(const Vector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
Vector3D<float> & operator=(const Vector3D<float> &) = default;
/**
* Assignment from BasicVector3D<float>. */
Vector3D<float> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<float>::operator=(v);
return *this;
}
/**
* Move assignment. */
Vector3D<float> & operator=(Vector3D<float> &&) = default;
/**
* Transformation by Transform3D. */
Vector3D<float> & transform(const Transform3D & m);
@@ -101,7 +108,7 @@ namespace HepGeom {
public:
/**
* Default constructor. */
Vector3D() {}
Vector3D() = default;
/**
* Constructor from three numbers. */
@@ -119,7 +126,11 @@ namespace HepGeom {
/**
* Copy constructor. */
Vector3D(const Vector3D<double> & v) : BasicVector3D<double>(v) {}
Vector3D(const Vector3D<double> &) = default;
/**
* Move constructor. */
Vector3D(Vector3D<double> &&) = default;
/**
* Constructor from BasicVector3D<float>. */
@@ -131,7 +142,7 @@ namespace HepGeom {
/**
* Destructor. */
~Vector3D() {}
~Vector3D() = default;
/**
* Constructor from CLHEP::Hep3Vector.
@@ -145,27 +156,31 @@ namespace HepGeom {
* Conversion (cast) to CLHEP::Hep3Vector.
* This operator is needed only for backward compatibility and
* in principle should not exit.
*/
*/
operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
/**
* Assignment. */
Vector3D<double> & operator=(const Vector3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this;
}
Vector3D<double> & operator=(const Vector3D<double> &) = default;
/**
* Assignment from BasicVector3D<float>. */
Vector3D<double> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<double>::operator=(v);
return *this;
}
/**
* Assignment from BasicVector3D<double>. */
Vector3D<double> & operator=(const BasicVector3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this;
this->BasicVector3D<double>::operator=(v);
return *this;
}
/**
* Move assignment. */
Vector3D<double> & operator=(Vector3D<double> &&) = default;
/**
* Transformation by Transform3D. */
Vector3D<double> & transform(const Transform3D & m);
+16 -16
View File
@@ -53,12 +53,12 @@ public:
// Static methods to shoot random values using the static generator
static float shoot() {return shoot(HepRandom::getTheEngine());};
static float shoot( float mean ) {return shoot(HepRandom::getTheEngine(),mean);};
static float shoot() {return shoot(HepRandom::getTheEngine());}
static float shoot( float mean ) {return shoot(HepRandom::getTheEngine(),mean);}
/* ENGINE IS INTRINSIC FLOAT
static double shoot() {return shoot(HepRandom::getTheEngine());};
static double shoot( double mean ) {return shoot(HepRandom::getTheEngine(),mean);};
static double shoot() {return shoot(HepRandom::getTheEngine());}
static double shoot( double mean ) {return shoot(HepRandom::getTheEngine(),mean);}
*/
static void shootArray ( const int size, float* vect, float mean=1.0 );
@@ -67,13 +67,13 @@ public:
// Static methods to shoot random values using a given engine
// by-passing the static generator.
static inline float shoot( HepRandomEngine* anEngine ) {return ziggurat_REXP(anEngine);};
static inline float shoot( HepRandomEngine* anEngine, float mean ) {return shoot(anEngine)*mean;};
static inline float shoot( HepRandomEngine* anEngine ) {return ziggurat_REXP(anEngine);}
static inline float shoot( HepRandomEngine* anEngine, float mean ) {return shoot(anEngine)*mean;}
/* ENGINE IS INTRINSIC FLOAT
static inline double shoot( HepRandomEngine* anEngine ) {return ziggurat_REXP(anEngine);};
static inline double shoot( HepRandomEngine* anEngine ) {return ziggurat_REXP(anEngine);}
static inline double shoot( HepRandomEngine* anEngine, double mean ) {return shoot(anEngine)*mean;};
static inline double shoot( HepRandomEngine* anEngine, double mean ) {return shoot(anEngine)*mean;}
*/
static void shootArray ( HepRandomEngine* anEngine, const int size, float* vect, float mean=1.0 );
@@ -82,12 +82,12 @@ public:
// Methods using the localEngine to shoot random values, by-passing
// the static generator.
inline float fire() {return fire(defaultMean);};
inline float fire( float mean ) {return ziggurat_REXP(localEngine.get())*mean;};
inline float fire() {return fire(float(defaultMean));}
inline float fire( float mean ) {return ziggurat_REXP(localEngine.get())*mean;}
/* ENGINE IS INTRINSIC FLOAT
inline double fire() {return fire(defaultMean);};
inline double fire( double mean ) {return ziggurat_REXP(localEngine.get())*mean;};
inline double fire() {return fire(defaultMean);}
inline double fire( double mean ) {return ziggurat_REXP(localEngine.get())*mean;}
*/
void fireArray ( const int size, float* vect );
@@ -96,7 +96,7 @@ public:
void fireArray ( const int size, double* vect, double mean );
virtual double operator()();
inline float operator()( float mean ) {return fire( mean );};
inline float operator()( float mean ) {return fire( mean );}
// Save and restore to/from streams
@@ -132,14 +132,14 @@ protected:
static CLHEP_THREAD_LOCAL bool ziggurat_is_init;
static inline unsigned long ziggurat_SHR3(HepRandomEngine* anEngine) {return (unsigned int)(*anEngine);};
static inline float ziggurat_UNI(HepRandomEngine* anEngine) {return anEngine->flat();};
static inline unsigned long ziggurat_SHR3(HepRandomEngine* anEngine) {return (unsigned int)(*anEngine);}
static inline float ziggurat_UNI(HepRandomEngine* anEngine) {return float(anEngine->flat());}
static inline float ziggurat_REXP(HepRandomEngine* anEngine) {
if(!ziggurat_is_init) ziggurat_init();
unsigned long jz=ziggurat_SHR3(anEngine);
unsigned long iz=jz&255;
return (jz<ke[iz]) ? jz*we[iz] : ziggurat_efix(jz,anEngine);
};
}
static float ziggurat_efix(unsigned long jz,HepRandomEngine* anEngine);
private:
@@ -46,8 +46,8 @@ public:
// Static methods to shoot random values using the static generator
static inline float shoot() {return ziggurat_RNOR(HepRandom::getTheEngine());};
static inline float shoot( float mean, float stdDev ) {return shoot()*stdDev + mean;};
static inline float shoot() {return ziggurat_RNOR(HepRandom::getTheEngine());}
static inline float shoot( float mean, float stdDev ) {return shoot()*stdDev + mean;}
static void shootArray ( const int size, float* vect, float mean=0.0, float stdDev=1.0 );
static void shootArray ( const int size, double* vect, double mean=0.0, double stdDev=1.0 );
@@ -55,8 +55,8 @@ public:
// Static methods to shoot random values using a given engine
// by-passing the static generator.
static inline float shoot( HepRandomEngine* anotherEngine ) {return ziggurat_RNOR(anotherEngine);};
static inline float shoot( HepRandomEngine* anotherEngine, float mean, float stdDev ) {return shoot(anotherEngine)*stdDev + mean;};
static inline float shoot( HepRandomEngine* anotherEngine ) {return ziggurat_RNOR(anotherEngine);}
static inline float shoot( HepRandomEngine* anotherEngine, float mean, float stdDev ) {return shoot(anotherEngine)*stdDev + mean;}
static void shootArray ( HepRandomEngine* anotherEngine, const int size, float* vect, float mean=0.0, float stdDev=1.0 );
static void shootArray ( HepRandomEngine* anotherEngine, const int size, double* vect, double mean=0.0, double stdDev=1.0 );
@@ -64,9 +64,9 @@ public:
// Instance methods using the localEngine to instead of the static
// generator, and the default mean and stdDev established at construction
inline float fire() {return ziggurat_RNOR(localEngine.get()) * defaultStdDev + defaultMean;};
inline float fire() {return float(ziggurat_RNOR(localEngine.get()) * defaultStdDev + defaultMean);}
inline float fire ( float mean, float stdDev ) {return ziggurat_RNOR(localEngine.get()) * stdDev + mean;};
inline float fire ( float mean, float stdDev ) {return ziggurat_RNOR(localEngine.get()) * stdDev + mean;}
void fireArray ( const int size, float* vect);
void fireArray ( const int size, double* vect);
@@ -110,14 +110,14 @@ protected:
static CLHEP_THREAD_LOCAL bool ziggurat_is_init;
static inline unsigned long ziggurat_SHR3(HepRandomEngine* anEngine) {return (unsigned int)(*anEngine);};
static inline float ziggurat_UNI(HepRandomEngine* anEngine) {return anEngine->flat();};
static inline unsigned long ziggurat_SHR3(HepRandomEngine* anEngine) {return (unsigned int)(*anEngine);}
static inline float ziggurat_UNI(HepRandomEngine* anEngine) {return float(anEngine->flat());}
static inline float ziggurat_RNOR(HepRandomEngine* anEngine) {
if(!ziggurat_is_init) ziggurat_init();
long hz=(signed)ziggurat_SHR3(anEngine);
unsigned long iz=hz&127;
return ((unsigned long)std::abs(hz)<kn[iz]) ? hz*wn[iz] : ziggurat_nfix(hz,anEngine);
};
}
static float ziggurat_nfix(long hz,HepRandomEngine* anEngine);
private:
+4 -2
View File
@@ -49,10 +49,12 @@ public:
// Default constructor. Gives a boost of 0.
inline HepBoost(const HepBoost & m);
// Copy constructor.
inline HepBoost(HepBoost && m) = default;
// Copy and move constructors.
inline HepBoost & operator = (const HepBoost & m);
// Assignment.
inline HepBoost & operator = (HepBoost && m) = default;
// Copy and move assignment operators.
HepBoost & set (double betaX, double betaY, double betaZ);
inline HepBoost (double betaX, double betaY, double betaZ);
+4 -2
View File
@@ -48,10 +48,12 @@ public:
// Default constructor. Gives a boost of 0.
inline HepBoostX(const HepBoostX & b);
// Copy constructor.
inline HepBoostX(HepBoostX && b) = default;
// Copy and move constructors.
inline HepBoostX & operator = (const HepBoostX & m);
// Assignment.
inline HepBoostX & operator = (HepBoostX && m) = default;
// Copy and move assignment operators.
HepBoostX & set (double beta);
inline HepBoostX (double beta);
+4 -2
View File
@@ -48,10 +48,12 @@ public:
// Default constructor. Gives a boost of 0.
inline HepBoostY(const HepBoostY & b);
// Copy constructor.
inline HepBoostY(HepBoostY && b) = default;
// Copy and move constructors.
inline HepBoostY & operator = (const HepBoostY & m);
// Assignment.
inline HepBoostY & operator = (HepBoostY && m) = default;
// Copy and move assignment operators.
HepBoostY & set (double beta);
inline HepBoostY (double beta);
+4 -2
View File
@@ -48,10 +48,12 @@ public:
// Default constructor. Gives a boost of 0.
inline HepBoostZ(const HepBoostZ & b);
// Copy constructor.
inline HepBoostZ(HepBoostZ && b) = default;
// Copy and move constructors.
inline HepBoostZ & operator = (const HepBoostZ & m);
// Assignment.
inline HepBoostZ & operator = (HepBoostZ && m) = default;
// Copy and move assignment operators.
HepBoostZ & set (double beta);
inline HepBoostZ (double beta);
@@ -61,8 +61,9 @@ public:
inline HepLorentzRotation();
// Default constructor. Gives a unit matrix.
inline HepLorentzRotation (const HepLorentzRotation & r);
// Copy constructor.
inline HepLorentzRotation (const HepLorentzRotation & r);
inline HepLorentzRotation (HepLorentzRotation && r) = default;
// Copy and move constructors.
inline HepLorentzRotation (const HepRotation & r);
inline explicit HepLorentzRotation (const HepRotationX & r);
@@ -74,6 +75,7 @@ public:
inline explicit HepLorentzRotation (const HepBoostZ & b);
// Constructors from special cases.
inline HepLorentzRotation & operator = (HepLorentzRotation && m) = default;
inline HepLorentzRotation & operator = (const HepLorentzRotation & m);
inline HepLorentzRotation & operator = (const HepRotation & m);
inline HepLorentzRotation & operator = (const HepBoost & m);
@@ -94,7 +94,8 @@ public:
// Constructor giving a 3-Vector and a time component.
inline HepLorentzVector(const HepLorentzVector &);
// Copy constructor.
inline HepLorentzVector(HepLorentzVector &&) = default;
// Copy and move constructors.
inline ~HepLorentzVector();
// The destructor.
@@ -153,7 +154,8 @@ public:
// Set components by index.
inline HepLorentzVector & operator = (const HepLorentzVector &);
// Assignment.
inline HepLorentzVector & operator = (HepLorentzVector &&) = default;
// Copy and move assignment operators.
inline HepLorentzVector operator + (const HepLorentzVector &) const;
inline HepLorentzVector & operator += (const HepLorentzVector &);
+5 -3
View File
@@ -52,8 +52,9 @@ public:
inline HepRotation();
// Default constructor. Gives a unit matrix.
inline HepRotation(const HepRotation & m);
// Copy constructor.
inline HepRotation(const HepRotation & m);
inline HepRotation(HepRotation && m) = default;
// Copy and move constructors.
inline HepRotation(const HepRotationX & m);
inline HepRotation(const HepRotationY & m);
@@ -102,7 +103,8 @@ public:
// set from specialized rotation.
inline HepRotation & operator = (const HepRotation & r);
// Assignment.
inline HepRotation & operator = (HepRotation && r) = default;
// Copy and move assignment operators.
inline HepRotation & operator = (const HepRotationX & r);
inline HepRotation & operator = (const HepRotationY & r);
+4 -2
View File
@@ -53,10 +53,12 @@ public:
// supply angle of rotation
inline HepRotationX(const HepRotationX & orig);
// Copy constructor.
inline HepRotationX(HepRotationX && orig) = default;
// Copy and move constructors.
inline HepRotationX & operator = (const HepRotationX & r);
// Assignment from a Rotation, which must be RotationX
inline HepRotationX & operator = (HepRotationX && r) = default;
// Copy and move assignments from a Rotation, which must be RotationX
HepRotationX & set ( double delta );
// set angle of rotation
+4 -2
View File
@@ -52,10 +52,12 @@ public:
// supply angle of rotation
inline HepRotationY(const HepRotationY & orig);
// Copy constructor.
inline HepRotationY(HepRotationY && orig) = default;
// Copy and move constructors.
inline HepRotationY & operator = (const HepRotationY & r);
// Assignment from a Rotation, which must be RotationY
inline HepRotationY & operator = (HepRotationY && r) = default;
// Copy and move assignments from a Rotation, which must be RotationY
HepRotationY & set ( double delta );
// set angle of rotation
+4 -2
View File
@@ -52,10 +52,12 @@ public:
// supply angle of rotation
inline HepRotationZ(const HepRotationZ & orig);
// Copy constructor.
inline HepRotationZ(HepRotationZ && orig) = default;
// Copy and move constructors.
inline HepRotationZ & operator = (const HepRotationZ & r);
// Assignment from a Rotation, which must be RotationZ
inline HepRotationZ & operator = (HepRotationZ && r) = default;
// Copy and move assignments from a Rotation, which must be RotationZ
HepRotationZ & set ( double delta );
// set angle of rotation
+4 -2
View File
@@ -54,7 +54,8 @@ public:
// The constructor.
inline Hep3Vector(const Hep3Vector &);
// The copy constructor.
inline Hep3Vector(Hep3Vector &&) = default;
// The copy and move constructors.
inline ~Hep3Vector();
// The destructor. Not virtual - inheritance from this class is dangerous.
@@ -130,7 +131,8 @@ public:
// The transverse component w.r.t. given axis.
inline Hep3Vector & operator = (const Hep3Vector &);
// Assignment.
inline Hep3Vector & operator = (Hep3Vector &&) = default;
// The copy and move assignment operators.
inline bool operator == (const Hep3Vector &) const;
inline bool operator != (const Hep3Vector &) const;
+4 -2
View File
@@ -56,7 +56,8 @@ public:
// The constructor.
inline Hep2Vector(const Hep2Vector & p);
// The copy constructor.
inline Hep2Vector(Hep2Vector && p) = default;
// The copy and move constructors.
explicit Hep2Vector( const Hep3Vector & );
// "demotion" constructor"
@@ -108,7 +109,8 @@ public:
// Set by polar coordinates.
inline Hep2Vector & operator = (const Hep2Vector & p);
// Assignment.
inline Hep2Vector & operator = (Hep2Vector && p) = default;
// The copy and move assignment operators.
inline bool operator == (const Hep2Vector & v) const;
inline bool operator != (const Hep2Vector & v) const;