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
+2 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 108564 2018-02-16 10:19:00Z gcosmo $
# $Id: GNUmakefile 110076 2018-05-15 10:04:27Z gcosmo $
# -----------------------------------------------------------------
# "gmake" makes default libraries for each subdomain.
# "gmake global" makes global libraries for each subdomain.
@@ -168,7 +168,7 @@ endif
banner:
@$(ECHO) "*************************************************************"
@$(ECHO) " Installation Geant4 version geant4-10-04-patch-01 "
@$(ECHO) " Installation Geant4 version geant4-10-04-patch-02 "
@$(ECHO) " Copyright (C) 1994-2018 Geant4 Collaboration "
@$(ECHO) "*************************************************************"
+2 -2
View File
@@ -7,13 +7,13 @@
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt 66892 2013-01-17 10:57:59Z gunter $
# $Id: CMakeLists.txt 110058 2018-05-15 09:02:41Z gcosmo $
#
#------------------------------------------------------------------------------
# Add allocation export symbol for the event category
add_definitions(-DG4EVENT_ALLOC_EXPORT)
add_definitions(-DG4_USESMARTSTACK)
########add_definitions(-DG4_USESMARTSTACK)
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
+3 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 66892 2013-01-17 10:57:59Z gunter $
# $Id: GNUmakefile 110058 2018-05-15 09:02:41Z gcosmo $
# ------------------------------------------------------------
# GNUmakefile for events library. Makoto Asai, 5/9/95.
# ------------------------------------------------------------
@@ -16,7 +16,8 @@ GLOBLIBS += libG4intercoms.lib libG4global.lib
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4EVENT_ALLOC_EXPORT -DG4_USESMARTSTACK
CPPFLAGS += -DG4EVENT_ALLOC_EXPORT
##### CPPFLAGS += -DG4_USESMARTSTACK
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
+9 -1
View File
@@ -1,4 +1,4 @@
$Id: History 108474 2018-02-15 14:15:39Z gcosmo $
$Id: History 110058 2018-05-15 09:02:41Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
April 30, 2018 M. Asai (event-V10-03-06)
- Change the default stack to
G4TrackStack. Addressing to bug report #2040.
March 16, 2018 M. Asai
- Change the default stack to G4TrackStack. Addressing to bug
report #2040.
February 8, 2018 Dennis Wright (event-V10-03-05)
- add deprecation warning for /gun/ionL in
G4ParticleGunMessenger::SetNewValue()
+1 -6
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 93155 2015-10-08 12:00:14Z gcosmo $
# $Id: GNUmakefile 110061 2018-05-15 09:06:38Z gcosmo $
# -----------------------------------------------------------------------
# GNUmakefile for Geant4 external packages
# Gunter Folger 26-April-2011
@@ -14,11 +14,6 @@ endif
include $(G4INSTALL)/config/architecture.gmk
ifeq ($(G4SYSTEM), WIN32-VC)
G4LIB_BUILD_EXPAT = 1
G4LIB_USE_EXPAT = 1
endif
SUBDIRS :=
SUBLIBS :=
+3
View File
@@ -17,6 +17,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
19 March 2018 - G.Cosmo (externals-V10-03-10)
- Corrected GNUmakefile for Windows.
11-December-2017 - G.Cosmo (externals-V10-03-09)
- CLHEP: in MixMaxRng::modadd(), fixed guard for assembly code to protect
builds on 32-bit systems.
+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;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Version.hh 108486 2018-02-15 14:47:25Z gcosmo $
// $Id: G4Version.hh 110074 2018-05-15 10:03:53Z gcosmo $
// GEANT4 tag $Name:$
//
// Version information
@@ -46,11 +46,11 @@
// |--> patch number
#ifndef G4VERSION_NUMBER
#define G4VERSION_NUMBER 1041
#define G4VERSION_NUMBER 1042
#endif
#ifndef G4VERSION_TAG
#define G4VERSION_TAG "$Name: geant4-10-04-patch-01 $"
#define G4VERSION_TAG "$Name: geant4-10-04-patch-02 $"
#endif
// as variables
@@ -58,10 +58,10 @@
#include "G4String.hh"
#ifdef G4MULTITHREADED
static const G4String G4Version = "$Name: geant4-10-04-patch-01 [MT]$";
static const G4String G4Version = "$Name: geant4-10-04-patch-02 [MT]$";
#else
static const G4String G4Version = "$Name: geant4-10-04-patch-01 $";
static const G4String G4Version = "$Name: geant4-10-04-patch-02 $";
#endif
static const G4String G4Date = "(28-February-2018)";
static const G4String G4Date = "(25-May-2018)";
#endif
+9 -1
View File
@@ -1,4 +1,4 @@
$Id: History 108490 2018-02-15 14:54:21Z gcosmo $
$Id: History 110081 2018-05-15 10:13:55Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14th May 2018 Garnier Laurent (interfaces-V10-03-03)
- G4UIQt.cc:
o Fix a bug with some "critical errors" message containing HTML tags inside (<, > and &)
23th April 2018 Garnier Laurent
- G4UIQt:
o Fix a bug with command guidance with HTML tags inside (<, > and &)
8th February 2018 Garnier Laurent (interfaces-V10-03-02)
- G4UIQt:
o Take account \n in account for command guidance in help tree. Bug #296 Fixed
+27 -5
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UIQt.cc 108490 2018-02-15 14:54:21Z gcosmo $
// $Id: G4UIQt.cc 110081 2018-05-15 10:13:55Z gcosmo $
//
// L. Garnier
@@ -2042,6 +2042,9 @@ G4int G4UIQt::ReceiveG4cout (
#ifdef G4MULTITHREADED
UpdateCoutThreadFilter();
#endif
// reset error stack
fLastErrMessage = aString;
return 0;
}
@@ -2083,7 +2086,14 @@ G4int G4UIQt::ReceiveG4cerr (
if ((G4StateManager::GetStateManager()->GetCurrentState() == G4State_Abort) ||
(G4StateManager::GetStateManager()->GetCurrentState() == G4State_Quit )) {
// In case of Abort or Quit, the useful error message should be in the last error message !
QMessageBox::critical(fMainWindow, "Error",QString(fLastErrMessage.data())+"\n"+aString.data());
fLastErrMessage += "\n"+aString;
QString criticalMessage = fLastErrMessage.data();
#if QT_VERSION < 0x050000
criticalMessage = Qt::escape(criticalMessage);
#else
criticalMessage = criticalMessage.toHtmlEscaped();
#endif
QMessageBox::critical(fMainWindow, "Error",QString(fLastErrMessage));
}
}
QColor previousColor = fCoutTBTextArea->textColor();
@@ -2093,7 +2103,7 @@ G4int G4UIQt::ReceiveG4cerr (
fCoutTBTextArea->ensureCursorVisible ();
if (QString(aString.data()).trimmed() != "") {
fLastErrMessage = aString;
fLastErrMessage += aString;
}
#ifdef G4MULTITHREADED
UpdateCoutThreadFilter();
@@ -3162,11 +3172,23 @@ void G4UIQt::updateHelpArea (
QString tmpGuidance = "";
for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
tmpGuidance = QString((char*)(aCommand->GetGuidanceLine(i_thGuidance)).data());
tmpGuidance.replace("\n","<br />");
#if QT_VERSION < 0x050000
tmpGuidance = Qt::escape(tmpGuidance);
#else
tmpGuidance = tmpGuidance.toHtmlEscaped();
#endif
tmpGuidance.replace("\n","<br />");
txt += tmpGuidance + "<br />";
}
if( ! rangeString.isNull() ) {
txt += "<b>Range of parameters : </b> " + QString((char*)(rangeString).data()) + "<br />";
QString range = QString((char*)(rangeString).data());
#if QT_VERSION < 0x050000
range = Qt::escape(range);
#else
range = range.toHtmlEscaped();
#endif
txt += "<b>Range of parameters : </b> " + range + "<br />";
} else {
txt += "<br />";
}
+5 -1
View File
@@ -1,4 +1,4 @@
$Id: History 106143 2017-09-14 06:34:42Z gcosmo $
$Id: History 110104 2018-05-15 11:40:56Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
- 09 April 2018 Makoto Asai ( particles-V10-03-17 )
- G4PhaseSpaceDecayChannel::ManyBodyDecayIt()
Fix incorrect indexing. Addressing bug report #2053.
- 13 September 2017 Krzysztof Genser ( particles-V10-03-16 )
- moved G4MuonicAtom & G4MuonicAtomHelper to management
to avoid circular reference in the granular lib case
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhaseSpaceDecayChannel.cc 102916 2017-03-02 12:58:58Z gcosmo $
// $Id: G4PhaseSpaceDecayChannel.cc 110104 2018-05-15 11:40:56Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -554,7 +554,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ManyBodyDecayIt()
//Calculate daughter momentum
weight = 1.0;
G4bool smOK=true;
for(index =0; index< numberOfDaughters-1 && smOK; index--) {
for(index =0; index< numberOfDaughters-1 && smOK; index++) {
smOK = (sm[index]-daughtermass[index]- sm[index+1] >=0.);
}
if (!smOK) continue;
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History 108496 2018-02-15 15:28:32Z gcosmo $
$Id: History 110108 2018-05-15 11:46:54Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
15 March 2018 Gabriele Cosmo (gdml-V10-03-11)
- Protect printout of progress in reading/writing by G4VERBOSE.
07 February 2018 Daren Sawkey (gdml-V10-03-10)
- Updates to changes in G4Material[Const]PropertiesTable (fix bug #2030) in
G4GDMLWriteSolids and G4GDMLWriteMaterials.
+7 -3
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GDMLRead.cc 89819 2015-04-30 14:53:35Z gcosmo $
// $Id: G4GDMLRead.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLRead Implementation
//
@@ -321,8 +321,9 @@ AuxiliaryRead(const xercesc::DOMElement* const auxiliaryElement)
void G4GDMLRead::UserinfoRead(const xercesc::DOMElement* const userinfoElement)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Reading userinfo..." << G4endl;
#endif
for (xercesc::DOMNode* iter = userinfoElement->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
@@ -364,6 +365,7 @@ void G4GDMLRead::Read(const G4String& fileName,
G4bool strip)
{
dostrip = strip;
#ifdef G4VERBOSE
if (isModule)
{
G4cout << "G4GDML: Reading module '" << fileName << "'..." << G4endl;
@@ -372,7 +374,7 @@ void G4GDMLRead::Read(const G4String& fileName,
{
G4cout << "G4GDML: Reading '" << fileName << "'..." << G4endl;
}
#endif
inLoop = 0;
validate = validation;
@@ -458,7 +460,9 @@ void G4GDMLRead::Read(const G4String& fileName,
if (isModule)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Reading module '" << fileName << "' done!" << G4endl;
#endif
}
else
{
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GDMLReadDefine.cc 96190 2016-03-29 08:07:36Z gcosmo $
// $Id: G4GDMLReadDefine.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLReadDefine Implementation
//
@@ -466,8 +466,9 @@ void G4GDMLReadDefine::QuantityRead(const xercesc::DOMElement* const element)
void
G4GDMLReadDefine::DefineRead(const xercesc::DOMElement* const defineElement)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Reading definitions..." << G4endl;
#endif
for (xercesc::DOMNode* iter = defineElement->getFirstChild();
iter != 0;iter = iter->getNextSibling())
{
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLReadMaterials.cc 96190 2016-03-29 08:07:36Z gcosmo $
// $Id: G4GDMLReadMaterials.cc 110108 2018-05-15 11:46:54Z gcosmo $
// GEANT4 tag $ Name:$
//
// class G4GDMLReadMaterials Implementation
@@ -697,8 +697,9 @@ PropertyRead(const xercesc::DOMElement* const propertyElement,
void G4GDMLReadMaterials::
MaterialsRead(const xercesc::DOMElement* const materialsElement)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Reading materials..." << G4endl;
#endif
for (xercesc::DOMNode* iter = materialsElement->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GDMLReadSetup.cc 88207 2015-02-03 13:47:36Z gcosmo $
// $Id: G4GDMLReadSetup.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLReadSetup Implementation
//
@@ -64,8 +64,9 @@ G4String G4GDMLReadSetup::GetSetup(const G4String& ref)
void G4GDMLReadSetup::SetupRead(const xercesc::DOMElement* const element)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Reading setup..." << G4endl;
#endif
G4String name;
const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GDMLReadSolids.cc 105857 2017-08-24 07:52:24Z gcosmo $
// $Id: G4GDMLReadSolids.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLReadSolids Implementation
//
@@ -2689,8 +2689,9 @@ OpticalSurfaceRead(const xercesc::DOMElement* const opticalsurfaceElement)
void G4GDMLReadSolids::SolidsRead(const xercesc::DOMElement* const solidsElement)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Reading solids..." << G4endl;
#endif
for (xercesc::DOMNode* iter = solidsElement->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GDMLReadStructure.cc 101687 2016-11-21 09:43:18Z gcosmo $
// $Id: G4GDMLReadStructure.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLReadStructure Implementation
//
@@ -794,8 +794,9 @@ Volume_contentRead(const xercesc::DOMElement* const volumeElement)
void G4GDMLReadStructure::
StructureRead(const xercesc::DOMElement* const structureElement)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Reading structure..." << G4endl;
#endif
for (xercesc::DOMNode* iter = structureElement->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
+7 -4
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWrite.cc 96170 2016-03-22 09:17:29Z gcosmo $
// $Id: G4GDMLWrite.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLWrite Implementation
//
@@ -112,8 +112,9 @@ void G4GDMLWrite::UserinfoWrite(xercesc::DOMElement* gdmlElement)
{
if(auxList.size()>0)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Writing userinfo..." << G4endl;
#endif
userinfoElement = NewElement("userinfo");
gdmlElement->appendChild(userinfoElement);
AddAuxInfo(&auxList, userinfoElement);
@@ -171,10 +172,10 @@ G4Transform3D G4GDMLWrite::Write(const G4String& fname,
{
SchemaLocation = setSchemaLocation;
addPointerToName = refs;
#ifdef G4VERBOSE
if (depth==0) { G4cout << "G4GDML: Writing '" << fname << "'..." << G4endl; }
else { G4cout << "G4GDML: Writing module '" << fname << "'..." << G4endl; }
#endif
if (FileExists(fname))
{
G4String ErrorMessage = "File '"+fname+"' already exists!";
@@ -272,7 +273,9 @@ G4Transform3D G4GDMLWrite::Write(const G4String& fname,
}
else
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Writing module '" << fname << "' done !" << G4endl;
#endif
}
return R;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteDefine.cc 93077 2015-10-02 14:38:25Z gcosmo $
// $Id: G4GDMLWriteDefine.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLWriteDefine Implementation
//
@@ -130,8 +130,9 @@ Position_vectorWrite(xercesc::DOMElement* element, const G4String& tag,
void G4GDMLWriteDefine::DefineWrite(xercesc::DOMElement* element)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Writing definitions..." << G4endl;
#endif
defineElement = NewElement("define");
element->appendChild(defineElement);
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteMaterials.cc 108496 2018-02-15 15:28:32Z gcosmo $
// $Id: G4GDMLWriteMaterials.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLWriteMaterials Implementation
//
@@ -284,8 +284,9 @@ void G4GDMLWriteMaterials::PropertyWrite(xercesc::DOMElement* matElement,
void G4GDMLWriteMaterials::MaterialsWrite(xercesc::DOMElement* element)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Writing materials..." << G4endl;
#endif
materialsElement = NewElement("materials");
element->appendChild(materialsElement);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteSetup.cc 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4GDMLWriteSetup.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLWriteSetup Implementation
//
@@ -47,8 +47,9 @@ G4GDMLWriteSetup::~G4GDMLWriteSetup()
void G4GDMLWriteSetup::SetupWrite(xercesc::DOMElement* gdmlElement,
const G4LogicalVolume* const logvol)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Writing setup..." << G4endl;
#endif
const G4String worldref = GenerateName(logvol->GetName(),logvol);
xercesc::DOMElement* setupElement = NewElement("setup");
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteSolids.cc 108496 2018-02-15 15:28:32Z gcosmo $
// $Id: G4GDMLWriteSolids.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLWriteSolids Implementation
//
@@ -555,7 +555,6 @@ GenericPolyconeWrite(xercesc::DOMElement* solElement,
const G4double z_point=polycone->GetCorner(i).z;
RZPointWrite(polyconeElement,r_point,z_point);
}
}
void G4GDMLWriteSolids::
@@ -563,56 +562,60 @@ PolyhedraWrite(xercesc::DOMElement* solElement,
const G4Polyhedra* const polyhedra)
{
const G4String& name = GenerateName(polyhedra->GetName(),polyhedra);
if(polyhedra->IsGeneric() == false){
xercesc::DOMElement* polyhedraElement = NewElement("polyhedra");
polyhedraElement->setAttributeNode(NewAttribute("name",name));
polyhedraElement->setAttributeNode(NewAttribute("startphi",
if(polyhedra->IsGeneric() == false)
{
xercesc::DOMElement* polyhedraElement = NewElement("polyhedra");
polyhedraElement->setAttributeNode(NewAttribute("name",name));
polyhedraElement->setAttributeNode(NewAttribute("startphi",
polyhedra->GetOriginalParameters()->Start_angle/degree));
polyhedraElement->setAttributeNode(NewAttribute("deltaphi",
polyhedraElement->setAttributeNode(NewAttribute("deltaphi",
polyhedra->GetOriginalParameters()->Opening_angle/degree));
polyhedraElement->setAttributeNode(NewAttribute("numsides",
polyhedraElement->setAttributeNode(NewAttribute("numsides",
polyhedra->GetOriginalParameters()->numSide));
polyhedraElement->setAttributeNode(NewAttribute("aunit","deg"));
polyhedraElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyhedraElement);
polyhedraElement->setAttributeNode(NewAttribute("aunit","deg"));
polyhedraElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyhedraElement);
const size_t num_zplanes = polyhedra->GetOriginalParameters()->Num_z_planes;
const G4double* z_array = polyhedra->GetOriginalParameters()->Z_values;
const G4double* rmin_array = polyhedra->GetOriginalParameters()->Rmin;
const G4double* rmax_array = polyhedra->GetOriginalParameters()->Rmax;
const size_t num_zplanes =
polyhedra->GetOriginalParameters()->Num_z_planes;
const G4double* z_array =
polyhedra->GetOriginalParameters()->Z_values;
const G4double* rmin_array = polyhedra->GetOriginalParameters()->Rmin;
const G4double* rmax_array = polyhedra->GetOriginalParameters()->Rmax;
const G4double convertRad =
std::cos(0.5*polyhedra->GetOriginalParameters()->Opening_angle
/ polyhedra->GetOriginalParameters()->numSide);
const G4double convertRad =
std::cos(0.5*polyhedra->GetOriginalParameters()->Opening_angle
/ polyhedra->GetOriginalParameters()->numSide);
for (size_t i=0;i<num_zplanes;i++)
{
ZplaneWrite(polyhedraElement,z_array[i],
rmin_array[i]*convertRad, rmax_array[i]*convertRad);
}
}else{//generic polyhedra
xercesc::DOMElement* polyhedraElement = NewElement("genericPolyhedra");
polyhedraElement->setAttributeNode(NewAttribute("name",name));
polyhedraElement->setAttributeNode(NewAttribute("startphi",
for (size_t i=0;i<num_zplanes;i++)
{
ZplaneWrite(polyhedraElement,z_array[i],
rmin_array[i]*convertRad, rmax_array[i]*convertRad);
}
}
else // generic polyhedra
{
xercesc::DOMElement* polyhedraElement = NewElement("genericPolyhedra");
polyhedraElement->setAttributeNode(NewAttribute("name",name));
polyhedraElement->setAttributeNode(NewAttribute("startphi",
polyhedra->GetOriginalParameters()->Start_angle/degree));
polyhedraElement->setAttributeNode(NewAttribute("deltaphi",
polyhedraElement->setAttributeNode(NewAttribute("deltaphi",
polyhedra->GetOriginalParameters()->Opening_angle/degree));
polyhedraElement->setAttributeNode(NewAttribute("numsides",
polyhedraElement->setAttributeNode(NewAttribute("numsides",
polyhedra->GetOriginalParameters()->numSide));
polyhedraElement->setAttributeNode(NewAttribute("aunit","deg"));
polyhedraElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyhedraElement);
polyhedraElement->setAttributeNode(NewAttribute("aunit","deg"));
polyhedraElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyhedraElement);
const size_t num_rzpoints = polyhedra->GetNumRZCorner();
const size_t num_rzpoints = polyhedra->GetNumRZCorner();
for (size_t i=0;i<num_rzpoints;i++)
{
const G4double r_point = polyhedra->GetCorner(i).r;
const G4double z_point = polyhedra->GetCorner(i).z;
RZPointWrite(polyhedraElement,r_point,z_point);
}
}
for (size_t i=0;i<num_rzpoints;i++)
{
const G4double r_point = polyhedra->GetCorner(i).r;
const G4double z_point = polyhedra->GetCorner(i).z;
RZPointWrite(polyhedraElement,r_point,z_point);
}
}
}
void G4GDMLWriteSolids::
@@ -1106,8 +1109,9 @@ void G4GDMLWriteSolids::PropertyWrite(xercesc::DOMElement* optElement,
void G4GDMLWriteSolids::SolidsWrite(xercesc::DOMElement* gdmlElement)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Writing solids..." << G4endl;
#endif
solidsElement = NewElement("solids");
gdmlElement->appendChild(solidsElement);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteStructure.cc 106390 2017-10-09 09:42:18Z gcosmo $
// $Id: G4GDMLWriteStructure.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4GDMLWriteStructure Implementation
//
@@ -362,8 +362,9 @@ G4GDMLWriteStructure::GetBorderSurface(const G4VPhysicalVolume* const pvol)
void G4GDMLWriteStructure::SurfacesWrite()
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Writing surfaces..." << G4endl;
#endif
std::vector<xercesc::DOMElement*>::const_iterator pos;
for (pos = skinElementVec.begin(); pos != skinElementVec.end(); pos++)
{
@@ -377,8 +378,9 @@ void G4GDMLWriteStructure::SurfacesWrite()
void G4GDMLWriteStructure::StructureWrite(xercesc::DOMElement* gdmlElement)
{
#ifdef G4VERBOSE
G4cout << "G4GDML: Writing structure..." << G4endl;
#endif
structureElement = NewElement("structure");
gdmlElement->appendChild(structureElement);
}
+7 -3
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4STRead.cc 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4STRead.cc 110108 2018-05-15 11:46:54Z gcosmo $
//
// class G4STRead Implementation
//
@@ -63,7 +63,9 @@ void G4STRead::TessellatedRead(const std::string& line)
new G4LogicalVolume(tessellated, solid_material, name+"_LV" , 0, 0, 0);
tessellatedList.push_back(tessellated);
#ifdef G4VERBOSE
G4cout << "G4STRead: Reading solid: " << name << G4endl;
#endif
}
void G4STRead::FacetRead(const std::string& line)
@@ -197,8 +199,9 @@ void G4STRead::PhysvolRead(const std::string& line)
void G4STRead::ReadGeom(const G4String& name)
{
#ifdef G4VERBOSE
G4cout << "G4STRead: Reading '" << name << "'..." << G4endl;
#endif
std::ifstream GeomFile(name);
if (!GeomFile)
@@ -228,8 +231,9 @@ void G4STRead::ReadGeom(const G4String& name)
void G4STRead::ReadTree(const G4String& name)
{
#ifdef G4VERBOSE
G4cout << "G4STRead: Reading '" << name << "'..." << G4endl;
#endif
std::ifstream TreeFile(name);
if (!TreeFile)
@@ -1,4 +1,4 @@
$Id: History 107332 2017-11-08 16:44:06Z gcosmo $
$Id: History 110187 2018-05-17 10:41:08Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -14,6 +14,15 @@ introduced in the code and keeptrack of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
17-May-2018 V.Ivanchenko (phys-ctor-em-V10-03-38)
- G4EmModelActivator - fixed GS and Opt3 configurations
27-April-2018 V.Ivanchenko
- G4EmModelActivator - modified accordingly
28-March-2018 V.Ivanchenko
- G4EmModelActivator - fixed Opt4 and single scattering (problem #2045)
07-November-2017 V.Ivanchenko (phys-ctor-em-V10-03-37)
- G4EmStandardPhysics_option4 - enable Auger cascade
@@ -54,6 +54,8 @@
class G4EmParameters;
class G4ProcessManager;
class G4ParticleDefinition;
class G4EmConfigurator;
class G4VMscModel;
class G4EmModelActivator
{
@@ -71,6 +73,10 @@ private:
void FindOrAddProcess(const G4ParticleDefinition*, const G4String&);
void AddStandardScattering(const G4ParticleDefinition*, G4EmConfigurator*,
G4VMscModel*, const G4String&,
G4double, G4double);
G4bool HasMsc(G4ProcessManager*) const;
G4EmModelActivator & operator=(const G4EmModelActivator &right) = delete;
@@ -51,6 +51,7 @@
#include "G4RegionStore.hh"
#include "G4Region.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4VMscModel.hh"
#include "G4LossTableManager.hh"
#include "G4EmConfigurator.hh"
#include "G4PAIModel.hh"
@@ -159,12 +160,22 @@ void G4EmModelActivator::ActivateEmOptions()
const G4ParticleDefinition* elec = G4Electron::Electron();
const G4ParticleDefinition* posi = G4Positron::Positron();
const G4ParticleDefinition* phot = G4Gamma::Gamma();
const G4ParticleDefinition* prot = G4Proton::Proton();
G4LossTableManager* man = G4LossTableManager::Instance();
G4EmConfigurator* em_config = man->EmConfigurator();
G4VAtomDeexcitation* adeexc = man->AtomDeexcitation();
G4ParticleTable* table = G4ParticleTable::GetParticleTable();
G4VEmModel* mod;
// high energy limit for low-energy e+- model of msc
G4double mscEnergyLimit = 100*MeV;
// high energy limit for Livermore and Penelope models
G4double highEnergyLimit = 1*GeV;
// general high energy limit
G4double highEnergy = 100*TeV;
for(G4int i=0; i<nreg; ++i) {
G4String reg = regnamesPhys[i];
if(verbose > 0) {
@@ -177,10 +188,11 @@ void G4EmModelActivator::ActivateEmOptions()
if("G4EmStandard" == typesPhys[i]) {
G4UrbanMscModel* msc = new G4UrbanMscModel();
msc->SetLocked(true);
em_config->SetExtraEmModel("e-", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
msc = new G4UrbanMscModel();
msc->SetLocked(true);
em_config->SetExtraEmModel("e+", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
} else if("G4EmStandard_opt1" == typesPhys[i] ||
"G4EmStandard_opt2" == typesPhys[i]) {
@@ -188,27 +200,39 @@ void G4EmModelActivator::ActivateEmOptions()
msc->SetStepLimitType(fMinimal);
msc->SetRangeFactor(0.2);
msc->SetLocked(true);
em_config->SetExtraEmModel("e-", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
msc = new G4UrbanMscModel();
msc->SetStepLimitType(fMinimal);
msc->SetRangeFactor(0.2);
msc->SetLocked(true);
em_config->SetExtraEmModel("e+", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
} else if("G4EmStandard_opt3" == typesPhys[i]) {
G4DummyModel* dummy = new G4DummyModel();
G4UrbanMscModel* msc = new G4UrbanMscModel();
msc->SetStepLimitType(fUseDistanceToBoundary);
msc->SetLocked(true);
em_config->SetExtraEmModel("e-", "msc", msc, reg);
FindOrAddProcess(elec, "CoulombScat");
em_config->SetExtraEmModel("e-", "CoulombScat", dummy, reg);
msc = new G4UrbanMscModel();
msc->SetStepLimitType(fUseDistanceToBoundary);
msc->SetLocked(true);
em_config->SetExtraEmModel("e+", "msc", msc, reg);
FindOrAddProcess(posi, "CoulombScat");
em_config->SetExtraEmModel("e+", "CoulombScat", dummy, reg);
msc = new G4UrbanMscModel();
msc->SetStepLimitType(fMinimal);
msc->SetRangeFactor(0.2);
msc->SetLocked(true);
em_config->SetExtraEmModel("proton", "msc", msc, reg);
FindOrAddProcess(prot, "CoulombScat");
em_config->SetExtraEmModel("proton", "CoulombScat", dummy, reg);
if(G4Threading::IsMasterThread()) {
theParameters->SetDeexActiveRegion(reg, true, false, false);
}
@@ -224,16 +248,18 @@ void G4EmModelActivator::ActivateEmOptions()
em_config->SetExtraEmModel("gamma", "compt", mod, reg);
} else if("G4EmStandard_opt4" == typesPhys[i]) {
G4UrbanMscModel* msc = new G4UrbanMscModel();
msc->SetStepLimitType(fUseDistanceToBoundary);
msc->SetRangeFactor(0.02);
G4GoudsmitSaundersonMscModel* msc = new G4GoudsmitSaundersonMscModel();
msc->SetStepLimitType(fUseSafetyPlus);
msc->SetRangeFactor(0.1);
msc->SetLocked(true);
em_config->SetExtraEmModel("e-", "msc", msc, reg, 0.0, 100*MeV);
msc = new G4UrbanMscModel();
msc->SetStepLimitType(fUseDistanceToBoundary);
msc->SetRangeFactor(0.02);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
msc = new G4GoudsmitSaundersonMscModel();
msc->SetStepLimitType(fUseSafetyPlus);
msc->SetRangeFactor(0.1);
msc->SetLocked(true);
em_config->SetExtraEmModel("e+", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
if(G4Threading::IsMasterThread()) {
theParameters->SetDeexActiveRegion(reg, true, false, false);
theParameters->SetStepFunction(0.2, 10*um);
@@ -243,9 +269,6 @@ void G4EmModelActivator::ActivateEmOptions()
FindOrAddProcess(phot, "Rayl");
mod = new G4LivermoreRayleighModel();
em_config->SetExtraEmModel("gamma", "Rayl", mod, reg);
FindOrAddProcess(phot, "phot");
mod = new G4LivermorePhotoElectricModel();
em_config->SetExtraEmModel("gamma", "phot", mod, reg);
FindOrAddProcess(phot, "compt");
mod = new G4KleinNishinaModel();
em_config->SetExtraEmModel("gamma", "compt", mod, reg);
@@ -255,30 +278,30 @@ void G4EmModelActivator::ActivateEmOptions()
} else if("G4EmStandardGS" == typesPhys[i]) {
G4GoudsmitSaundersonMscModel* msc = new G4GoudsmitSaundersonMscModel();
msc->SetStepLimitType(fUseSafetyPlus);
msc->SetRangeFactor(0.1);
msc->SetRangeFactor(0.06);
msc->SetLocked(true);
em_config->SetExtraEmModel("e-", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
msc = new G4GoudsmitSaundersonMscModel();
msc->SetStepLimitType(fUseSafetyPlus);
msc->SetRangeFactor(0.1);
msc->SetRangeFactor(0.06);
msc->SetLocked(true);
em_config->SetExtraEmModel("e+", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
} else if("G4EmStandardWVI" == typesPhys[i]) {
G4WentzelVIModel* msc = new G4WentzelVIModel();
msc->SetLocked(true);
em_config->SetExtraEmModel("e-", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(elec, em_config, msc, reg, mscEnergyLimit, highEnergy);
msc = new G4WentzelVIModel();
msc->SetLocked(true);
em_config->SetExtraEmModel("e+", "msc", msc, reg, 0.0, 100*MeV);
AddStandardScattering(posi, em_config, msc, reg, mscEnergyLimit, highEnergy);
FindOrAddProcess(elec, "CoulombScat");
FindOrAddProcess(posi, "CoulombScat");
mod = new G4eCoulombScatteringModel();
em_config->SetExtraEmModel("e-", "CoulombScat", mod, reg, 0.0, 100*MeV);
em_config->SetExtraEmModel("e-", "CoulombScat", mod, reg, 0.0, mscEnergyLimit);
mod = new G4eCoulombScatteringModel();
em_config->SetExtraEmModel("e+", "CoulombScat", mod, reg, 0.0, 100*MeV);
em_config->SetExtraEmModel("e+", "CoulombScat", mod, reg, 0.0, mscEnergyLimit);
if(G4Threading::IsMasterThread()) {
theParameters->SetDeexActiveRegion(regnamesPhys[i], true, false, false);
@@ -327,7 +350,7 @@ void G4EmModelActivator::ActivateEmOptions()
G4UniversalFluctuation* uf = new G4UniversalFluctuation();
em_config->SetExtraEmModel("e-", "eIoni", mod, reg, 0.0, 0.1*MeV, uf);
mod = new G4LivermoreBremsstrahlungModel();
em_config->SetExtraEmModel("e-", "eBrem", mod, reg, 0.0, 1*GeV);
em_config->SetExtraEmModel("e-", "eBrem", mod, reg, 0.0, highEnergyLimit);
if(G4Threading::IsMasterThread()) {
theParameters->SetDeexActiveRegion(regnamesPhys[i], true, false, false);
@@ -348,17 +371,17 @@ void G4EmModelActivator::ActivateEmOptions()
mod = new G4PenelopeIonisationModel();
G4UniversalFluctuation* uf = new G4UniversalFluctuation();
em_config->SetExtraEmModel("e-", "eIoni", mod, reg, 0.0, 1*GeV, uf);
em_config->SetExtraEmModel("e-", "eIoni", mod, reg, 0.0, highEnergyLimit, uf);
mod = new G4PenelopeBremsstrahlungModel();
em_config->SetExtraEmModel("e-", "eBrem", mod, reg, 0.0, 1*GeV);
em_config->SetExtraEmModel("e-", "eBrem", mod, reg, 0.0, highEnergyLimit);
mod = new G4PenelopeIonisationModel();
uf = new G4UniversalFluctuation();
em_config->SetExtraEmModel("e+", "eIoni", mod, reg, 0.0, 1*GeV, uf);
em_config->SetExtraEmModel("e+", "eIoni", mod, reg, 0.0, highEnergyLimit, uf);
mod = new G4PenelopeBremsstrahlungModel();
em_config->SetExtraEmModel("e+", "eBrem", mod, reg, 0.0, 1*GeV);
em_config->SetExtraEmModel("e+", "eBrem", mod, reg, 0.0, highEnergyLimit);
mod = new G4PenelopeAnnihilationModel();
em_config->SetExtraEmModel("e+", "annihil", mod, reg, 0.0, 1*GeV);
em_config->SetExtraEmModel("e+", "annihil", mod, reg, 0.0, highEnergyLimit);
if(G4Threading::IsMasterThread()) {
theParameters->SetDeexActiveRegion(regnamesPhys[i], true, false, false);
@@ -368,8 +391,6 @@ void G4EmModelActivator::ActivateEmOptions()
} else if("G4RadioactiveDecay" == typesPhys[i]) {
if(G4Threading::IsMasterThread()) {
theParameters->SetFluo(true);
theParameters->SetAuger(true);
theParameters->SetAugerCascade(true);
theParameters->SetDeexcitationIgnoreCut(true);
}
@@ -436,16 +457,17 @@ void G4EmModelActivator::ActivatePAI()
else if (p == gion)
{ name = "ionIoni"; }
for(itr = v.begin(); itr != v.end(); ++itr) {
//for(itr = v.begin(); itr != v.end(); ++itr) {
for(auto proc : v) {
G4VEnergyLossProcess* proc = *itr;
if(!proc->IsIonisationProcess()) { continue; }
G4String namep = proc->GetProcessName();
if(p) {
if(name != namep) { continue; }
} else {
if(namep != "hIoni" && namep != "muIoni" && namep != "eIoni")
if(namep != "hIoni" && namep != "muIoni" &&
namep != "eIoni" && namep != "ionIoni")
{ continue; }
}
G4VEmModel* em = nullptr;
@@ -660,6 +682,30 @@ G4bool G4EmModelActivator::HasMsc(G4ProcessManager* pm) const
return res;
}
void G4EmModelActivator::AddStandardScattering(const G4ParticleDefinition* part,
G4EmConfigurator* em_config,
G4VMscModel* mscmod,
const G4String& reg,
G4double e1, G4double e2)
{
G4String pname = part->GetParticleName();
// low-energy msc model
em_config->SetExtraEmModel(pname, "msc", mscmod, reg, 0.0, e1);
// high energy msc model
G4WentzelVIModel* msc = new G4WentzelVIModel();
msc->SetLocked(true);
em_config->SetExtraEmModel(pname, "msc", msc, reg, e1, e2);
// high energy single scattering model
FindOrAddProcess(part, "CoulombScat");
G4eCoulombScatteringModel* mod = new G4eCoulombScatteringModel();
mod->SetActivationLowEnergyLimit(e1);
mod->SetLocked(true);
em_config->SetExtraEmModel(pname, "CoulombScat", mod, reg, 0.0, e2);
}
void G4EmModelActivator::FindOrAddProcess(const G4ParticleDefinition* part,
const G4String& name)
{
@@ -1,4 +1,4 @@
$Id: History 108500 2018-02-15 15:38:58Z gcosmo $
$Id: History 110113 2018-05-15 11:53:10Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
25.04.2018 V.Ivanchenko, emlowen-V10-03-21
- G4LivermorePhotoElectricModel - fixed double deletion of static members
happens when models defined per region (problem #2052)
19.12.2017 G.Cosmo, emlowen-V10-03-20
- Fixed self-consistency in G4ecpssrFormFactorMixsModel header (missing #include).
Thanks to Raphael Isemann for reporting this.
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermorePhotoElectricModel.cc 107157 2017-11-03 11:27:29Z gcosmo $
// $Id: G4LivermorePhotoElectricModel.cc 110113 2018-05-15 11:53:10Z gcosmo $
//
//
// Author: Sebastien Incerti
@@ -99,15 +99,16 @@ G4LivermorePhotoElectricModel::~G4LivermorePhotoElectricModel()
{
if(IsMaster()) {
delete fShellCrossSection;
fShellCrossSection = nullptr;
for(G4int i=0; i<maxZ; ++i) {
delete fParamHigh[i];
fParamHigh[i] = 0;
fParamHigh[i] = nullptr;
delete fParamLow[i];
fParamLow[i] = 0;
fParamLow[i] = nullptr;
delete fCrossSection[i];
fCrossSection[i] = 0;
fCrossSection[i] = nullptr;
delete fCrossSectionLE[i];
fCrossSectionLE[i] = 0;
fCrossSectionLE[i] = nullptr;
}
}
}
@@ -119,7 +120,7 @@ G4LivermorePhotoElectricModel::Initialise(const G4ParticleDefinition*,
const G4DataVector&)
{
if (verboseLevel > 2) {
G4cout << "Calling G4LivermorePhotoElectricModel::Initialise()" << G4endl;
G4cout << "Calling G4LivermorePhotoElectricModel::Initialise() " << G4endl;
}
if(IsMaster()) {
@@ -14,6 +14,10 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
24 April 2018 Alberto Ribon (hadr-hpp-V10-03-11)
---------------------------------------------------
- G4ParticleHPFissionFS : protect against very rare cases of division by zero.
19 December 2017 Gabriele Cosmo (hadr-hpp-V10-03-10)
---------------------------------------------------
- Fixed self-consistency in headers (missing #include) in G4FFGEnumerations,
@@ -224,7 +224,17 @@
//G4cout << "delayed" << G4endl;
for(i0=Prompt; i0<Prompt+delayed; i0++)
{
G4double time = -G4Log(G4UniformRand())/theDecayConstants[i0-Prompt];
// Protect against the very rare case of division by zero
G4double time = 0.0;
if ( theDecayConstants[i0-Prompt] > 1.0e-30 ) {
time = -G4Log(G4UniformRand())/theDecayConstants[i0-Prompt];
} else {
G4ExceptionDescription ed;
ed << " theDecayConstants[i0-Prompt]=" << theDecayConstants[i0-Prompt]
<< " -> cannot sample the time : set it to 0.0 !" << G4endl;
G4Exception( "G4ParticleHPFissionFS::ApplyYourself ", "HAD_FISSIONHP_001", JustWarning, ed );
}
time += theTrack.GetGlobalTime();
theResult.Get()->AddSecondary(theNeutrons->operator[](i0));
theResult.Get()->GetSecondary(theResult.Get()->GetNumberOfSecondaries()-1)->SetTime(time);
@@ -14,6 +14,24 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
4 April 2018 Dennis Wright radioactive_decay-V10-03-23
---------------------------------------------------------
- G4RadioactiveDecay::ConvolveSourceTimeProfile: switch from std::exp to
std::expm1 where small exp arguments are expected. This greatly reduces
cancellation errors as well as the accumulated error in the variance
reduction weight calculation. Although negative weights still occur,
their size is reduced by about ten orders of magnitude, enough to set
negative weights to zero. Fixes bug report #1480.
- G4Radioactivation::ConvolveSourceTimeProfile: same as above.
12 March 2018 Dennis Wright
---------------------------------------------------------
- G4RadioactiveDecay::AddDeexcitationSpectrumForBiasMode: make sure
last stable nuclide in decay chain is included as secondary.
Fixes bug 2024.
- G4Radioactivation::AddDeexcitationSpectrumForBiasMode: same as above
14 December 2017 Dennis Wright radioactive_decay-V10-03-22
------------------------------------------------------------
- re-tag
@@ -174,52 +174,50 @@ G4Radioactivation::GetChainsFromParent(const G4ParticleDefinition& aParticle)
// function with a single exponential characterized by a decay constant in the
// decay chain. The time profile is treated as a step function so that the
// convolution integral can be done bin-by-bin.
// Input time and mean life (tau) are in ns.
// This implements Eq. 4.13 of DERA technical note, with SProfile[i] = F(t')
G4double
G4Radioactivation::ConvolveSourceTimeProfile(const G4double t, const G4double tau)
{
long double convolvedTime = 0.L;
G4double convolvedTime = 0.0;
G4int nbin;
if ( t > SBin[NSourceBin]) {
// Region 3 of convolution integral (t falls above source function domain)
nbin = NSourceBin;
} else {
// Region 2 of convolution integral (t falls within source function domain)
// 0 < t < SBin[NSourceBin]
nbin = 0;
G4int loop = 0;
G4ExceptionDescription ed;
ed << " While count exceeded " << G4endl;
while (t > SBin[nbin]) { /* Loop checking, 01.09.2015, D.Wright */
while (t > SBin[nbin]) { // Loop checking, 01.09.2015, D.Wright
loop++;
if (loop > 1000) {
G4Exception("G4RadioactiveDecay::ConvolveSourceTimeProfile()",
"HAD_RDM_100", JustWarning, ed);
break;
}
nbin++;
}
nbin--;
}
long double lt = t ;
long double ltau = tau;
// G4cout << " Convolve: tau = " << tau << G4endl;
// Use expm1 wherever possible to avoid large cancellation errors in
// 1 - exp(x) for small x
G4double earg = 0.0;
if (nbin > 0) {
for (G4int i = 0; i < nbin; i++) {
convolvedTime += (long double)SProfile[i] *
(std::exp(-(lt-(long double)SBin[i+1])/ltau)-std::exp(-(lt-(long double)SBin[i])/ltau));
earg = (SBin[i+1] - SBin[i])/tau;
if (earg < 100.) {
convolvedTime += SProfile[i] * std::exp((SBin[i] - t)/tau) *
std::expm1(earg);
} else {
convolvedTime += SProfile[i] *
(std::exp(-(t-SBin[i+1])/tau)-std::exp(-(t-SBin[i])/tau));
}
}
}
// if (nbin < NSourceBin)
convolvedTime += (long double)SProfile[nbin] * (1.L-std::exp(-(lt-(long double)SBin[nbin])/ltau));
// In traditional convolution, the last line should not be added to the sum.
// Instead it should be the sole expresssion for times greater than SBin[nbin].
// This expression only represents a source function consisting of a single rectangle pulse.
// Also, it looks like the final integral should be multiplied by ltau
convolvedTime -= SProfile[nbin] * std::expm1((SBin[nbin] - t)/tau);
// tau divided out of final result to provide probability of decay in window
if (convolvedTime < 0.) {
G4cout << " Convolved time =: " << convolvedTime << " reset to zero! " << G4endl;
@@ -231,7 +229,7 @@ G4Radioactivation::ConvolveSourceTimeProfile(const G4double t, const G4double ta
if (GetVerboseLevel() > 1)
G4cout << " Convolved time: " << convolvedTime << G4endl;
#endif
return (G4double)convolvedTime ;
return convolvedTime;
}
@@ -877,13 +875,51 @@ G4Radioactivation::DecayIt(const G4Track& theTrack, const G4Step&)
PT = theDecayRateVector[i].GetTaos();
PR = theDecayRateVector[i].GetDecayRateC();
// Calculate the decay rate of the isotope
// decayRate is the radioactivity of isotope (PZ,PA,PE) at the
// time 'theDecayTime'
// The array of arrays theDecayRateVector contains all possible decay
// chains of a given parent nucleus (ZP,AP,EP) to a given descendant
// nuclide (Z,A,E).
//
// theDecayRateVector[0] contains the decay parameters of the parent
// nucleus
// PZ = ZP
// PA = AP
// PE = EP
// PT[] = {TP}
// PR[] = {RP}
//
// theDecayRateVector[1] contains the decay of the parent to the first
// generation daughter (Z1,A1,E1).
// PZ = Z1
// PA = A1
// PE = E1
// PT[] = {TP, T1}
// PR[] = {RP, R1}
//
// theDecayRateVector[2] contains the decay of the parent to the first
// generation daughter (Z1,A1,E1) and the decay of the first
// generation daughter to the second generation daughter (Z2,A2,E2).
// PZ = Z2
// PA = A2
// PE = E2
// PT[] = {TP, T1, T2}
// PR[] = {RP, R1, R2}
//
// theDecayRateVector[3] may contain a branch chain
// PZ = Z2a
// PA = A2a
// PE = E2a
// PT[] = {TP, T1, T2a}
// PR[] = {RP, R1, R2a}
//
// and so on.
// Calculate the decay rate of the isotope. decayRate is the
// radioactivity of isotope (PZ,PA,PE) at 'theDecayTime'
// it will be used to calculate the statistical weight of the
// decay products of this isotope
// G4cout <<"PA= "<< PA << " PZ= " << PZ << " PE= "<< PE <<G4endl;
// For each nuclide, calculate all the decay chains which can reach
// the parent nuclide
decayRate = 0.L;
for (j = 0; j < PT.size(); j++) {
// G4cout << " RDM::DecayIt: tau input to Convolve: " << PT[j] << G4endl;
@@ -895,14 +931,38 @@ G4Radioactivation::DecayIt(const G4Track& theTrack, const G4Step&)
// equation is defined to be negative,
// i.e. decay away, but we need positive value here.
// G4cout << j << "\t"<< PT[j]/s <<"\t"<<PR[j]<< "\t"
// << decayRate << G4endl;
// G4cout << j << "\t"<< PT[j]/s << "\t" << PR[j] << "\t" << decayRate << G4endl;
}
// add the isotope to the radioactivity tables
// At this point any negative decay rates are probably small enough
// (order 10**-30) that negative values are likely due to cancellation
// errors. Set them to zero.
if (decayRate < 0.0) decayRate = 0.0;
/*
if (decayRate < 0.0) {
if (-decayRate > 1.0e-30) {
G4ExceptionDescription ed;
ed << " Negative decay probability (magnitude > 1e-30) \n"
<< " in variance reduction branch " << G4endl;
G4Exception("G4RadioactiveDecay::DecayIt()",
"HAD_RDM_200", JustWarning, ed);
} else {
// Decay probability is small enough that negative value is likely
// due to cancellation errors. Set it to zero.
decayRate = 0.0;
}
}
if (decayRate < 0.0) G4cout << " NEGATIVE decay rate = " << decayRate << G4endl;
*/
// G4cout <<theDecayTime/s <<"\t"<<nbin<<G4endl;
// G4cout << theTrack.GetWeight() <<"\t"<<weight1<<"\t"<<decayRate<< G4endl;
theRadioactivityTables[decayWindows[nbin-1]]->AddIsotope(PZ,PA,PE,weight1*decayRate,theTrack.GetWeight());
// Add isotope to the radioactivity tables
// One table for each observation time window specifed in
// SetDecayBias(G4String filename)
theRadioactivityTables[decayWindows[nbin-1]]
->AddIsotope(PZ,PA,PE,weight1*decayRate,theTrack.GetWeight());
// Now calculate the statistical weight
// One needs to fold the source bias function with the decaytime
@@ -991,7 +1051,7 @@ G4Radioactivation::DecayIt(const G4Track& theTrack, const G4Step&)
}
//Add gamma,Xray,conversion,and auger electrons for bias mode
// Add gamma, X-ray, conversion and auger electrons for bias mode
void
G4Radioactivation::AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition* apartDef,
G4double weight,G4double currentTime,
@@ -1001,26 +1061,35 @@ G4Radioactivation::AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition* apar
{
G4double elevel=((const G4Ions*)(apartDef))->GetExcitationEnergy();
G4double life_time=apartDef->GetPDGLifeTime();
G4ITDecay* anITChannel = 0;
while (life_time <halflifethreshold && elevel>0.) {
G4ITDecay* anITChannel = new G4ITDecay(apartDef, 100., elevel,elevel,
photonEvaporation);
anITChannel = new G4ITDecay(apartDef, 100., elevel, elevel, photonEvaporation);
G4DecayProducts* pevap_products = anITChannel->DecayIt(0.);
G4int nb_pevapSecondaries = pevap_products->entries();
G4DynamicParticle* a_pevap_secondary = 0;
G4ParticleDefinition* secDef = 0;
for (G4int ind = 0; ind < nb_pevapSecondaries; ind++) {
G4DynamicParticle* a_pevap_secondary= pevap_products->PopProducts();
//Gammas,electrons, alphas coming from excited state
if (a_pevap_secondary->GetDefinition()->GetBaryonNumber() < 5) {
weights_v.push_back(weight);
times_v.push_back(currentTime);
secondaries_v.push_back(a_pevap_secondary);
}
//New excited or ground state
else {
apartDef =a_pevap_secondary->GetDefinition();
elevel=((const G4Ions*)(apartDef))->GetExcitationEnergy();
life_time=apartDef->GetPDGLifeTime();
}
a_pevap_secondary= pevap_products->PopProducts();
secDef = a_pevap_secondary->GetDefinition();
if (secDef->GetBaryonNumber() > 4) {
elevel = ((const G4Ions*)(secDef))->GetExcitationEnergy();
life_time = secDef->GetPDGLifeTime();
apartDef = secDef;
if (secDef->GetPDGStable() ) {
weights_v.push_back(weight);
times_v.push_back(currentTime);
secondaries_v.push_back(a_pevap_secondary);
}
} else {
weights_v.push_back(weight);
times_v.push_back(currentTime);
secondaries_v.push_back(a_pevap_secondary);
}
}
delete anITChannel;
}
}
@@ -256,16 +256,20 @@ G4RadioactiveDecay::~G4RadioactiveDecay()
G4bool G4RadioactiveDecay::IsApplicable(const G4ParticleDefinition& aParticle)
{
// All particles other than G4Ions, are rejected by default
if (((const G4Ions*)(&aParticle))->GetExcitationEnergy() > 0.) {return true;}
// All particles other than G4Ions are rejected by default
if (((const G4Ions*)(&aParticle))->GetExcitationEnergy() > 0.) {
return true; // Not ground state - decay
}
if (aParticle.GetParticleName() == "GenericIon") {
return true;
} else if (!(aParticle.GetParticleType() == "nucleus")
|| aParticle.GetPDGLifeTime() < 0. ) {
return false;
return false; // Nuclide is stable - no decay
}
// Determine whether the nuclide falls into the correct A and Z range
// At this point nuclide must be an unstable ground state
// Determine whether it falls into the correct A and Z range
G4int A = ((const G4Ions*) (&aParticle))->GetAtomicMass();
G4int Z = ((const G4Ions*) (&aParticle))->GetAtomicNumber();
@@ -412,12 +416,7 @@ G4RadioactiveDecay::GetChainsFromParent(const G4ParticleDefinition& aParticle)
#endif
}
// ConvolveSourceTimeProfile performs the convolution of the source time profile
// function with a single exponential characterized by a decay constant in the
// decay chain. The time profile is treated as a step function so that the
// convolution integral can be done bin-by-bin.
// Input time and mean life (tau) are in ns.
/* DHW: long double version - only few % improvement, but don't delete yet
G4double
G4RadioactiveDecay::ConvolveSourceTimeProfile(const G4double t, const G4double tau)
{
@@ -431,7 +430,7 @@ G4RadioactiveDecay::ConvolveSourceTimeProfile(const G4double t, const G4double t
G4int loop = 0;
G4ExceptionDescription ed;
ed << " While count exceeded " << G4endl;
while (t > SBin[nbin]) { /* Loop checking, 01.09.2015, D.Wright */
while (t > SBin[nbin]) {
loop++;
if (loop > 1000) {
G4Exception("G4RadioactiveDecay::ConvolveSourceTimeProfile()",
@@ -443,18 +442,25 @@ G4RadioactiveDecay::ConvolveSourceTimeProfile(const G4double t, const G4double t
}
nbin--;
}
long double lt = t ;
long double ltau = tau;
// G4cout << " Convolve: tau = " << tau << G4endl;
long double earg = 0.L;
if (nbin > 0) {
for (G4int i = 0; i < nbin; i++) {
convolvedTime += (long double)SProfile[i] *
(std::exp(-(lt-(long double)SBin[i+1])/ltau)-std::exp(-(lt-(long double)SBin[i])/ltau));
earg = (long double)(SBin[i+1] - SBin[i])/ltau;
if (earg < 100.) {
convolvedTime += (long double)SProfile[i] *
std::exp(((long double)SBin[i] - lt)/ltau) *
std::expm1(earg);
} else {
convolvedTime += (long double)SProfile[i] *
(std::exp(-(lt-(long double)SBin[i+1])/ltau)-std::exp(-(lt-(long double)SBin[i])/ltau));
}
}
}
convolvedTime += (long double)SProfile[nbin] * (1.L-std::exp(-(lt-(long double)SBin[nbin])/ltau));
// Is the above line necessary? If so, the 1.L looks incorrect - should be an exp
// Also, it looks like the final integral should be multiplied by ltau
// Use -expm1 instead of 1 - exp
convolvedTime -= (long double)SProfile[nbin] * std::expm1(((long double)SBin[nbin] - lt)/ltau);
if (convolvedTime < 0.) {
G4cout << " Convolved time =: " << convolvedTime << " reset to zero! " << G4endl;
@@ -466,119 +472,73 @@ G4RadioactiveDecay::ConvolveSourceTimeProfile(const G4double t, const G4double t
if (GetVerboseLevel() > 1)
G4cout << " Convolved time: " << convolvedTime << G4endl;
#endif
return (G4double)convolvedTime ;
}
/*
// Other implementation tests to avoid use of long double
G4double G4RadioactiveDecay::GetTaoTime(const G4double t, const G4double tao)
{
long double taotime =0.L;
G4int nbin;
if ( t > SBin[NSourceBin]) {
nbin = NSourceBin;}
else {
nbin = 0;
while (t > SBin[nbin]) nbin++;
nbin--;}
long double lt = t ;
long double ltao = tao;
long double factor,factor1,dt1,dt;
if (nbin > 0) {
for (G4int i = 0; i < nbin; i++)
{ long double s1=SBin[i];
long double s2=SBin[i+1];
dt1=(s2-s1)/ltao;
if (dt1 <50.) {
factor1=std::exp(dt1)-1.;
if (factor1<dt1) factor1 =dt1;
dt=(lt-s1)/ltao;
factor=std::exp(-dt);
}
else {
factor1=1.-std::exp(-dt1);
dt=(lt-s2)/ltao;
factor=std::exp(-dt);
}
G4cout<<(long double) SProfile[i] *factor*factor1<<'\t'<<std::endl;
long double test = (long double)SProfile[i] * (std::exp(-(lt-(long double)SBin[i+1])/ltao)-std::exp(-(lt-(long double)SBin[i])/ltao));
G4cout<<test<<std::endl;
taotime += (long double) SProfile[i] *factor*factor1;
}
}
long double s=SBin[nbin];
dt1=(lt-s)/ltao;
factor=1.-std::exp(-dt1);
taotime += (long double) SProfile[nbin] *factor;
if (taotime < 0.) {
G4cout <<" Tao time =: " <<taotime << " reset to zero!"<<G4endl;
G4cout <<" t = " << t <<" tao = " <<tao <<G4endl;
G4cout << SBin[nbin] << " " <<SBin[0] << G4endl;
taotime = 0.;
}
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<" Tao time: " <<taotime <<G4endl;}
#endif
return (G4double)taotime ;
}
G4double G4RadioactiveDecay::GetTaoTime(const G4double t, const G4double tao)
{
G4double taotime =0.;
G4int nbin;
if ( t > SBin[NSourceBin]) {
nbin = NSourceBin;}
else {
nbin = 0;
while (t > SBin[nbin]) nbin++;
nbin--;}
G4double lt = t ;
G4double ltao = tao;
G4double factor,factor1,dt1,dt;
if (nbin > 0) {
for (G4int i = 0; i < nbin; i++)
{ dt1=(SBin[i+1]-SBin[i])/ltao;
if (dt1 <50.) {
factor1=std::exp(dt1)-1.;
if (factor1<dt1) factor1 =dt1;
dt=(lt-SBin[i])/ltao;
factor=std::exp(-(lt-SBin[i])/ltao);
G4cout<<factor<<'\t'<<factor1<<std::endl;
}
else {
factor1=1.-std::exp(-dt1);
factor=std::exp(-(lt-SBin[i+1])/ltao);
}
G4cout<<factor<<'\t'<<factor1<<std::endl;
taotime += SProfile[i] *factor*factor1;
G4cout<<taotime<<std::endl;
}
}
dt1=(lt-SBin[nbin])/ltao;
factor=1.-std::exp(-dt1);
if (factor<(dt1-0.5*dt1*dt1)) factor =dt1-0.5*dt1*dt1;
taotime += SProfile[nbin] *factor;
G4cout<<factor<<'\t'<<taotime<<std::endl;
if (taotime < 0.) {
G4cout <<" Tao time =: " <<taotime << " reset to zero!"<<G4endl;
G4cout <<" t = " << t <<" tao = " <<tao <<G4endl;
G4cout << SBin[nbin] << " " <<SBin[0] << G4endl;
taotime = 0.;
}
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<" Tao time: " <<taotime <<G4endl;}
#endif
return (G4double)taotime ;
return (G4double)convolvedTime;
}
*/
// ConvolveSourceTimeProfile performs the convolution of the source time profile
// function with a single exponential characterized by a decay constant in the
// decay chain. The time profile is treated as a set of step functions so that
// the convolution integral can be done bin-by-bin.
// This implements Eq. 4.13 of DERA technical note, with SProfile[i] = F(t')
G4double
G4RadioactiveDecay::ConvolveSourceTimeProfile(const G4double t, const G4double tau)
{
G4double convolvedTime = 0.0;
G4int nbin;
if ( t > SBin[NSourceBin]) {
nbin = NSourceBin;
} else {
nbin = 0;
G4int loop = 0;
G4ExceptionDescription ed;
ed << " While count exceeded " << G4endl;
while (t > SBin[nbin]) { // Loop checking, 01.09.2015, D.Wright
loop++;
if (loop > 1000) {
G4Exception("G4RadioactiveDecay::ConvolveSourceTimeProfile()",
"HAD_RDM_100", JustWarning, ed);
break;
}
nbin++;
}
nbin--;
}
// Use expm1 wherever possible to avoid large cancellation errors in
// 1 - exp(x) for small x
G4double earg = 0.0;
if (nbin > 0) {
for (G4int i = 0; i < nbin; i++) {
earg = (SBin[i+1] - SBin[i])/tau;
if (earg < 100.) {
convolvedTime += SProfile[i] * std::exp((SBin[i] - t)/tau) *
std::expm1(earg);
} else {
convolvedTime += SProfile[i] *
(std::exp(-(t-SBin[i+1])/tau)-std::exp(-(t-SBin[i])/tau));
}
}
}
convolvedTime -= SProfile[nbin] * std::expm1((SBin[nbin] - t)/tau);
// tau divided out of final result to provide probability of decay in window
if (convolvedTime < 0.) {
G4cout << " Convolved time =: " << convolvedTime << " reset to zero! " << G4endl;
G4cout << " t = " << t << " tau = " << tau << G4endl;
G4cout << SBin[nbin] << " " << SBin[0] << G4endl;
convolvedTime = 0.;
}
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1)
G4cout << " Convolved time: " << convolvedTime << G4endl;
#endif
return convolvedTime;
}
////////////////////////////////////////////////////////////////////////////////
// //
// GetDecayTime //
@@ -1792,11 +1752,11 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
G4String keyName;
std::vector<G4double> PT;
std::vector<G4double> PR;
G4double taotime;
G4double tauprob;
long double decayRate;
size_t i;
size_t j;
// size_t j;
G4int numberOfSecondaries;
G4int totalNumberOfSecondaries = 0;
G4double currentTime = 0.;
@@ -1828,7 +1788,7 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
// it should be calculated in seconds
weight1 /= s ;
// loop over all the possible secondaries of the nucleus
// Loop over all the possible secondaries of the nucleus
// the first one is itself.
for (i = 0; i < theDecayRateVector.size(); i++) {
PZ = theDecayRateVector[i].GetZ();
@@ -1837,39 +1797,100 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
PT = theDecayRateVector[i].GetTaos();
PR = theDecayRateVector[i].GetDecayRateC();
// Calculate the decay rate of the isotope
// decayRate is the radioactivity of isotope (PZ,PA,PE) at the
// time 'theDecayTime'
// it will be used to calculate the statistical weight of the
// The array of arrays theDecayRateVector contains all possible decay
// chains of a given parent nucleus (ZP,AP,EP) to a given descendant
// nuclide (Z,A,E).
//
// theDecayRateVector[0] contains the decay parameters of the parent
// nucleus
// PZ = ZP
// PA = AP
// PE = EP
// PT[] = {TP}
// PR[] = {RP}
//
// theDecayRateVector[1] contains the decay of the parent to the first
// generation daughter (Z1,A1,E1).
// PZ = Z1
// PA = A1
// PE = E1
// PT[] = {TP, T1}
// PR[] = {RP, R1}
//
// theDecayRateVector[2] contains the decay of the parent to the first
// generation daughter (Z1,A1,E1) and the decay of the first
// generation daughter to the second generation daughter (Z2,A2,E2).
// PZ = Z2
// PA = A2
// PE = E2
// PT[] = {TP, T1, T2}
// PR[] = {RP, R1, R2}
//
// theDecayRateVector[3] may contain a branch chain
// PZ = Z2a
// PA = A2a
// PE = E2a
// PT[] = {TP, T1, T2a}
// PR[] = {RP, R1, R2a}
//
// and so on.
// Calculate the decay rate of the isotope. decayRate is the
// radioactivity of isotope (PZ,PA,PE) at 'theDecayTime'.
// It will be used to calculate the statistical weight of the
// decay products of this isotope
// G4cout <<"PA= "<< PA << " PZ= " << PZ << " PE= "<< PE <<G4endl;
// For each nuclide, calculate all the decay chains which can reach
// the parent nuclide
decayRate = 0.L;
for (j = 0; j < PT.size(); j++) {
// G4cout << " RDM::DecayIt: tau input to Convolve: " << PT[j] << G4endl;
taotime = ConvolveSourceTimeProfile(theDecayTime,PT[j]);
// taotime = GetTaoTime(theDecayTime,PT[j]);
decayRate -= PR[j] * (long double)taotime;
for (G4int j = 0; j < G4int(PT.size()); j++) {
tauprob = ConvolveSourceTimeProfile(theDecayTime,PT[j]);
// tauprob is dimensionless, PR has units of s-1
decayRate -= PR[j] * (long double)tauprob;
// Eq.4.23 of of the TN
// note the negative here is required as the rate in the
// equation is defined to be negative,
// i.e. decay away, but we need positive value here.
// G4cout << j << "\t"<< PT[j]/s <<"\t"<<PR[j]<< "\t"
// << decayRate << G4endl;
// G4cout << j << "\t" << PT[j]/s << "\t" << PR[j] << "\t" << decayRate << G4endl;
}
// add the isotope to the radioactivity tables
// G4cout <<theDecayTime/s <<"\t"<<nbin<<G4endl;
// G4cout << theTrack.GetWeight() <<"\t"<<weight1<<"\t"<<decayRate<< G4endl;
theRadioactivityTables[decayWindows[nbin-1]]->AddIsotope(PZ,PA,PE,weight1*decayRate,theTrack.GetWeight());
// At this point any negative decay rates are probably small enough
// (order 10**-30) that negative values are likely due to cancellation
// errors. Set them to zero.
if (decayRate < 0.0) decayRate = 0.0;
/*
if (decayRate < 0.0) {
if (-decayRate > 1.0e-30) {
G4ExceptionDescription ed;
ed << " Negative decay probability (magnitude > 1e-30) \n"
<< " in variance reduction branch " << G4endl;
G4Exception("G4RadioactiveDecay::DecayIt()",
"HAD_RDM_200", JustWarning, ed);
} else {
// Decay probability is small enough that negative value is likely
// due to cancellation errors. Set it to zero.
decayRate = 0.0;
}
}
if (decayRate < 0.0) G4cout << " NEGATIVE decay rate = " << decayRate << G4endl;
*/
// G4cout << theDecayTime/s << "\t" << nbin << G4endl;
// G4cout << theTrack.GetWeight() << "\t" << weight1 << "\t" << decayRate << G4endl;
// Add isotope to the radioactivity tables
// One table for each observation time window specifed in
// SetDecayBias(G4String filename)
theRadioactivityTables[decayWindows[nbin-1]]
->AddIsotope(PZ,PA,PE,weight1*decayRate,theTrack.GetWeight());
// Now calculate the statistical weight
// One needs to fold the source bias function with the decaytime
// also need to include the track weight! (F.Lei, 28/10/10)
G4double weight = weight1*decayRate*theTrack.GetWeight();
// decay the isotope
// Decay the isotope
theIonTable = (G4IonTable *)(G4ParticleTable::GetParticleTable()->GetIonTable());
parentNucleus = theIonTable->GetIon(PZ,PA,PE);
@@ -1905,7 +1926,7 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
tempprods = DoDecay(*parentNucleus);
}
// save the secondaries for buffers
// Save the secondaries for buffers
numberOfSecondaries = tempprods->entries();
currentTime = finalGlobalTime + theDecayTime;
for (index = 0; index < numberOfSecondaries; index++) {
@@ -1953,7 +1974,7 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
// Reset NumberOfInteractionLengthLeft.
ClearNumberOfInteractionLengthLeft();
return &fParticleChangeForRadDecay ;
return &fParticleChangeForRadDecay;
}
}
@@ -2069,35 +2090,45 @@ G4ThreeVector G4RadioactiveDecay::ChooseCollimationDirection() const {
return dir;
}
//Add gamma,Xray,conversion,and auger electrons for bias mode
void G4RadioactiveDecay::AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition* apartDef,
G4double weight,G4double currentTime,
std::vector<double>& weights_v,
std::vector<double>& times_v,
std::vector<G4DynamicParticle*>& secondaries_v)
// Add gamma, X-ray, conversion and auger electrons for bias mode
void
G4RadioactiveDecay::AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition* apartDef,
G4double weight,G4double currentTime,
std::vector<double>& weights_v,
std::vector<double>& times_v,
std::vector<G4DynamicParticle*>& secondaries_v)
{
G4double elevel=((const G4Ions*)(apartDef))->GetExcitationEnergy();
G4double life_time=apartDef->GetPDGLifeTime();
while (life_time <halflifethreshold && elevel>0.) {
G4ITDecay* anITChannel = new G4ITDecay(apartDef, 100., elevel,elevel,
photonEvaporation);
G4double elevel = ((const G4Ions*)(apartDef))->GetExcitationEnergy();
G4double life_time = apartDef->GetPDGLifeTime();
G4ITDecay* anITChannel = 0;
while (life_time < halflifethreshold && elevel > 0.) {
anITChannel = new G4ITDecay(apartDef, 100., elevel, elevel, photonEvaporation);
G4DecayProducts* pevap_products = anITChannel->DecayIt(0.);
G4int nb_pevapSecondaries = pevap_products->entries();
G4DynamicParticle* a_pevap_secondary = 0;
G4ParticleDefinition* secDef = 0;
for (G4int ind = 0; ind < nb_pevapSecondaries; ind++) {
G4DynamicParticle* a_pevap_secondary= pevap_products->PopProducts();
//Gammas,electrons, alphas coming from excited state
if (a_pevap_secondary->GetDefinition()->GetBaryonNumber() < 5) {
weights_v.push_back(weight);
times_v.push_back(currentTime);
secondaries_v.push_back(a_pevap_secondary);
}
//New excited or ground state
else {
apartDef =a_pevap_secondary->GetDefinition();
elevel=((const G4Ions*)(apartDef))->GetExcitationEnergy();
life_time=apartDef->GetPDGLifeTime();
}
a_pevap_secondary = pevap_products->PopProducts();
secDef = a_pevap_secondary->GetDefinition();
if (secDef->GetBaryonNumber() > 4) {
elevel = ((const G4Ions*)(secDef))->GetExcitationEnergy();
life_time = secDef->GetPDGLifeTime();
apartDef = secDef;
if (secDef->GetPDGStable() ) {
weights_v.push_back(weight);
times_v.push_back(currentTime);
secondaries_v.push_back(a_pevap_secondary);
}
} else {
weights_v.push_back(weight);
times_v.push_back(currentTime);
secondaries_v.push_back(a_pevap_secondary);
}
}
delete anITChannel;
}
}
+5 -1
View File
@@ -1,4 +1,4 @@
$Id: History 108682 2018-02-27 07:54:34Z gcosmo $
$Id: History 110119 2018-05-15 12:22:31Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
April 3, 2018, M. Asai (run-V10-03-19)
- G4ExceptionHandler: Add track/step/volume information when
exception happens while event is in process.
February 27, 2018, G. Cosmo (run-V10-03-18)
- G4RunManagerKernel: updated also MT banner.
+3 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ExceptionHandler.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: G4ExceptionHandler.hh 110119 2018-05-15 12:22:31Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -79,6 +79,8 @@ private:
G4ExceptionHandler(const G4ExceptionHandler &right);
G4ExceptionHandler& operator=(const G4ExceptionHandler &right);
private:
void DumpTrackInfo();
};
#endif
+114 -9
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ExceptionHandler.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: G4ExceptionHandler.cc 110119 2018-05-15 12:22:31Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -91,20 +91,23 @@ G4bool G4ExceptionHandler::Notify(const char* originOfException,
switch(severity)
{
case FatalException:
G4cerr << es_banner << message.str() << "*** Fatal Exception *** core dump ***"
<< ee_banner << G4endl;
G4cerr << es_banner << message.str() << "*** Fatal Exception *** core dump ***" << G4endl;
DumpTrackInfo();
G4cerr << ee_banner << G4endl;
abortionForCoreDump = true;
break;
case FatalErrorInArgument:
G4cerr << es_banner << message.str() << "*** Fatal Error In Argument *** core dump ***"
<< ee_banner << G4endl;
G4cerr << es_banner << message.str() << "*** Fatal Error In Argument *** core dump ***" << G4endl;
DumpTrackInfo();
G4cerr << ee_banner << G4endl;
abortionForCoreDump = true;
break;
case RunMustBeAborted:
if(aps==G4State_GeomClosed || aps==G4State_EventProc)
{
G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***"
<< ee_banner << G4endl;
G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***" << G4endl;
DumpTrackInfo();
G4cerr << ee_banner << G4endl;
G4RunManager::GetRunManager()->AbortRun(false);
}
abortionForCoreDump = false;
@@ -112,8 +115,9 @@ G4bool G4ExceptionHandler::Notify(const char* originOfException,
case EventMustBeAborted:
if(aps==G4State_EventProc)
{
G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***"
<< ee_banner << G4endl;
G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***" << G4endl;
DumpTrackInfo();
G4cerr << ee_banner << G4endl;
G4RunManager::GetRunManager()->AbortEvent();
}
abortionForCoreDump = false;
@@ -126,3 +130,104 @@ G4bool G4ExceptionHandler::Notify(const char* originOfException,
}
return abortionForCoreDump;
}
#include "G4RunManagerKernel.hh"
#include "G4EventManager.hh"
#include "G4TrackingManager.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4ParticleDefinition.hh"
#include "G4VProcess.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Material.hh"
#include "G4UnitsTable.hh"
void G4ExceptionHandler::DumpTrackInfo()
{
G4ApplicationState aps = G4StateManager::GetStateManager()->GetCurrentState();
G4SteppingManager* steppingMgr = G4RunManagerKernel::GetRunManagerKernel()
->GetTrackingManager()->GetSteppingManager();
const G4Track* theTrack = steppingMgr->GetfTrack();
const G4Step* theStep = steppingMgr->GetfStep();
if(aps!=G4State_EventProc || !theTrack)
{
G4cerr << " **** Track information is not available at this moment" << G4endl;
}
else
{
G4cerr << "G4Track (" << theTrack << ") - track ID = " << theTrack->GetTrackID()
<< ", parent ID = " << theTrack->GetParentID() << G4endl;
G4cerr << " Particle type : " << theTrack->GetParticleDefinition()->GetParticleName();
if(theTrack->GetCreatorProcess())
{ G4cerr
<< " - creator process : " << theTrack->GetCreatorProcess()->GetProcessName()
<< ", creator model : " << theTrack->GetCreatorModelName() << G4endl;
}
else
{ G4cerr << " - creator process : not available" << G4endl; }
G4cerr << " Kinetic energy : " << G4BestUnit(theTrack->GetKineticEnergy(),"Energy")
<< " - Momentum direction : " << theTrack->GetMomentumDirection() << G4endl;
}
if(aps!=G4State_EventProc || !theStep)
{
G4cerr << " **** Step information is not available at this moment" << G4endl;
}
else
{
G4cerr << " Step length : " << G4BestUnit(theStep->GetStepLength(),"Length")
<< " - total energy deposit : " << G4BestUnit(theStep->GetTotalEnergyDeposit(),"Energy")
<< G4endl;
G4cerr << " Pre-step point : " << theStep->GetPreStepPoint()->GetPosition();
G4cerr << " - Physical volume : ";
if(theStep->GetPreStepPoint()->GetPhysicalVolume())
{
G4cerr << theStep->GetPreStepPoint()->GetPhysicalVolume()->GetName();
if(theStep->GetPreStepPoint()->GetMaterial())
{ G4cerr << " (" << theStep->GetPreStepPoint()->GetMaterial()->GetName() << ")"; }
else
{ G4cerr << " (material not available)"; }
}
else
{ G4cerr << "not available"; }
G4cerr << G4endl;
if(theStep->GetPreStepPoint()->GetProcessDefinedStep())
{
G4cerr << " - defined by : "
<< theStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName()
<< " - step status : " << theStep->GetPreStepPoint()->GetStepStatus() << G4endl;
}
else
{
G4cerr << " - defined by : not available" << G4endl;
}
G4cerr << " Post-step point : " << theStep->GetPostStepPoint()->GetPosition();
G4cerr << " - Physical volume : ";
if(theStep->GetPostStepPoint()->GetPhysicalVolume())
{
G4cerr << theStep->GetPostStepPoint()->GetPhysicalVolume()->GetName();
if(theStep->GetPostStepPoint()->GetMaterial())
{ G4cerr << " (" << theStep->GetPostStepPoint()->GetMaterial()->GetName() << ")"; }
else
{ G4cerr << " (material not available)"; }
}
else
{ G4cerr << "not available"; }
G4cerr << G4endl;
if(theStep->GetPostStepPoint()->GetProcessDefinedStep())
{
G4cerr << " - defined by : "
<< theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()
<< " - step status : " << theStep->GetPostStepPoint()->GetStepStatus() << G4endl;
}
else
{
G4cerr << " - defined by : not available" << G4endl;
}
G4cerr << " *** Note: Step information might not be properly updated." << G4endl;
}
}
+7 -1
View File
@@ -1,5 +1,5 @@
$Id: History 99076 2016-09-01 12:40:47Z gcosmo $
$Id: History 110130 2018-05-16 06:43:10Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -25,6 +25,12 @@ committal in the CVS repository !
History file for visualization/Tree sub-category
------------------------------------------------
11th March 2018 John Allison (vistree-V10-03-00)
- G4ASCIITreeSceneHandler.cc:
o Fix bug in suppressed writing of repeated parameterised volumes.
- G4ASCIITreeMessenger.cc:
o Improve command guidance and advice printing.
31st August 2016 John Allison (vistree-V10-02-02)
- G4ASCIITreeSceneHandler.cc:
o Overall mass(es) now calculated for any specified top volume,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ASCIITreeMessenger.cc 99076 2016-09-01 12:40:47Z gcosmo $
// $Id: G4ASCIITreeMessenger.cc 110130 2018-05-16 06:43:10Z gcosmo $
//
//
// John Allison 5th April 2001
@@ -55,14 +55,11 @@ fpASCIITree(ASCIITree) {
fpCommandVerbose = new G4UIcmdWithAnInteger ("/vis/ASCIITree/verbose", this);
fVerbosityGuidance.push_back
(" < 10: - does not print daughters of repeated placements,"
" does not repeat replicas.");
(" < 10: notifies but does not print details of repeated volumes.");
fVerbosityGuidance.push_back
(" >= 10: prints all physical volumes.");
(" >= 10: prints all physical volumes (touchables).");
fVerbosityGuidance.push_back
("The level of detail is given by verbosity%10:");
fVerbosityGuidance.push_back
("for each volume:");
fVerbosityGuidance.push_back
(" >= 0: physical volume name.");
fVerbosityGuidance.push_back
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ASCIITreeSceneHandler.cc 99076 2016-09-01 12:40:47Z gcosmo $
// $Id: G4ASCIITreeSceneHandler.cc 110130 2018-05-16 06:43:10Z gcosmo $
//
//
// John Allison 5th April 2001
@@ -208,6 +208,8 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
//G4int currentDepth = pPVModel->GetCurrentDepth();
G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
const G4String& currentPVName = pCurrentPV->GetName();
const G4int currentCopyNo = pCurrentPV->GetCopyNo();
G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
@@ -215,41 +217,49 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
G4int verbosity = pSystem->GetVerbosity();
G4int detail = verbosity % 10;
if (verbosity < 10 && pCurrentPV->IsReplicated()) {
// See if this has been a replica found before with same mother LV...
// If verbosity < 10 suppress unnecessary repeated printing.
// Repeated simple replicas can always be suppressed.
// Paramaterisations can only be suppressed if verbosity < 3, since their
// size, density, etc., are in principle different.
const G4bool isParameterised = pCurrentPV->GetParameterisation();
const G4bool isSimpleReplica = pCurrentPV->IsReplicated() && !isParameterised;
const G4bool isAmenableToSupression =
(verbosity < 10 && isSimpleReplica) || (verbosity < 3 && isParameterised);
if (isAmenableToSupression) {
// See if this has been found before with same mother LV...
PVPath::const_reverse_iterator thisID = drawnPVPath.rbegin();
PVPath::const_reverse_iterator motherID = ++drawnPVPath.rbegin();
G4bool ignore = false;
for (ReplicaSetIterator i = fReplicaSet.begin(); i != fReplicaSet.end();
++i) {
++i) {
if (i->back().GetPhysicalVolume()->GetLogicalVolume() ==
thisID->GetPhysicalVolume()->GetLogicalVolume()) {
// For each one previously found (if more than one, they must
// have different mothers)...
// To avoid compilation errors on VC++ .Net 7.1...
// Previously:
// PVNodeID previousMotherID = ++(i->rbegin());
// (Should that have been: PVNodeID::const_iterator previousMotherID?)
// Replace
// previousMotherID == i->rend()
// by
// i->size() <= 1
// Replace
// previousMotherID != i->rend()
// by
// i->size() > 1
// Replace
// previousMotherID->
// by
// (*i)[i->size() - 2].
if (motherID == drawnPVPath.rend() &&
i->size() <= 1)
ignore = true; // Both have no mother.
if (motherID != drawnPVPath.rend() &&
i->size() > 1 &&
motherID->GetPhysicalVolume()->GetLogicalVolume() ==
(*i)[i->size() - 2].GetPhysicalVolume()->GetLogicalVolume())
ignore = true; // Same mother LV...
thisID->GetPhysicalVolume()->GetLogicalVolume()) {
// For each one previously found (if more than one, they must
// have different mothers)...
// To avoid compilation errors on VC++ .Net 7.1...
// Previously:
// PVNodeID previousMotherID = ++(i->rbegin());
// (Should that have been: PVNodeID::const_iterator previousMotherID?)
// Replace
// previousMotherID == i->rend()
// by
// i->size() <= 1
// Replace
// previousMotherID != i->rend()
// by
// i->size() > 1
// Replace
// previousMotherID->
// by
// (*i)[i->size() - 2].
if (motherID == drawnPVPath.rend() &&
i->size() <= 1)
ignore = true; // Both have no mother.
if (motherID != drawnPVPath.rend() &&
i->size() > 1 &&
motherID->GetPhysicalVolume()->GetLogicalVolume() ==
(*i)[i->size() - 2].GetPhysicalVolume()->GetLogicalVolume())
ignore = true; // Same mother LV...
}
}
if (ignore) {
@@ -258,20 +268,19 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
}
}
const G4String& currentPVName = pCurrentPV->GetName();
const G4int currentCopyNo = pCurrentPV->GetCopyNo();
if (verbosity < 10 &&
// Now suppress printing for volumes with the same name but different
// copy number - but not if they are parameterisations that have not been
// taken out above (those that are "amenable to suppression" will have been
// taken out).
if (verbosity < 10 && !isParameterised &&
currentPVName == fLastPVName &&
currentCopyNo != fLastCopyNo) {
// For low verbosity, trap series of G4PVPlacements with the same name but
// different copy number (replicas should have been taken out above)...
// Check...
if (pCurrentPV->IsReplicated()) {
if (isAmenableToSupression) {
G4Exception("G4ASCIITreeSceneHandler::RequestPrimitives",
"vistree0001",
JustWarning,
"Replica unexpected");
"Volume amenable to suppressed printing unexpected");
}
// Check mothers are identical...
else if (pCurrentLV == (fpLastPV? fpLastPV->GetLogicalVolume(): 0)) {
@@ -287,7 +296,7 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
}
fpLastPV = pCurrentPV;
// High verbosity or a new G4VPhysicalVolume...
// High verbosity or a new or otherwise non-amenable volume...
// Output copy number, if any, from previous invocation...
if (fLastCopyNo != fLastNonSequentialCopyNo) {
if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
@@ -300,9 +309,9 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
fLastPVName = currentPVName;
fLastCopyNo = currentCopyNo;
fLastNonSequentialCopyNo = currentCopyNo;
// Start next line...
// Indent according to drawn path depth...
for (size_t i = 0; i < drawnPVPath.size(); i++ ) *fpOutFile << " ";
// Start next line...
*fpOutFile << "\"" << currentPVName
<< "\":" << currentCopyNo;
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History 108542 2018-02-16 09:35:32Z gcosmo $
$Id: History 110128 2018-05-16 06:36:57Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,9 @@ committal in the CVS repository !
History file for visualization/modeling
---------------------------------------
11th March 2018 John Allison (modeling-V10-03-10)
- G4PhysicalVolumeMassScene.cc: Protect case of no material in parallel world.
19th December 2017 Gabriele Cosmo (modeling-V10-03-09)
- Fixed self-consistency in G4AttValueFilterT header (missing #include).
Thanks to Raphael Isemann for reporting this.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.cc 99076 2016-09-01 12:40:47Z gcosmo $
// $Id: G4PhysicalVolumeMassScene.cc 110128 2018-05-16 06:36:57Z gcosmo $
//
//
// John Allison 10th August 1998.
@@ -78,7 +78,7 @@ void G4PhysicalVolumeMassScene::ProcessVolume (const G4VSolid& solid)
}
G4double currentVolume = ((G4VSolid&)solid).GetCubicVolume();
G4double currentDensity = pCurrentMaterial->GetDensity();
G4double currentDensity = pCurrentMaterial? pCurrentMaterial->GetDensity() : 0.;
/* Using G4Polyhedron... (gives slightly different answers on Tubs, e.g.).
G4Polyhedron* pPolyhedron = solid.GetPolyhedron();
if (!pPolyhedron) {