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
@@ -93,9 +93,8 @@ class G4AdjointPosOnPhysVolGenerator
//---------
private: // private methods
//---------
G4AdjointPosOnPhysVolGenerator();
~G4AdjointPosOnPhysVolGenerator();
G4AdjointPosOnPhysVolGenerator() = default;
~G4AdjointPosOnPhysVolGenerator() = default;
G4double ComputeAreaOfExtSurfaceStartingFromSphere(G4VSolid* aSolid,
G4int NStat);
G4double ComputeAreaOfExtSurfaceStartingFromBox(G4VSolid* aSolid,
@@ -119,11 +118,11 @@ class G4AdjointPosOnPhysVolGenerator
G4VSolid* theSolid = nullptr;
G4VPhysicalVolume* thePhysicalVolume = nullptr;
G4bool UseSphere;
G4String ModelOfSurfaceSource;
G4bool UseSphere{true};
G4String ModelOfSurfaceSource{"OnSolid"};
G4AffineTransform theTransformationFromPhysVolToWorld;
G4double AreaOfExtSurfaceOfThePhysicalVolume;
G4double CosThDirComparedToNormal;
G4double AreaOfExtSurfaceOfThePhysicalVolume{0.};
G4double CosThDirComparedToNormal{0.};
};
#endif
@@ -54,12 +54,12 @@ class G4AdjointStackingAction : public G4UserStackingAction
{
public:
G4AdjointStackingAction(G4AdjointTrackingAction* anAction);
virtual ~G4AdjointStackingAction();
explicit G4AdjointStackingAction(G4AdjointTrackingAction* anAction);
~G4AdjointStackingAction() override = default;
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
virtual void NewStage();
virtual void PrepareNewEvent();
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) override;
void NewStage() override;
void PrepareNewEvent() override;
inline void SetUserFwdStackingAction(G4UserStackingAction* anAction)
{ theFwdStackingAction = anAction; }
inline void SetUserAdjointStackingAction(G4UserStackingAction* anAction)
@@ -73,9 +73,10 @@ class G4AdjointStackingAction : public G4UserStackingAction
G4UserStackingAction* theFwdStackingAction = nullptr;
G4UserStackingAction* theUserAdjointStackingAction = nullptr;
G4bool reclassification_stage = false,
first_reclassification_stage = false,
kill_tracks = false, adjoint_mode = false;
G4bool reclassification_stage = false;
G4bool first_reclassification_stage = false;
G4bool kill_tracks = false;
G4bool adjoint_mode = false;
G4AdjointTrackingAction* theAdjointTrackingAction = nullptr;
};
+4 -4
View File
@@ -49,10 +49,10 @@ class G4EvManMessenger : public G4UImessenger
{
public:
G4EvManMessenger(G4EventManager* fEvMan);
~G4EvManMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
explicit G4EvManMessenger(G4EventManager* fEvMan);
~G4EvManMessenger() override;
void SetNewValue(G4UIcommand* command, G4String newValues) override;
G4String GetCurrentValue(G4UIcommand* command) override;
private:
+10 -7
View File
@@ -57,8 +57,8 @@ class G4Event
using ProfilerConfig = G4ProfilerConfig<G4ProfileType::Event>;
public:
G4Event();
G4Event(G4int evID);
G4Event() = default;
explicit G4Event(G4int evID);
~G4Event();
G4Event(const G4Event &) = delete;
@@ -138,18 +138,18 @@ class G4Event
{
if( i == 0 )
{ return thePrimaryVertex; }
else if( i > 0 && i < numberOfPrimaryVertex )
if( i > 0 && i < numberOfPrimaryVertex )
{
G4PrimaryVertex* primaryVertex = thePrimaryVertex;
for( G4int j=0; j<i; ++j )
{
if( !primaryVertex ) return nullptr;
if( primaryVertex == nullptr ) return nullptr;
primaryVertex = primaryVertex->GetNext();
}
return primaryVertex;
}
else
{ return nullptr; }
return nullptr;
}
// Returns i-th primary vertex of the event.
@@ -234,7 +234,10 @@ extern G4EVENT_DLL G4Allocator<G4Event>*& anEventAllocator();
inline void* G4Event::operator new(std::size_t)
{
if (!anEventAllocator()) anEventAllocator() = new G4Allocator<G4Event>;
if (anEventAllocator() == nullptr)
{
anEventAllocator() = new G4Allocator<G4Event>;
}
return (void*)anEventAllocator()->MallocSingle();
}
@@ -63,10 +63,10 @@ class G4GeneralParticleSource : public G4VPrimaryGenerator
// Initialize variables and instantiates the messenger and
// generator classes
~G4GeneralParticleSource();
~G4GeneralParticleSource() override;
// Delete messenger and others
void GeneratePrimaryVertex(G4Event*);
void GeneratePrimaryVertex(G4Event*) override;
inline G4int GetNumberofSource() { return GPSData->GetSourceVectorSize(); }
// Return the number of particle gun defined
@@ -78,13 +78,13 @@ class G4GeneralParticleSourceMessenger: public G4UImessenger
void SetParticleGun(G4SingleParticleSource *fpg) { fParticleGun = fpg; } ;
// Select the particle gun to be defined/modified
void SetNewValue(G4UIcommand* command, G4String newValues);
void SetNewValue(G4UIcommand* command, G4String newValues) override;
// Identifies the command which has been invoked by the user, extracts the
// parameters associated with that command (held in newValues), and uses
// these values with the appropriate member function of
// G4GeneralParticleSource
G4String GetCurrentValue(G4UIcommand* command);
G4String GetCurrentValue(G4UIcommand* command) override;
// Allows the user to retrieve the current values of parameters.
// NOT yet implemented!
@@ -93,9 +93,9 @@ class G4GeneralParticleSourceMessenger: public G4UImessenger
private:
G4GeneralParticleSourceMessenger(G4GeneralParticleSource*);
explicit G4GeneralParticleSourceMessenger(G4GeneralParticleSource*);
// Constructor: sets up commands
~G4GeneralParticleSourceMessenger();
~G4GeneralParticleSourceMessenger() override;
// Destructor: deletes commands
void IonCommand(G4String newValues);
+3 -3
View File
@@ -79,13 +79,13 @@ class G4HEPEvtInterface : public G4VPrimaryGenerator
{
public:
G4HEPEvtInterface(const char* evfile, G4int vl=0);
explicit G4HEPEvtInterface(const char* evfile, G4int vl=0);
// Constructor, "evfile" is the file name (with directory path).
~G4HEPEvtInterface();
~G4HEPEvtInterface() override = default;
// Destructor
void GeneratePrimaryVertex(G4Event* evt);
void GeneratePrimaryVertex(G4Event* evt) override;
private:
+6 -4
View File
@@ -44,10 +44,10 @@ class G4HEPEvtParticle
{
public:
G4HEPEvtParticle();
G4HEPEvtParticle() = default;
G4HEPEvtParticle(G4PrimaryParticle* pp,
G4int isthep, G4int jdahep1, G4int jdahep2);
~G4HEPEvtParticle();
~G4HEPEvtParticle() = default;
G4HEPEvtParticle & operator=(const G4HEPEvtParticle& right);
G4bool operator==(const G4HEPEvtParticle &right) const;
@@ -64,7 +64,7 @@ class G4HEPEvtParticle
private:
G4PrimaryParticle* theParticle = nullptr;
G4PrimaryParticle* theParticle = nullptr; // not owned
G4int ISTHEP = 1; // Status code of the entry
// Set to be 0 after generating links of
// G4PrimaryParticle object
@@ -76,8 +76,10 @@ extern G4EVENT_DLL G4Allocator<G4HEPEvtParticle>*& aHEPEvtParticleAllocator();
inline void * G4HEPEvtParticle::operator new(std::size_t)
{
if (!aHEPEvtParticleAllocator())
if (aHEPEvtParticleAllocator() == nullptr)
{
aHEPEvtParticleAllocator() = new G4Allocator<G4HEPEvtParticle>;
}
return (void *) aHEPEvtParticleAllocator()->MallocSingle();
}
+4 -4
View File
@@ -59,10 +59,10 @@ class G4MultiEventAction : public G4UserEventAction
public:
G4MultiEventAction() = default;
virtual ~G4MultiEventAction() override = default;
virtual void SetEventManager(G4EventManager* ) override;
virtual void BeginOfEventAction(const G4Event* ) override;
virtual void EndOfEventAction(const G4Event* ) override;
~G4MultiEventAction() override = default;
void SetEventManager(G4EventManager* ) override;
void BeginOfEventAction(const G4Event* ) override;
void EndOfEventAction(const G4Event* ) override;
};
#endif
+4 -4
View File
@@ -66,21 +66,21 @@ class G4ParticleGun : public G4VPrimaryGenerator
public:
G4ParticleGun();
G4ParticleGun(G4int numberofparticles);
G4ParticleGun(G4ParticleDefinition* particleDef,
explicit G4ParticleGun(G4int numberofparticles);
explicit G4ParticleGun(G4ParticleDefinition* particleDef,
G4int numberofparticles = 1);
// Costructors. "numberofparticles" is the number of particles to be
// shot at one invokation of GeneratePrimaryVertex() method.
// All particles are shot with the same physical quantities.
virtual ~G4ParticleGun();
~G4ParticleGun() override;
G4ParticleGun(const G4ParticleGun&) = delete;
const G4ParticleGun& operator=(const G4ParticleGun&) = delete;
G4bool operator==(const G4ParticleGun&) const = delete;
G4bool operator!=(const G4ParticleGun&) const = delete;
virtual void GeneratePrimaryVertex(G4Event* evt);
void GeneratePrimaryVertex(G4Event* evt) override;
// Creates a primary vertex at the given point
// and put primary particles to it.
@@ -53,11 +53,11 @@ class G4ParticleGunMessenger : public G4UImessenger
{
public:
G4ParticleGunMessenger(G4ParticleGun* fPtclGun);
~G4ParticleGunMessenger();
explicit G4ParticleGunMessenger(G4ParticleGun* fPtclGun);
~G4ParticleGunMessenger() override;
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
void SetNewValue(G4UIcommand* command, G4String newValues) override;
G4String GetCurrentValue(G4UIcommand* command) override;
private:
@@ -66,7 +66,7 @@ class G4ParticleGunMessenger : public G4UImessenger
private:
G4ParticleGun* fParticleGun = nullptr;
G4ParticleGun* fParticleGun = nullptr; // Not owned, cannot be null post construction
G4ParticleTable* particleTable = nullptr;
// Commands
+1 -1
View File
@@ -49,7 +49,7 @@ class G4PrimaryTransformer
public:
G4PrimaryTransformer();
virtual ~G4PrimaryTransformer();
virtual ~G4PrimaryTransformer() = default;
G4TrackVector* GimmePrimaries(G4Event* anEvent, G4int trackIDCounter=0);
void CheckUnknown();
+3 -6
View File
@@ -48,8 +48,8 @@ class G4RayShooter
{
public:
G4RayShooter();
virtual ~G4RayShooter();
G4RayShooter() = default;
virtual ~G4RayShooter() = default;
void Shoot(G4Event* evt, G4ThreeVector vtx, G4ThreeVector direc);
// Generates a primary vertex and a primary particle at the given
@@ -57,12 +57,9 @@ class G4RayShooter
// by G4RayTracer and G4MaterialScanner.
private:
void SetInitialValues();
G4ParticleDefinition* particle_definition = nullptr;
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy = 0.0;
G4double particle_energy = 1.0*CLHEP::GeV;
G4ThreeVector particle_position;
G4double particle_time = 0.0;
G4ThreeVector particle_polarization;
+1 -1
View File
@@ -181,7 +181,7 @@ class G4SPSAngDistribution
G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist
G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi
G4double DR,DX,DY ; // Standard deviations for beam divergence
G4double Theta, Phi; // Store these for use with DEBUG
G4double Theta{0.}, Phi{0.}; // Store these for use with DEBUG
G4ThreeVector FocusPoint ; // the focusing point in mother coordinates
G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist
G4PhysicsFreeVector UDefThetaH; // Theta histo data
@@ -75,10 +75,10 @@ class G4SingleParticleSource : public G4VPrimaryGenerator
// Constructor: initializes variables and instantiates the
// messenger and navigator classes
~G4SingleParticleSource();
~G4SingleParticleSource() override;
// Destructor: deletes messenger and prints out run information
void GeneratePrimaryVertex(G4Event *evt);
void GeneratePrimaryVertex(G4Event *evt) override;
// Generate the particles initial parameters
inline G4SPSPosDistribution* GetPosDist() const { return posGenerator; }
+8 -18
View File
@@ -35,6 +35,8 @@
#ifndef G4SmartTrackStack_hh
#define G4SmartTrackStack_hh 1
#include <array>
#include "G4StackedTrack.hh"
#include "G4TrackStack.hh"
#include "globals.hh"
@@ -62,29 +64,17 @@ class G4SmartTrackStack
inline G4int GetMaxNTrack() const { return maxNTracks; }
private:
inline G4int n_stackedTrack() const
{
return G4int(stacks[0]->GetNTrack() +
stacks[1]->GetNTrack() +
stacks[2]->GetNTrack() +
stacks[3]->GetNTrack() +
stacks[4]->GetNTrack());
}
private:
G4int fTurn;
G4int nTurn; // should be 5
G4double energies[5];
G4TrackStack* stacks[5];
G4int fTurn = 0;
static constexpr G4int nTurn{5};
std::array<G4double,nTurn> energies;
std::array<G4TrackStack*,nTurn> stacks;
// = 0 : all primaries and secondaries except followings
// = 1 : secondary neutrons
// = 2 : secondary electrons
// = 3 : secondary gammas
// = 4 : secondary positrons
G4int maxNTracks;
G4int nTracks;
G4int maxNTracks{0};
G4int nTracks{0};
};
#endif
+4 -7
View File
@@ -44,17 +44,14 @@ class G4StackChecker : public G4UserStackingAction
{
public:
G4StackChecker();
virtual ~G4StackChecker();
G4StackChecker() = default;
~G4StackChecker() override = default;
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* track);
virtual void NewStage();
virtual void PrepareNewEvent();
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* track) override;
private:
G4ThreeVector nullDirection;
G4ThreeVector nullDirection{0.0,0.0,0.0};
};
#endif
+2 -2
View File
@@ -40,10 +40,10 @@ class G4StackedTrack
{
public:
G4StackedTrack() : track(nullptr), trajectory(nullptr) {}
G4StackedTrack() = default;
G4StackedTrack(G4Track* aTrack, G4VTrajectory* aTraj = nullptr)
: track(aTrack), trajectory(aTraj) {}
~G4StackedTrack() {}
~G4StackedTrack() = default;
inline G4Track* GetTrack() const { return track; }
inline G4VTrajectory* GetTrajectory() const { return trajectory; }
+3 -3
View File
@@ -51,12 +51,12 @@ class G4StackingMessenger : public G4UImessenger
public:
G4StackingMessenger(G4StackManager* fCont);
~G4StackingMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
~G4StackingMessenger() override;
void SetNewValue(G4UIcommand* command, G4String newValues) override;
private:
G4StackManager* fContainer = nullptr;
G4StackManager* fContainer = nullptr; // Cannot be null after construction
G4UIdirectory* stackDir;
G4UIcmdWithoutParameter* statusCmd;
G4UIcmdWithAnInteger* clearCmd;
+6 -7
View File
@@ -45,9 +45,8 @@ class G4TrackStack : public std::vector<G4StackedTrack>
{
public:
G4TrackStack()
: safetyValue1(0), safetyValue2(0), nstick(0) {}
G4TrackStack(std::size_t n)
G4TrackStack() = default;
explicit G4TrackStack(std::size_t n)
: safetyValue1(G4int(4*n/5)),
safetyValue2(G4int(4*n/5-100)), nstick(100) { reserve(n); }
~G4TrackStack();
@@ -71,14 +70,14 @@ class G4TrackStack : public std::vector<G4StackedTrack>
inline G4int GetSafetyValue2() const { return safetyValue2; }
inline G4int GetNStick() const { return nstick; }
G4double getTotalEnergy(void) const;
G4double getTotalEnergy() const;
inline void SetSafetyValue2(G4int x) { safetyValue2 = x < 0 ? 0 : x; }
private:
G4int safetyValue1;
G4int safetyValue2;
G4int nstick;
G4int safetyValue1{0};
G4int safetyValue2{0};
G4int nstick{0};
};
#endif
@@ -42,7 +42,7 @@
#include "G4VTrajectory.hh"
#include "G4Allocator.hh"
typedef std::vector<G4VTrajectory*> TrajectoryVector;
using TrajectoryVector = std::vector<G4VTrajectory*>;
class G4TrajectoryContainer
{
@@ -82,8 +82,10 @@ G4Allocator<G4TrajectoryContainer>*& aTrajectoryContainerAllocator();
inline void* G4TrajectoryContainer::operator new(std::size_t)
{
if (!aTrajectoryContainerAllocator())
if (aTrajectoryContainerAllocator() == nullptr)
{
aTrajectoryContainerAllocator() = new G4Allocator<G4TrajectoryContainer>;
}
return (void*)aTrajectoryContainerAllocator()->MallocSingle();
}
+2 -2
View File
@@ -50,7 +50,7 @@ class G4UserEventAction
public:
G4UserEventAction();
virtual ~G4UserEventAction();
virtual ~G4UserEventAction() = default;
virtual void SetEventManager(G4EventManager* value);
virtual void BeginOfEventAction(const G4Event* anEvent);
@@ -59,7 +59,7 @@ class G4UserEventAction
protected:
G4EventManager* fpEventManager = nullptr;
G4EventManager* fpEventManager = nullptr; // not owned
};
#endif
+2 -2
View File
@@ -46,7 +46,7 @@ class G4UserStackingAction
public:
G4UserStackingAction();
virtual ~G4UserStackingAction();
virtual ~G4UserStackingAction() = default;
inline void SetStackManager(G4StackManager* value) { stackManager=value; }
@@ -112,7 +112,7 @@ class G4UserStackingAction
protected:
G4StackManager* stackManager = nullptr;
G4StackManager* stackManager = nullptr; // Not owned
};
#endif
+2 -2
View File
@@ -45,8 +45,8 @@ class G4VPrimaryGenerator
{
public:
G4VPrimaryGenerator();
virtual ~G4VPrimaryGenerator();
G4VPrimaryGenerator() = default;
virtual ~G4VPrimaryGenerator() = default;
// Constructor and destructor
static G4bool CheckVertexInsideWorld(const G4ThreeVector& pos);
@@ -52,8 +52,8 @@ class G4VUserEventInformation
{
public:
G4VUserEventInformation() {;}
virtual ~G4VUserEventInformation() {;}
G4VUserEventInformation() = default;
virtual ~G4VUserEventInformation() = default;
public: