Import Geant4 10.4.2 source tree

This commit is contained in:
Gabriele Cosmo
2018-05-25 16:18:53 +02:00
parent fe04dcb406
commit fe81a77428
233 changed files with 44301 additions and 105671 deletions
+27 -1
View File
@@ -1,4 +1,4 @@
$Id: History 108664 2018-02-27 07:20:25Z gcosmo $
$Id: History 110067 2018-05-15 09:20:12Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,32 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 4, 2018 - J.Apostolakis (geomnav-V10-03-11)
---------------------------
- G4Navigator::GetLocalExitNormal(): fix for normal calculated at the endpoint
of current step, on a 'candidate' next volume. Adds missing transformation to
the frame of the current volume.
Addresses problem report #2054.
April 17, 2018 - J.Apostolakis
------------------------------
- G4Navigator::Set/RestoreSavedState(): fix for save/restore of ReplicaNumber
(Thanks to Helmut Burkhardt).
April 11, 2018 - J.Apostolakis
------------------------------
- G4PathFinder::DoNextLinearStep():
* Use 'Relocated Point' flag to signal move from call to ReLocate, and
ensure that new point is used in cross-checks in subsequent Locate.
* Revert change of geomnav-V10-03-09, keeping fMinStep as 'logical'
value, which can be kInfinity when step is not limited by Navigators
(it was meant to cope with zero proposed step in RE03, however it
caused problems in multiple cases when PathFinder was used).
- G4SafetyHelper:
* Do not limit memorisation of safety in case of parallel
geometries (when a length is not passed to safety method).
* Fix to including full message in Exception.
February 26, 2018 - J.Apostolakis (geomnav-V10-03-10)
---------------------------------
- Fix for momentum value in G4PathFinder::SetChargeMomentumMass
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PathFinder.hh 103219 2017-03-22 11:30:15Z gcosmo $
// $Id: G4PathFinder.hh 110067 2018-05-15 09:20:12Z gcosmo $
//
// class G4PathFinder
//
@@ -238,7 +238,7 @@ class G4PathFinder
G4ThreeVector fPreSafetyLocation; // last initial position for which safety evaluated
G4double fPreSafetyMinValue; // /\ corresponding value of full safety
G4double fPreSafetyValues[ fMaxNav ]; // Safeties for the above point
// This part of the state can be retained for severall calls --> CARE
// This part of the state can be retained for several calls --> CARE
G4ThreeVector fPreStepLocation; // point where last ComputeStep called
G4double fMinSafety_PreStepPt; // /\ corresponding value of full safety
@@ -674,7 +674,7 @@ void G4Navigator::SetSavedState()
fSaveState.sEntering = fEntering;
fSaveState.spBlockedPhysicalVolume = fBlockedPhysicalVolume;
fSaveState.sBlockedReplicaNo = fBlockedReplicaNo,
fSaveState.sBlockedReplicaNo = fBlockedReplicaNo;
fSaveState.sLastStepWasZero = fLastStepWasZero;
@@ -704,7 +704,7 @@ void G4Navigator::RestoreSavedState()
fEntering = fSaveState.sEntering;
fBlockedPhysicalVolume = fSaveState.spBlockedPhysicalVolume;
fBlockedReplicaNo = fSaveState.sBlockedReplicaNo,
fBlockedReplicaNo = fSaveState.sBlockedReplicaNo;
fLastStepWasZero = fSaveState.sLastStepWasZero;
@@ -1394,7 +1394,9 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
// Entering the solid ==> opposite
//
ExitNormal = -nextSolidExitNormal;
// First flip ( ExitNormal = -nextSolidExitNormal; )
// and then rotate the the normal to the frame of the mother (current volume)
ExitNormal = MotherToDaughterTransform.Inverse().TransformAxis( -nextSolidExitNormal );
fCalculatedExitNormal= true;
}
else
+13 -14
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PathFinder.cc 108664 2018-02-27 07:20:25Z gcosmo $
// $Id: G4PathFinder.cc 110067 2018-05-15 09:20:12Z gcosmo $
// GEANT4 tag $ Name: $
//
// class G4PathFinder Implementation
@@ -79,7 +79,7 @@ G4PathFinder* G4PathFinder::GetInstanceIfExist()
G4PathFinder::G4PathFinder()
: fEndState( G4ThreeVector(), G4ThreeVector(), 0., 0., 0., 0., 0.),
fFieldExertedForce(false),
fRelocatedPoint(true),
fRelocatedPoint(false),
fLastStepNo(-1), fCurrentStepNo(-1),
fVerboseLevel(0)
{
@@ -256,6 +256,7 @@ G4PathFinder::ComputeStep( const G4FieldTrack &InitialFieldTrack,
//--------------
}
fLastStepNo= stepNo;
fRelocatedPoint= false;
#ifdef G4DEBUG_PATHFINDER
if ( (fNoGeometriesLimiting < 0)
@@ -335,7 +336,6 @@ G4PathFinder::ComputeStep( const G4FieldTrack &InitialFieldTrack,
pNewSafety = fCurrentPreStepSafety[ navigatorNo ];
limitedStep = fLimitedStep[ navigatorNo ];
fRelocatedPoint= false;
possibleStep= std::min(proposedStepLength, fCurrentStepSize[ navigatorNo ]);
EndState = fEndState; // now corrected for smaller step, if needed
@@ -488,10 +488,11 @@ G4PathFinder::Locate( const G4ThreeVector& position,
std::vector<G4Navigator*>::iterator pNavIter=
fpTransportManager->GetActiveNavigatorsIterator();
G4ThreeVector lastEndPosition= fEndState.GetPosition();
G4ThreeVector moveVec = (position - lastEndPosition );
G4ThreeVector lastEndPosition= fRelocatedPoint ?
fLastLocatedPosition : fEndState.GetPosition();
G4ThreeVector moveVec = ( position - lastEndPosition );
G4double moveLenSq= moveVec.mag2();
if( (!fNewTrack) && (!fRelocatedPoint) && ( moveLenSq > movLenTol ) )
if( (!fNewTrack) && ( moveLenSq > movLenTol ) )
{
ReportMove( lastEndPosition, position,
" (End) Position / G4PathFinder::Locate" );
@@ -739,7 +740,7 @@ void G4PathFinder::ReLocate( const G4ThreeVector& position )
}
fLastLocatedPosition= position;
fRelocatedPoint= false;
fRelocatedPoint= true;
#ifdef G4DEBUG_PATHFINDER
if( fVerboseLevel > 2 )
@@ -826,8 +827,8 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
{
std::vector<G4Navigator*>::iterator pNavigatorIter;
G4double safety= 0.0, step=0.0;
G4double minSafety= kInfinity, minStep;
G4double minSafety= kInfinity, minStep= kInfinity;
const G4int IdTransport= 0; // Id of Mass Navigator !!
G4int num=0;
@@ -933,9 +934,9 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
step= (*pNavigatorIter)->ComputeStep( initialPosition,
initialDirection,
proposedStepLength,
safety );
// minStep = std::min( step, minStep); // OLD ==> can be 'logical' value, ie. kInfinity
safety );
minStep = std::min( step, minStep); // OLD ==> can be 'logical' value, ie. kInfinity
#ifdef G4DEBUG_PATHFINDER
if( fVerboseLevel > 0)
{
@@ -951,8 +952,6 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
}
fCurrentStepSize[num] = step; // Raw value - can be kInfinity
step = std::min( step, proposedStepLength ); // Now a physical value (not kInf)
minStep = std::min( step, minStep); // Minimum of physical values !!
// TODO: consider whether/how to reduce the proposed step
// to the latest minStep value - to reduce calculations.
// ( If so, much change 1st minimum above. )
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4SafetyHelper.cc 81060 2014-05-20 09:12:39Z gcosmo $
// $Id: G4SafetyHelper.cc 110067 2018-05-15 09:20:12Z gcosmo $
// GEANT4 tag $ Name: $
//
// class G4SafetyHelper Implementation
@@ -114,7 +114,7 @@ G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double maxLength )
{
G4double newSafety;
// Only recompute (calling Navigator/PathFinder) if 'position'
// is *not* the safety location and has moved 'significantly'
//
@@ -125,19 +125,23 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double
{
// Safety for mass geometry
newSafety = fpMassNavigator->ComputeSafety(position, maxLength, true);
// Only store a 'true' safety - one that was not restricted by maxLength
if( newSafety < maxLength )
{
fLastSafety= newSafety;
fLastSafetyPosition = position;
}
}
else
{
// Safety for all geometries
newSafety = fpPathFinder->ComputeSafety(position);
newSafety = fpPathFinder->ComputeSafety(position);
fLastSafety= newSafety;
fLastSafetyPosition = position;
}
// We can only store a 'true' safety - one that was not restricted by maxLength
if( newSafety < maxLength )
{
fLastSafety= newSafety;
fLastSafetyPosition = position;
}
}
else
{
@@ -146,26 +150,28 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double
// G4double moveLength = 0;
// if( moveLengthSq > 0.0 ) { moveLength= std::sqrt(moveLengthSq); }
newSafety = fLastSafety; // -moveLength;
}
}
return newSafety;
}
void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector &newPosition )
{
// G4cout << " G4SafetyHelper::ReLocateWithinVolume called at " << newPosition << G4endl;
#ifdef G4VERBOSE
if( fVerbose > 0 ) {
if( fVerbose > 0 ) {
// There is an opportunity - and need - to check whether the proposed move is safe
G4ThreeVector moveVec= newPosition - fLastSafetyPosition;
if( moveVec.mag2() > sqr(fLastSafety) )
{
// A problem exists - we are proposing to move outside 'Safety Sphere'
G4ExceptionDescription ed;
ed << "Unsafe Move> Asked to relocate beyond 'Safety sphere'. Details: " << G4endl;
ed << " Safety Sphere: Radius = " << fLastSafety;
ed << " Center = " << fLastSafetyPosition << G4endl;
ed << " New Location : Move = " << moveVec.mag2();
ed << " New Location : Move = " << moveVec.mag();
ed << " Position = " << newPosition << G4endl;
G4Exception("G4SafetyHelper::ReLocateWithinVolume", "GeomNav999", JustWarning,
"Unsafe Move> Asked to relocate beyond 'Safety sphere'.");
G4Exception("G4SafetyHelper::ReLocateWithinVolume", "GeomNav999", JustWarning, ed);
}
}
#endif
+24 -1
View File
@@ -1,5 +1,5 @@
$Id: History 104316 2017-05-24 13:04:23Z gcosmo $
$Id: History 110069 2018-05-15 09:32:07Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,29 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
April 24, 2018 E. Tcherniaev geom-bool-V10-03-05
- G4UnionSolid: define simple bounding-box and make use of early returns
in Inside() for points laying outside.
April 11, 2018 E. Tcherniaev
- G4BooleanSolid: Use -1 instead of 0 as default initialisation value
for area and capacity, so to distinguish cases when values are zero
referring to NULL Boolean constructs.
April 11, 2018 G. Cosmo
- G4BooleanSolid: enhanced warning message for the case of an invalid
(NULL) Boolean construct in GetPointOnSurface() and StackPolyhedron().
- Replaced USOLIDS_LIBRARIES with VECGEOM_LIBRARIES in sources.cmake.
February 28, 2018 E. Tcherniaev
- Improved contruction of G4DiplaceSolid to combine transformations for
nested displaced types.
June 13, 2017 J. Allison
- G4BooleanSolid.cc, G4DisplacedSolid.cc, G4ScaledSolid.cc:
Added protection and a warning message in the case of a null
polyhedron pointer.
May 24, 2017 G. Cosmo geom-bool-V10-03-04
- Renamed ambiguous name Extent() in all shapes to BoundingLimits().
Change required in order to avoid signature conflict with VecGeom in
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4BooleanSolid.icc 96960 2016-05-18 14:59:54Z gcosmo $
// $Id: G4BooleanSolid.icc 110069 2018-05-15 09:32:07Z gcosmo $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -49,15 +49,15 @@ G4double G4BooleanSolid::GetCubVolEpsilon() const
inline
void G4BooleanSolid::SetCubVolStatistics(G4int st)
{
fCubicVolume=0.;
fStatistics=st;
fCubicVolume = -1.;
fStatistics = st;
}
inline
void G4BooleanSolid::SetCubVolEpsilon(G4double ep)
{
fCubicVolume=0.;
fCubVolEpsilon=ep;
fCubicVolume = -1.;
fCubVolEpsilon = ep;
}
inline
@@ -75,29 +75,33 @@ G4double G4BooleanSolid::GetAreaAccuracy() const
inline
void G4BooleanSolid::SetAreaStatistics(G4int st)
{
fSurfaceArea=0.;
fStatistics=st;
fSurfaceArea = -1.;
fStatistics = st;
}
inline
void G4BooleanSolid::SetAreaAccuracy(G4double ep)
{
fSurfaceArea=0.;
fAreaAccuracy=ep;
fSurfaceArea = -1.;
fAreaAccuracy = ep;
}
inline
G4double G4BooleanSolid::GetCubicVolume()
{
if(fCubicVolume != 0.) {;}
else { fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon); }
if(fCubicVolume < 0.)
{
fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon);
}
return fCubicVolume;
}
inline
G4double G4BooleanSolid::GetSurfaceArea()
{
if(fSurfaceArea != 0.) {;}
else { fSurfaceArea = EstimateSurfaceArea(fStatistics,fAreaAccuracy); }
if(fSurfaceArea < 0.)
{
fSurfaceArea = EstimateSurfaceArea(fStatistics,fAreaAccuracy);
}
return fSurfaceArea;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UnionSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4UnionSolid.hh 110069 2018-05-15 09:32:07Z gcosmo $
//
//
// class G4UnionSolid
@@ -117,6 +117,9 @@ class G4UnionSolid : public G4BooleanSolid
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
G4Polyhedron* CreatePolyhedron () const ;
private:
G4ThreeVector fPMin, fPMax; // bounding box extended by half-tolerance
};
#endif
+2 -2
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 103464 2017-04-11 07:24:03Z gcosmo $
# $Id: sources.cmake 110069 2018-05-15 09:32:07Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -65,7 +65,7 @@ GEANT4_DEFINE_MODULE(NAME G4geomBoolean
G4graphics_reps
G4intercoms
LINK_LIBRARIES
${USOLIDS_LIBRARIES}
${VECGEOM_LIBRARIES}
)
# List any source specific properties here
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4BooleanSolid.cc 97300 2016-06-01 09:27:19Z gcosmo $
// $Id: G4BooleanSolid.cc 110069 2018-05-15 09:32:07Z gcosmo $
//
// Implementation for the abstract base class for solids created by boolean
// operations between other solids
@@ -62,7 +62,7 @@ G4BooleanSolid::G4BooleanSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ) :
G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
fAreaAccuracy(-1.), fCubicVolume(-1.), fSurfaceArea(-1.),
fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
createdDisplacedSolid(false)
{
@@ -80,7 +80,7 @@ G4BooleanSolid::G4BooleanSolid( const G4String& pName,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) :
G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
fAreaAccuracy(-1.), fCubicVolume(-1.), fSurfaceArea(-1.),
fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
createdDisplacedSolid(true)
{
@@ -97,7 +97,7 @@ G4BooleanSolid::G4BooleanSolid( const G4String& pName,
G4VSolid* pSolidB ,
const G4Transform3D& transform ) :
G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
fAreaAccuracy(-1.), fCubicVolume(-1.), fSurfaceArea(-1.),
fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
createdDisplacedSolid(true)
{
@@ -113,7 +113,7 @@ G4BooleanSolid::G4BooleanSolid( const G4String& pName,
G4BooleanSolid::G4BooleanSolid( __void__& a )
: G4VSolid(a), fPtrSolidA(0), fPtrSolidB(0),
fStatistics(1000000), fCubVolEpsilon(0.001),
fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
fAreaAccuracy(-1.), fCubicVolume(-1.), fSurfaceArea(-1.),
fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
createdDisplacedSolid(false)
{
@@ -354,8 +354,8 @@ G4ThreeVector G4BooleanSolid::GetPointOnSurface() const
}
std::ostringstream message;
message << "Solid - " << GetName() << "\n"
<< "All attempts to generate a point on the surface have failed.\n"
<< "Returning point from the last unsuccessful attempt!";
<< "All attempts to generate a point on the surface have failed!\n"
<< "The solid created may be an invalid Boolean construct!";
G4Exception("G4BooleanSolid::GetPointOnSurface()",
"GeomSolids1001", JustWarning, message);
return p;
@@ -420,7 +420,18 @@ G4BooleanSolid::StackPolyhedron(HepPolyhedronProcessor& processor,
top = solidA->GetPolyhedron();
}
G4Polyhedron* operand = solidB->GetPolyhedron();
processor.push_back (operation, *operand);
if (operand)
{
processor.push_back (operation, *operand);
}
else
{
std::ostringstream message;
message << "Solid - " << solid->GetName()
<< " - No G4Polyhedron for Boolean component";
G4Exception("G4BooleanSolid::StackPolyhedron()",
"GeomSolids2001", JustWarning, message);
}
return top;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DisplacedSolid.cc 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4DisplacedSolid.cc 110069 2018-05-15 09:32:07Z gcosmo $
//
// Implementation for G4DisplacedSolid class for boolean
// operations between other solids
@@ -34,6 +34,7 @@
// 28.10.98 V.Grichine: created
// 14.11.99 V.Grichine: modifications in CalculateExtent(...) method
// 22.11.00 V.Grichine: new set methods for matrix/vectors
// 28.02.18 E.Tcherniaev: improved contruction from G4DisplacedSolid
//
// --------------------------------------------------------------------
@@ -57,10 +58,19 @@ G4DisplacedSolid::G4DisplacedSolid( const G4String& pName,
const G4ThreeVector& transVector )
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0)
{
fPtrSolid = pSolid ;
fPtrTransform = new G4AffineTransform(rotMatrix,transVector) ;
fPtrTransform->Invert() ;
fDirectTransform = new G4AffineTransform(rotMatrix,transVector) ;
if (pSolid->GetEntityType() == "G4DisplacedSolid")
{
fPtrSolid = ((G4DisplacedSolid*)pSolid)->GetConstituentMovedSolid();
G4AffineTransform t1 = ((G4DisplacedSolid*)pSolid)->GetDirectTransform();
G4AffineTransform t2 = G4AffineTransform(rotMatrix,transVector);
fDirectTransform = new G4AffineTransform(t1*t2);
}
else
{
fPtrSolid = pSolid;
fDirectTransform = new G4AffineTransform(rotMatrix,transVector);
}
fPtrTransform = new G4AffineTransform(fDirectTransform->Inverse());
}
/////////////////////////////////////////////////////////////////////////////////
@@ -72,13 +82,21 @@ G4DisplacedSolid::G4DisplacedSolid( const G4String& pName,
const G4Transform3D& transform )
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0)
{
fPtrSolid = pSolid ;
fDirectTransform = new G4AffineTransform(transform.getRotation().inverse(),
transform.getTranslation()) ;
fPtrTransform = new G4AffineTransform(transform.getRotation().inverse(),
transform.getTranslation()) ;
fPtrTransform->Invert() ;
if (pSolid->GetEntityType() == "G4DisplacedSolid")
{
fPtrSolid = ((G4DisplacedSolid*)pSolid)->GetConstituentMovedSolid();
G4AffineTransform t1 = ((G4DisplacedSolid*)pSolid)->GetDirectTransform();
G4AffineTransform t2 = G4AffineTransform(transform.getRotation().inverse(),
transform.getTranslation());
fDirectTransform = new G4AffineTransform(t1*t2);
}
else
{
fPtrSolid = pSolid;
fDirectTransform = new G4AffineTransform(transform.getRotation().inverse(),
transform.getTranslation()) ;
}
fPtrTransform = new G4AffineTransform(fDirectTransform->Inverse());
}
///////////////////////////////////////////////////////////////////
@@ -91,9 +109,19 @@ G4DisplacedSolid::G4DisplacedSolid( const G4String& pName,
const G4AffineTransform directTransform )
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0)
{
fPtrSolid = pSolid ;
fDirectTransform = new G4AffineTransform( directTransform );
fPtrTransform = new G4AffineTransform( directTransform.Inverse() ) ;
if (pSolid->GetEntityType() == "G4DisplacedSolid")
{
fPtrSolid = ((G4DisplacedSolid*)pSolid)->GetConstituentMovedSolid();
G4AffineTransform t1 = ((G4DisplacedSolid*)pSolid)->GetDirectTransform();
G4AffineTransform t2 = G4AffineTransform(directTransform);
fDirectTransform = new G4AffineTransform(t1*t2);
}
else
{
fPtrSolid = pSolid;
fDirectTransform = new G4AffineTransform(directTransform);
}
fPtrTransform = new G4AffineTransform(fDirectTransform->Inverse());
}
///////////////////////////////////////////////////////////////////
@@ -491,8 +519,18 @@ G4Polyhedron*
G4DisplacedSolid::CreatePolyhedron () const
{
G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
polyhedron
if (polyhedron)
{
polyhedron
->Transform(G4Transform3D(GetObjectRotation(),GetObjectTranslation()));
}
else
{
DumpInfo();
G4Exception("G4DisplacedSolid::CreatePolyhedron()",
"GeomSolids2002", JustWarning,
"No G4Polyhedron for displaced solid");
}
return polyhedron;
}
@@ -404,7 +404,17 @@ G4Polyhedron*
G4ScaledSolid::CreatePolyhedron () const
{
G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
polyhedron->Transform(GetScaleTransform());
if (polyhedron)
{
polyhedron->Transform(GetScaleTransform());
}
else
{
DumpInfo();
G4Exception("G4ScaledSolid::CreatePolyhedron()",
"GeomSolids2003", JustWarning,
"No G4Polyhedron for scaled solid");
}
return polyhedron;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UnionSolid.cc 104316 2017-05-24 13:04:23Z gcosmo $
// $Id: G4UnionSolid.cc 110069 2018-05-15 09:32:07Z gcosmo $
//
// Implementation of methods for the class G4UnionSolid
//
@@ -35,6 +35,7 @@
// 27.07.99 V.Grichine: modifications in DistToOut(p,v,...), while -> do-while
// 16.03.01 V.Grichine: modifications in CalculateExtent()
// 17.03.17 E.Tcherniaev: revision of SurfaceNormal()
// 23.04.18 E.Tcherniaev: added extended BBox, yearly return in Inside()
//
// --------------------------------------------------------------------
@@ -61,6 +62,11 @@ G4UnionSolid:: G4UnionSolid( const G4String& pName,
G4VSolid* pSolidB )
: G4BooleanSolid(pName,pSolidA,pSolidB)
{
G4ThreeVector pdelta(0.5*kCarTolerance,0.5*kCarTolerance,0.5*kCarTolerance);
G4ThreeVector pmin, pmax;
BoundingLimits(pmin, pmax);
fPMin = pmin - pdelta;
fPMax = pmax + pdelta;
}
/////////////////////////////////////////////////////////////////////
@@ -75,6 +81,11 @@ G4UnionSolid::G4UnionSolid( const G4String& pName,
: G4BooleanSolid(pName,pSolidA,pSolidB,rotMatrix,transVector)
{
G4ThreeVector pdelta(0.5*kCarTolerance,0.5*kCarTolerance,0.5*kCarTolerance);
G4ThreeVector pmin, pmax;
BoundingLimits(pmin, pmax);
fPMin = pmin - pdelta;
fPMax = pmax + pdelta;
}
///////////////////////////////////////////////////////////
@@ -87,6 +98,11 @@ G4UnionSolid::G4UnionSolid( const G4String& pName,
const G4Transform3D& transform )
: G4BooleanSolid(pName,pSolidA,pSolidB,transform)
{
G4ThreeVector pdelta(0.5*kCarTolerance,0.5*kCarTolerance,0.5*kCarTolerance);
G4ThreeVector pmin, pmax;
BoundingLimits(pmin, pmax);
fPMin = pmin - pdelta;
fPMax = pmax + pdelta;
}
//////////////////////////////////////////////////////////////////
@@ -114,6 +130,8 @@ G4UnionSolid::~G4UnionSolid()
G4UnionSolid::G4UnionSolid(const G4UnionSolid& rhs)
: G4BooleanSolid (rhs)
{
fPMin = rhs.fPMin;
fPMax = rhs.fPMax;
}
///////////////////////////////////////////////////////////////
@@ -130,6 +148,8 @@ G4UnionSolid& G4UnionSolid::operator = (const G4UnionSolid& rhs)
//
G4BooleanSolid::operator=(rhs);
fPMin = rhs.fPMin;
fPMax = rhs.fPMax;
return *this;
}
@@ -208,27 +228,23 @@ G4UnionSolid::CalculateExtent( const EAxis pAxis,
EInside G4UnionSolid::Inside( const G4ThreeVector& p ) const
{
EInside positionA = fPtrSolidA->Inside(p);
if (positionA == kInside) { return kInside; }
if (std::max(p.z()-fPMax.z(),fPMin.z()-p.z()) > 0) return kOutside;
EInside positionA = fPtrSolidA->Inside(p);
if (positionA == kInside) { return positionA; } // inside A
EInside positionB = fPtrSolidB->Inside(p);
if (positionA == kOutside) { return positionB; }
if (positionB == kInside) { return positionB; } // inside B
if (positionB == kOutside) { return positionA; } // surface A
// Both points are on surface
//
static const G4double rtol
= 1000*G4GeometryTolerance::GetInstance()->GetRadialTolerance();
EInside positionB = fPtrSolidB->Inside(p);
if( positionB == kInside ||
( positionA == kSurface && positionB == kSurface &&
( fPtrSolidA->SurfaceNormal(p) +
fPtrSolidB->SurfaceNormal(p) ).mag2() < rtol ) )
{
return kInside;
}
else
{
if( ( positionB == kSurface ) || ( positionA == kSurface ) )
{ return kSurface; }
else
{ return kOutside; }
}
return ((fPtrSolidA->SurfaceNormal(p) +
fPtrSolidB->SurfaceNormal(p)).mag2() < rtol) ? kInside : kSurface;
}
//////////////////////////////////////////////////////////////
+6 -1
View File
@@ -1,4 +1,4 @@
$Id: History 108482 2018-02-15 14:34:23Z gcosmo $
$Id: History 110070 2018-05-15 09:40:05Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,11 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
April 11, 2018 G.Cosmo geom-csg-V10-03-40
- G4Box: simplified and optimised calculation of normal in method
DistanceToOut(p,v,..). (E.Tcherniaev)
- Replaced USOLIDS_LIBRARIES with VECGEOM_LIBRARIES in sources.cmake.
February 5, 2018 G.Cosmo geom-csg-V10-03-39
- Correction in G4UPara::ComputeDimensions() to add explicit cast for the
solid type to parameterise.
+2 -2
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 105075 2017-07-11 14:22:53Z gcosmo $
# $Id: sources.cmake 110070 2018-05-15 09:40:05Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -100,7 +100,7 @@ GEANT4_DEFINE_MODULE(NAME G4csg
G4graphics_reps
G4intercoms
LINK_LIBRARIES
${USOLIDS_LIBRARIES}
${VECGEOM_LIBRARIES}
)
# List any source specific properties here
+4 -18
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Box.cc 105023 2017-07-05 09:55:35Z gcosmo $
// $Id: G4Box.cc 110070 2018-05-15 09:40:05Z gcosmo $
//
//
//
@@ -438,23 +438,9 @@ G4double G4Box::DistanceToOut( const G4ThreeVector& p,
if (calcNorm)
{
*validNorm = true;
G4double xnew = p.x() + tmax*vx;
if (std::abs(std::abs(xnew) - fDx) <= delta)
{
n->set(std::copysign(1.,xnew), 0., 0.);
return tmax;
}
G4double ynew = p.y() + tmax*vy;
if (std::abs(std::abs(ynew) - fDy) <= delta)
{
n->set(0., std::copysign(1.,ynew), 0.);
return tmax;
}
else
{
G4double znew = p.z() + tmax*vz;
n->set(0., 0., std::copysign(1.,znew));
}
if (tmax == tx) n->set((v.x() < 0) ? -1. : 1., 0., 0.);
else if (tmax == ty) n->set(0., (v.y() < 0) ? -1. : 1., 0.);
else n->set(0., 0., (v.z() < 0) ? -1. : 1.);
}
return tmax;
}
+9 -1
View File
@@ -1,4 +1,4 @@
$Id: History 108484 2018-02-15 14:38:03Z gcosmo $
$Id: History 110072 2018-05-15 09:59:42Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
11-April-2018 G.Cosmo (geom-specific-V10-03-27)
- Replaced USOLIDS_LIBRARIES with VECGEOM_LIBRARIES in sources.cmake.
13-February-2018 G.Cosmo
- Corrected conversion of input parameters to internal structure (used for
caching for adoption in GDML persistency) in G4UPolycone and G4UPolyhedra
wrappers.
13-December-2017 E.Tcherniaev (geom-specific-V10-03-26)
- Removed redundant data initialistion in G4ExtrudedSolid constructors.
@@ -35,10 +35,10 @@
//
// Class description:
//
// Wrapper class for G4UGenericPolycone to make use of it from USolids module.
// Wrapper class for G4GenericPolycone to make use of VecGeom GenericPolycone.
// History:
// 30.10.13 G.Cosmo, CERN/PH
// 30.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UGENERICPOLYCONE_hh
#define G4UGENERICPOLYCONE_hh
@@ -35,7 +35,7 @@
//
// Class description:
//
// Wrapper class for G4UGenericTrap to make use of it from USolids module.
// Wrapper class for G4GenericTrap to make use of VecGeom GenericTrap.
// History:
// 30.10.13 G.Cosmo, CERN/PH
@@ -35,7 +35,7 @@
//
// Class description:
//
// Wrapper class for UParaboloid to make use of it from USolids module.
// Wrapper class for G4Paraboloid to make use of VecGeom Paraboloid.
// History:
// 19.08.15 Guilherme Lima, FNAL
@@ -35,10 +35,10 @@
//
// Class description:
//
// Wrapper class for UPolycone to make use of it from USolids module.
// Wrapper class for G4Polycone to make use of VecGeom Polycone.
// History:
// 31.10.13 G.Cosmo, CERN/PH
// 31.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UPOLYCONE_HH
#define G4UPOLYCONE_HH
@@ -35,10 +35,10 @@
//
// Class description:
//
// Wrapper class for UPolyhedra to make use of it from USolids module.
// Wrapper class for G4Polyhedra to make use of VecGeom Polyhedron.
// History:
// 31.10.13 G.Cosmo, CERN/PH
// 31.10.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UPOLYHEDRA_HH
#define G4UPOLYHEDRA_HH
@@ -38,10 +38,10 @@
//
// Class description:
//
// Wrapper class for UTet to make use of UTet from USolids module.
// Wrapper class for G4Tet to make use of VecGeom Tet.
// History:
// 1.11.13 G.Cosmo, CERN/PH
// 1.11.13 G.Cosmo, CERN
// --------------------------------------------------------------------
#ifndef G4UTET_HH
#define G4UTET_HH
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 106627 2017-10-17 06:23:58Z gcosmo $
# $Id: sources.cmake 110072 2018-05-15 09:59:42Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -170,7 +170,7 @@ GEANT4_DEFINE_MODULE(NAME G4specsolids
G4graphics_reps
G4intercoms
LINK_LIBRARIES
${USOLIDS_LIBRARIES}
${VECGEOM_LIBRARIES}
)
# List any source specific properties here
@@ -231,24 +231,26 @@ G4PolyconeHistorical* G4UPolycone::GetOriginalParameters() const
}
void G4UPolycone::SetOriginalParameters()
{
G4int numPlanes = GetNSections()+1;
vecgeom::PolyconeHistorical* original_parameters = Base_t::GetOriginalParameters();
fOriginalParameters.Start_angle = original_parameters->fHStart_angle;
fOriginalParameters.Opening_angle = original_parameters->fHOpening_angle;
fOriginalParameters.Num_z_planes = original_parameters->fHNum_z_planes;
delete [] fOriginalParameters.Z_values;
delete [] fOriginalParameters.Rmin;
delete [] fOriginalParameters.Rmax;
G4int numPlanes = fOriginalParameters.Num_z_planes;
fOriginalParameters.Z_values = new G4double[numPlanes];
fOriginalParameters.Rmin = new G4double[numPlanes];
fOriginalParameters.Rmax = new G4double[numPlanes];
for (G4int j=0; j<numPlanes; ++j)
{
fOriginalParameters.Z_values[j] = GetZAtPlane(j);
fOriginalParameters.Rmax[j] = GetRmaxAtPlane(j);
fOriginalParameters.Rmin[j] = GetRminAtPlane(j);
}
fOriginalParameters.Start_angle = Base_t::GetStartPhi();
fOriginalParameters.Opening_angle = Base_t::GetDeltaPhi();
fOriginalParameters.Num_z_planes = numPlanes;
for (G4int i=0; i<numPlanes; ++i)
{
fOriginalParameters.Z_values[i] = original_parameters->fHZ_values[i];
fOriginalParameters.Rmin[i] = original_parameters->fHRmin[i];
fOriginalParameters.Rmax[i] = original_parameters->fHRmax[i];
}
}
void G4UPolycone::SetOriginalParameters(G4PolyconeHistorical* pars)
{
@@ -245,7 +245,16 @@ G4PolyhedraHistorical* G4UPolyhedra::GetOriginalParameters() const
}
void G4UPolyhedra::SetOriginalParameters()
{
G4int numPlanes = GetZSegmentCount() + 1;
G4double startPhi = GetPhiStart();
G4double deltaPhi = GetPhiDelta();
G4int numPlanes = GetZSegmentCount() + 1;
G4int numSides = GetSideCount();
fOriginalParameters.Start_angle = startPhi;
fOriginalParameters.Opening_angle = deltaPhi;
fOriginalParameters.Num_z_planes = numPlanes;
fOriginalParameters.numSide = numSides;
delete [] fOriginalParameters.Z_values;
delete [] fOriginalParameters.Rmin;
delete [] fOriginalParameters.Rmax;
@@ -253,17 +262,13 @@ void G4UPolyhedra::SetOriginalParameters()
fOriginalParameters.Rmin = new G4double[numPlanes];
fOriginalParameters.Rmax = new G4double[numPlanes];
for (G4int j=0; j<numPlanes; ++j)
G4double convertRad = std::cos(0.5*deltaPhi/numSides);
for (G4int i=0; i<numPlanes; ++i)
{
fOriginalParameters.Z_values[j] = GetZPlanes()[j];
fOriginalParameters.Rmax[j] = GetRMax()[j];
fOriginalParameters.Rmin[j] = GetRMin()[j];
fOriginalParameters.Z_values[i] = GetZPlanes()[i];
fOriginalParameters.Rmax[i] = GetRMax()[i]/convertRad;
fOriginalParameters.Rmin[i] = GetRMin()[i]/convertRad;
}
fOriginalParameters.Start_angle = GetPhiStart();
fOriginalParameters.Opening_angle = GetPhiDelta();
fOriginalParameters.Num_z_planes = numPlanes;
fOriginalParameters.numSide = GetSideCount();
}
void G4UPolyhedra::SetOriginalParameters(G4PolyhedraHistorical* pars)
{
@@ -298,18 +303,17 @@ G4bool G4UPolyhedra::Reset()
wrDelta = twopi;
}
wrNumSide = fOriginalParameters.numSide;
G4double convertRad = 1./std::cos(0.5*wrDelta/wrNumSide);
rzcorners.resize(0);
for (G4int i=0; i<fOriginalParameters.Num_z_planes; ++i)
{
G4double z = fOriginalParameters.Z_values[i];
G4double r = fOriginalParameters.Rmax[i]*convertRad;
G4double r = fOriginalParameters.Rmax[i];
rzcorners.push_back(G4TwoVector(r,z));
}
for (G4int i=fOriginalParameters.Num_z_planes-1; i>=0; --i)
{
G4double z = fOriginalParameters.Z_values[i];
G4double r = fOriginalParameters.Rmin[i]*convertRad;
G4double r = fOriginalParameters.Rmin[i];
rzcorners.push_back(G4TwoVector(r,z));
}
std::vector<G4int> iout;