Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4CoupledTransportation.hh 105913 2017-08-28 08:39:12Z gcosmo $
// $Id: G4CoupledTransportation.hh 110805 2018-06-15 06:52:15Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -59,7 +59,9 @@
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleChangeForTransport.hh"
class G4SafetyHelper;
class G4TransportationLogger;
class G4CoupledTransportation : public G4VProcess
{
@@ -87,7 +89,7 @@ class G4CoupledTransportation : public G4VProcess
const G4Track& track,
const G4Step& stepData
);
// Responsible for the relocation.
// Responsible for the relocation
G4double PostStepGetPhysicalInteractionLength(
const G4Track& ,
@@ -95,11 +97,11 @@ class G4CoupledTransportation : public G4VProcess
G4ForceCondition* pForceCond
);
// Forces the PostStepDoIt action to be called,
// but does not limit the step.
// but does not limit the step
G4PropagatorInField* GetPropagatorInField();
void SetPropagatorInField( G4PropagatorInField* pFieldPropagator);
// Access/set the assistant class that Propagate in a Field.
// Access/set the assistant class that Propagate in a Field
inline G4double GetThresholdWarningEnergy() const;
inline G4double GetThresholdImportantEnergy() const;
@@ -122,50 +124,54 @@ class G4CoupledTransportation : public G4VProcess
static G4bool EnableUseMagneticMoment(G4bool useMoment=true);
// Whether to deflect particles with force due to magnetic moment
static void SetSignifyStepsInAnyVolume( G4bool anyVol ) { fSignifyStepInAnyVolume = anyVol; }
static G4bool GetSignifyStepsInAnyVolume( ) { return fSignifyStepInAnyVolume; }
// Flag in step corresponds to first/last step in a volume 'any' geometry (if this is true)
// or refers to first/last step in mass geometry only (if false).
static void SetSignifyStepsInAnyVolume( G4bool anyVol )
{ fSignifyStepInAnyVolume = anyVol; }
static G4bool GetSignifyStepsInAnyVolume()
{ return fSignifyStepInAnyVolume; }
// Flag in step corresponds to first/last step in a volume 'any'
// geometry (if this is true) or refers to first/last step in mass
// geometry only (if false)
// The following methods give access to first/last step in particular geometry
// *independent* of the choice of the 'Signify' flag.
G4bool IsFirstStepInAnyVolume() { return fFirstStepInAnyVolume; }
G4bool IsLastStepInAnyVolume() { return fAnyGeometryLimitedStep; }
G4bool IsFirstStepInMassVolume() { return fFirstStepInMassVolume; }
G4bool IsLastStepInMassVolume() { return fMassGeometryLimitedStep; }
// The following methods give access to first/last step in particular
// geometry *independent* of the choice of the 'Signify' flag
//
G4bool IsFirstStepInAnyVolume() const { return fFirstStepInAnyVolume; }
G4bool IsLastStepInAnyVolume() const { return fAnyGeometryLimitedStep; }
G4bool IsFirstStepInMassVolume() const { return fFirstStepInMassVolume; }
G4bool IsLastStepInMassVolume() const { return fMassGeometryLimitedStep; }
public: // without description
void StartTracking(G4Track* aTrack);
void EndTracking();
G4double AtRestGetPhysicalInteractionLength( const G4Track& ,
G4ForceCondition* )
{ return -1.0; } // No operation in AtRestGPIL
G4double AtRestGetPhysicalInteractionLength(
const G4Track& ,
G4ForceCondition*
) { return -1.0; };
// No operation in AtRestDoIt.
G4VParticleChange* AtRestDoIt(
const G4Track& ,
const G4Step&
) {return 0;};
// No operation in AtRestDoIt.
G4VParticleChange* AtRestDoIt( const G4Track&, const G4Step&)
{ return 0; } // No operation in AtRestDoIt
protected:
G4bool DoesGlobalFieldExist();
// Checks whether a field exists for the "global" field manager.
G4bool DoesGlobalFieldExist();
// Checks whether a field exists for the "global" field manager
void ReportInexactEnergy(G4double startEnergy, G4double endEnergy);
// Issue warning
void ReportMove( G4ThreeVector OldVector, G4ThreeVector NewVector,
const G4String& Quantity );
// void ReportLoopingTrack( .. ) -> Moved to Logger class
// Warn about dropping of tracks that repeatedly exceed number of
// iterations for propagaton in field
private:
G4Navigator* fMassNavigator;
// The navigator for the 'mass' geometry (the real one, that physics occurs in)
// The navigator for the 'mass' geometry
// (the real one, that physics occurs in)
G4PathFinder* fPathFinder;
G4int fNavigatorId;
// The PathFinder used to transport the particle
@@ -174,8 +180,8 @@ class G4CoupledTransportation : public G4VProcess
// Still required in order to find/set the fieldmanager
G4bool fGlobalFieldExists;
// G4bool fStartedNewTrack; // True for first step or restarted tracking
// until first step's AlongStepGPIL
// G4bool fStartedNewTrack; // True for first step or restarted tracking
// until first step's AlongStepGPIL
G4ThreeVector fTransportEndPosition;
G4ThreeVector fTransportEndMomentumDir;
@@ -211,36 +217,42 @@ class G4CoupledTransportation : public G4VProcess
G4double fEndpointDistance;
// Thresholds for looping particles:
//
// Thresholds for looping particles:
//
G4double fThreshold_Warning_Energy; // Warn above this energy
G4double fThreshold_Important_Energy; // Hesitate above this
G4int fThresholdTrials; // for this no of trials
// Above 'important' energy a 'looping' particle in field will
// *NOT* be abandoned, except after fThresholdTrials attempts.
// *NOT* be abandoned, except after fThresholdTrials attempts.
// Counter for steps in which particle reports 'looping',
// if it is above 'Important' Energy
// Counter for steps in which particle reports 'looping',
// if it is above 'Important' Energy
//
G4int fNoLooperTrials;
// Statistics for tracks abandoned
// Statistics for tracks abandoned
//
G4double fSumEnergyKilled;
G4double fMaxEnergyKilled;
G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained
G4TransportationLogger* fpLogger; // Reports issues / raises warnings
private:
friend class G4Transportation;
static G4bool fUseMagneticMoment;
private:
private:
G4bool fFirstStepInMassVolume;
G4bool fFirstStepInAnyVolume;
// G4bool fLastStepInMassVolume; => use fMassGeometryLimitedStep
// G4bool fLastStepInAnyVolume; => use fAnyGeometryLimitedStep
static G4bool fSignifyStepInAnyVolume; // True: First/Last step in any one of the geometries
// False: First/last step flag signifies step in volume of 'mass' geometry
// G4bool fLastStepInMassVolume; => use fMassGeometryLimitedStep
// G4bool fLastStepInAnyVolume; => use fAnyGeometryLimitedStep
static G4bool fSignifyStepInAnyVolume;
// True: First/Last step in any one of the geometries
// False: First/Last step in volume of 'mass' geometry
};
#include "G4CoupledTransportation.icc"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4CoupledTransportation.icc 105913 2017-08-28 08:39:12Z gcosmo $
// $Id: G4CoupledTransportation.icc 110805 2018-06-15 06:52:15Z gcosmo $
//
//
@@ -37,6 +37,7 @@
//
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4TransportationLogger.hh"
inline void
G4CoupledTransportation::SetPropagatorInField( G4PropagatorInField* pFieldPropagator)
@@ -77,16 +78,19 @@ inline G4int G4CoupledTransportation::GetThresholdTrials() const
inline void G4CoupledTransportation::SetThresholdWarningEnergy( G4double newEnWarn )
{
fThreshold_Warning_Energy= newEnWarn;
fpLogger->SetThresholdWarningEnergy( newEnWarn ); // Update the information for correct reporting
}
inline void G4CoupledTransportation::SetThresholdImportantEnergy( G4double newEnImp )
{
fThreshold_Important_Energy = newEnImp;
fThreshold_Important_Energy = newEnImp;
fpLogger->SetThresholdImportantEnergy( newEnImp ); // Update the information for correct reporting
}
inline void G4CoupledTransportation::SetThresholdTrials(G4int newMaxTrials )
{
fThresholdTrials = newMaxTrials;
fThresholdTrials = newMaxTrials;
fpLogger->SetThresholdTrials(newMaxTrials ); // Update the information for correct reporting
}
// Get/Set parameters for killing loopers:
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NeutronKiller.hh 68048 2013-03-13 14:34:07Z gcosmo $
// $Id: G4NeutronKiller.hh 110694 2018-06-08 06:39:34Z gcosmo $
//
//---------------------------------------------------------------------------
//
@@ -75,19 +75,19 @@ public:
virtual ~G4NeutronKiller();
G4bool IsApplicable(const G4ParticleDefinition&);
virtual G4bool IsApplicable(const G4ParticleDefinition&);
void SetTimeLimit(G4double);
void SetKinEnergyLimit(G4double);
G4double PostStepGetPhysicalInteractionLength( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4double PostStepGetPhysicalInteractionLength( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
G4double GetMeanFreePath(const G4Track&, G4double,G4ForceCondition*);
virtual G4double GetMeanFreePath(const G4Track&, G4double,G4ForceCondition*);
private:
@@ -103,38 +103,5 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4NeutronKiller::PostStepGetPhysicalInteractionLength(
const G4Track& aTrack,
G4double, G4ForceCondition* condition)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double limit = DBL_MAX;
if(aTrack.GetGlobalTime() > timeThreshold ||
aTrack.GetKineticEnergy() < kinEnergyThreshold) limit = 0.0;
return limit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4NeutronKiller::GetMeanFreePath(const G4Track&,G4double,
G4ForceCondition*)
{
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4VParticleChange* G4NeutronKiller::PostStepDoIt(const G4Track& aTrack,
const G4Step&)
{
pParticleChange->Initialize(aTrack);
pParticleChange->ProposeTrackStatus(fStopAndKill);
return pParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Transportation.hh 105913 2017-08-28 08:39:12Z gcosmo $
// $Id: G4Transportation.hh 110805 2018-06-15 06:52:15Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -55,6 +55,7 @@
#include "G4ParticleChangeForTransport.hh"
class G4SafetyHelper;
class G4CoupledTransportation;
class G4TransportationLogger;
class G4Transportation : public G4VProcess
{
@@ -82,7 +83,7 @@ class G4Transportation : public G4VProcess
const G4Track& track,
const G4Step& stepData
);
// Responsible for the relocation.
// Responsible for the relocation
G4double PostStepGetPhysicalInteractionLength(
const G4Track& ,
@@ -90,13 +91,13 @@ class G4Transportation : public G4VProcess
G4ForceCondition* pForceCond
);
// Forces the PostStepDoIt action to be called,
// but does not limit the step.
// but does not limit the step
G4bool FieldExertedForce() { return fFieldExertedForce; }
G4PropagatorInField* GetPropagatorInField();
void SetPropagatorInField( G4PropagatorInField* pFieldPropagator);
// Access/set the assistant class that Propagate in a Field.
// Access/set the assistant class that Propagate in a Field
inline G4double GetThresholdWarningEnergy() const;
inline G4double GetThresholdImportantEnergy() const;
@@ -124,35 +125,31 @@ class G4Transportation : public G4VProcess
public: // without description
G4double AtRestGetPhysicalInteractionLength(
const G4Track& ,
G4ForceCondition*
) { return -1.0; };
// No operation in AtRestDoIt.
G4double AtRestGetPhysicalInteractionLength( const G4Track&,
G4ForceCondition*)
{ return -1.0; } // No operation in AtRestGPIL
G4VParticleChange* AtRestDoIt(
const G4Track& ,
const G4Step&
) {return 0;};
// No operation in AtRestDoIt.
G4VParticleChange* AtRestDoIt( const G4Track&, const G4Step& )
{ return 0; } // No operation in AtRestDoIt
void StartTracking(G4Track* aTrack);
void StartTracking(G4Track* aTrack);
// Reset state for new (potentially resumed) track
protected:
G4bool DoesGlobalFieldExist();
G4bool DoesGlobalFieldExist();
// Checks whether a field exists for the "global" field manager.
// void ReportLoopingTrack( ... ) --> moved to Logger class
// Warn about dropping of tracks that repeatedly exceed number of
// iterations for propagaton in field
private:
G4Navigator* fLinearNavigator;
G4PropagatorInField* fFieldPropagator;
// The Propagators used to transport the particle
// G4FieldManager* fGlobalFieldMgr; // Used MagneticField CC
// Field Manager for the whole Detector
G4ThreeVector fTransportEndPosition;
G4ThreeVector fTransportEndMomentumDir;
G4double fTransportEndKineticEnergy;
@@ -182,31 +179,36 @@ class G4Transportation : public G4VProcess
G4double fEndPointDistance;
// Thresholds for looping particles:
//
// Thresholds for looping particles:
//
G4double fThreshold_Warning_Energy; // Warn above this energy
G4double fThreshold_Important_Energy; // Hesitate above this
G4int fThresholdTrials; // for this no of trials
// Above 'important' energy a 'looping' particle in field will
// *NOT* be abandoned, except after fThresholdTrials attempts.
// *NOT* be abandoned, except after fThresholdTrials attempts.
// Counter for steps in which particle reports 'looping',
// if it is above 'Important' Energy
// Counter for steps in which particle reports 'looping',
// if it is above 'Important' Energy
//
G4int fNoLooperTrials;
// Statistics for tracks abandoned
// Statistics for tracks abandoned
//
G4double fSumEnergyKilled;
G4double fMaxEnergyKilled;
// Whether to avoid calling G4Navigator for short step ( < safety)
// If using it, the safety estimate for endpoint will likely be smaller.
// Whether to avoid calling G4Navigator for short step ( < safety)
// If using it, the safety estimate for endpoint will likely be smaller.
//
G4bool fShortStepOptimisation;
G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained
G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained
G4TransportationLogger* fpLogger; // Reports issues / raises warnings
private:
friend class G4CoupledTransportation;
static G4bool fUseMagneticMoment;
friend class G4CoupledTransportation;
static G4bool fUseMagneticMoment;
};
#include "G4Transportation.icc"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Transportation.icc 105913 2017-08-28 08:39:12Z gcosmo $
// $Id: G4Transportation.icc 110805 2018-06-15 06:52:15Z gcosmo $
//
//
@@ -37,6 +37,7 @@
//
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4TransportationLogger.hh"
inline void
G4Transportation::SetPropagatorInField( G4PropagatorInField* pFieldPropagator)
@@ -77,16 +78,19 @@ inline G4int G4Transportation::GetThresholdTrials() const
inline void G4Transportation::SetThresholdWarningEnergy( G4double newEnWarn )
{
fThreshold_Warning_Energy= newEnWarn;
fpLogger->SetThresholdWarningEnergy( newEnWarn ); // Update the information for correct reporting
}
inline void G4Transportation::SetThresholdImportantEnergy( G4double newEnImp )
{
fThreshold_Important_Energy = newEnImp;
fpLogger->SetThresholdImportantEnergy( newEnImp );// Update the information for correct reporting
}
inline void G4Transportation::SetThresholdTrials(G4int newMaxTrials )
{
fThresholdTrials = newMaxTrials;
fpLogger->SetThresholdTrials(newMaxTrials ); // Update the information for correct reporting
}
// Get/Set parameters for killing loopers:
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4TransportationLogger.hh 110824 2018-06-15 13:25:52Z gcosmo $
//
//
// class G4TransportationLogger
//
// Class description:
//
// Simple utility class for use by navigation systems
// for verbosity and check-mode.
// History:
// - Created. John Apostolakis, June 2018
// --------------------------------------------------------------------
#ifndef G4TRANSPORTATIONLOGGER_HH
#define G4TRANSPORTATIONLOGGER_HH
#include "globals.hh"
class G4Track;
class G4Step;
class G4TransportationLogger
{
public: // with description
G4TransportationLogger(const G4String& className, G4int verbosity);
G4TransportationLogger(const char* className, G4int verbosity);
~G4TransportationLogger();
// Provide report in case of particle looping in field
//
void ReportLoopingTrack( const G4Track & track,
const G4Step & stepInfo,
G4int numTrials,
G4long noCalls,
const char* methodName) const;
public: // without description
void SetThresholds( G4double newEnWarn, G4double importantEnergy,
G4int newMaxTrials );
G4int GetVerboseLevel() const { return fVerbose; }
void SetVerboseLevel(G4int level) { fVerbose = level; }
// Get/Set limit parameters for use in reporting
//
G4double GetThresholdWarningEnergy() const { return fThldWarningEnergy; }
G4double GetThresholdImportantEnergy() const { return fThldImportantEnergy; }
G4double GetThresholdTrials() const { return fThldTrials; }
void SetThresholdWarningEnergy( G4double val ) { fThldWarningEnergy= val; }
void SetThresholdImportantEnergy( G4double val ) { fThldImportantEnergy= val; }
void SetThresholdTrials(G4int maxNoTrials ) { fThldTrials = std::max( maxNoTrials, 1); }
private:
G4String fClassName; // Name of Transportation process (class name)
G4int fVerbose; // Verbosity level
// Parameters for transporation limits
// Used only for reporting in this class
//
G4double fThldWarningEnergy;
G4double fThldImportantEnergy;
G4int fThldTrials;
};
#endif