Commit cd7b1047 authored by Lynn Garren's avatar Lynn Garren
Browse files

changes from geant4

parent 25289013
2019-06-20 Gabriele Cosmo <Gabriele.Cosmo@cern.ch>
* Random/Random/MixMaxRng.h: removed not implemented constructor declaration.
* Random/src/MixMaxRng.cc: use throw instead of exit()
* Geometry/Geometry/BasicVector3D.h, Geometry/Geometry/Plane3D.h:
defaulted operator=(); fixing deprecation warnings on gcc-9.1.
* Geometry/Geometry/Transform3D.h, icc: fixed shadowing compilation
warnings as reported on gcc-9.1.
* Geometry/src/Transform3D.cc: fixed typo in printout.
==============================
19.06.19 Release CLHEP-2.4.1.1
==============================
......
......@@ -91,9 +91,7 @@ namespace HepGeom {
/**
* Assignment. */
BasicVector3D<T> & operator= (const BasicVector3D<T> & v) {
v_[0] = v.v_[0]; v_[1] = v.v_[1]; v_[2] = v.v_[2]; return *this;
}
BasicVector3D<T> & operator= (const BasicVector3D<T> &) = default;
/**
* Addition. */
BasicVector3D<T> & operator+=(const BasicVector3D<T> & v) {
......
......@@ -69,9 +69,7 @@ namespace HepGeom {
/**
* Assignment. */
Plane3D<T> & operator=(const Plane3D<T> & p) {
a_ = p.a_; b_ = p.b_; c_ = p.c_; d_ = p.d_; return *this;
}
Plane3D<T> & operator=(const Plane3D<T> &) = default;
/**
* Returns the a-coefficient in the plane equation: a*x+b*y+c*z+d=0. */
......
......@@ -216,7 +216,7 @@ namespace HepGeom {
/**
* Constructor: rotation and then translation. */
inline Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v);
inline Transform3D(const CLHEP::HepRotation & mt, const CLHEP::Hep3Vector & v);
/**
* Constructor: transformation of basis (assumed - no reflection). */
......@@ -229,10 +229,10 @@ namespace HepGeom {
/**
* Copy constructor. */
Transform3D(const Transform3D & m)
: xx_(m.xx_), xy_(m.xy_), xz_(m.xz_), dx_(m.dx_),
yx_(m.yx_), yy_(m.yy_), yz_(m.yz_), dy_(m.dy_),
zx_(m.zx_), zy_(m.zy_), zz_(m.zz_), dz_(m.dz_) {}
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_) {}
/**
* Destructor.
......@@ -287,10 +287,10 @@ namespace HepGeom {
/**
* Assignment. */
Transform3D & operator=(const Transform3D &m) {
xx_= m.xx_; xy_= m.xy_; xz_= m.xz_; dx_= m.dx_;
yx_= m.yx_; yy_= m.yy_; yz_= m.yz_; dy_= m.dy_;
zx_= m.zx_; zy_= m.zy_; zz_= m.zz_; dz_= m.dz_;
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;
}
......@@ -380,7 +380,7 @@ namespace HepGeom {
/**
* Constructor from CLHEP::HepRotation. */
inline Rotate3D(const CLHEP::HepRotation &m);
inline Rotate3D(const CLHEP::HepRotation &mt);
/**
* Constructor from angle and axis given by two points.
......@@ -737,8 +737,8 @@ namespace HepGeom {
/**
* Constructor from a number: sets uniform scaling in all directions. */
Scale3D(double s)
: Transform3D(s,0,0,0, 0,s,0,0, 0,0,s,0) {}
Scale3D(double sc)
: Transform3D(sc,0,0,0, 0,sc,0,0, 0,0,sc,0) {}
};
/**
......
......@@ -27,20 +27,20 @@ const Transform3D::Transform3D_row Transform3D::operator[](int i) const {
}
inline
Transform3D::Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v) {
xx_= m.xx(); xy_= m.xy(); xz_= m.xz();
yx_= m.yx(); yy_= m.yy(); yz_= m.yz();
zx_= m.zx(); zy_= m.zy(); zz_= m.zz();
Transform3D::Transform3D(const CLHEP::HepRotation & mt, const CLHEP::Hep3Vector & v) {
xx_= mt.xx(); xy_= mt.xy(); xz_= mt.xz();
yx_= mt.yx(); yy_= mt.yy(); yz_= mt.yz();
zx_= mt.zx(); zy_= mt.zy(); zz_= mt.zz();
dx_= v.x(); dy_= v.y(); dz_= v.z();
}
inline
CLHEP::HepRotation
Transform3D::getRotation() const {
CLHEP::HepRotation m;
return m.rotateAxes(CLHEP::Hep3Vector(xx_,yx_,zx_),
CLHEP::Hep3Vector(xy_,yy_,zy_),
CLHEP::Hep3Vector(xz_,yz_,zz_));
CLHEP::HepRotation mt;
return mt.rotateAxes(CLHEP::Hep3Vector(xx_,yx_,zx_),
CLHEP::Hep3Vector(xy_,yy_,zy_),
CLHEP::Hep3Vector(xz_,yz_,zz_));
}
inline
......@@ -52,10 +52,10 @@ Transform3D::getTranslation() const {
// I N L I N E S F O R R O T A T I O N
inline
Rotate3D::Rotate3D(const CLHEP::HepRotation & m) {
xx_= m.xx(); xy_= m.xy(); xz_= m.xz();
yx_= m.yx(); yy_= m.yy(); yz_= m.yz();
zx_= m.zx(); zy_= m.zy(); zz_= m.zz();
Rotate3D::Rotate3D(const CLHEP::HepRotation & mt) {
xx_= mt.xx(); xy_= mt.xy(); xz_= mt.xz();
yx_= mt.yx(); yy_= mt.yy(); yz_= mt.yz();
zx_= mt.zx(); zy_= mt.zy(); zz_= mt.zz();
dx_= 0; dy_= 0; dz_= 0;
}
......
......@@ -13,12 +13,9 @@
#include <iostream>
#include <cmath> // double std::abs()
#include <stdlib.h> // int std::abs()
#include "CLHEP/Geometry/defs.h"
#include "CLHEP/Geometry/Transform3D.h"
using std::abs;
namespace HepGeom {
const Transform3D Transform3D::Identity = Transform3D ();
......@@ -47,7 +44,7 @@ namespace HepGeom {
if (j == 2) { return 0.0; }
if (j == 3) { return 1.0; }
}
std::cerr << "Transform3D subscripting: bad indeces "
std::cerr << "Transform3D subscripting: bad indices "
<< "(" << i << "," << j << ")" << std::endl;
return 0.0;
}
......
......@@ -56,9 +56,8 @@ public:
MixMaxRng(std::istream& is);
MixMaxRng();
MixMaxRng(long seed);
MixMaxRng(int rowIndex, int colIndex);
~MixMaxRng();
// Constructor and destructor.
// Constructors and destructor.
MixMaxRng(const MixMaxRng& rng);
MixMaxRng& operator=(const MixMaxRng& rng);
......
......@@ -119,12 +119,6 @@ void MixMaxRng::saveStatus( const char filename[] ) const
}
}
#define MIXMAX_ARRAY_INDEX_OUT_OF_BOUNDS 0xFF01
#define MIXMAX_SEED_WAS_ZERO 0xFF02
#define MIXMAX_ERROR_READING_STATE_FILE 0xFF03
#define MIXMAX_ERROR_READING_STATE_COUNTER 0xFF04
#define MIXMAX_ERROR_READING_STATE_CHECKSUM 0xFF05
void MixMaxRng::restoreStatus( const char filename[] )
{
// a function for reading the state from a file
......@@ -140,7 +134,7 @@ void MixMaxRng::restoreStatus( const char filename[] )
else
{
fprintf(stderr, "mixmax -> read_state: error reading file %s\n", filename);
exit(MIXMAX_ERROR_READING_STATE_FILE);
throw std::runtime_error("Error in reading state file");
}
myuint_t vecVal;
......@@ -148,7 +142,7 @@ void MixMaxRng::restoreStatus( const char filename[] )
if (!fscanf(fin, "%llu", &S.V[0]) )
{
fprintf(stderr, "mixmax -> read_state: error reading file %s\n", filename);
exit(MIXMAX_ERROR_READING_STATE_FILE);
throw std::runtime_error("Error in reading state file");
}
int i;
......@@ -157,7 +151,7 @@ void MixMaxRng::restoreStatus( const char filename[] )
if (!fscanf(fin, ", %llu", &vecVal) )
{
fprintf(stderr, "mixmax -> read_state: error reading vector component i=%d from file %s\n", i, filename);
exit(MIXMAX_ERROR_READING_STATE_FILE);
throw std::runtime_error("Error in reading state file");
}
if( vecVal <= MixMaxRng::M61 )
{
......@@ -176,7 +170,7 @@ void MixMaxRng::restoreStatus( const char filename[] )
if (!fscanf( fin, "}; counter=%i; ", &counter))
{
fprintf(stderr, "mixmax -> read_state: error reading counter from file %s\n", filename);
exit(MIXMAX_ERROR_READING_STATE_FILE);
throw std::runtime_error("Error in reading state file");
}
if( counter <= rng_get_N() )
{
......@@ -187,30 +181,24 @@ void MixMaxRng::restoreStatus( const char filename[] )
fprintf(stderr, "mixmax -> read_state: Invalid counter = %d"
" Must be 0 <= counter < %u\n" , counter, rng_get_N());
print_state();
exit(MIXMAX_ERROR_READING_STATE_COUNTER);
throw std::runtime_error("Error in reading state counter");
}
precalc();
myuint_t sumtot;
if (!fscanf( fin, "sumtot=%llu\n", &sumtot))
{
fprintf(stderr, "mixmax -> read_state: error reading checksum from file %s\n", filename);
exit(MIXMAX_ERROR_READING_STATE_FILE);
throw std::runtime_error("Error in reading state file");
}
if (S.sumtot != sumtot)
{
fprintf(stderr, "mixmax -> checksum error while reading state from file %s - corrupted?\n", filename);
exit(MIXMAX_ERROR_READING_STATE_CHECKSUM);
throw std::runtime_error("Error in reading state checksum");
}
fclose(fin);
}
#undef MIXMAX_ARRAY_INDEX_OUT_OF_BOUNDS
#undef MIXMAX_SEED_WAS_ZERO
#undef MIXMAX_ERROR_READING_STATE_FILE
#undef MIXMAX_ERROR_READING_STATE_COUNTER
#undef MIXMAX_ERROR_READING_STATE_CHECKSUM
void MixMaxRng::showStatus() const
{
std::cout << std::endl;
......@@ -577,8 +565,6 @@ void MixMaxRng::seed_vielbein(unsigned int index)
S.counter = N; // set the counter to N if iteration should happen right away
S.sumtot = 1;
}
#define MIXMAX_SEED_WAS_ZERO 0xFF02
void MixMaxRng::seed_spbox(myuint_t seed)
{
......@@ -589,10 +575,6 @@ void MixMaxRng::seed_spbox(myuint_t seed)
myuint_t sumtot=0,ovflow=0;
if (seed == 0) throw std::runtime_error("try seeding with nonzero seed next time");
// {
//fprintf(stderr, " try seeding with nonzero seed next time!\n");
//exit(MIXMAX_SEED_WAS_ZERO);
// }
myuint_t l = seed;
......@@ -605,8 +587,6 @@ void MixMaxRng::seed_spbox(myuint_t seed)
S.sumtot = MIXMAX_MOD_MERSENNE(MIXMAX_MOD_MERSENNE(sumtot) + (ovflow <<3 ));
}
#undef MIXMAX_SEED_WAS_ZERO
void MixMaxRng::seed_uniquestream( myID_t clusterID, myID_t machineID, myID_t runID, myID_t streamID )
{
seed_vielbein(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment