Import Geant4 11.3.1 source tree

This commit is contained in:
Gabriele Cosmo
2025-03-24 16:45:22 +01:00
parent 32390e802b
commit df176550b3
388 changed files with 29491 additions and 29435 deletions
+4
View File
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-03-11 Gabriele Cosmo (field-V11-02-07)
- Added missing guard in G4TMagFieldEquation header and minor cleanup.
Fixes [GitHub PR #83](https://github.com/Geant4/geant4/pull/83).
## 2024-11-26 Ivana Hrivnacova (field-V11-02-06)
- Better names for the G4EquationType enum constants
@@ -27,31 +27,31 @@
//
// Class description:
//
// Templated version of equation of motion of a particle in a pure magnetic field.
// Templated version of equation of motion of a particle in a pure
// magnetic field.
// Enables use of inlined code for field, equation, stepper, driver,
// avoiding all virtual calls.
//
// Adapted from G4Mag_UsualEqRhs.hh
// Adapted from G4Mag_UsualEqRhs.
//
// Created: Josh Xie, Google Summer of Code 2014
// --------------------------------------------------------------------
// Created: Josh Xie (Google Summer of Code 2014 )
// Adapted from G4Mag_UsualEqRhs
//
// #include "G4ChargeState.hh"
#ifndef G4TMAGFIELD_EQUATION_HH
#define G4TMAGFIELD_EQUATION_HH
#include "G4Mag_UsualEqRhs.hh"
template
<class T_Field>
template <class T_Field>
class G4TMagFieldEquation : public G4Mag_UsualEqRhs
{
public:
G4TMagFieldEquation(T_Field* f)
: G4Mag_UsualEqRhs(f)
G4TMagFieldEquation(T_Field* f) : G4Mag_UsualEqRhs(f)
{
itsField = f;
itsField = f;
}
virtual ~G4TMagFieldEquation(){;}
virtual ~G4TMagFieldEquation() = default;
inline void GetFieldValue(const G4double Point[4],
G4double Field[]) const
@@ -79,7 +79,7 @@ class G4TMagFieldEquation : public G4Mag_UsualEqRhs
}
__attribute__((always_inline))
void RightHandSide(const G4double y[], G4double dydx[] )
void RightHandSide( const G4double y[], G4double dydx[] )
// const
{
G4double Field[G4maximum_number_of_field_components];
@@ -92,10 +92,12 @@ class G4TMagFieldEquation : public G4Mag_UsualEqRhs
TEvaluateRhsGivenB(y, Field, dydx);
}
private:
enum { G4maximum_number_of_field_components = 24 };
private:
// Dependent objects
T_Field *itsField;
enum { G4maximum_number_of_field_components = 24 };
// Dependent objects
T_Field* itsField;
};
#endif
+19
View File
@@ -6,6 +6,25 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-03-05 Gabriele Cosmo (geommng-V11-02-07)
- Applied clang-tidy to G4GeometryManager and some code cleanup.
Moved additional checks/warnings under verbosity level.
## 2025-03-03 Gabriele Cosmo
- In G4VSolid::EstimateCubicVolume(..), initialise local variable to zero
to silence invalid false positive warnings reported in compilation of CMSSW.
## 2025-02-25 John Apostolakis
- In G4GeometryManager, fix in ConfigureParallelOptimisation() to reset
logical volumes iterator; in ReportWorkerIsDoneOptimising(), added checks
to report fatal error if incorrect number of volumes was voxelised, and warns
if number of workers reporting is not as expected.
In ConfigureParallelOptimisation(), reports on the times it was called.
## 2025-02-03 Gabriele Cosmo
- G4UAdapter: removed fake default constructor, clearing compilation warnings
on gcc-14.
## 2024-08-26 Gabriele Cosmo (geommng-V11-02-06)
- G4GeometryManager: temporarily disable default parallel optimisation.
Fixed spelling for method OptimiseInParallel(..).
@@ -196,13 +196,6 @@ class G4UAdapter : public G4VSolid, protected UnplacedVolume_t
// Smart access function - creates on request and stores for future
// access. A null pointer means "not available".
public: // without description
G4UAdapter(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UAdapter(const G4UAdapter& rhs);
G4UAdapter& operator=(const G4UAdapter& rhs);
// Copy constructor and assignment operator.
@@ -257,13 +250,6 @@ class G4UAdapter : public G4VSolid, protected UnplacedVolume_t
// Inline implementations
template <class UnplacedVolume_t>
G4UAdapter<UnplacedVolume_t>::G4UAdapter(__void__& a)
: G4VSolid(a), UnplacedVolume_t(*this),
kHalfTolerance(0.5*kCarTolerance)
{
}
template <class UnplacedVolume_t>
G4UAdapter<UnplacedVolume_t>::~G4UAdapter()
{
@@ -113,7 +113,7 @@ G4GeometryManager::~G4GeometryManager()
fgInstance = nullptr;
fIsClosed = false;
if( fWallClockTimer && G4Threading::IsMasterThread() )
if( (fWallClockTimer != nullptr) && G4Threading::IsMasterThread() )
{
delete fWallClockTimer;
fWallClockTimer= nullptr;
@@ -240,11 +240,9 @@ G4bool G4GeometryManager::BuildOptimisations(G4bool allOpts, G4bool verbose)
fOptimiseInParallelConfigured = fParallelVoxelOptimisationRequested
&& G4Threading::IsMultithreadedApplication();
static unsigned int NumCallsBuildOptimisations = 0; // WORKAROUND - TODO fix
if( fOptimiseInParallelConfigured && (NumCallsBuildOptimisations==0) )
if( fOptimiseInParallelConfigured )
{
PrepareParallelOptimisation(allOpts, verbose);
++NumCallsBuildOptimisations;
}
else
{
@@ -285,7 +283,7 @@ void G4GeometryManager::BuildOptimisationsSequential(G4bool allOpts,
for (auto & n : *Store)
{
if (verbose) timer.Start();
if (verbose) { timer.Start(); }
volume=n;
// For safety, check if there are any existing voxels and
// delete before replacement
@@ -374,7 +372,7 @@ void
G4GeometryManager::CreateListOfVolumesToOptimise(G4bool allOpts, G4bool verbose)
{
// Prepare the work - must be called only in one thread !!
G4LogicalVolumeStore* Store = G4LogicalVolumeStore::GetInstance();
if( !fVolumesToOptimise.empty() )
@@ -416,9 +414,11 @@ G4GeometryManager::CreateListOfVolumesToOptimise(G4bool allOpts, G4bool verbose)
}
if(verbose)
G4cout << "** G4GeometryManager::PrepareOptimisationWork: "
{
G4cout << "** G4GeometryManager::CreateListOfVolumesToOptimise: "
<< " Number of volumes for voxelisation = "
<< fVolumesToOptimise.size() << G4endl;
}
fLogVolumeIterator = fVolumesToOptimise.cbegin();
}
@@ -482,9 +482,13 @@ void G4GeometryManager::RequestParallelOptimisation(G4bool flag, G4bool verbose)
//
void G4GeometryManager::ConfigureParallelOptimisation(G4bool verbose)
{
static G4ThreadLocal unsigned int numCallsConfig = 0;
++numCallsConfig;
if(verbose)
{
G4cout << "** G4GeometryManager::ConfigureParallelOptimisation() called. "
G4cout << "** G4GeometryManager::ConfigureParallelOptimisation() called "
<< " for the " << numCallsConfig << " time. "
<< " LEAVING all the work (of voxel optimisation) to the threads/tasks !"
<< G4endl;
}
@@ -501,6 +505,9 @@ void G4GeometryManager::ConfigureParallelOptimisation(G4bool verbose)
fTotalNumberVolumesOptimised = 0; // Number of volumes done
fWallClockStarted = false; // Will need to restart it!
fLogVolumeIterator = fVolumesToOptimise.cbegin();
// Reset the iterator -- else to be sure that work is done correctly
}
// ***************************************************************************
@@ -528,8 +535,8 @@ void G4GeometryManager::UndertakeOptimisation()
G4bool verbose = fVerboseParallel;
G4LogicalVolume* logVolume = nullptr;
fParallelVoxelOptimisationUnderway = true;
fParallelVoxelOptimisationUnderway = true;
// Start timer - if not already done
if( ( !fWallClockStarted ) && verbose )
{
@@ -546,7 +553,7 @@ void G4GeometryManager::UndertakeOptimisation()
while( (logVolume = ObtainVolumeToOptimise()) != nullptr )
{
if (verbose) fetimer.Start();
if (verbose) { fetimer.Start(); }
G4SmartVoxelHeader* head = logVolume->GetVoxelHeader();
delete head;
@@ -601,7 +608,7 @@ void G4GeometryManager::UndertakeOptimisation()
<< "but found that voxels headers are missing in "
<< badVolumes << " volumes.";
G4Exception("G4GeometryManager::UndertakeOptimisation()",
"GeomMng002", FatalException, errmsg);
"GeomMgt002", FatalException, errmsg);
}
// Create report
@@ -688,18 +695,80 @@ G4int G4GeometryManager::CheckOptimisation()
// ***************************************************************************
//
G4int
G4GeometryManager::ReportWorkerIsDoneOptimising(unsigned int numVolumesOptimised)
G4GeometryManager::ReportWorkerIsDoneOptimising(unsigned int nVolOptimised)
{
// Check that all are done and, if so, signal that optimisation is finished
G4int orderReporting;
G4AutoLock lock(statResultsMutex);
orderReporting = ++fNumberThreadsReporting;
fTotalNumberVolumesOptimised += numVolumesOptimised;
fTotalNumberVolumesOptimised += nVolOptimised;
if (fNumberThreadsReporting == G4Threading::GetNumberOfRunningWorkerThreads())
if( fVerboseParallel )
{
InformOptimisationIsFinished(fVerboseParallel);
std::cout << "G4GeometryManager: the " << orderReporting
<< " worker has finished. "
<< " Total volumes voxelised = "
<< fTotalNumberVolumesOptimised
<< " out of " << fVolumesToOptimise.size() << G4endl;
}
if ( fNumberThreadsReporting == G4Threading::GetNumberOfRunningWorkerThreads()
|| fTotalNumberVolumesOptimised == fVolumesToOptimise.size() )
{
const auto TotalThreads = G4Threading::GetNumberOfRunningWorkerThreads();
auto tid= G4Threading::G4GetThreadId();
// -- Some Checks
if( fTotalNumberVolumesOptimised != fVolumesToOptimise.size() )
{
G4ExceptionDescription errmsg;
errmsg << " [thread " << tid << " ] "
<< " ERROR: Number of volumes 'voxelised' = "
<< fTotalNumberVolumesOptimised
<< " is not equal to the total number requested "
<< fVolumesToOptimise.size() << " !! " << G4endl;
G4Exception("G4GeometryManager::ReportWorkerIsDoneOptimising()",
"GeomMgt0003", FatalException, errmsg);
}
if( fVerboseParallel )
{
if( fNumberThreadsReporting > TotalThreads )
{
G4ExceptionDescription errmsg;
errmsg << " [thread " << tid << " ] "
<< " WARNING: Number of threads 'reporting' = "
<< fNumberThreadsReporting
<< " exceeds the total number of threads "
<< TotalThreads << " !! " << G4endl
<< " *Missed* calling ConfigureParallelOptimisation() to reset. ";
G4Exception("G4GeometryManager::ReportWorkerIsDoneOptimising()",
"GeomMgt1002", JustWarning, errmsg);
}
else
{
if( fTotalNumberVolumesOptimised == fVolumesToOptimise.size()
&& ( fNumberThreadsReporting < TotalThreads ) )
{
G4ExceptionDescription errmsg;
errmsg << " [thread " << tid << " ] "
<< " WARNING: All volumes optimised, yet only "
<< fNumberThreadsReporting << " threads reported out of "
<< TotalThreads;
G4Exception("G4GeometryManager::ReportWorkerIsDoneOptimising()",
"GeomMgt1002", JustWarning, errmsg);
}
}
}
// -- End of Checks
// Report the end
if( fNumberThreadsReporting <= G4Threading::GetNumberOfRunningWorkerThreads() )
{
// Close the work, and (if verbosity is on) report statistics
InformOptimisationIsFinished(fVerboseParallel);
}
}
return orderReporting;
@@ -859,8 +928,7 @@ void G4GeometryManager::SetWorldMaximumExtent(G4double extent)
//
void
G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
G4double totalCpuTime,
std::ostream &os )
G4double totalCpuTime, std::ostream &os )
{
os << "--------------------------------------------------------------------------------"
<< G4endl;
+32 -31
View File
@@ -218,7 +218,8 @@ G4double G4VSolid::GetCubicVolume()
G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const
{
G4int iInside=0;
G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume,halfepsilon;
G4double px, py, pz, volume, halfepsilon;
G4double minX=0., maxX=0., minY=0., maxY=0., minZ=0., maxZ=0.;
G4ThreeVector p;
EInside in;
@@ -235,8 +236,8 @@ G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const
// limits
if(nStat < 100) nStat = 100;
if(epsilon > 0.01) epsilon = 0.01;
if(nStat < 100) { nStat = 100; }
if(epsilon > 0.01) { epsilon = 0.01; }
halfepsilon = 0.5*epsilon;
for(auto i = 0; i < nStat; ++i )
@@ -246,7 +247,7 @@ G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const
pz = minZ-halfepsilon+(maxZ-minZ+epsilon)*G4QuickRand();
p = G4ThreeVector(px,py,pz);
in = Inside(p);
if(in != kOutside) ++iInside;
if(in != kOutside) { ++iInside; }
}
volume = (maxX-minX+epsilon)*(maxY-minY+epsilon)
* (maxZ-minZ+epsilon)*iInside/nStat;
@@ -360,15 +361,15 @@ G4double G4VSolid::EstimateSurfaceArea(G4int nstat, G4double ell) const
G4double dist = 0;
if (in == kInside)
{
if (DistanceToOut(p) >= eps) continue;
if (DistanceToOut(p) >= eps) { continue; }
G4int icase = 0;
if (Inside(G4ThreeVector(px-del, py, pz)) != kInside) icase += 1;
if (Inside(G4ThreeVector(px+del, py, pz)) != kInside) icase += 2;
if (Inside(G4ThreeVector(px, py-del, pz)) != kInside) icase += 4;
if (Inside(G4ThreeVector(px, py+del, pz)) != kInside) icase += 8;
if (Inside(G4ThreeVector(px, py, pz-del)) != kInside) icase += 16;
if (Inside(G4ThreeVector(px, py, pz+del)) != kInside) icase += 32;
if (icase == 0) continue;
if (Inside(G4ThreeVector(px-del, py, pz)) != kInside) { icase += 1; }
if (Inside(G4ThreeVector(px+del, py, pz)) != kInside) { icase += 2; }
if (Inside(G4ThreeVector(px, py-del, pz)) != kInside) { icase += 4; }
if (Inside(G4ThreeVector(px, py+del, pz)) != kInside) { icase += 8; }
if (Inside(G4ThreeVector(px, py, pz-del)) != kInside) { icase += 16; }
if (Inside(G4ThreeVector(px, py, pz+del)) != kInside) { icase += 32; }
if (icase == 0) { continue; }
G4ThreeVector v = directions[icase];
dist = DistanceToOut(p, v);
G4ThreeVector n = SurfaceNormal(p + v*dist);
@@ -376,22 +377,22 @@ G4double G4VSolid::EstimateSurfaceArea(G4int nstat, G4double ell) const
}
else if (in == kOutside)
{
if (DistanceToIn(p) >= eps) continue;
if (DistanceToIn(p) >= eps) { continue; }
G4int icase = 0;
if (Inside(G4ThreeVector(px-del, py, pz)) != kOutside) icase += 1;
if (Inside(G4ThreeVector(px+del, py, pz)) != kOutside) icase += 2;
if (Inside(G4ThreeVector(px, py-del, pz)) != kOutside) icase += 4;
if (Inside(G4ThreeVector(px, py+del, pz)) != kOutside) icase += 8;
if (Inside(G4ThreeVector(px, py, pz-del)) != kOutside) icase += 16;
if (Inside(G4ThreeVector(px, py, pz+del)) != kOutside) icase += 32;
if (icase == 0) continue;
if (Inside(G4ThreeVector(px-del, py, pz)) != kOutside) { icase += 1; }
if (Inside(G4ThreeVector(px+del, py, pz)) != kOutside) { icase += 2; }
if (Inside(G4ThreeVector(px, py-del, pz)) != kOutside) { icase += 4; }
if (Inside(G4ThreeVector(px, py+del, pz)) != kOutside) { icase += 8; }
if (Inside(G4ThreeVector(px, py, pz-del)) != kOutside) { icase += 16; }
if (Inside(G4ThreeVector(px, py, pz+del)) != kOutside) { icase += 32; }
if (icase == 0) { continue; }
G4ThreeVector v = directions[icase];
dist = DistanceToIn(p, v);
if (dist == kInfinity) continue;
if (dist == kInfinity) { continue; }
G4ThreeVector n = SurfaceNormal(p + v*dist);
dist *= -(v.dot(n));
}
if (dist < eps) ++icount;
if (dist < eps) { ++icount; }
}
return dX*dY*dZ*icount/npoints/dd;
}
@@ -567,14 +568,14 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
pPolygon.clear();
if ( outputPolygon.empty() ) return;
if ( outputPolygon.empty() ) { return; }
G4VoxelLimits simpleLimit2;
simpleLimit2.AddLimit(kXAxis,-kInfinity,pVoxelLimit.GetMaxXExtent());
ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
if ( pPolygon.empty() ) return;
else outputPolygon.clear();
if ( pPolygon.empty() ) { return; }
outputPolygon.clear();
}
if ( pVoxelLimit.IsYLimited() ) // && pAxis != kYAxis)
{
@@ -587,14 +588,14 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
pPolygon.clear();
if ( outputPolygon.empty() ) return;
if ( outputPolygon.empty() ) { return; }
G4VoxelLimits simpleLimit2;
simpleLimit2.AddLimit(kYAxis,-kInfinity,pVoxelLimit.GetMaxYExtent());
ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
if ( pPolygon.empty() ) return;
else outputPolygon.clear();
if ( pPolygon.empty() ) { return; }
outputPolygon.clear();
}
if ( pVoxelLimit.IsZLimited() ) // && pAxis != kZAxis)
{
@@ -607,7 +608,7 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
pPolygon.clear();
if ( outputPolygon.empty() ) return;
if ( outputPolygon.empty() ) { return; }
G4VoxelLimits simpleLimit2;
simpleLimit2.AddLimit(kZAxis,-kInfinity,pVoxelLimit.GetMaxZExtent());
@@ -635,8 +636,8 @@ G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
for (i = 0 ; i < noVertices ; ++i )
{
vStart = pPolygon[i];
if ( i == noVertices-1 ) vEnd = pPolygon[0];
else vEnd = pPolygon[i+1];
if ( i == noVertices-1 ) { vEnd = pPolygon[0]; }
else { vEnd = pPolygon[i+1]; }
if ( pVoxelLimit.Inside(vStart) )
{
+8
View File
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-03-04 Ben Morgan (geom-csg-V11-02-04)
- Hide all ENorm/ESide enums in anonymous namespaces to prevent ODR warnings.
- Identified in ATLAS Athena code built against v11.3.0.
## 2025-02-03 Gabriele Cosmo
- Removed fake default constructor from G4U* wrappers, clearing compilation
warnings on gcc-14.
## 2024-05-29 Evgueni Tcherniaev (geom-csg-V11-02-03)
- Added new methods GetNumOfConstituents() and IsFaceted().
@@ -189,15 +189,6 @@ class G4Cons : public G4CSGSolid
// specification for points not on the surface
private:
// Used by distanceToOut
//
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
// used by normal
//
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
@@ -201,15 +201,6 @@ class G4Sphere : public G4CSGSolid
// specification for points not on the surface
private:
// Used by distanceToOut
//
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kSTheta,kETheta};
// used by normal
//
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNSTheta,kNETheta};
G4double fRminTolerance, fRmaxTolerance, kAngTolerance,
kRadTolerance, fEpsilon = 2.e-11;
//
@@ -183,11 +183,7 @@ class G4Torus : public G4CSGSolid
G4double fRmin,fRmax,fRtor,fSPhi,fDPhi;
// Used by distanceToOut
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi};
// used by normal
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi};
G4double fRminTolerance, fRmaxTolerance, kRadTolerance, kAngTolerance;
// Radial and angular tolerances
@@ -190,14 +190,6 @@ class G4Tubs : public G4CSGSolid
protected:
// Used by distanceToOut
//
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
// Used by normal
//
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
+2 -9
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Box to make use of VecGeom Box.
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UBOX_HH
#define G4UBOX_HH
@@ -47,7 +47,7 @@ class G4UBox : public G4UAdapter<vecgeom::UnplacedBox>
using Shape_t = vecgeom::UnplacedBox;
using Base_t = G4UAdapter<vecgeom::UnplacedBox>;
public: // with description
public:
G4UBox(const G4String& pName, G4double pX, G4double pY, G4double pZ);
// Constructs a box with name, and half lengths pX,pY,pZ
@@ -81,13 +81,6 @@ class G4UBox : public G4UAdapter<vecgeom::UnplacedBox>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4UBox(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UBox(const G4UBox& rhs);
G4UBox& operator=(const G4UBox& rhs);
// Copy constructor and assignment operator.
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Cons to make use of VecGeom Cone.
// 30.10.13 G.Cosmo, CERN/PH
// 30.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UCONS_HH
#define G4UCONS_HH
@@ -47,7 +47,7 @@ class G4UCons : public G4UAdapter<vecgeom::GenericUnplacedCone>
using Shape_t = vecgeom::GenericUnplacedCone;
using Base_t = G4UAdapter<vecgeom::GenericUnplacedCone>;
public: // with description
public:
G4UCons(const G4String& pName,
G4double pRmin1, G4double pRmax1,
@@ -95,13 +95,6 @@ class G4UCons : public G4UAdapter<vecgeom::GenericUnplacedCone>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4UCons(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UCons(const G4UCons& rhs);
G4UCons& operator=(const G4UCons& rhs);
// Copy constructor and assignment operator.
@@ -29,7 +29,7 @@
//
// Wrapper class for G4CutTubs to make use of VecGeom CutTube.
// 07.07.17 G.Cosmo, CERN/PH
// 07.07.17 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UCUTTUBS_HH
#define G4UCUTTUBS_HH
@@ -47,7 +47,7 @@ class G4UCutTubs : public G4UAdapter<vecgeom::UnplacedCutTube>
using Shape_t = vecgeom::UnplacedCutTube;
using Base_t = G4UAdapter<vecgeom::UnplacedCutTube>;
public: // with description
public:
G4UCutTubs( const G4String& pName,
G4double pRMin,
@@ -92,13 +92,6 @@ class G4UCutTubs : public G4UAdapter<vecgeom::UnplacedCutTube>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4UCutTubs(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UCutTubs(const G4UCutTubs& rhs);
G4UCutTubs& operator=(const G4UCutTubs& rhs);
// Copy constructor and assignment operator.
+2 -9
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Orb to make use of VecGeom Orb.
// 30.10.13 G.Cosmo, CERN/PH
// 30.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UORB_HH
#define G4UORB_HH
@@ -47,7 +47,7 @@ class G4UOrb : public G4UAdapter<vecgeom::UnplacedOrb>
using Shape_t = vecgeom::UnplacedOrb;
using Base_t = G4UAdapter<vecgeom::UnplacedOrb>;
public: // with description
public:
G4UOrb(const G4String& pName, G4double pRmax);
@@ -74,13 +74,6 @@ class G4UOrb : public G4UAdapter<vecgeom::UnplacedOrb>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4UOrb(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UOrb(const G4UOrb& rhs);
G4UOrb& operator=(const G4UOrb& rhs);
// Copy constructor and assignment operator.
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Para to make use of VecGeom Parallelepiped.
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UPARA_HH
#define G4UPARA_HH
@@ -47,7 +47,7 @@ class G4UPara : public G4UAdapter<vecgeom::UnplacedParallelepiped>
using Shape_t = vecgeom::UnplacedParallelepiped;
using Base_t = G4UAdapter<vecgeom::UnplacedParallelepiped>;
public: // with description
public:
G4UPara(const G4String& pName,
G4double pDx, G4double pDy, G4double pDz,
@@ -102,13 +102,6 @@ class G4UPara : public G4UAdapter<vecgeom::UnplacedParallelepiped>
G4Polyhedron* CreatePolyhedron () const override;
public: // without description
G4UPara(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects
G4UPara(const G4UPara& rhs);
G4UPara& operator=(const G4UPara& rhs);
// Copy constructor and assignment operator
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Sphere to make use of VecGeom Sphere.
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4USPHERE_HH
#define G4USPHERE_HH
@@ -47,7 +47,7 @@ class G4USphere : public G4UAdapter<vecgeom::UnplacedSphere>
using Shape_t = vecgeom::UnplacedSphere;
using Base_t = G4UAdapter<vecgeom::UnplacedSphere>;
public: // with description
public:
G4USphere(const G4String& pName,
G4double pRmin, G4double pRmax,
@@ -97,14 +97,6 @@ class G4USphere : public G4UAdapter<vecgeom::UnplacedSphere>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4USphere(__void__&);
//
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4USphere(const G4USphere& rhs);
G4USphere& operator=(const G4USphere& rhs);
// Copy constructor and assignment operator.
@@ -47,7 +47,7 @@ class G4UTorus : public G4UAdapter<vecgeom::UnplacedTorus2>
using Shape_t = vecgeom::UnplacedTorus2;
using Base_t = G4UAdapter<vecgeom::UnplacedTorus2>;
public: // with description
public:
G4UTorus(const G4String& pName,
G4double rmin, G4double rmax, G4double rtor,
@@ -92,13 +92,6 @@ class G4UTorus : public G4UAdapter<vecgeom::UnplacedTorus2>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4UTorus(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UTorus(const G4UTorus& rhs);
G4UTorus& operator=(const G4UTorus& rhs);
// Copy constructor and assignment operator.
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Trap to make use of VecGeom Trapezoid.
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UTRAP_HH
#define G4UTRAP_HH
@@ -47,7 +47,7 @@ class G4UTrap : public G4UAdapter<vecgeom::UnplacedTrapezoid>
using Shape_t = vecgeom::UnplacedTrapezoid;
using Base_t = G4UAdapter<vecgeom::UnplacedTrapezoid>;
public: // with description
public:
G4UTrap( const G4String& pName,
G4double pDz,
@@ -143,13 +143,6 @@ class G4UTrap : public G4UAdapter<vecgeom::UnplacedTrapezoid>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4UTrap(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UTrap(const G4UTrap& rhs);
G4UTrap& operator=(const G4UTrap& rhs);
// Copy constructor and assignment operator.
+2 -9
View File
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Trd to make use of VecGeom Trd.
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UTRD_HH
#define G4UTRD_HH
@@ -47,7 +47,7 @@ class G4UTrd : public G4UAdapter<vecgeom::GenericUnplacedTrd>
using Shape_t = vecgeom::GenericUnplacedTrd;
using Base_t = G4UAdapter<vecgeom::GenericUnplacedTrd>;
public: // with description
public:
G4UTrd(const G4String& pName,
G4double pdx1, G4double pdx2,
@@ -91,13 +91,6 @@ class G4UTrd : public G4UAdapter<vecgeom::GenericUnplacedTrd>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4UTrd(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UTrd(const G4UTrd& rhs);
G4UTrd& operator=(const G4UTrd& rhs);
// Copy constructor and assignment operator.
@@ -29,7 +29,7 @@
//
// Wrapper class for G4Tubs to make use of VecGeom Tube.
// 30.10.13 G.Cosmo, CERN/PH
// 30.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UTUBS_HH
#define G4UTUBS_HH
@@ -47,7 +47,7 @@ class G4UTubs : public G4UAdapter<vecgeom::GenericUnplacedTube>
using Shape_t = vecgeom::GenericUnplacedTube;
using Base_t = G4UAdapter<vecgeom::GenericUnplacedTube>;
public: // with description
public:
G4UTubs( const G4String& pName,
G4double pRMin,
@@ -92,13 +92,6 @@ class G4UTubs : public G4UAdapter<vecgeom::GenericUnplacedTube>
G4Polyhedron* CreatePolyhedron() const override;
public: // without description
G4UTubs(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UTubs(const G4UTubs& rhs);
G4UTubs& operator=(const G4UTubs& rhs);
// Copy constructor and assignment operator.
+4 -4
View File
@@ -56,14 +56,14 @@
using namespace CLHEP;
// Private enum: Not for external use - used by distanceToOut
// Private enums: Not for external use
namespace {
// used by distanceToOut
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kSTheta,kETheta};
// used by normal
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNSTheta,kNETheta};
}
////////////////////////////////////////////////////////////////////////
//
// constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
+78 -69
View File
@@ -57,6 +57,15 @@
using namespace CLHEP;
// Private enums: Not for external use
namespace {
// Used by distanceToOut
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi};
// used by normal
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi};
}
///////////////////////////////////////////////////////////////
//
// Constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
@@ -147,7 +156,7 @@ G4Torus::SetAllParameters( G4double pRmin,
"GeomSolids0002", FatalException, message);
}
}
// Ensure psphi in 0-2PI or -2PI-0 range if shape crosses 0
//
fSPhi = pSPhi;
@@ -184,7 +193,7 @@ G4Torus::G4Torus(const G4Torus&) = default;
//
// Assignment operator
G4Torus& G4Torus::operator = (const G4Torus& rhs)
G4Torus& G4Torus::operator = (const G4Torus& rhs)
{
// Check assignment to self
//
@@ -222,7 +231,7 @@ void G4Torus::ComputeDimensions( G4VPVParameterisation* p,
////////////////////////////////////////////////////////////////////////////////
//
// Calculate the real roots to torus surface.
// Calculate the real roots to torus surface.
// Returns negative solutions as well.
void G4Torus::TorusRootsJT( const G4ThreeVector& p,
@@ -249,11 +258,11 @@ void G4Torus::TorusRootsJT( const G4ThreeVector& p,
G4JTPolynomialSolver torusEq;
num = torusEq.FindRoots( c, 4, srd, si );
for ( i = 0; i < num; ++i )
for ( i = 0; i < num; ++i )
{
if( si[i] == 0. ) { roots.push_back(srd[i]) ; } // store real roots
}
}
std::sort(roots.begin() , roots.end() ) ; // sorting with <
}
@@ -261,7 +270,7 @@ void G4Torus::TorusRootsJT( const G4ThreeVector& p,
//////////////////////////////////////////////////////////////////////////////
//
// Interface for DistanceToIn and DistanceToOut.
// Calls TorusRootsJT and returns the smalles possible distance to
// Calls TorusRootsJT and returns the smalles possible distance to
// the surface.
// Attention: Difference in DistanceToIn/Out for points p on the surface.
@@ -304,18 +313,18 @@ G4double G4Torus::SolveNumericJT( const G4ThreeVector& p,
ptmp = p + t*v ; // calculate the position of the proposed intersection
G4double theta = std::atan2(ptmp.y(),ptmp.x());
if ( fSPhi >= 0 )
{
if ( theta < - halfAngTolerance ) { theta += twopi; }
if ( (std::fabs(theta) < halfAngTolerance)
&& (std::fabs(fSPhi + fDPhi - twopi) < halfAngTolerance) )
{
{
theta += twopi ; // 0 <= theta < 2pi
}
}
if ((fSPhi <= -pi )&&(theta>halfAngTolerance)) { theta = theta-twopi; }
// We have to verify if this root is inside the region between
// fSPhi and fSPhi + fDPhi
//
@@ -350,7 +359,7 @@ G4double G4Torus::SolveNumericJT( const G4ThreeVector& p,
{
if (std::fabs(t) < halfCarTolerance )
{
// compute scalar product at position p : v.n
// compute scalar product at position p : v.n
//
scal = v* G4ThreeVector( p.x()*(1-fRtor/std::hypot(p.x(),p.y())),
p.y()*(1-fRtor/std::hypot(p.x(),p.y())),
@@ -578,7 +587,7 @@ EInside G4Torus::Inside( const G4ThreeVector& p ) const
else tolRMin = 0 ;
tolRMax = fRmax - fRmaxTolerance;
if (pt2 >= tolRMin*tolRMin && pt2 <= tolRMax*tolRMax )
{
if ( fDPhi == twopi || pt2 == 0 ) // on torus swept axis
@@ -597,7 +606,7 @@ EInside G4Torus::Inside( const G4ThreeVector& p ) const
{
if ( (std::fabs(pPhi) < halfAngTolerance)
&& (std::fabs(fSPhi + fDPhi - twopi) < halfAngTolerance) )
{
{
pPhi += twopi ; // 0 <= pPhi < 2pi
}
if ( (pPhi >= fSPhi + halfAngTolerance)
@@ -644,7 +653,7 @@ EInside G4Torus::Inside( const G4ThreeVector& p ) const
{
if ( (std::fabs(pPhi) < halfAngTolerance)
&& (std::fabs(fSPhi + fDPhi - twopi) < halfAngTolerance) )
{
{
pPhi += twopi ; // 0 <= pPhi < 2pi
}
if ( (pPhi >= fSPhi - halfAngTolerance)
@@ -676,7 +685,7 @@ EInside G4Torus::Inside( const G4ThreeVector& p ) const
G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
{
G4int noSurfaces = 0;
G4int noSurfaces = 0;
G4double rho, pt, pPhi;
G4double distRMin = kInfinity;
G4double distSPhi = kInfinity, distEPhi = kInfinity;
@@ -719,7 +728,7 @@ G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
}
nPs = G4ThreeVector(std::sin(fSPhi),-std::cos(fSPhi),0);
nPe = G4ThreeVector(-std::sin(fSPhi+fDPhi),std::cos(fSPhi+fDPhi),0);
}
}
if( distRMax <= delta )
{
++noSurfaces;
@@ -741,7 +750,7 @@ G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
++noSurfaces;
sumnorm += nPs;
}
if (distEPhi <= dAngle)
if (distEPhi <= dAngle)
{
++noSurfaces;
sumnorm += nPe;
@@ -754,7 +763,7 @@ G4ThreeVector G4Torus::SurfaceNormal( const G4ThreeVector& p ) const
ed.precision(16);
EInside inIt= Inside( p );
if( inIt != kSurface )
{
ed << " ERROR> Surface Normal was called for Torus,"
@@ -818,7 +827,7 @@ G4ThreeVector G4Torus::ApproxSurfaceNormal( const G4ThreeVector& p ) const
G4cout << " G4Torus::ApproximateSurfaceNormal called for point " << p
<< G4endl;
#endif
distRMax = std::fabs(pt - fRmax) ;
if(fRmin != 0.0) // First minimum radius
@@ -840,7 +849,7 @@ G4ThreeVector G4Torus::ApproxSurfaceNormal( const G4ThreeVector& p ) const
{
distMin = distRMax ;
side = kNRMax ;
}
}
if ( (fDPhi < twopi) && (rho != 0.0) )
{
phi = std::atan2(p.y(),p.x()) ; // Protected against (0,0,z) (above rho!=0)
@@ -860,7 +869,7 @@ G4ThreeVector G4Torus::ApproxSurfaceNormal( const G4ThreeVector& p ) const
{
if (distEPhi < distMin) { side = kNEPhi ; }
}
}
}
switch (side)
{
case kNRMin: // Inner radius
@@ -885,7 +894,7 @@ G4ThreeVector G4Torus::ApproxSurfaceNormal( const G4ThreeVector& p ) const
"GeomSolids1002", JustWarning,
"Undefined side for valid surface normal to solid.");
break ;
}
}
return norm ;
}
@@ -894,7 +903,7 @@ G4ThreeVector G4Torus::ApproxSurfaceNormal( const G4ThreeVector& p ) const
// Calculate distance to shape from outside, along normalised vector
// - return kInfinity if no intersection, or intersection distance <= tolerance
//
// - Compute the intersection with the z planes
// - Compute the intersection with the z planes
// - if at valid r, phi, return
//
// -> If point is outer outer radius, compute intersection with rmax
@@ -934,7 +943,7 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
// Calculate safety distance to bounding box
// If point is too far, move it closer and calculate distance
//
G4double Dmax = 32*boxMax;
G4double Dmax = 32*boxMax;
G4double safe = std::max(std::max(distX,distY),distZ);
if (safe > Dmax)
{
@@ -1047,7 +1056,7 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
sinEPhi=std::sin(ePhi);
cosEPhi=std::cos(ePhi);
Comp=-(v.x()*sinEPhi-v.y()*cosEPhi);
if ( Comp < 0 ) // Component in outwards normal dirn
{
Dist = -(p.y()*cosEPhi - p.x()*sinEPhi) ;
@@ -1059,7 +1068,7 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
if (sphi < snxt )
{
if (sphi < 0 ) { sphi = 0 ; }
xi = p.x() + sphi*v.x() ;
yi = p.y() + sphi*v.y() ;
zi = p.z() + sphi*v.z() ;
@@ -1072,7 +1081,7 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p,
// with correct half-plane
//
if ((yi*cosCPhi-xi*sinCPhi)>=0) { snxt=sphi; }
}
}
}
}
}
@@ -1094,7 +1103,7 @@ G4double G4Torus::DistanceToIn( const G4ThreeVector& p ) const
G4double safe=0.0, safe1, safe2 ;
G4double phiC, cosPhiC, sinPhiC, safePhi, ePhi, cosPsi ;
G4double rho, pt ;
rho = std::hypot(p.x(),p.y());
pt = std::hypot(p.z(),rho-fRtor);
safe1 = fRmin - pt ;
@@ -1155,18 +1164,18 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
#if 1
// This is the version with the calculation of CalcNorm = true
// This is the version with the calculation of CalcNorm = true
// To be done: Check the precision of this calculation.
// If you want return always validNorm = false, then take the version below
G4double rho = std::hypot(p.x(),p.y());
G4double pt = hypot(p.z(),rho-fRtor);
G4double pDotV = p.x()*v.x() + p.y()*v.y() + p.z()*v.z() ;
G4double tolRMax = fRmax - fRmaxTolerance ;
G4double vDotNmax = pDotV - fRtor*(v.x()*p.x() + v.y()*p.y())/rho ;
G4double pDotxyNmax = (1 - fRtor/rho) ;
@@ -1175,19 +1184,19 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
// On tolerant boundary & heading outwards (or perpendicular to) outer
// radial surface -> leaving immediately with *n for really convex part
// only
if ( calcNorm && (pDotxyNmax >= -2.*fRmaxTolerance) )
if ( calcNorm && (pDotxyNmax >= -2.*fRmaxTolerance) )
{
*n = G4ThreeVector( p.x()*(1 - fRtor/rho)/pt,
p.y()*(1 - fRtor/rho)/pt,
p.z()/pt ) ;
*validNorm = true ;
}
return snxt = 0 ; // Leaving by Rmax immediately
}
snxt = SolveNumericJT(p,v,fRmax,false);
snxt = SolveNumericJT(p,v,fRmax,false);
side = kRMax ;
// rmin
@@ -1201,7 +1210,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
if (calcNorm) { *validNorm = false ; } // Concave surface of the torus
return snxt = 0 ; // Leaving by Rmin immediately
}
sd[0] = SolveNumericJT(p,v,fRmin,false);
if ( sd[0] < snxt )
{
@@ -1215,7 +1224,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
// this is the "conservative" version which return always validnorm = false
// NOTE: using this version the unit test testG4Torus will break
snxt = SolveNumericJT(p,v,fRmax,false);
snxt = SolveNumericJT(p,v,fRmax,false);
side = kRMax ;
if ( fRmin )
@@ -1235,7 +1244,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
}
#endif
if (fDPhi < twopi) // Phi Intersections
{
sinSPhi = std::sin(fSPhi) ;
@@ -1246,12 +1255,12 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
cPhi = fSPhi + fDPhi*0.5 ;
sinCPhi = std::sin(cPhi) ;
cosCPhi = std::cos(cPhi) ;
// angle calculation with correction
// angle calculation with correction
// of difference in domain of atan2 and Sphi
//
vphi = std::atan2(v.y(),v.x()) ;
if ( vphi < fSPhi - halfAngTolerance ) { vphi += twopi; }
else if ( vphi > ePhi + halfAngTolerance ) { vphi -= twopi; }
@@ -1265,7 +1274,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
compS = -sinSPhi*v.x() + cosSPhi*v.y() ;
compE = sinEPhi*v.x() - cosEPhi*v.y() ;
sidephi = kNull ;
if( ( (fDPhi <= pi) && ( (pDistS <= halfCarTolerance)
&& (pDistE <= halfCarTolerance) ) )
|| ( (fDPhi > pi) && ((pDistS <= halfCarTolerance)
@@ -1276,12 +1285,12 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
if ( compS < 0 )
{
sphi = pDistS/compS ;
if (sphi >= -halfCarTolerance)
{
xi = p.x() + sphi*v.x() ;
yi = p.y() + sphi*v.y() ;
// Check intersecting with correct half-plane
// (if not -> no intersect)
//
@@ -1302,7 +1311,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
else
{
sidephi = kSPhi ;
}
}
}
else
{
@@ -1317,14 +1326,14 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
if ( compE < 0 )
{
sphi2 = pDistE/compE ;
// Only check further if < starting phi intersection
//
if ( (sphi2 > -kCarTolerance) && (sphi2 < sphi) )
{
xi = p.x() + sphi2*v.x() ;
yi = p.y() + sphi2*v.y() ;
if ( (std::fabs(xi)<=kCarTolerance)
&& (std::fabs(yi)<=kCarTolerance) )
{
@@ -1336,8 +1345,8 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
sidephi = kEPhi ;
sphi = sphi2;
}
}
else // Check intersecting with correct half-plane
}
else // Check intersecting with correct half-plane
{
if ( (yi*cosCPhi-xi*sinCPhi) >= 0)
{
@@ -1345,7 +1354,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
//
sidephi = kEPhi ;
sphi = sphi2;
}
}
}
@@ -1355,22 +1364,22 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
{
sphi = kInfinity ;
}
}
}
else
{
// On z axis + travel not || to z axis -> if phi of vector direction
// within phi of shape, Step limited by rmax, else Step =0
vphi = std::atan2(v.y(),v.x());
if ( ( fSPhi-halfAngTolerance <= vphi ) &&
if ( ( fSPhi-halfAngTolerance <= vphi ) &&
( vphi <= ( ePhi+halfAngTolerance ) ) )
{
sphi = kInfinity;
}
else
{
sidephi = kSPhi ; // arbitrary
sidephi = kSPhi ; // arbitrary
sphi=0;
}
}
@@ -1381,7 +1390,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
{
snxt=sphi;
side=sidephi;
}
}
}
G4double rhoi,it,iDotxyNmax ;
@@ -1392,7 +1401,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
{
switch(side)
{
case kRMax: // n is unit vector
case kRMax: // n is unit vector
xi = p.x() + snxt*v.x() ;
yi = p.y() + snxt*v.y() ;
zi = p.z() + snxt*v.z() ;
@@ -1401,7 +1410,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
iDotxyNmax = (1-fRtor/rhoi) ;
if(iDotxyNmax >= -2.*fRmaxTolerance) // really convex part of Rmax
{
{
*n = G4ThreeVector( xi*(1-fRtor/rhoi)/it,
yi*(1-fRtor/rhoi)/it,
zi/it ) ;
@@ -1481,10 +1490,10 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p ) const
G4double safe=0.0,safeR1,safeR2;
G4double rho,pt ;
G4double safePhi,phiC,cosPhiC,sinPhiC,ePhi;
rho = std::hypot(p.x(),p.y());
pt = std::hypot(p.z(),rho-fRtor);
#ifdef G4CSGDEBUG
if( Inside(p) == kOutside )
{
@@ -1512,7 +1521,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p ) const
else
{
safe = fRmax - pt ;
}
}
// Check if phi divided, Calc distances closest phi plane
//
@@ -1534,7 +1543,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p ) const
if (safePhi < safe) { safe = safePhi ; }
}
if (safe < 0) { safe = 0 ; }
return safe ;
return safe ;
}
//////////////////////////////////////////////////////////////////////////
@@ -1585,10 +1594,10 @@ std::ostream& G4Torus::StreamInfo( std::ostream& os ) const
G4ThreeVector G4Torus::GetPointOnSurface() const
{
G4double cosu, sinu,cosv, sinv, aOut, aIn, aSide, chose, phi, theta, rRand;
phi = G4RandFlat::shoot(fSPhi,fSPhi+fDPhi);
theta = G4RandFlat::shoot(0.,twopi);
cosu = std::cos(phi); sinu = std::sin(phi);
cosv = std::cos(theta); sinv = std::sin(theta);
@@ -1597,7 +1606,7 @@ G4ThreeVector G4Torus::GetPointOnSurface() const
aOut = (fDPhi)*twopi*fRtor*fRmax;
aIn = (fDPhi)*twopi*fRtor*fRmin;
aSide = pi*(fRmax*fRmax-fRmin*fRmin);
if ((fSPhi == 0) && (fDPhi == twopi)){ aSide = 0; }
chose = G4RandFlat::shoot(0.,aOut + aIn + 2.*aSide);
@@ -1620,19 +1629,19 @@ G4ThreeVector G4Torus::GetPointOnSurface() const
rRand = GetRadiusInRing(fRmin,fRmax);
return { (fRtor+rRand*cosv)*std::cos(fSPhi+fDPhi),
(fRtor+rRand*cosv)*std::sin(fSPhi+fDPhi), rRand*sinv };
}
}
}
///////////////////////////////////////////////////////////////////////
//
// Visualisation Functions
void G4Torus::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
void G4Torus::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
{
scene.AddSolid (*this);
}
G4Polyhedron* G4Torus::CreatePolyhedron () const
G4Polyhedron* G4Torus::CreatePolyhedron () const
{
return new G4PolyhedronTorus (fRmin, fRmax, fRtor, fSPhi, fDPhi);
}
+9
View File
@@ -50,6 +50,15 @@
using namespace CLHEP;
// Private enums: Not for external use
namespace {
// Used by distanceToOut
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
// Used by normal
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
}
/////////////////////////////////////////////////////////////////////////
//
// Constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
+1 -11
View File
@@ -25,7 +25,7 @@
//
// Implementation for G4UBox wrapper class
//
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#include "G4Box.hh"
@@ -52,16 +52,6 @@ G4UBox::G4UBox(const G4String& pName,
{
}
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
G4UBox::G4UBox( __void__& a )
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
+1 -11
View File
@@ -25,7 +25,7 @@
//
// Implementation for G4UCons wrapper class
//
// 30.10.13 G.Cosmo, CERN/PH
// 30.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#include "G4Cons.hh"
@@ -54,16 +54,6 @@ G4UCons::G4UCons( const G4String& pName,
{
}
///////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UCons::G4UCons( __void__& a )
: Base_t(a)
{
}
///////////////////////////////////////////////////////////////////////
//
// Destructor
+1 -11
View File
@@ -25,7 +25,7 @@
//
// Implementation for G4UCutTubs wrapper class
//
// 07.07.17 G.Cosmo, CERN/PH
// 07.07.17 G.Cosmo, CERN
// --------------------------------------------------------------------
#include "G4CutTubs.hh"
@@ -57,16 +57,6 @@ G4UCutTubs::G4UCutTubs( const G4String& pName,
{
}
///////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UCutTubs::G4UCutTubs( __void__& a )
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
+1 -11
View File
@@ -25,7 +25,7 @@
//
// Implementation for G4UOrb wrapper class
//
// 30.10.13 G.Cosmo, CERN/PH
// 30.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#include "G4Orb.hh"
@@ -53,16 +53,6 @@ G4UOrb::G4UOrb( const G4String& pName, G4double pRmax )
{
}
///////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UOrb::G4UOrb( __void__& a )
: Base_t(a)
{
}
/////////////////////////////////////////////////////////////////////
//
// Destructor
+1 -13
View File
@@ -25,7 +25,7 @@
//
// Implementation for G4UPara wrapper class
//
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#include "G4Para.hh"
@@ -119,18 +119,6 @@ G4UPara::G4UPara( const G4String& pName,
}
}
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency
G4UPara::G4UPara( __void__& a )
: Base_t(a)
{
SetAllParameters(1., 1., 1., 0., 0., 0.);
fRebuildPolyhedron = false;
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
+1 -11
View File
@@ -25,7 +25,7 @@
//
// Implementation for G4USphere wrapper class
//
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#include "G4Sphere.hh"
@@ -53,16 +53,6 @@ G4USphere::G4USphere( const G4String& pName,
{
}
///////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4USphere::G4USphere( __void__& a )
: Base_t(a)
{
}
/////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -53,15 +53,6 @@ G4UTorus::G4UTorus(const G4String& pName,
: Base_t(pName, rmin, rmax, rtor, sphi, dphi)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
G4UTorus::G4UTorus( __void__& a )
: Base_t(a)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Destructor
-10
View File
@@ -134,16 +134,6 @@ G4UTrap::G4UTrap( const G4String& pName )
{
}
///////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UTrap::G4UTrap( __void__& a )
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
+1 -11
View File
@@ -25,7 +25,7 @@
//
// Implementation for G4UTrd wrapper class
//
// 13.09.13 G.Cosmo, CERN/PH
// 13.09.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#include "G4Trd.hh"
@@ -51,16 +51,6 @@ G4UTrd::G4UTrd(const G4String& pName,
{
}
///////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UTrd::G4UTrd( __void__& a )
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
+1 -11
View File
@@ -25,7 +25,7 @@
//
// Implementation for G4UTubs wrapper class
//
// 30.10.13 G.Cosmo, CERN/PH
// 30.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#include "G4Tubs.hh"
@@ -53,16 +53,6 @@ G4UTubs::G4UTubs( const G4String& pName,
{
}
///////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UTubs::G4UTubs( __void__& a )
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
+9 -1
View File
@@ -6,8 +6,16 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-03-07 Soon Yung Jun (geom-specific-V11-02-09)
- G4Polyhedra, G4UPolyhedra: Verify the validity of the delta phi to restore
visualization of HepPolyhedronPgon
## 2025-02-03 Gabriele Cosmo
- Removed fake default constructor from G4U* wrappers, clearing compilation
warnings on gcc-14.
## 2024-10-01 Evgueni Tcherniaev (geom-specific-V11-02-08)
- G4GenericTrap: Fixed minor defect reported by Coverity
- G4GenericTrap: Fixed minor defect reported by Coverity.
## 2024-07-18 Alvaro Tolosa-Delgado (geom-specific-V11-02-07)
- Remove internal state of G4TwistedTubs and G4VTwistedFaceted.
@@ -69,11 +69,6 @@ class G4UEllipsoid : public G4UAdapter<vecgeom::UnplacedEllipsoid>
inline G4GeometryType GetEntityType() const override;
G4UEllipsoid(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UEllipsoid( const G4UEllipsoid &source );
G4UEllipsoid &operator=( const G4UEllipsoid &source );
// Copy constructor and assignment operator.
@@ -68,11 +68,6 @@ class G4UEllipticalCone : public G4UAdapter<vecgeom::UnplacedEllipticalCone>
inline G4GeometryType GetEntityType() const override;
G4UEllipticalCone(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UEllipticalCone( const G4UEllipticalCone& source );
G4UEllipticalCone& operator=( const G4UEllipticalCone& source );
// Copy constructor and assignment operator.
@@ -66,11 +66,6 @@ class G4UEllipticalTube : public G4UAdapter<vecgeom::UnplacedEllipticalTube>
inline G4GeometryType GetEntityType() const override;
G4UEllipticalTube(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UEllipticalTube( const G4UEllipticalTube& source );
G4UEllipticalTube &operator=( const G4UEllipticalTube& source );
// Copy constructor and assignment operator.
@@ -88,11 +88,6 @@ class G4UExtrudedSolid : public G4UAdapter<vecgeom::UnplacedExtruded>
inline G4bool IsFaceted() const override;
G4UExtrudedSolid(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UExtrudedSolid( const G4UExtrudedSolid& source );
G4UExtrudedSolid &operator=(const G4UExtrudedSolid& source);
// Copy constructor and assignment operator.
@@ -73,11 +73,6 @@ class G4UGenericPolycone : public G4UAdapter<vecgeom::UnplacedGenericPolycone>
G4VSolid* Clone() const override;
G4UGenericPolycone(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UGenericPolycone( const G4UGenericPolycone& source );
G4UGenericPolycone& operator=(const G4UGenericPolycone& source);
// Copy constructor and assignment operator.
@@ -70,11 +70,6 @@ class G4UGenericTrap : public G4UAdapter<vecgeom::UnplacedGenTrap>
inline G4bool IsFaceted() const override;
G4UGenericTrap(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UGenericTrap( const G4UGenericTrap& source );
G4UGenericTrap& operator=(const G4UGenericTrap& source);
// Copy constructor and assignment operator.
@@ -77,11 +77,6 @@ class G4UHype : public G4UAdapter<vecgeom::GenericUnplacedHype>
inline G4GeometryType GetEntityType() const override;
G4UHype(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UHype( const G4UHype& source );
G4UHype& operator=( const G4UHype& source );
// Copy constructor and assignment operator.
@@ -66,11 +66,6 @@ class G4UParaboloid : public G4UAdapter<vecgeom::UnplacedParaboloid>
inline G4GeometryType GetEntityType() const override;
G4UParaboloid(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UParaboloid( const G4UParaboloid& source );
G4UParaboloid& operator=( const G4UParaboloid& source );
// Copy constructor and assignment operator.
@@ -92,11 +92,6 @@ class G4UPolycone : public G4UAdapter<vecgeom::GenericUnplacedPolycone>
inline G4GeometryType GetEntityType() const override;
G4UPolycone(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UPolycone( const G4UPolycone& source );
G4UPolycone& operator=( const G4UPolycone& source );
// Copy constructor and assignment operator.
@@ -100,11 +100,6 @@ class G4UPolyhedra : public G4UAdapter<vecgeom::UnplacedPolyhedron>
inline G4bool IsFaceted() const override;
G4UPolyhedra(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UPolyhedra( const G4UPolyhedra& source );
G4UPolyhedra& operator=( const G4UPolyhedra& source );
// Copy constructor and assignment operator.
@@ -78,11 +78,6 @@ class G4UTessellatedSolid : public G4UAdapter<vecgeom::UnplacedTessellated>
G4int AllocatedMemory();
void DisplayAllocatedMemory();
G4UTessellatedSolid(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UTessellatedSolid( const G4UTessellatedSolid& source );
G4UTessellatedSolid& operator=(const G4UTessellatedSolid& source);
// Copy constructor and assignment operator.
@@ -69,11 +69,6 @@ class G4UTet : public G4UAdapter<vecgeom::UnplacedTet>
inline G4bool IsFaceted() const override;
G4UTet(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4UTet(const G4UTet& rhs);
G4UTet& operator=(const G4UTet& rhs);
// Copy constructor and assignment operator.
@@ -1038,7 +1038,14 @@ G4Polyhedron* G4Polyhedra::CreatePolyhedron() const
std::vector<G4TwoVector> rz(numCorner);
for (G4int i = 0; i < numCorner; ++i)
rz[i].set(corners[i].r, corners[i].z);
return new G4PolyhedronPgon(startPhi, endPhi - startPhi, numSide, rz);
// Check the validity of the delta phi
G4double wrDelta = endPhi - startPhi;
if (wrDelta <= 0. || wrDelta >= twopi*(1-DBL_EPSILON))
{
wrDelta = twopi;
}
return new G4PolyhedronPgon(startPhi, wrDelta, numSide, rz);
}
// SetOriginalParameters
@@ -53,15 +53,6 @@ G4UEllipsoid::G4UEllipsoid(const G4String& pName,
: Base_t(pName, dx, dy, dz, bcut, tcut)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
G4UEllipsoid::G4UEllipsoid( __void__& a )
: Base_t(a)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -52,15 +52,6 @@ G4UEllipticalCone::G4UEllipticalCone(const G4String& pName,
: Base_t(pName, a, b, h, cut)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
G4UEllipticalCone::G4UEllipticalCone( __void__& a )
: Base_t(a)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -51,15 +51,6 @@ G4UEllipticalTube::G4UEllipticalTube(const G4String& pName,
: Base_t(pName, dx, dy, dz)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
G4UEllipticalTube::G4UEllipticalTube( __void__& a )
: Base_t(a)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -97,17 +97,6 @@ G4UExtrudedSolid::G4UExtrudedSolid(const G4String& name,
delete[] sections;
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UExtrudedSolid::G4UExtrudedSolid(__void__& a)
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -71,17 +71,6 @@ G4UGenericPolycone::G4UGenericPolycone(const G4String& name,
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UGenericPolycone::G4UGenericPolycone(__void__& a)
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -54,17 +54,6 @@ G4UGenericTrap::G4UGenericTrap(const G4String& name, G4double halfZ,
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UGenericTrap::G4UGenericTrap(__void__& a)
: Base_t(a), fVisSubdivisions(0)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -53,15 +53,6 @@ G4UHype::G4UHype(const G4String& pName,
newInnerStereo, newOuterStereo, newHalfLenZ)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
G4UHype::G4UHype( __void__& a )
: Base_t(a)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -51,15 +51,6 @@ G4UParaboloid::G4UParaboloid(const G4String& pName,
: Base_t(pName, rlo, rhi, dz)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
G4UParaboloid::G4UParaboloid( __void__& a )
: Base_t(a)
{ }
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -115,17 +115,6 @@ G4UPolycone::G4UPolycone(const G4String& name,
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UPolycone::G4UPolycone( __void__& a )
: Base_t(a)
{
}
////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -126,17 +126,6 @@ G4UPolyhedra::G4UPolyhedra(const G4String& name,
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UPolyhedra::G4UPolyhedra( __void__& a )
: Base_t(a)
{
}
////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -593,7 +582,13 @@ G4UPolyhedra::CalculateExtent(const EAxis pAxis,
//
G4Polyhedron* G4UPolyhedra::CreatePolyhedron() const
{
return new G4PolyhedronPgon(wrStart, wrDelta, wrNumSide, rzcorners);
// Check the validity of the delta phi
G4double deltaPhi = wrDelta;
if (deltaPhi <= 0. || deltaPhi >= twopi*(1-DBL_EPSILON))
{
deltaPhi = twopi;
}
return new G4PolyhedronPgon(wrStart, deltaPhi, wrNumSide, rzcorners);
}
#endif // G4GEOM_USE_USOLIDS
@@ -54,16 +54,6 @@ G4UTessellatedSolid::G4UTessellatedSolid(const G4String& name)
{
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UTessellatedSolid::G4UTessellatedSolid(__void__& a)
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
@@ -75,16 +75,6 @@ G4UTet::G4UTet(const G4String& pName,
}
}
//////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UTet::G4UTet( __void__& a )
: Base_t(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor