Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
@@ -46,25 +46,15 @@
#ifndef G4CoupledTransportation_hh
#define G4CoupledTransportation_hh 1
#include "G4VProcess.hh"
#include "G4FieldManager.hh"
#include "G4Navigator.hh"
#include "G4TransportationManager.hh"
#include "G4PropagatorInField.hh"
#include "G4PathFinder.hh"
#include "G4Transportation.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleChangeForTransport.hh"
class G4SafetyHelper;
class G4TransportationLogger;
class G4PathFinder;
class G4CoupledTransportation : public G4VProcess
class G4CoupledTransportation : public G4Transportation
{
// Concrete class that does the geometrical transport
public: // with description
@@ -79,10 +69,7 @@ class G4CoupledTransportation : public G4VProcess
G4GPILSelection* selection
);
G4VParticleChange* AlongStepDoIt(
const G4Track& track,
const G4Step& stepData
);
// AlongStepDoIt is implemented by G4Transportation.
G4VParticleChange* PostStepDoIt(
const G4Track& track,
@@ -90,51 +77,9 @@ class G4CoupledTransportation : public G4VProcess
);
// Responsible for the relocation
G4double PostStepGetPhysicalInteractionLength(
const G4Track& ,
G4double previousStepSize,
G4ForceCondition* pForceCond
);
// Forces the PostStepDoIt action to be called,
// but does not limit the step
// PostStepGetPhysicalInteractionLength is implemented by
// G4Transportation to force PostStepDoIt, but not limiting the step.
G4PropagatorInField* GetPropagatorInField();
void SetPropagatorInField( G4PropagatorInField* pFieldPropagator);
// Access/set the assistant class that Propagate in a Field
inline G4double GetThresholdWarningEnergy() const;
inline G4double GetThresholdImportantEnergy() const;
inline G4int GetThresholdTrials() const;
inline void SetThresholdWarningEnergy( G4double newEnWarn );
inline void SetThresholdImportantEnergy( G4double newEnImp );
inline void SetThresholdTrials(G4int newMaxTrials );
void SetHighLooperThresholds(); // Shortcut method - old values (meant for HEP)
void SetLowLooperThresholds(); // Set low thresholds - for low-E applications
void PushThresholdsToLogger(); // Inform logger of current thresholds
void ReportLooperThresholds(); // Print values of looper thresholds
// Get/Set parameters for killing loopers:
// Above 'important' energy a 'looping' particle in field will
// *NOT* be abandoned, except after fThresholdTrials attempts.
// Below Warning energy, no verbosity for looping particles is issued
inline G4double GetMaxEnergyKilled() const;
inline G4double GetSumEnergyKilled() const;
inline void ResetKilledStatistics( G4int report = 1);
// Statistics for tracks killed (currently due to looping in field)
static G4bool EnableMagneticMoment(G4bool useMoment=true);
// Whether to deflect particles with force due to magnetic moment
static G4bool EnableGravity(G4bool useGravity);
// Turn on the capability to deflect particles with a gravity field
static void SetSilenceLooperWarnings( G4bool val);
// Do not warn (or throw exception) about 'looping' particles
static G4bool GetSilenceLooperWarnings();
static void SetSignifyStepsInAnyVolume( G4bool anyVol )
{ fSignifyStepInAnyVolume = anyVol; }
static G4bool GetSignifyStepsInAnyVolume()
@@ -146,8 +91,8 @@ class G4CoupledTransportation : public G4VProcess
// 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 IsFirstStepInAnyVolume() const { return fFirstStepInVolume; }
G4bool IsLastStepInAnyVolume() const { return fGeometryLimitedStep; }
G4bool IsFirstStepInMassVolume() const { return fFirstStepInMassVolume; }
G4bool IsLastStepInMassVolume() const { return fMassGeometryLimitedStep; }
@@ -160,130 +105,33 @@ class G4CoupledTransportation : public G4VProcess
{ return EnableMagneticMoment(useMoment); }
// Old name ... obsolete
G4double AtRestGetPhysicalInteractionLength( const G4Track& ,
G4ForceCondition* )
{ return -1.0; } // No operation in AtRestGPIL
G4VParticleChange* AtRestDoIt( const G4Track&, const G4Step&)
{ return 0; } // No operation in AtRestDoIt
void PrintStatistics( std::ostream& outStr) const;
protected:
G4bool DoesAnyFieldExist();
// Check whether any field exists in the geometry
// - replaces method that checked only whether a field for the world volume
void ReportInexactEnergy(G4double startEnergy, G4double endEnergy);
// Issue warning
void ReportMove( G4ThreeVector OldVector, G4ThreeVector NewVector,
const G4String& Quantity );
void ReportMissingLogger(const char * methodName);
private:
G4Navigator* fMassNavigator;
// The navigator for the 'mass' geometry
// (the real one, that physics occurs in)
G4PathFinder* fPathFinder;
G4int fNavigatorId;
// The PathFinder used to transport the particle
G4PropagatorInField* fFieldPropagator;
// Still required in order to find/set the fieldmanager
G4bool fAnyFieldExists;
// G4bool fStartedNewTrack; // True for first step or restarted tracking
// until first step's AlongStepGPIL
G4ThreeVector fTransportEndPosition;
G4ThreeVector fTransportEndMomentumDir;
G4double fTransportEndKineticEnergy;
G4ThreeVector fTransportEndSpin;
G4bool fMomentumChanged;
// The particle's state after this Step, Store for DoIt
G4bool fEndGlobalTimeComputed;
G4double fCandidateEndGlobalTime;
G4bool fParticleIsLooping;
G4bool fNewTrack;
G4ThreeVector fPreviousSftOrigin;
G4double fPreviousMassSafety;
G4double fPreviousFullSafety;
G4TouchableHandle fCurrentTouchableHandle;
// G4bool fFieldExists;
// Whether a magnetic field exists ...
// A data member for this is problematic: it is useful only if it
// can be initialised and updated -- and a scheme is not yet possible.
G4bool fMassGeometryLimitedStep;
// Flag to determine whether a 'mass' boundary was reached.
G4bool fAnyGeometryLimitedStep;
// Did any geometry limit the step ?
G4ParticleChangeForTransport fParticleChange;
// New ParticleChange
G4double fEndpointDistance;
// Thresholds for looping particles:
//
G4double fThreshold_Warning_Energy = 1.0 * CLHEP::keV; // Warn above this energy
G4double fThreshold_Important_Energy = 1.0 * CLHEP::MeV; // Give a few trial above this E
G4int fThresholdTrials = 10; // Number of trials an important looper survives
// Above 'important' energy a 'looping' particle in field will
// *NOT* be abandoned, except after fThresholdTrials attempts.
// Counter for steps in which particle reports 'looping',
// if it is above 'Important' Energy
//
G4int fNoLooperTrials=0;
// Statistics for tracks abandoned
//
G4double fSumEnergyKilled= 0.0;
G4double fSumEnerSqKilled= 0.0;
G4double fMaxEnergyKilled= -1.0;
G4int fMaxEnergyKilledPDG= 0;
unsigned long fNumLoopersKilled= 0;
G4double fSumEnergyKilled_NonElectron= 0.0;
G4double fSumEnerSqKilled_NonElectron= 0.0;
G4double fMaxEnergyKilled_NonElectron= -1.0;
G4int fMaxEnergyKilled_NonElecPDG= 0;
unsigned long fNumLoopersKilled_NonElectron= 0;
G4double fSumEnergySaved= 0.0;
G4double fMaxEnergySaved= -1.0;
G4double fSumEnergyUnstableSaved = 0.0;
G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained
G4TransportationLogger* fpLogger; // Reports issues / raises warnings
private:
friend class G4Transportation;
static G4bool fUseMagneticMoment;
static G4bool fUseGravity;
static G4bool fSilenceLooperWarnings; // Flag to *Supress* all 'looper' warnings
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 in volume of 'mass' geometry
};
#include "G4CoupledTransportation.icc"
#endif
@@ -1,141 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
//
// Inline function implementation.
// =======================================================================
// Created: 9 June 1998, J. Apostolakis
// =======================================================================
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4TransportationLogger.hh"
#include "G4FieldManagerStore.hh"
inline void G4CoupledTransportation::
SetPropagatorInField( G4PropagatorInField* pFieldPropagator)
{
fFieldPropagator= pFieldPropagator;
}
inline G4PropagatorInField* G4CoupledTransportation::GetPropagatorInField()
{
return fFieldPropagator;
}
inline G4bool G4CoupledTransportation::DoesAnyFieldExist()
{
G4FieldManagerStore* fieldMgrStore= G4FieldManagerStore::GetInstance();
return fieldMgrStore->size() > 0;
}
inline G4double G4CoupledTransportation::GetThresholdWarningEnergy() const
{
return fThreshold_Warning_Energy;
}
inline G4double G4CoupledTransportation::GetThresholdImportantEnergy() const
{
return fThreshold_Important_Energy;
}
inline G4int G4CoupledTransportation::GetThresholdTrials() const
{
return fThresholdTrials;
}
inline void G4CoupledTransportation::SetThresholdWarningEnergy( G4double newEnWarn )
{
fThreshold_Warning_Energy= newEnWarn;
if( fpLogger ) {
fpLogger->SetThresholdWarningEnergy( newEnWarn );
} else {
ReportMissingLogger("SetThresholdWarningEnergy");
}
// Update the information for correct reporting
}
inline void G4CoupledTransportation::SetThresholdImportantEnergy( G4double newEnImp )
{
fThreshold_Important_Energy = newEnImp;
if( fpLogger ) {
fpLogger->SetThresholdImportantEnergy( newEnImp );
// Update the information for correct reporting
} else {
ReportMissingLogger("SetThresholdImportantEnergy");
}
}
inline void G4CoupledTransportation::SetThresholdTrials(G4int newMaxTrials )
{
fThresholdTrials = newMaxTrials;
if( fpLogger ) {
fpLogger->SetThresholdTrials(newMaxTrials );
// Update the information for correct reporting
} else {
ReportMissingLogger("SetThresholdTrials");
}
}
inline G4double G4CoupledTransportation::GetMaxEnergyKilled() const
{
return fMaxEnergyKilled;
}
inline G4double G4CoupledTransportation::GetSumEnergyKilled() const
{
return fSumEnergyKilled;
}
inline void G4CoupledTransportation::ResetKilledStatistics(G4int report)
{
// Statistics for tracks killed (currently due to looping in field)
if( report )
{
G4cout << " G4CoupledTransportation: Statistics for looping particles "
<< G4endl;
G4cout << " Sum of energy of loopers killed: " << fSumEnergyKilled
<< G4endl;
G4cout << " Max energy of loopers killed: " << fMaxEnergyKilled
<< G4endl;
}
fSumEnergyKilled= 0;
fMaxEnergyKilled= -1.0*CLHEP::GeV;
}
inline void
G4CoupledTransportation::PushThresholdsToLogger()
{
if( fpLogger )
fpLogger->SetThresholds( GetThresholdWarningEnergy(),
GetThresholdImportantEnergy(),
GetThresholdTrials() );
else
ReportMissingLogger("PushThresholdsToLogger()");
}
@@ -44,17 +44,14 @@
#define G4Transportation_hh 1
#include "G4VProcess.hh"
#include "G4FieldManager.hh"
#include "G4Navigator.hh"
#include "G4TransportationManager.hh"
#include "G4PropagatorInField.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleChangeForTransport.hh"
class G4Navigator;
class G4PropagatorInField;
class G4SafetyHelper;
class G4CoupledTransportation;
class G4TransportationLogger;
class G4Transportation : public G4VProcess
@@ -63,7 +60,7 @@ class G4Transportation : public G4VProcess
public: // with description
G4Transportation( G4int verbosityLevel= 1);
G4Transportation( G4int verbosityLevel= 1, const G4String& aName = "Transportation");
~G4Transportation();
G4double AlongStepGetPhysicalInteractionLength(
@@ -155,15 +152,15 @@ class G4Transportation : public G4VProcess
protected:
G4bool DoesAnyFieldExist();
// Check whether any field exists in the geometry
// - replaces method that checked only whether a field for the world volume
void SetTouchableInformation(const G4TouchableHandle& touchable);
void ReportMissingLogger(const char * methodName);
private:
protected:
G4Navigator* fLinearNavigator;
// The navigator for the 'mass' geometry
// (the real one, that physics occurs in)
G4PropagatorInField* fFieldPropagator;
// The Propagators used to transport the particle
@@ -235,9 +232,8 @@ class G4Transportation : public G4VProcess
G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained
G4TransportationLogger* fpLogger; // Reports issues / raises warnings
private:
protected:
friend class G4CoupledTransportation;
static G4bool fUseMagneticMoment;
static G4bool fUseGravity;
static G4bool fSilenceLooperWarnings; // Flag to *Supress* all 'looper' warnings
@@ -35,7 +35,6 @@
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4TransportationLogger.hh"
#include "G4FieldManagerStore.hh"
inline void
G4Transportation::SetPropagatorInField( G4PropagatorInField* pFieldPropagator)
@@ -48,12 +47,6 @@ inline G4PropagatorInField* G4Transportation::GetPropagatorInField()
return fFieldPropagator;
}
inline G4bool G4Transportation::DoesAnyFieldExist()
{
G4FieldManagerStore* fieldMgrStore= G4FieldManagerStore::GetInstance();
return fieldMgrStore->size() > 0;
}
inline G4double G4Transportation::GetThresholdWarningEnergy() const
{
return fThreshold_Warning_Energy;
@@ -1,107 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// class description
//
// A "process" to be registered to the process manager of each particle,
// in the UserPhysicsList, in order to take into account the user limits
// defined in the G4UserLimits object attached to a logical volume.
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef G4UserSpecialCuts_h
#define G4UserSpecialCuts_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "G4VProcess.hh"
class G4LossTableManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4UserSpecialCuts : public G4VProcess
{
public: // with description
G4UserSpecialCuts(const G4String& processName ="UserSpecialCut" );
virtual ~G4UserSpecialCuts();
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
virtual G4VParticleChange* PostStepDoIt(
const G4Track& ,
const G4Step&
);
public: // without description
// no operation in AtRestGPIL
virtual G4double AtRestGetPhysicalInteractionLength(
const G4Track& ,
G4ForceCondition*
){ return -1.0; };
// no operation in AtRestDoIt
virtual G4VParticleChange* AtRestDoIt(
const G4Track& ,
const G4Step&
){return 0;};
// no operation in AlongStepGPIL
virtual G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*
){ return -1.0; };
// no operation in AlongStepDoIt
virtual G4VParticleChange* AlongStepDoIt(
const G4Track& ,
const G4Step&
) {return 0;};
private:
// hide assignment operator as private
G4UserSpecialCuts(G4UserSpecialCuts&);
G4UserSpecialCuts& operator=(const G4UserSpecialCuts& right);
G4LossTableManager* theLossTableManager;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif