Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4LocatorChangeLogger
//
// Class description:
//
// Aggregate the records of changes in an endpoint of a locator.
// Its key use is in playing these back in case of a problem.
// Author: John Apostolakis, 04.09.19 - First version
// --------------------------------------------------------------------
#ifndef G4LOCATOR_CHANGE_LOGGER_HH
#define G4LOCATOR_CHANGE_LOGGER_HH
#include <vector>
#include "G4LocatorChangeRecord.hh"
#include "G4FieldTrack.hh"
class G4LocatorChangeLogger : public std::vector<G4LocatorChangeRecord>
{
public:
G4LocatorChangeLogger( const std::string name ) : fName(name) {}
void AddRecord( G4LocatorChangeRecord && chngRecord );
void AddRecord( const G4LocatorChangeRecord & chngRecord );
// Create a new record with full information
inline
void AddRecord( G4LocatorChangeRecord::EChangeLocation codeLocation,
G4int iter,
unsigned int count,
const G4FieldTrack & fieldTrack );
friend std::ostream& operator << ( std::ostream& os,
const G4LocatorChangeLogger& logR );
std::ostream& StreamInfo(std::ostream& os) const;
static std::ostream& ReportEndChanges ( std::ostream& os,
const G4LocatorChangeLogger& startA,
const G4LocatorChangeLogger& endB );
// Print the changes in start, end points in columns
// One event per row
private:
const std::string fName;
};
// --------------
// Inline methods
// --------------
void G4LocatorChangeLogger::
AddRecord( G4LocatorChangeRecord::EChangeLocation codeLocation,
G4int iter, unsigned int count,
const G4FieldTrack & fieldTrack )
{
this->push_back(G4LocatorChangeRecord(codeLocation, iter, count, fieldTrack));
}
inline
void G4LocatorChangeLogger::
AddRecord( const G4LocatorChangeRecord& chngRecord )
{
this->push_back( chngRecord );
}
inline
void G4LocatorChangeLogger::
AddRecord( G4LocatorChangeRecord && chngRecord )
{
this->push_back( chngRecord );
}
#endif
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4LocatorChangeRecord
//
// Class description:
//
// Record the changes in an endpoint of a locator.
// Its key use is in playing these back in case of a problem.
// Author: John Apostolakis, 27.08.19 - First version
// --------------------------------------------------------------------
#ifndef G4LOCATOR_CHANGE_RECORD_HH
#define G4LOCATOR_CHANGE_RECORD_HH
#include <vector>
#include "G4FieldTrack.hh"
class G4LocatorChangeRecord
{
public:
enum EChangeLocation { kInvalidCL = 0, kUnknownCL = 1, // 2
kInitialisingCL, kIntersectsAF, kIntersectsFB, // 3
kNoIntersectAForFB, kRecalculatedB, // 2
kInsertingMidPoint, kRecalculatedBagn, // 2
kLevelPop };
static const char* fNameChangeLocation[];
static const char* GetNameChangeLocation( EChangeLocation );
G4LocatorChangeRecord( EChangeLocation codeLocation,
G4int iter,
unsigned int count,
const G4FieldTrack& fieldTrack )
: fCodeLocation( codeLocation), fIteration(iter), fEventCount(count),
fFieldTrack( fieldTrack ) {}
G4LocatorChangeRecord( const G4LocatorChangeRecord & ) = default;
G4LocatorChangeRecord( G4LocatorChangeRecord && ) = default;
// No set methods -> create a new record for each entry (more reliable)
// void SetLocation( EChangeLocation loc ) { fCodeLocation= loc; }
// void SetLength( double len ) { fLength= len; }
// void SetCount( int cnt ) { fEventCount= cnt; }
// void SetIteration( int iter ) { fIteration= iter; }
inline EChangeLocation GetLocation() const { return fCodeLocation; }
inline unsigned int GetCount() const { return fEventCount; }
inline G4int GetIteration() const { return fIteration; }
inline G4double GetLength() const { return fFieldTrack.GetCurveLength(); }
friend std::ostream& operator<< ( std::ostream& os,
const G4LocatorChangeRecord& r );
// Streaming operator, using StreamInfo().
friend std::ostream& operator<< ( std::ostream& os,
const std::vector<G4LocatorChangeRecord> & vecR );
std::ostream& StreamInfo(std::ostream& os) const;
static std::ostream& ReportVector ( std::ostream& os,
const std::string & nameOfRecord,
const std::vector<G4LocatorChangeRecord> & lcr );
static std::ostream& ReportEndChanges ( std::ostream& os,
const std::vector<G4LocatorChangeRecord> & startA,
const std::vector<G4LocatorChangeRecord> & endB );
private:
EChangeLocation fCodeLocation = kInvalidCL;
G4int fIteration = -1;
unsigned int fEventCount = 0;
G4FieldTrack fFieldTrack;
};
#endif
@@ -379,6 +379,16 @@ class G4Navigator
// Transformation and history of the current path
// through the geometrical hierarchy.
G4ThreeVector fStepEndPoint;
// Endpoint of last ComputeStep
// can be used for optimisation (e.g. when computing safety).
G4ThreeVector fLastStepEndPointLocal;
// Position of the end-point of the last call to ComputeStep
// in last Local coordinates.
G4int fVerbose = 0;
// Verbose(ness) level [if > 0, printout can occur].
G4bool fEnteredDaughter;
// A memory of whether in this Step a daughter volume is entered
// (set in Compute & Locate).
@@ -391,19 +401,52 @@ class G4Navigator
G4bool fWasLimitedByGeometry = false;
// Set true if last Step was limited by geometry.
G4ThreeVector fStepEndPoint;
// Endpoint of last ComputeStep
// can be used for optimisation (e.g. when computing safety).
G4ThreeVector fLastStepEndPointLocal;
// Position of the end-point of the last call to ComputeStep
// in last Local coordinates.
G4int fVerbose = 0;
// Verbose(ness) level [if > 0, printout can occur].
private:
G4ThreeVector fLastLocatedPointLocal;
// Position of the last located point relative to its containing volume.
// This is coupled with the bool member fLocatedOutsideWorld;
G4ThreeVector fExitNormal; // Leaving volume normal, in the
// volume containing the exited
// volume's coordinate system
// This is closely coupled with G4bool fValidExitNormal - which
// signals whether we have a (valid) normal for volume we're leaving
G4ThreeVector fGrandMotherExitNormal; // Leaving volume normal, in its
// own coordinate system
G4ThreeVector fExitNormalGlobalFrame; // Leaving volume normal, in the
// global coordinate system
G4ThreeVector fPreviousSftOrigin;
G4double fPreviousSafety;
// Memory of last safety origin & value. Used in ComputeStep to ensure
// that origin of current Step is in the same volume as the point of the
// last relocation
G4VPhysicalVolume* fLastMotherPhys = nullptr;
// Memory of the mother volume during previous step.
// Intended use: inform user in case of stuck track.
G4VPhysicalVolume* fBlockedPhysicalVolume;
G4int fBlockedReplicaNo;
// Identifies the volume and copy / replica number that is
// blocked (after exiting -- because the exit direction is along the exit normal)
// or a candidate for entry (after compute step.)
// Count zero steps - as one or two can occur due to changing momentum at
// a boundary or at an edge common between volumes
// - several are likely a problem in the geometry
// description or in the navigation
//
G4int fNumberZeroSteps;
// Number of preceding moves that were Zero. Reset to 0 after finite step
G4int fActionThreshold_NoZeroSteps = 10;
// After this many failed/zero steps, act (push etc)
G4int fAbandonThreshold_NoZeroSteps = 25;
// After this many failed/zero steps, abandon track
G4bool fActive = false;
// States if the navigator is activated or not.
@@ -421,60 +464,26 @@ class G4Navigator
// o If entering
// volume ptr & replica number (set by ComputeStep(),used by
// Locate..()) of volume for `automatic' entry
G4VPhysicalVolume* fBlockedPhysicalVolume;
G4int fBlockedReplicaNo;
G4ThreeVector fLastLocatedPointLocal;
// Position of the last located point relative to its containing volume.
G4bool fLocatedOutsideWorld;
// Whether the last call to Locate methods left the world
G4bool fValidExitNormal; // Set true if have leaving volume normal
G4ThreeVector fExitNormal; // Leaving volume normal, in the
// volume containing the exited
// volume's coordinate system
G4ThreeVector fGrandMotherExitNormal; // Leaving volume normal, in its
// own coordinate system
G4bool fChangedGrandMotherRefFrame; // Whether frame is changed
G4ThreeVector fExitNormalGlobalFrame; // Leaving volume normal, in the
// global coordinate system
G4bool fLastStepWasZero;
// Whether the last ComputeStep moved Zero. Used to check for edges.
G4bool fLocatedOnEdge;
// Whether the Navigator has detected an edge
G4bool fLocatedOutsideWorld;
// Whether the last call to Locate methods left the world
G4bool fChangedGrandMotherRefFrame; // Whether frame is changed
G4bool fCalculatedExitNormal; // Has it been computed since
// the last call to ComputeStep
// Covers both Global and GrandMother
// Count zero steps - as one or two can occur due to changing momentum at
// a boundary or at an edge common between volumes
// - several are likely a problem in the geometry
// description or in the navigation
//
G4bool fLastStepWasZero;
// Whether the last ComputeStep moved Zero. Used to check for edges.
G4bool fLocatedOnEdge;
// Whether the Navigator has detected an edge
G4int fNumberZeroSteps;
// Number of preceding moves that were Zero. Reset to 0 after finite step
G4int fActionThreshold_NoZeroSteps = 10;
// After this many failed/zero steps, act (push etc)
G4int fAbandonThreshold_NoZeroSteps = 25;
// After this many failed/zero steps, abandon track
G4ThreeVector fPreviousSftOrigin;
G4double fPreviousSafety;
// Memory of last safety origin & value. Used in ComputeStep to ensure
// that origin of current Step is in the same volume as the point of the
// last relocation
G4VPhysicalVolume* fLastMotherPhys = nullptr;
// Memory of the mother volume during previous step.
// Intended use: inform user in case of stuck track.
//
// END State information
//
// Optional State information (created/used as needed)
//
// Save key state information (NOT the navigation history stack)
//
struct G4SaveNavigatorState
@@ -496,19 +505,13 @@ class G4Navigator
G4double sPreviousSafety;
} fSaveState;
// Tracking Invariants
//
private:
// BEGIN -- Tracking Invariants
// ===========================================
G4VPhysicalVolume* fTopPhysical = nullptr;
// A link to the topmost physical volume in the detector.
// Must be positioned at the origin and unrotated.
// Utility information
//
G4bool fCheck = false;
// Check-mode flag [if true, more strict checks are performed].
G4bool fPushed = false, fWarnPush = true;
// Push flags [if true, means a stuck particle has been pushed].
// Helpers/Utility classes
//
G4NormalNavigation fnormalNav;
@@ -517,7 +520,16 @@ class G4Navigator
G4ReplicaNavigation freplicaNav;
G4RegularNavigation fregularNav;
G4VExternalNavigation* fpExternalNav = nullptr;
G4VoxelSafety* fpVoxelSafety;
G4VoxelSafety* fpVoxelSafety;
// Utility information
//
G4bool fCheck = false;
// Check-mode flag [if true, more strict checks are performed].
G4bool fPushed = false, fWarnPush = true;
// Push flags [if true, means a stuck particle has been pushed].
// End -- Tracking Invariants
};
#include "G4Navigator.icc"
@@ -92,6 +92,7 @@ class G4PropagatorInField
G4int SetVerboseLevel( G4int verbose );
inline G4int GetVerboseLevel() const;
inline G4int Verbose() const;
inline void CheckMode(G4bool mode);
inline void SetVerboseTrace( G4bool enable );
inline G4bool GetVerboseTrace();
@@ -293,6 +294,7 @@ class G4PropagatorInField
G4int fVerboseLevel = 0;
G4bool fVerbTracePiF = false;
G4bool fCheck = false;
// For debugging purposes
G4bool fFirstStepInVolume = true;
@@ -150,6 +150,18 @@ G4bool G4PropagatorInField::GetVerboseTrace()
return fVerbTracePiF;
}
// ------------------------------------------------------------------------
//
inline
void G4PropagatorInField::CheckMode(G4bool mode)
{
fCheck = mode;
if (fIntersectionLocator != nullptr)
{
fIntersectionLocator->SetCheckMode(mode);
}
}
// ------------------------------------------------------------------------
//
inline
@@ -32,7 +32,7 @@
// navigation does not stop at the surface
// History:
// - Created. P.Arce, May 2007
// - Created. P. Arce, May 2007
// --------------------------------------------------------------------
#ifndef G4RegularNavigation_HH
#define G4RegularNavigation_HH
@@ -119,22 +119,21 @@ class G4RegularNavigation
G4int fverbose = false;
G4bool fcheck = false;
G4NormalNavigation* fnormalNav = nullptr;
G4double kCarTolerance;
G4double fMinStep;
G4bool fLastStepWasZero;
// Whether the last ComputeStep moved Zero. Used to check for edges.
G4int fNumberZeroSteps;
// Number of preceding moves that were Zero. Reset to 0 after finite step
G4int fActionThreshold_NoZeroSteps;
// After this many failed/zero steps, act (push etc)
G4int fAbandonThreshold_NoZeroSteps;
G4int fActionThreshold_NoZeroSteps;
// After this many failed/zero steps, act (push etc)
G4int fAbandonThreshold_NoZeroSteps;
// After this many failed/zero steps, abandon track
G4int fNoStepsAllowed;
// Maximum number of steps a track can travel skipping voxels
// (if there are more, track is assumed to be stuck and it is killed)
// Maximum number of steps a track can travel skipping voxels (if there are more, track is assumed to be stuck and it is killed)
G4bool fWarnPush;
// Send warning message that a stuck particle has been pushed
};
@@ -126,7 +126,10 @@ class G4VIntersectionLocator
std::ostream& oss,
G4int verboseLevel );
// Print Method for any ostream - e.g. cerr -- and for G4Exception
inline void SetCheckMode( G4bool value ) { fCheckMode = value; }
inline G4bool GetCheckMode() { return fCheckMode; }
protected: // with description
G4FieldTrack ReEstimateEndpoint( const G4FieldTrack& CurrentStateA,
@@ -197,9 +200,6 @@ class G4VIntersectionLocator
G4int CheckMode );
// As above, but report information about code location.
// If CheckMode > 1, report extra information.
inline void SetCheckMode( G4bool value ) { fCheckMode = value; }
inline G4bool GetCheckMode() { return fCheckMode; }
protected: // without description
@@ -254,13 +254,13 @@ class G4VIntersectionLocator
G4int fVerboseLevel = 0; // For debugging
G4bool fUseNormalCorrection = false; // Configuration parameter
G4bool fCheckMode = false;
G4bool fiUseSafety = false; // Whether to use safety for 'fast steps'
G4Navigator* fiNavigator;
G4ChordFinder* fiChordFinder = nullptr; // Overridden at each step
G4double fiEpsilonStep = -1.0; // Overridden at each step
G4double fiDeltaIntersection = -1.0; // Overridden at each step
G4bool fiUseSafety = false; // Overridden at each step
// Parameters set at each physical step by calling method
// by G4PropagatorInField