Import Geant4 11.2.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2023-06-30 09:09:57 +02:00
parent aef78ca386
commit dd1f179cda
3780 changed files with 212808 additions and 142780 deletions
@@ -32,7 +32,7 @@
// surface of a sphere.
// It is used to check if an adjoint particle reaches the external
// surface or reenter the sensitive region delimited by the adjoint
// source.
// source.
// Author: L. Desorgher, SpaceIT GmbH - 15 January 2007
// Contract: ESA contract 21435/08/NL/AT
@@ -41,98 +41,65 @@
#ifndef G4AdjointCrossSurfChecker_hh
#define G4AdjointCrossSurfChecker_hh 1
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include <vector>
class G4Step;
class G4AdjointCrossSurfChecker
{
public:
static G4AdjointCrossSurfChecker* GetInstance();
G4bool CrossingASphere(const G4Step* aStep,
G4double sphere_radius,
G4ThreeVector sphere_center,
G4ThreeVector& cross_pos,
G4double& cos_to_surface,
G4bool& GoingIn);
class G4AdjointCrossSurfChecker
{
public:
static G4AdjointCrossSurfChecker* GetInstance();
G4bool GoingInOrOutOfaVolume(const G4Step* aStep,
const G4String& volume_name,
G4double& cos_to_surface,
G4bool& GoingIn);
G4bool CrossingASphere(const G4Step* aStep, G4double sphere_radius, G4ThreeVector sphere_center,
G4ThreeVector& cross_pos, G4double& cos_to_surface, G4bool& GoingIn);
G4bool GoingInOrOutOfaVolumeByExtSurface(const G4Step* aStep,
const G4String& volume_name,
const G4String& mother_lvol_name,
G4double& cos_to_surface,
G4bool& GoingIn);
G4bool GoingInOrOutOfaVolume(
const G4Step* aStep, const G4String& volume_name, G4double& cos_to_surface, G4bool& GoingIn);
G4bool CrossingAGivenRegisteredSurface(const G4Step* aStep,
const G4String& surface_name,
G4ThreeVector& cross_pos,
G4double& cos_to_surface,
G4bool& GoingIn);
G4bool GoingInOrOutOfaVolumeByExtSurface(const G4Step* aStep, const G4String& volume_name,
const G4String& mother_lvol_name, G4double& cos_to_surface, G4bool& GoingIn);
G4bool CrossingAGivenRegisteredSurface(const G4Step* aStep,
G4int ind,
G4ThreeVector& cross_pos,
G4double& cos_to_surface,
G4bool& GoingIn);
G4bool CrossingAGivenRegisteredSurface(const G4Step* aStep, const G4String& surface_name,
G4ThreeVector& cross_pos, G4double& cos_to_surface, G4bool& GoingIn);
G4bool CrossingOneOfTheRegisteredSurface(const G4Step* aStep,
G4String& surface_name,
G4ThreeVector& cross_pos,
G4double& cos_to_surface,
G4bool& GoingIn);
G4bool CrossingAGivenRegisteredSurface(const G4Step* aStep, G4int ind, G4ThreeVector& cross_pos,
G4double& cos_to_surface, G4bool& GoingIn);
G4bool CrossingAnInterfaceBetweenTwoVolumes(const G4Step* aStep,
const G4String& vol1_name,
const G4String& vol2_name,
G4ThreeVector& cross_pos,
G4double& cos_to_surface,
G4bool& GoingIn);
G4bool AddaSphericalSurface(const G4String& SurfaceName,
G4double radius,
G4ThreeVector pos,
G4double& area);
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(
const G4String& SurfaceName,
G4double radius,
const G4String& volume_name,
G4ThreeVector& center,
G4double& area);
G4bool AddanExtSurfaceOfAvolume(const G4String& SurfaceName,
const G4String& volume_name,
G4double& area);
G4bool AddanInterfaceBetweenTwoVolumes(const G4String& SurfaceName,
const G4String& volume_name1,
const G4String& volume_name2,
G4double& area);
void ClearListOfSelectedSurface();
G4bool CrossingOneOfTheRegisteredSurface(const G4Step* aStep, G4String& surface_name,
G4ThreeVector& cross_pos, G4double& cos_to_surface, G4bool& GoingIn);
private:
G4AdjointCrossSurfChecker();
~G4AdjointCrossSurfChecker();
G4int FindRegisteredSurface(const G4String& name);
private:
G4bool CrossingAnInterfaceBetweenTwoVolumes(const G4Step* aStep, const G4String& vol1_name,
const G4String& vol2_name, G4ThreeVector& cross_pos, G4double& cos_to_surface, G4bool& GoingIn);
static G4ThreadLocal G4AdjointCrossSurfChecker* instance;
std::vector<G4String> ListOfSurfaceName;
std::vector<G4String> ListOfSurfaceType;
std::vector<G4double> ListOfSphereRadius;
std::vector<G4ThreeVector> ListOfSphereCenter;
std::vector<G4String> ListOfVol1Name;
std::vector<G4String> ListOfVol2Name;
std::vector<G4double> AreaOfSurface;
G4bool AddaSphericalSurface(
const G4String& SurfaceName, G4double radius, G4ThreeVector pos, G4double& area);
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String& SurfaceName,
G4double radius, const G4String& volume_name, G4ThreeVector& center, G4double& area);
G4bool AddanExtSurfaceOfAvolume(
const G4String& SurfaceName, const G4String& volume_name, G4double& area);
G4bool AddanInterfaceBetweenTwoVolumes(const G4String& SurfaceName, const G4String& volume_name1,
const G4String& volume_name2, G4double& area);
void ClearListOfSelectedSurface();
private:
G4AdjointCrossSurfChecker() = default;
~G4AdjointCrossSurfChecker();
G4int FindRegisteredSurface(const G4String& name);
private:
static G4ThreadLocal G4AdjointCrossSurfChecker* instance;
std::vector<G4String> ListOfSurfaceName;
std::vector<G4String> ListOfSurfaceType;
std::vector<G4double> ListOfSphereRadius;
std::vector<G4ThreeVector> ListOfSphereCenter;
std::vector<G4String> ListOfVol1Name;
std::vector<G4String> ListOfVol2Name;
std::vector<G4double> AreaOfSurface;
};
#endif
@@ -27,9 +27,9 @@
//
// Class description:
//
// Stepping action used in the adjoint simulation.
// Stepping action used in the adjoint simulation.
// It is responsible to stop the adjoint tracking phase when:
// a) The adjoint track reaches the external surface.
// a) The adjoint track reaches the external surface.
// b) The being tracked adjoint dynamic particle get an energy higher than
// the maximum energy of the external source.
// c) The adjoint track enters the volume delimited by the adjoint source.
@@ -43,7 +43,7 @@
// Author: L. Desorgher, SpaceIT GmbH
// Contract: ESA contract 21435/08/NL/AT
// Customer: ESA/ESTEC
// History:
// History:
// - 15/01/2007 L.Desorgher, created.
// - 04/11/2009 L.Desorgher, added possibility to use user stepping action.
// - 20/11/2009 L.Desorgher, corrected stop of adjoint particles tracking
@@ -52,69 +52,65 @@
#ifndef G4AdjointSteppingAction_hh
#define G4AdjointSteppingAction_hh 1
#include "G4ThreeVector.hh"
#include "G4UserSteppingAction.hh"
#include "globals.hh"
#include "G4ThreeVector.hh"
class G4AdjointCrossSurfChecker;
class G4ParticleDefinition;
class G4AdjointSteppingAction : public G4UserSteppingAction
{
public:
public:
G4AdjointSteppingAction();
~G4AdjointSteppingAction() override = default;
G4AdjointSteppingAction();
~G4AdjointSteppingAction();
void UserSteppingAction(const G4Step*) override;
void UserSteppingAction(const G4Step*);
inline void SetExtSourceEMax(G4double Emax)
{ ext_sourceEMax = Emax; }
inline void SetStartEvent(G4bool aBool)
{ start_event = aBool; }
inline G4bool GetDidAdjParticleReachTheExtSource()
{ return did_adj_part_reach_ext_source; }
inline G4ThreeVector GetLastMomentum()
{ return last_momentum; }
inline G4ThreeVector GetLastPosition()
{ return last_pos; }
inline G4double GetLastEkin()
{ return last_ekin; }
inline G4double GetLastWeight()
{ return last_weight; }
inline void SetPrimWeight(G4double weight)
{ prim_weight = weight; }
inline G4ParticleDefinition* GetLastPartDef()
{ return last_part_def; }
inline void SetUserAdjointSteppingAction(G4UserSteppingAction* anAction)
{ theUserAdjointSteppingAction = anAction; }
inline void SetUserForwardSteppingAction(G4UserSteppingAction* anAction)
{ theUserFwdSteppingAction = anAction; }
inline void SetAdjointTrackingMode(G4bool aBool)
{ is_adjoint_tracking_mode = aBool; }
inline void ResetDidOneAdjPartReachExtSourceDuringEvent()
{ did_one_adj_part_reach_ext_source_during_event = false; }
inline void SetAdjointGeantinoTrackingMode(G4bool aBool)
{ is_adjoint_geantino_tracking_mode = aBool; }
inline void SetExtSourceEMax(G4double Emax) { ext_sourceEMax = Emax; }
inline void SetStartEvent(G4bool aBool) { start_event = aBool; }
inline G4bool GetDidAdjParticleReachTheExtSource() { return did_adj_part_reach_ext_source; }
inline G4ThreeVector GetLastMomentum() { return last_momentum; }
inline G4ThreeVector GetLastPosition() { return last_pos; }
inline G4double GetLastEkin() { return last_ekin; }
inline G4double GetLastWeight() { return last_weight; }
inline void SetPrimWeight(G4double weight) { prim_weight = weight; }
inline G4ParticleDefinition* GetLastPartDef() { return last_part_def; }
inline void SetUserAdjointSteppingAction(G4UserSteppingAction* anAction)
{
theUserAdjointSteppingAction = anAction;
}
inline void SetUserForwardSteppingAction(G4UserSteppingAction* anAction)
{
theUserFwdSteppingAction = anAction;
}
inline void SetAdjointTrackingMode(G4bool aBool) { is_adjoint_tracking_mode = aBool; }
inline void ResetDidOneAdjPartReachExtSourceDuringEvent()
{
did_one_adj_part_reach_ext_source_during_event = false;
}
inline void SetAdjointGeantinoTrackingMode(G4bool aBool)
{
is_adjoint_geantino_tracking_mode = aBool;
}
private:
private:
G4double ext_sourceEMax = 0.0;
G4AdjointCrossSurfChecker* theG4AdjointCrossSurfChecker = nullptr;
G4double ext_sourceEMax = 0.0;
G4AdjointCrossSurfChecker* theG4AdjointCrossSurfChecker = nullptr;
G4ThreeVector last_momentum, last_pos;
G4double last_ekin = 0.0;
G4double last_weight = 0.0;
G4double prim_weight = 1.0;
G4ParticleDefinition* last_part_def = nullptr;
G4UserSteppingAction* theUserAdjointSteppingAction = nullptr;
G4UserSteppingAction* theUserFwdSteppingAction = nullptr;
G4ThreeVector last_momentum, last_pos;
G4double last_ekin = 0.0;
G4double last_weight = 0.0;
G4double prim_weight = 1.0;
G4ParticleDefinition* last_part_def = nullptr;
G4UserSteppingAction* theUserAdjointSteppingAction = nullptr;
G4UserSteppingAction* theUserFwdSteppingAction = nullptr;
G4bool start_event = false;
G4bool did_adj_part_reach_ext_source = false;
G4bool did_one_adj_part_reach_ext_source_during_event = false;
G4bool is_adjoint_tracking_mode = false;
G4bool is_adjoint_geantino_tracking_mode = false;
G4bool start_event = false;
G4bool did_adj_part_reach_ext_source = false;
G4bool did_one_adj_part_reach_ext_source_during_event = false;
G4bool is_adjoint_tracking_mode = false;
G4bool is_adjoint_geantino_tracking_mode = false;
};
#endif
@@ -37,9 +37,10 @@
#ifndef G4AdjointTrackingAction_hh
#define G4AdjointTrackingAction_hh 1
#include "globals.hh"
#include "G4UserTrackingAction.hh"
#include "G4ThreeVector.hh"
#include "G4UserTrackingAction.hh"
#include "globals.hh"
#include <vector>
class G4AdjointSteppingAction;
@@ -48,71 +49,73 @@ class G4ParticleDefinition;
class G4AdjointTrackingAction : public G4UserTrackingAction
{
public:
G4AdjointTrackingAction(G4AdjointSteppingAction* anAction);
~G4AdjointTrackingAction() override = default;
public:
void PreUserTrackingAction(const G4Track*) override;
void PostUserTrackingAction(const G4Track*) override;
void RegisterAtEndOfAdjointTrack();
void ClearEndOfAdjointTrackInfoVectors();
G4AdjointTrackingAction(G4AdjointSteppingAction* anAction);
virtual ~G4AdjointTrackingAction();
inline void SetUserForwardTrackingAction(G4UserTrackingAction* anAction)
{
theUserFwdTrackingAction = anAction;
}
inline G4ThreeVector GetPositionAtEndOfLastAdjointTrack(std::size_t i = 0)
{
return last_pos_vec[i];
}
inline G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(std::size_t i = 0)
{
return last_direction_vec[i];
}
inline G4double GetEkinAtEndOfLastAdjointTrack(std::size_t i = 0) { return last_ekin_vec[i]; }
inline G4double GetEkinNucAtEndOfLastAdjointTrack(std::size_t i = 0)
{
return last_ekin_nuc_vec[i];
}
inline G4double GetWeightAtEndOfLastAdjointTrack(std::size_t i = 0) { return last_weight_vec[i]; }
inline G4double GetCosthAtEndOfLastAdjointTrack(std::size_t i = 0) { return last_cos_th_vec[i]; }
inline const G4String& GetFwdParticleNameAtEndOfLastAdjointTrack() { return last_fwd_part_name; }
inline G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(std::size_t i = 0)
{
return last_fwd_part_PDGEncoding_vec[i];
}
inline G4bool GetIsAdjointTrackingMode() { return is_adjoint_tracking_mode; }
inline G4int GetLastFwdParticleIndex(std::size_t i = 0) { return last_fwd_part_index_vec[i]; }
inline std::size_t GetNbOfAdointTracksReachingTheExternalSurface() { return last_pos_vec.size(); }
inline void SetListOfPrimaryFwdParticles(std::vector<G4ParticleDefinition*>* aListOfParticles)
{
pListOfPrimaryFwdParticles = aListOfParticles;
}
virtual void PreUserTrackingAction(const G4Track*);
virtual void PostUserTrackingAction(const G4Track*);
void RegisterAtEndOfAdjointTrack();
void ClearEndOfAdjointTrackInfoVectors();
private:
G4AdjointSteppingAction* theAdjointSteppingAction = nullptr;
G4UserTrackingAction* theUserFwdTrackingAction = nullptr;
G4bool is_adjoint_tracking_mode = false;
inline void SetUserForwardTrackingAction(G4UserTrackingAction* anAction)
{ theUserFwdTrackingAction = anAction; }
inline G4ThreeVector GetPositionAtEndOfLastAdjointTrack(std::size_t i=0)
{ return last_pos_vec[i]; }
inline G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(std::size_t i=0)
{ return last_direction_vec[i]; }
inline G4double GetEkinAtEndOfLastAdjointTrack(std::size_t i=0)
{ return last_ekin_vec[i]; }
inline G4double GetEkinNucAtEndOfLastAdjointTrack(std::size_t i=0)
{ return last_ekin_nuc_vec[i]; }
inline G4double GetWeightAtEndOfLastAdjointTrack(std::size_t i=0)
{ return last_weight_vec[i]; }
inline G4double GetCosthAtEndOfLastAdjointTrack(std::size_t i=0)
{ return last_cos_th_vec[i]; }
inline const G4String& GetFwdParticleNameAtEndOfLastAdjointTrack()
{ return last_fwd_part_name; }
inline G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(std::size_t i=0)
{ return last_fwd_part_PDGEncoding_vec[i]; }
inline G4bool GetIsAdjointTrackingMode()
{ return is_adjoint_tracking_mode; }
inline G4int GetLastFwdParticleIndex(std::size_t i=0)
{ return last_fwd_part_index_vec[i]; }
inline std::size_t GetNbOfAdointTracksReachingTheExternalSurface()
{ return last_pos_vec.size(); }
inline void SetListOfPrimaryFwdParticles(std::vector<G4ParticleDefinition*>* aListOfParticles)
{ pListOfPrimaryFwdParticles = aListOfParticles; }
// Adjoint particle information on the external surface
// ----------------------------------------------------
G4ThreeVector last_pos;
G4ThreeVector last_direction;
G4double last_ekin = 0.0, last_ekin_nuc = 0.0;
// last_ekin_nuc=last_ekin/nuc, nuc is 1 if not a nucleus
G4double last_cos_th = 0.0;
G4String last_fwd_part_name;
G4int last_fwd_part_PDGEncoding = 0;
G4double last_weight = 0.0;
G4int last_fwd_part_index = 0;
std::vector<G4ParticleDefinition*>* pListOfPrimaryFwdParticles = nullptr;
private:
G4AdjointSteppingAction* theAdjointSteppingAction = nullptr;
G4UserTrackingAction* theUserFwdTrackingAction = nullptr;
G4bool is_adjoint_tracking_mode = false;
// Adjoint particle information on the external surface
// ----------------------------------------------------
G4ThreeVector last_pos;
G4ThreeVector last_direction;
G4double last_ekin = 0.0, last_ekin_nuc = 0.0;
// last_ekin_nuc=last_ekin/nuc, nuc is 1 if not a nucleus
G4double last_cos_th = 0.0;
G4String last_fwd_part_name;
G4int last_fwd_part_PDGEncoding = 0;
G4double last_weight = 0.0;
G4int last_fwd_part_index = 0;
std::vector<G4ParticleDefinition*>* pListOfPrimaryFwdParticles = nullptr;
std::vector<G4ThreeVector> last_pos_vec;
std::vector<G4ThreeVector> last_direction_vec;
std::vector<G4double> last_ekin_vec;
std::vector<G4double> last_ekin_nuc_vec;
std::vector<G4double> last_cos_th_vec;
std::vector<G4double> last_weight_vec;
std::vector<G4int> last_fwd_part_PDGEncoding_vec;
std::vector<G4int> last_fwd_part_index_vec;
std::vector<G4ThreeVector> last_pos_vec;
std::vector<G4ThreeVector> last_direction_vec;
std::vector<G4double> last_ekin_vec;
std::vector<G4double> last_ekin_nuc_vec;
std::vector<G4double> last_cos_th_vec;
std::vector<G4double> last_weight_vec;
std::vector<G4int> last_fwd_part_PDGEncoding_vec;
std::vector<G4int> last_fwd_part_index_vec;
};
#endif
@@ -48,21 +48,20 @@
#define G4MULTISTEPPINGACTION_HH
#include "G4UserSteppingAction.hh"
#include <vector>
#include <memory>
#include <vector>
using G4UserSteppingActionUPtr = std::unique_ptr<G4UserSteppingAction>;
using G4UserSteppingActionVector = std::vector<G4UserSteppingActionUPtr>;
class G4MultiSteppingAction : public G4UserSteppingAction,
public G4UserSteppingActionVector
class G4MultiSteppingAction : public G4UserSteppingAction, public G4UserSteppingActionVector
{
public:
G4MultiSteppingAction() = default;
virtual ~G4MultiSteppingAction() override = default;
virtual void UserSteppingAction(const G4Step*) override;
virtual void SetSteppingManagerPointer(G4SteppingManager* pVal) override;
public:
G4MultiSteppingAction() = default;
~G4MultiSteppingAction() override = default;
void UserSteppingAction(const G4Step*) override;
void SetSteppingManagerPointer(G4SteppingManager* pVal) override;
};
#endif
@@ -48,22 +48,21 @@
#define G4MULTITRACKINGACTION_HH
#include "G4UserTrackingAction.hh"
#include <vector>
#include <memory>
#include <vector>
using G4UserTrackingActionUPtr=std::unique_ptr<G4UserTrackingAction>;
using G4UserTrackingActionVector=std::vector<G4UserTrackingActionUPtr>;
using G4UserTrackingActionUPtr = std::unique_ptr<G4UserTrackingAction>;
using G4UserTrackingActionVector = std::vector<G4UserTrackingActionUPtr>;
class G4MultiTrackingAction : public G4UserTrackingAction,
public G4UserTrackingActionVector
class G4MultiTrackingAction : public G4UserTrackingAction, public G4UserTrackingActionVector
{
public:
G4MultiTrackingAction() = default;
virtual ~G4MultiTrackingAction() override = default;
virtual void SetTrackingManagerPointer(G4TrackingManager* pVal) override;
virtual void PreUserTrackingAction(const G4Track*) override;
virtual void PostUserTrackingAction(const G4Track*) override;
public:
G4MultiTrackingAction() = default;
~G4MultiTrackingAction() override = default;
void SetTrackingManagerPointer(G4TrackingManager* pVal) override;
void PreUserTrackingAction(const G4Track*) override;
void PostUserTrackingAction(const G4Track*) override;
};
#endif
+44 -46
View File
@@ -29,8 +29,8 @@
//
// This class extends G4Trajectory, which includes the following:
// 1) List of trajectory points which compose the trajectory,
// 2) static information of particle which generated the
// trajectory,
// 2) static information of particle which generated the
// trajectory,
// 3) trackID and parent particle ID of the trajectory.
// The extended information, only publicly accessible through AttValues,
// includes:
@@ -50,66 +50,64 @@
#ifndef G4RICHTRAJECTORY_HH
#define G4RICHTRAJECTORY_HH
#include "trkgdefs.hh"
#include "G4Trajectory.hh"
#include "G4TouchableHandle.hh"
#include "G4Trajectory.hh"
#include "trkgdefs.hh"
class G4RichTrajectory : public G4Trajectory
{
{
using RichTrajectoryPointsContainer = std::vector<G4VTrajectoryPoint*>;
public:
// Constructors/destructor
//
G4RichTrajectory();
G4RichTrajectory(const G4Track* aTrack);
G4RichTrajectory(G4RichTrajectory &);
virtual ~G4RichTrajectory();
public:
// Constructors/destructor
//
G4RichTrajectory() = default;
G4RichTrajectory(const G4Track* aTrack);
~G4RichTrajectory() override;
G4RichTrajectory(G4RichTrajectory&);
G4RichTrajectory& operator=(const G4RichTrajectory&) = delete;
// Operators
//
G4RichTrajectory& operator= (const G4RichTrajectory &) = delete;
G4int operator == (const G4RichTrajectory& r) const { return (this==&r); }
// Operators
//
G4bool operator==(const G4RichTrajectory& r) const { return (this == &r); }
inline void* operator new(size_t);
inline void operator delete(void*);
// Other (virtual) member functions
//
void ShowTrajectory(std::ostream& os=G4cout) const;
void DrawTrajectory() const;
void AppendStep(const G4Step* aStep);
void MergeTrajectory(G4VTrajectory* secondTrajectory);
inline G4int GetPointEntries() const;
inline G4VTrajectoryPoint* GetPoint(G4int i) const;
inline void* operator new(size_t);
inline void operator delete(void*);
// Get methods for HepRep style attributes
//
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
// Other (virtual) member functions
//
void ShowTrajectory(std::ostream& os = G4cout) const override;
void DrawTrajectory() const override;
void AppendStep(const G4Step* aStep) override;
void MergeTrajectory(G4VTrajectory* secondTrajectory) override;
inline G4int GetPointEntries() const override;
inline G4VTrajectoryPoint* GetPoint(G4int i) const override;
private:
// Get methods for HepRep style attributes
//
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
std::vector<G4AttValue>* CreateAttValues() const override;
// Extended information (only publicly accessible through AttValues)...
//
RichTrajectoryPointsContainer* fpRichPointsContainer = nullptr;
G4TouchableHandle fpInitialVolume;
G4TouchableHandle fpInitialNextVolume;
const G4VProcess* fpCreatorProcess = nullptr;
G4int fCreatorModelID = 0;
G4TouchableHandle fpFinalVolume;
G4TouchableHandle fpFinalNextVolume;
const G4VProcess* fpEndingProcess = nullptr;
G4double fFinalKineticEnergy = 0.0;
private:
// Extended information (only publicly accessible through AttValues)...
//
RichTrajectoryPointsContainer* fpRichPointsContainer = nullptr;
G4TouchableHandle fpInitialVolume;
G4TouchableHandle fpInitialNextVolume;
const G4VProcess* fpCreatorProcess = nullptr;
G4int fCreatorModelID = 0;
G4TouchableHandle fpFinalVolume;
G4TouchableHandle fpFinalNextVolume;
const G4VProcess* fpEndingProcess = nullptr;
G4double fFinalKineticEnergy = 0.0;
};
extern G4TRACKING_DLL G4Allocator<G4RichTrajectory>*& aRichTrajectoryAllocator();
inline void* G4RichTrajectory::operator new(size_t)
{
if (aRichTrajectoryAllocator() == nullptr)
{
if (aRichTrajectoryAllocator() == nullptr) {
aRichTrajectoryAllocator() = new G4Allocator<G4RichTrajectory>;
}
return (void*)aRichTrajectoryAllocator()->MallocSingle();
@@ -51,13 +51,14 @@
#ifndef G4RICHTRAJECTORYPOINT_HH
#define G4RICHTRAJECTORYPOINT_HH
#include <vector>
#include "G4StepStatus.hh"
#include "G4ThreeVector.hh"
#include "G4TouchableHandle.hh"
#include "G4TrajectoryPoint.hh"
#include "trkgdefs.hh"
#include "G4TrajectoryPoint.hh"
#include "G4TouchableHandle.hh"
#include "G4ThreeVector.hh"
#include "G4StepStatus.hh"
#include <vector>
class G4Track;
class G4Step;
@@ -65,76 +66,66 @@ class G4VProcess;
class G4RichTrajectoryPoint : public G4TrajectoryPoint
{
public: // without description
// Constructors/Destructor
//
G4RichTrajectoryPoint();
G4RichTrajectoryPoint(const G4Track*); // For first point.
G4RichTrajectoryPoint(const G4Step*); // For subsequent points.
G4RichTrajectoryPoint(const G4RichTrajectoryPoint& right);
~G4RichTrajectoryPoint() override;
public: // without description
// Operators
//
G4RichTrajectoryPoint& operator=(const G4RichTrajectoryPoint&) = delete;
inline G4bool operator==(const G4RichTrajectoryPoint& right) const;
inline void* operator new(size_t);
inline void operator delete(void* aRichTrajectoryPoint);
// Constructors/Destructor
//
G4RichTrajectoryPoint();
G4RichTrajectoryPoint(const G4Track*); // For first point.
G4RichTrajectoryPoint(const G4Step*); // For subsequent points.
G4RichTrajectoryPoint(const G4RichTrajectoryPoint& right);
virtual ~G4RichTrajectoryPoint();
// Get/Set functions
//
inline const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const override;
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
std::vector<G4AttValue>* CreateAttValues() const override;
// Operators
//
G4RichTrajectoryPoint& operator= (const G4RichTrajectoryPoint&) = delete;
inline G4bool operator==(const G4RichTrajectoryPoint& right) const;
inline void *operator new(size_t);
inline void operator delete(void *aRichTrajectoryPoint);
// Get/Set functions
//
inline const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const;
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
private:
// Extended member data
//
std::vector<G4ThreeVector>* fpAuxiliaryPointVector = nullptr;
G4double fTotEDep = 0.0;
G4double fRemainingEnergy = 0.0;
const G4VProcess* fpProcess = nullptr;
G4StepStatus fPreStepPointStatus = fUndefined;
G4StepStatus fPostStepPointStatus = fUndefined;
G4double fPreStepPointGlobalTime = 0.0;
G4double fPostStepPointGlobalTime = 0.0;
G4TouchableHandle fpPreStepPointVolume;
G4TouchableHandle fpPostStepPointVolume;
G4double fPreStepPointWeight = 0.0;
G4double fPostStepPointWeight = 0.0;
private:
// Extended member data
//
std::vector<G4ThreeVector>* fpAuxiliaryPointVector = nullptr;
G4double fTotEDep = 0.0;
G4double fRemainingEnergy = 0.0;
const G4VProcess* fpProcess = nullptr;
G4StepStatus fPreStepPointStatus = fUndefined;
G4StepStatus fPostStepPointStatus = fUndefined;
G4double fPreStepPointGlobalTime = 0.0;
G4double fPostStepPointGlobalTime = 0.0;
G4TouchableHandle fpPreStepPointVolume;
G4TouchableHandle fpPostStepPointVolume;
G4double fPreStepPointWeight = 0.0;
G4double fPostStepPointWeight = 0.0;
};
extern G4TRACKING_DLL
G4Allocator<G4RichTrajectoryPoint>*& aRichTrajectoryPointAllocator();
extern G4TRACKING_DLL G4Allocator<G4RichTrajectoryPoint>*& aRichTrajectoryPointAllocator();
inline void*
G4RichTrajectoryPoint::operator new(size_t)
inline void* G4RichTrajectoryPoint::operator new(size_t)
{
if (aRichTrajectoryPointAllocator() == nullptr)
{
if (aRichTrajectoryPointAllocator() == nullptr) {
aRichTrajectoryPointAllocator() = new G4Allocator<G4RichTrajectoryPoint>;
}
return (void *) aRichTrajectoryPointAllocator()->MallocSingle();
return (void*)aRichTrajectoryPointAllocator()->MallocSingle();
}
inline void
G4RichTrajectoryPoint::operator delete(void *aRichTrajectoryPoint)
inline void G4RichTrajectoryPoint::operator delete(void* aRichTrajectoryPoint)
{
aRichTrajectoryPointAllocator()->FreeSingle
((G4RichTrajectoryPoint *) aRichTrajectoryPoint);
aRichTrajectoryPointAllocator()->FreeSingle((G4RichTrajectoryPoint*)aRichTrajectoryPoint);
}
inline G4bool
G4RichTrajectoryPoint::operator==(const G4RichTrajectoryPoint& r) const
inline G4bool G4RichTrajectoryPoint::operator==(const G4RichTrajectoryPoint& r) const
{
return (this==&r);
return (this == &r);
}
inline const std::vector<G4ThreeVector>*
G4RichTrajectoryPoint::GetAuxiliaryPoints() const
inline const std::vector<G4ThreeVector>* G4RichTrajectoryPoint::GetAuxiliaryPoints() const
{
return fpAuxiliaryPointVector;
}
+62 -74
View File
@@ -28,10 +28,10 @@
// Class description:
//
// This class represents the trajectory of a particle tracked.
// It includes information of
// It includes information of
// 1) List of trajectory points which compose the trajectory,
// 2) static information of particle which generates the
// trajectory,
// 2) static information of particle which generates the
// trajectory,
// 3) trackID and parent particle ID of the trajectory,
// 4) Auxiliary points will be associated to G4SmoothTrajectoryPoint
// to assist drawing smoothly curved trajectory.
@@ -45,18 +45,19 @@
#ifndef G4SmoothTrajectory_hh
#define G4SmoothTrajectory_hh 1
#include <stdlib.h> // Include from 'system'
#include <vector>
#include "G4Allocator.hh"
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
#include "G4SmoothTrajectoryPoint.hh" // Include from 'tracking'
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4VTrajectory.hh"
#include "G4ios.hh" // Include from 'system'
#include "globals.hh" // Include from 'global'
#include "trkgdefs.hh"
#include "G4VTrajectory.hh"
#include "G4Allocator.hh"
#include "G4ios.hh" // Include from 'system'
#include "globals.hh" // Include from 'global'
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
#include "G4SmoothTrajectoryPoint.hh" // Include from 'tracking'
#include "G4Track.hh"
#include "G4Step.hh"
#include <stdlib.h> // Include from 'system'
#include <vector>
class G4Polyline;
@@ -64,76 +65,63 @@ class G4SmoothTrajectory : public G4VTrajectory
{
using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
public:
public:
// Constructors/Destructor
//
G4SmoothTrajectory() = default;
G4SmoothTrajectory(const G4Track* aTrack);
~G4SmoothTrajectory() override;
G4SmoothTrajectory(G4SmoothTrajectory&);
G4SmoothTrajectory& operator=(const G4SmoothTrajectory&) = delete;
// Constructors/Destructor
//
G4SmoothTrajectory();
G4SmoothTrajectory(const G4Track* aTrack);
G4SmoothTrajectory(G4SmoothTrajectory &);
virtual ~G4SmoothTrajectory();
// Operators
//
inline G4bool operator==(const G4SmoothTrajectory& r) const;
inline void* operator new(size_t);
inline void operator delete(void*);
// Operators
//
G4SmoothTrajectory& operator= (const G4SmoothTrajectory&) = delete;
inline G4int operator == (const G4SmoothTrajectory& r) const;
inline void* operator new(size_t);
inline void operator delete(void*);
// Get/Set functions
//
inline G4int GetTrackID() const override { return fTrackID; }
inline G4int GetParentID() const override { return fParentID; }
inline G4String GetParticleName() const override { return ParticleName; }
inline G4double GetCharge() const override { return PDGCharge; }
inline G4int GetPDGEncoding() const override { return PDGEncoding; }
inline G4double GetInitialKineticEnergy() const { return initialKineticEnergy; }
inline G4ThreeVector GetInitialMomentum() const override { return initialMomentum; }
// Get/Set functions
//
inline G4int GetTrackID() const
{ return fTrackID; }
inline G4int GetParentID() const
{ return fParentID; }
inline G4String GetParticleName() const
{ return ParticleName; }
inline G4double GetCharge() const
{ return PDGCharge; }
inline G4int GetPDGEncoding() const
{ return PDGEncoding; }
inline G4double GetInitialKineticEnergy() const
{ return initialKineticEnergy; }
inline G4ThreeVector GetInitialMomentum() const
{ return initialMomentum; }
// Other member functions
//
void ShowTrajectory(std::ostream& os = G4cout) const override;
void DrawTrajectory() const override;
void AppendStep(const G4Step* aStep) override;
G4int GetPointEntries() const override { return (G4int)positionRecord->size(); }
G4VTrajectoryPoint* GetPoint(G4int i) const override { return (*positionRecord)[i]; }
void MergeTrajectory(G4VTrajectory* secondTrajectory) override;
// Other member functions
//
virtual void ShowTrajectory(std::ostream& os=G4cout) const;
virtual void DrawTrajectory() const;
virtual void AppendStep(const G4Step* aStep);
virtual G4int GetPointEntries() const
{ return (G4int)positionRecord->size(); }
virtual G4VTrajectoryPoint* GetPoint(G4int i) const
{ return (*positionRecord)[i]; }
virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
G4ParticleDefinition* GetParticleDefinition();
G4ParticleDefinition* GetParticleDefinition();
// Get method for HEPRep style attributes
//
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
std::vector<G4AttValue>* CreateAttValues() const override;
// Get method for HEPRep style attributes
//
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
private:
G4TrajectoryPointContainer* positionRecord = nullptr;
G4int fTrackID = 0;
G4int fParentID = 0;
G4int PDGEncoding = 0;
G4double PDGCharge = 0.0;
G4String ParticleName = "";
G4double initialKineticEnergy = 0.0;
G4ThreeVector initialMomentum;
private:
G4TrajectoryPointContainer* positionRecord = nullptr;
G4int fTrackID = 0;
G4int fParentID = 0;
G4int PDGEncoding = 0;
G4double PDGCharge = 0.0;
G4String ParticleName = "";
G4double initialKineticEnergy = 0.0;
G4ThreeVector initialMomentum;
};
extern G4TRACKING_DLL
G4Allocator<G4SmoothTrajectory>*& aSmoothTrajectoryAllocator();
extern G4TRACKING_DLL G4Allocator<G4SmoothTrajectory>*& aSmoothTrajectoryAllocator();
inline void* G4SmoothTrajectory::operator new(size_t)
{
if (aSmoothTrajectoryAllocator() == nullptr)
{
if (aSmoothTrajectoryAllocator() == nullptr) {
aSmoothTrajectoryAllocator() = new G4Allocator<G4SmoothTrajectory>;
}
return (void*)aSmoothTrajectoryAllocator()->MallocSingle();
@@ -144,9 +132,9 @@ inline void G4SmoothTrajectory::operator delete(void* aTrajectory)
aSmoothTrajectoryAllocator()->FreeSingle((G4SmoothTrajectory*)aTrajectory);
}
inline G4int G4SmoothTrajectory::operator== (const G4SmoothTrajectory& r) const
inline G4bool G4SmoothTrajectory::operator==(const G4SmoothTrajectory& r) const
{
return (this==&r);
return (this == &r);
}
#endif
@@ -38,77 +38,67 @@
#ifndef G4SmoothTrajectoryPoint_hh
#define G4SmoothTrajectoryPoint_hh 1
#include "trkgdefs.hh"
#include "G4Allocator.hh" // Include from 'particle+matter'
#include "G4ThreeVector.hh" // Include from 'geometry'
#include "G4VTrajectoryPoint.hh"
#include "globals.hh" // Include from 'global'
#include "G4ThreeVector.hh" // Include from 'geometry'
#include "G4Allocator.hh" // Include from 'particle+matter'
#include "globals.hh" // Include from 'global'
#include "trkgdefs.hh"
class G4SmoothTrajectoryPoint : public G4VTrajectoryPoint
{
public:
G4SmoothTrajectoryPoint() = default;
G4SmoothTrajectoryPoint(G4ThreeVector pos, std::vector<G4ThreeVector>* auxiliaryPoints);
// No auxiliary points setter, so must set the points in the
// constructor already
G4SmoothTrajectoryPoint(G4ThreeVector pos);
~G4SmoothTrajectoryPoint() override;
G4SmoothTrajectoryPoint(const G4SmoothTrajectoryPoint& right);
G4SmoothTrajectoryPoint& operator=(const G4SmoothTrajectoryPoint&) = delete;
public:
// Operators
//
inline void* operator new(size_t);
inline void operator delete(void* aTrajectoryPoint);
inline G4bool operator==(const G4SmoothTrajectoryPoint& right) const;
G4SmoothTrajectoryPoint();
G4SmoothTrajectoryPoint(G4ThreeVector pos,
std::vector<G4ThreeVector>* auxiliaryPoints);
// No auxiliary points setter, so must set the points in the
// constructor already
// Get/Set functions
//
inline const G4ThreeVector GetPosition() const override { return fPosition; }
inline const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const override
{
return fAuxiliaryPointVector;
}
G4SmoothTrajectoryPoint(G4ThreeVector pos);
G4SmoothTrajectoryPoint(const G4SmoothTrajectoryPoint& right);
virtual ~G4SmoothTrajectoryPoint();
// Get method for HEPRep style attributes
//
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
std::vector<G4AttValue>* CreateAttValues() const override;
G4SmoothTrajectoryPoint& operator= (const G4SmoothTrajectoryPoint&)= delete;
// Operators
//
inline void* operator new(size_t);
inline void operator delete(void* aTrajectoryPoint);
inline G4bool operator==(const G4SmoothTrajectoryPoint& right) const;
// Get/Set functions
//
inline const G4ThreeVector GetPosition() const
{ return fPosition; }
inline const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const
{ return fAuxiliaryPointVector; }
// Get method for HEPRep style attributes
//
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
private:
G4ThreeVector fPosition;
std::vector<G4ThreeVector>* fAuxiliaryPointVector = nullptr;
private:
G4ThreeVector fPosition{0., 0., 0.};
std::vector<G4ThreeVector>* fAuxiliaryPointVector = nullptr;
};
extern G4TRACKING_DLL
G4Allocator<G4SmoothTrajectoryPoint>*& aSmoothTrajectoryPointAllocator();
extern G4TRACKING_DLL G4Allocator<G4SmoothTrajectoryPoint>*& aSmoothTrajectoryPointAllocator();
inline void*
G4SmoothTrajectoryPoint::operator new(size_t)
inline void* G4SmoothTrajectoryPoint::operator new(size_t)
{
if (aSmoothTrajectoryPointAllocator() == nullptr)
{
aSmoothTrajectoryPointAllocator()= new G4Allocator<G4SmoothTrajectoryPoint>;
if (aSmoothTrajectoryPointAllocator() == nullptr) {
aSmoothTrajectoryPointAllocator() = new G4Allocator<G4SmoothTrajectoryPoint>;
}
return (void *) aSmoothTrajectoryPointAllocator()->MallocSingle();
return (void*)aSmoothTrajectoryPointAllocator()->MallocSingle();
}
inline void
G4SmoothTrajectoryPoint::operator delete(void *aTrajectoryPoint)
inline void G4SmoothTrajectoryPoint::operator delete(void* aTrajectoryPoint)
{
aSmoothTrajectoryPointAllocator()
->FreeSingle((G4SmoothTrajectoryPoint*) aTrajectoryPoint);
aSmoothTrajectoryPointAllocator()->FreeSingle((G4SmoothTrajectoryPoint*)aTrajectoryPoint);
}
inline G4bool
G4SmoothTrajectoryPoint::operator==(const G4SmoothTrajectoryPoint& r) const
inline G4bool G4SmoothTrajectoryPoint::operator==(const G4SmoothTrajectoryPoint& r) const
{
return (this==&r);
return (this == &r);
}
#endif
+266 -402
View File
@@ -44,27 +44,26 @@
#ifndef G4SteppingManager_hh
#define G4SteppingManager_hh 1
#include <iomanip> // Include from 'system'
#include <vector> // Include from 'system'
#include "globals.hh" // Include from 'global'
#include "Randomize.hh" // Include from 'global'
#include "G4LogicalVolume.hh" // Include from 'geometry'
#include "G4Navigator.hh" // Include from 'geometry'
#include "G4NoProcess.hh" // Include from 'processes'
#include "G4ProcessManager.hh" // Include from 'processes'
#include "G4Step.hh" // Include from 'tracking'
#include "G4StepPoint.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'tracking'
#include "G4TouchableHandle.hh" // Include from 'geometry'
#include "G4TouchableHistoryHandle.hh" // Include from 'geometry'
#include "G4Track.hh" // Include from 'tracking'
#include "G4TrackStatus.hh" // Include from 'tracking'
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4UserSteppingAction.hh" // Include from 'tracking'
#include "G4VPhysicalVolume.hh" // Include from 'geometry'
#include "G4VSteppingVerbose.hh" // Include from 'tracking'
#include "Randomize.hh" // Include from 'global'
#include "globals.hh" // Include from 'global'
#include "G4Navigator.hh" // Include from 'geometry'
#include "G4LogicalVolume.hh" // Include from 'geometry'
#include "G4VPhysicalVolume.hh" // Include from 'geometry'
#include "G4ProcessManager.hh" // Include from 'processes'
#include "G4NoProcess.hh" // Include from 'processes'
#include "G4Track.hh" // Include from 'tracking'
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4TrackStatus.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'tracking'
#include "G4UserSteppingAction.hh" // Include from 'tracking'
#include "G4Step.hh" // Include from 'tracking'
#include "G4StepPoint.hh" // Include from 'tracking'
#include "G4VSteppingVerbose.hh" // Include from 'tracking'
#include "G4TouchableHandle.hh" // Include from 'geometry'
#include "G4TouchableHistoryHandle.hh" // Include from 'geometry'
#include <iomanip> // Include from 'system'
#include <vector> // Include from 'system'
using G4SelectedAtRestDoItVector = std::vector<G4int>;
using G4SelectedAlongStepDoItVector = std::vector<G4int>;
@@ -72,205 +71,197 @@ using G4SelectedPostStepDoItVector = std::vector<G4int>;
class G4VSensitiveDetector;
class G4SteppingManager
class G4SteppingManager
{
public:
using ProfilerConfig = G4Step::ProfilerConfig;
public:
// Constructor/Destructor
// Constructor/Destructor
G4SteppingManager();
// SteppingManger should be dynamically allocated, therefore
// you need to invoke new() when you call this constructor.
// "Secodary track vector" will be dynamically created by this
// constructor. G4UserSteppingAction will be also created
// in this constructor, and "this" pointer will be passed to
// G4UserSteppingAction.
// SteppingManger should be dynamically allocated, therefore
// you need to invoke new() when you call this constructor.
// "Secodary track vector" will be dynamically created by this
// constructor. G4UserSteppingAction will be also created
// in this constructor, and "this" pointer will be passed to
// G4UserSteppingAction.
G4SteppingManager();
~G4SteppingManager();
~G4SteppingManager();
// Get/Set functions
// Get/Set functions
const G4TrackVector* GetSecondary() const;
void SetUserAction(G4UserSteppingAction* apAction);
G4Track* GetTrack() const;
void SetVerboseLevel(G4int vLevel);
void SetVerbose(G4VSteppingVerbose*);
G4Step* GetStep() const;
void SetNavigator(G4Navigator* value);
const G4TrackVector* GetSecondary() const;
void SetUserAction(G4UserSteppingAction* apAction);
G4Track* GetTrack() const;
void SetVerboseLevel(G4int vLevel);
void SetVerbose(G4VSteppingVerbose*);
G4Step* GetStep() const;
void SetNavigator(G4Navigator* value);
// Other member functions
// Other member functions
// Steers to move the give particle from the TrackingManger by one Step.
G4StepStatus Stepping();
G4StepStatus Stepping();
// Steers to move the give particle from the TrackingManger by one Step.
// Sets up initial track information (enegry, position, etc) to
// the PreStepPoint of the G4Step. This funciton has to be called
// just once before the stepping loop in the "TrackingManager".
void SetInitialStep(G4Track* valueTrack);
void SetInitialStep(G4Track* valueTrack);
// Sets up initial track information (enegry, position, etc) to
// the PreStepPoint of the G4Step. This funciton has to be called
// just once before the stepping loop in the "TrackingManager".
// Get methods
void GetProcessNumber();
G4double GetPhysicalStep();
G4double GetGeometricalStep();
G4double GetCorrectedStep();
G4bool GetPreStepPointIsGeom();
G4bool GetFirstStep();
G4StepStatus GetfStepStatus();
G4double GetTempInitVelocity();
G4double GetTempVelocity();
G4double GetMass();
G4double GetsumEnergyChange();
G4VParticleChange* GetfParticleChange();
G4Track* GetfTrack();
G4TrackVector* GetfSecondary();
G4Step* GetfStep();
G4StepPoint* GetfPreStepPoint();
G4StepPoint* GetfPostStepPoint();
G4VPhysicalVolume* GetfCurrentVolume();
G4VSensitiveDetector* GetfSensitive();
G4VProcess* GetfCurrentProcess();
G4ProcessVector* GetfAtRestDoItVector();
G4ProcessVector* GetfAlongStepDoItVector();
G4ProcessVector* GetfPostStepDoItVector();
G4ProcessVector* GetfAlongStepGetPhysIntVector();
G4ProcessVector* GetfPostStepGetPhysIntVector();
G4ProcessVector* GetfAtRestGetPhysIntVector();
G4double GetcurrentMinimumStep();
G4double GetnumberOfInteractionLengthLeft();
std::size_t GetfAtRestDoItProcTriggered();
std::size_t GetfAlongStepDoItProcTriggered();
std::size_t GetfPostStepDoItProcTriggered();
G4int GetfN2ndariesAtRestDoIt();
G4int GetfN2ndariesAlongStepDoIt();
G4int GetfN2ndariesPostStepDoIt();
G4Navigator* GetfNavigator();
G4int GetverboseLevel();
std::size_t GetMAXofAtRestLoops();
std::size_t GetMAXofAlongStepLoops();
std::size_t GetMAXofPostStepLoops();
G4SelectedAtRestDoItVector* GetfSelectedAtRestDoItVector();
G4SelectedAlongStepDoItVector* GetfSelectedAlongStepDoItVector();
G4SelectedPostStepDoItVector* GetfSelectedPostStepDoItVector();
G4double GetfPreviousStepSize();
const G4TouchableHandle& GetTouchableHandle();
G4SteppingControl GetStepControlFlag();
G4UserSteppingAction* GetUserAction();
G4double GetphysIntLength();
G4ForceCondition GetfCondition();
G4GPILSelection GetfGPILSelection();
void GetProcessNumber();
private:
// Member functions
// Get methods
// Calculate corresponding physical length from the mean free path
// left for each discrete physics process. The minimum allowable
// step for each continuous process will be also calculated.
void DefinePhysicalStepLength();
G4double GetPhysicalStep();
G4double GetGeometricalStep();
G4double GetCorrectedStep();
G4bool GetPreStepPointIsGeom();
G4bool GetFirstStep();
G4StepStatus GetfStepStatus();
G4double GetTempInitVelocity();
G4double GetTempVelocity();
G4double GetMass();
G4double GetsumEnergyChange();
G4VParticleChange* GetfParticleChange();
G4Track* GetfTrack();
G4TrackVector* GetfSecondary();
G4Step* GetfStep();
G4StepPoint* GetfPreStepPoint();
G4StepPoint* GetfPostStepPoint();
G4VPhysicalVolume* GetfCurrentVolume();
G4VSensitiveDetector* GetfSensitive();
G4VProcess* GetfCurrentProcess();
G4ProcessVector* GetfAtRestDoItVector();
G4ProcessVector* GetfAlongStepDoItVector();
G4ProcessVector* GetfPostStepDoItVector();
G4ProcessVector* GetfAlongStepGetPhysIntVector();
G4ProcessVector* GetfPostStepGetPhysIntVector();
G4ProcessVector* GetfAtRestGetPhysIntVector();
G4double GetcurrentMinimumStep();
G4double GetnumberOfInteractionLengthLeft();
std::size_t GetfAtRestDoItProcTriggered();
std::size_t GetfAlongStepDoItProcTriggered();
std::size_t GetfPostStepDoItProcTriggered();
G4int GetfN2ndariesAtRestDoIt();
G4int GetfN2ndariesAlongStepDoIt();
G4int GetfN2ndariesPostStepDoIt();
G4Navigator* GetfNavigator();
G4int GetverboseLevel();
std::size_t GetMAXofAtRestLoops();
std::size_t GetMAXofAlongStepLoops();
std::size_t GetMAXofPostStepLoops();
G4SelectedAtRestDoItVector* GetfSelectedAtRestDoItVector();
G4SelectedAlongStepDoItVector* GetfSelectedAlongStepDoItVector();
G4SelectedPostStepDoItVector* GetfSelectedPostStepDoItVector();
G4double GetfPreviousStepSize();
const G4TouchableHandle& GetTouchableHandle();
G4SteppingControl GetStepControlFlag();
G4UserSteppingAction* GetUserAction();
G4double GetphysIntLength();
G4ForceCondition GetfCondition();
G4GPILSelection GetfGPILSelection();
void InvokeAtRestDoItProcs();
void InvokeAlongStepDoItProcs();
void InvokePostStepDoItProcs();
void InvokePSDIP(size_t); //
G4int ProcessSecondariesFromParticleChange();
private:
// Return the estimated safety value at the PostStepPoint
G4double CalculateSafety();
// Member functions
// Member data
void DefinePhysicalStepLength();
// Calculate corresponding physical length from the mean free path
// left for each discrete physics process. The minimum allowable
// step for each continuous process will be also calculated.
void InvokeAtRestDoItProcs();
void InvokeAlongStepDoItProcs();
void InvokePostStepDoItProcs();
void InvokePSDIP(size_t); //
G4int ProcessSecondariesFromParticleChange();
G4double CalculateSafety();
// Return the estimated safety value at the PostStepPoint
static const size_t SizeOfSelectedDoItVector = 100;
// Member data
G4bool KillVerbose = false;
static const size_t SizeOfSelectedDoItVector = 100;
G4UserSteppingAction* fUserSteppingAction = nullptr;
G4bool KillVerbose = false;
G4VSteppingVerbose* fVerbose = nullptr;
G4UserSteppingAction* fUserSteppingAction = nullptr;
G4double PhysicalStep = 0.0;
G4double GeometricalStep = 0.0;
G4double CorrectedStep = 0.0;
G4bool PreStepPointIsGeom = false;
G4bool FirstStep = false;
G4StepStatus fStepStatus = fUndefined;
G4VSteppingVerbose* fVerbose = nullptr;
G4double TempInitVelocity = 0.0;
G4double TempVelocity = 0.0;
G4double Mass = 0.0;
G4double PhysicalStep = 0.0;
G4double GeometricalStep = 0.0;
G4double CorrectedStep = 0.0;
G4bool PreStepPointIsGeom = false;
G4bool FirstStep = false;
G4StepStatus fStepStatus = fUndefined;
G4double sumEnergyChange = 0.0;
G4double TempInitVelocity = 0.0;
G4double TempVelocity = 0.0;
G4double Mass = 0.0;
G4VParticleChange* fParticleChange = nullptr;
G4Track* fTrack = nullptr;
G4TrackVector* fSecondary = nullptr;
G4Step* fStep = nullptr;
G4StepPoint* fPreStepPoint = nullptr;
G4StepPoint* fPostStepPoint = nullptr;
G4double sumEnergyChange = 0.0;
G4VPhysicalVolume* fCurrentVolume = nullptr;
G4VSensitiveDetector* fSensitive = nullptr;
G4VProcess* fCurrentProcess = nullptr; // Pointer to process of which DoIt() or
// GetPhysicalInteractionLength() has been just executed.
G4VParticleChange* fParticleChange = nullptr;
G4Track* fTrack = nullptr;
G4TrackVector* fSecondary = nullptr;
G4Step* fStep = nullptr;
G4StepPoint* fPreStepPoint = nullptr;
G4StepPoint* fPostStepPoint = nullptr;
G4ProcessVector* fAtRestDoItVector = nullptr;
G4ProcessVector* fAlongStepDoItVector = nullptr;
G4ProcessVector* fPostStepDoItVector = nullptr;
G4VPhysicalVolume* fCurrentVolume = nullptr;
G4VSensitiveDetector* fSensitive = nullptr;
G4VProcess* fCurrentProcess = nullptr;
// The pointer to the process of which DoIt() or
// GetPhysicalInteractionLength() has been just executed.
G4ProcessVector* fAtRestGetPhysIntVector = nullptr;
G4ProcessVector* fAlongStepGetPhysIntVector = nullptr;
G4ProcessVector* fPostStepGetPhysIntVector = nullptr;
std::size_t MAXofAtRestLoops = 0;
std::size_t MAXofAlongStepLoops = 0;
std::size_t MAXofPostStepLoops = 0;
G4ProcessVector* fAtRestDoItVector = nullptr;
G4ProcessVector* fAlongStepDoItVector = nullptr;
G4ProcessVector* fPostStepDoItVector = nullptr;
std::size_t fAtRestDoItProcTriggered = 0;
std::size_t fAlongStepDoItProcTriggered = 0;
std::size_t fPostStepDoItProcTriggered = 0;
G4ProcessVector* fAtRestGetPhysIntVector = nullptr;
G4ProcessVector* fAlongStepGetPhysIntVector = nullptr;
G4ProcessVector* fPostStepGetPhysIntVector = nullptr;
G4int fN2ndariesAtRestDoIt = 0;
G4int fN2ndariesAlongStepDoIt = 0;
G4int fN2ndariesPostStepDoIt = 0;
// These are the numbers of secondaries generated by the process
// just executed.
std::size_t MAXofAtRestLoops = 0;
std::size_t MAXofAlongStepLoops = 0;
std::size_t MAXofPostStepLoops = 0;
G4Navigator* fNavigator = nullptr;
std::size_t fAtRestDoItProcTriggered = 0;
std::size_t fAlongStepDoItProcTriggered = 0;
std::size_t fPostStepDoItProcTriggered = 0;
G4int verboseLevel = 0;
G4int fN2ndariesAtRestDoIt = 0;
G4int fN2ndariesAlongStepDoIt = 0;
G4int fN2ndariesPostStepDoIt = 0;
// These are the numbers of secondaries generated by the process
// just executed.
G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector = nullptr;
G4SelectedAlongStepDoItVector* fSelectedAlongStepDoItVector = nullptr;
G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector = nullptr;
G4Navigator* fNavigator = nullptr;
G4double fPreviousStepSize = 0.0;
G4int verboseLevel = 0;
G4TouchableHandle fTouchableHandle;
G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector = nullptr;
G4SelectedAlongStepDoItVector* fSelectedAlongStepDoItVector = nullptr;
G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector = nullptr;
G4SteppingControl StepControlFlag = NormalCondition;
G4double fPreviousStepSize = 0.0;
G4double kCarTolerance = 0.0; // Cached geometrical tolerance on surface
G4double proposedSafety = 0.0; // This keeps the minimum safety value proposed by AlongStepGPILs.
G4ThreeVector endpointSafOrigin;
G4double endpointSafety = 0.0; // To get the true safety value at the PostStepPoint, you have to
// subtract the distance to 'endpointSafOrigin' from this value.
G4double physIntLength = 0.0;
G4ForceCondition fCondition = InActivated;
G4GPILSelection fGPILSelection = NotCandidateForSelection;
// Above three variables are for the method
// DefinePhysicalStepLength(). To pass these information to
// the method Verbose, they are kept at here. Need a more
// elegant mechanism.
G4TouchableHandle fTouchableHandle;
G4SteppingControl StepControlFlag = NormalCondition;
G4double kCarTolerance = 0.0;
// Cached geometrical tolerance on surface
G4double proposedSafety = 0.0;
// This keeps the minimum safety value proposed by AlongStepGPILs.
G4ThreeVector endpointSafOrigin;
G4double endpointSafety = 0.0;
// To get the true safety value at the PostStepPoint, you have
// to subtract the distance to 'endpointSafOrigin' from this value.
G4double physIntLength = 0.0;
G4ForceCondition fCondition = InActivated;
G4GPILSelection fGPILSelection = NotCandidateForSelection;
// Above three variables are for the method
// DefinePhysicalStepLength(). To pass these information to
// the method Verbose, they are kept at here. Need a more
// elegant mechanism.
G4NoProcess const* fNoProcess = nullptr;
// Used in the InvokeAtRestDoItProcs() method to flag the process
// of any stable ion at rest.
G4NoProcess const* fNoProcess = nullptr; // Used in InvokeAtRestDoItProcs() method to flag the
// process of any stable ion at rest.
};
//*******************************************************************
@@ -279,279 +270,152 @@ class G4SteppingManager
//
//*******************************************************************
inline G4double G4SteppingManager::GetPhysicalStep()
{
return PhysicalStep;
}
inline G4double G4SteppingManager::GetPhysicalStep() { return PhysicalStep; }
inline G4double G4SteppingManager::GetGeometricalStep()
{
return GeometricalStep;
}
inline G4double G4SteppingManager::GetGeometricalStep() { return GeometricalStep; }
inline G4double G4SteppingManager::GetCorrectedStep()
{
return CorrectedStep;
}
inline G4bool G4SteppingManager::GetPreStepPointIsGeom()
{
return PreStepPointIsGeom;
}
inline G4double G4SteppingManager::GetCorrectedStep() { return CorrectedStep; }
inline G4bool G4SteppingManager::GetFirstStep()
{
return FirstStep;
}
inline G4bool G4SteppingManager::GetPreStepPointIsGeom() { return PreStepPointIsGeom; }
inline G4StepStatus G4SteppingManager::GetfStepStatus()
{
return fStepStatus;
}
inline G4bool G4SteppingManager::GetFirstStep() { return FirstStep; }
inline G4double G4SteppingManager::GetTempInitVelocity()
{
return TempInitVelocity;
}
inline G4StepStatus G4SteppingManager::GetfStepStatus() { return fStepStatus; }
inline G4double G4SteppingManager::GetTempVelocity()
{
return TempVelocity;
}
inline G4double G4SteppingManager::GetTempInitVelocity() { return TempInitVelocity; }
inline G4double G4SteppingManager::GetMass()
{
return Mass;
}
inline G4double G4SteppingManager::GetTempVelocity() { return TempVelocity; }
inline G4double G4SteppingManager::GetsumEnergyChange()
{
return sumEnergyChange;
}
inline G4double G4SteppingManager::GetMass() { return Mass; }
inline G4VParticleChange* G4SteppingManager::GetfParticleChange()
{
return fParticleChange;
}
inline G4double G4SteppingManager::GetsumEnergyChange() { return sumEnergyChange; }
inline G4Track* G4SteppingManager::GetfTrack()
{
return fTrack;
}
inline G4VParticleChange* G4SteppingManager::GetfParticleChange() { return fParticleChange; }
inline G4TrackVector* G4SteppingManager::GetfSecondary()
{
return fStep->GetfSecondary();
}
inline G4Track* G4SteppingManager::GetfTrack() { return fTrack; }
inline G4Step* G4SteppingManager::GetfStep()
{
return fStep;
}
inline G4TrackVector* G4SteppingManager::GetfSecondary() { return fStep->GetfSecondary(); }
inline G4StepPoint* G4SteppingManager::GetfPreStepPoint()
{
return fPreStepPoint;
}
inline G4Step* G4SteppingManager::GetfStep() { return fStep; }
inline G4StepPoint* G4SteppingManager::GetfPostStepPoint()
{
return fPostStepPoint;
}
inline G4StepPoint* G4SteppingManager::GetfPreStepPoint() { return fPreStepPoint; }
inline G4VPhysicalVolume* G4SteppingManager::GetfCurrentVolume()
{
return fCurrentVolume;
}
inline G4StepPoint* G4SteppingManager::GetfPostStepPoint() { return fPostStepPoint; }
inline G4VSensitiveDetector* G4SteppingManager::GetfSensitive()
{
return fSensitive;
}
inline G4VPhysicalVolume* G4SteppingManager::GetfCurrentVolume() { return fCurrentVolume; }
inline G4VProcess* G4SteppingManager::GetfCurrentProcess()
{
return fCurrentProcess;
}
inline G4VSensitiveDetector* G4SteppingManager::GetfSensitive() { return fSensitive; }
inline G4ProcessVector* G4SteppingManager::GetfAtRestDoItVector()
{
return fAtRestDoItVector;
}
inline G4VProcess* G4SteppingManager::GetfCurrentProcess() { return fCurrentProcess; }
inline G4ProcessVector* G4SteppingManager::GetfAlongStepDoItVector()
{
return fAlongStepDoItVector;
}
inline G4ProcessVector* G4SteppingManager::GetfAtRestDoItVector() { return fAtRestDoItVector; }
inline G4ProcessVector* G4SteppingManager::GetfPostStepDoItVector()
{
return fPostStepDoItVector;
}
inline G4ProcessVector* G4SteppingManager::GetfAlongStepDoItVector()
{
return fAlongStepDoItVector;
}
inline G4ProcessVector* G4SteppingManager::GetfAtRestGetPhysIntVector()
{
return fAtRestGetPhysIntVector;
}
inline G4ProcessVector* G4SteppingManager::GetfPostStepDoItVector() { return fPostStepDoItVector; }
inline G4ProcessVector* G4SteppingManager::GetfAlongStepGetPhysIntVector()
{
return fAlongStepGetPhysIntVector;
}
inline G4ProcessVector* G4SteppingManager::GetfAtRestGetPhysIntVector()
{
return fAtRestGetPhysIntVector;
}
inline G4ProcessVector* G4SteppingManager::GetfPostStepGetPhysIntVector()
{
return fPostStepGetPhysIntVector;
}
inline G4ProcessVector* G4SteppingManager::GetfAlongStepGetPhysIntVector()
{
return fAlongStepGetPhysIntVector;
}
inline size_t G4SteppingManager::GetMAXofAtRestLoops()
{
return MAXofAtRestLoops;
}
inline G4ProcessVector* G4SteppingManager::GetfPostStepGetPhysIntVector()
{
return fPostStepGetPhysIntVector;
}
inline size_t G4SteppingManager::GetMAXofAlongStepLoops()
{
return MAXofAlongStepLoops;
}
inline size_t G4SteppingManager::GetMAXofAtRestLoops() { return MAXofAtRestLoops; }
inline size_t G4SteppingManager::GetMAXofPostStepLoops()
{
return MAXofPostStepLoops;
}
inline size_t G4SteppingManager::GetMAXofAlongStepLoops() { return MAXofAlongStepLoops; }
inline size_t G4SteppingManager::GetfAtRestDoItProcTriggered()
{
return fAtRestDoItProcTriggered;
}
inline size_t G4SteppingManager::GetMAXofPostStepLoops() { return MAXofPostStepLoops; }
inline size_t G4SteppingManager::GetfAlongStepDoItProcTriggered()
{
return fAtRestDoItProcTriggered;
}
inline size_t G4SteppingManager::GetfAtRestDoItProcTriggered() { return fAtRestDoItProcTriggered; }
inline size_t G4SteppingManager::GetfPostStepDoItProcTriggered()
{
return fPostStepDoItProcTriggered;
}
inline size_t G4SteppingManager::GetfAlongStepDoItProcTriggered()
{
return fAtRestDoItProcTriggered;
}
inline G4int G4SteppingManager::GetfN2ndariesAtRestDoIt()
{
return fN2ndariesAtRestDoIt;
}
inline size_t G4SteppingManager::GetfPostStepDoItProcTriggered()
{
return fPostStepDoItProcTriggered;
}
inline G4int G4SteppingManager::GetfN2ndariesAlongStepDoIt()
{
return fN2ndariesAlongStepDoIt;
}
inline G4int G4SteppingManager::GetfN2ndariesAtRestDoIt() { return fN2ndariesAtRestDoIt; }
inline G4int G4SteppingManager::GetfN2ndariesPostStepDoIt()
{
return fN2ndariesPostStepDoIt;
}
inline G4int G4SteppingManager::GetfN2ndariesAlongStepDoIt() { return fN2ndariesAlongStepDoIt; }
inline G4Navigator* G4SteppingManager::GetfNavigator()
{
return fNavigator;
}
inline G4int G4SteppingManager::GetfN2ndariesPostStepDoIt() { return fN2ndariesPostStepDoIt; }
inline G4int G4SteppingManager::GetverboseLevel()
{
return verboseLevel;
}
inline G4Navigator* G4SteppingManager::GetfNavigator() { return fNavigator; }
inline G4SelectedAtRestDoItVector*
G4SteppingManager::GetfSelectedAtRestDoItVector()
{
return fSelectedAtRestDoItVector;
}
inline G4int G4SteppingManager::GetverboseLevel() { return verboseLevel; }
inline G4SelectedAlongStepDoItVector*
G4SteppingManager::GetfSelectedAlongStepDoItVector()
{
return fSelectedAlongStepDoItVector;
}
inline G4SelectedAtRestDoItVector* G4SteppingManager::GetfSelectedAtRestDoItVector()
{
return fSelectedAtRestDoItVector;
}
inline G4SelectedPostStepDoItVector*
G4SteppingManager::GetfSelectedPostStepDoItVector()
{
return fSelectedPostStepDoItVector;
}
inline G4SelectedAlongStepDoItVector* G4SteppingManager::GetfSelectedAlongStepDoItVector()
{
return fSelectedAlongStepDoItVector;
}
inline G4double G4SteppingManager::GetfPreviousStepSize()
{
return fPreviousStepSize;
}
inline G4SelectedPostStepDoItVector* G4SteppingManager::GetfSelectedPostStepDoItVector()
{
return fSelectedPostStepDoItVector;
}
inline const G4TouchableHandle& G4SteppingManager::GetTouchableHandle()
{
return fTouchableHandle;
}
inline G4double G4SteppingManager::GetfPreviousStepSize() { return fPreviousStepSize; }
inline G4SteppingControl G4SteppingManager::GetStepControlFlag()
{
return StepControlFlag;
}
inline const G4TouchableHandle& G4SteppingManager::GetTouchableHandle() { return fTouchableHandle; }
inline G4double G4SteppingManager::GetphysIntLength()
{
return physIntLength;
}
inline G4SteppingControl G4SteppingManager::GetStepControlFlag() { return StepControlFlag; }
inline G4ForceCondition G4SteppingManager::GetfCondition()
{
return fCondition;
}
inline G4double G4SteppingManager::GetphysIntLength() { return physIntLength; }
inline G4GPILSelection G4SteppingManager::GetfGPILSelection()
{
return fGPILSelection;
}
inline G4ForceCondition G4SteppingManager::GetfCondition() { return fCondition; }
inline const G4TrackVector* G4SteppingManager::GetSecondary() const
{
return fStep->GetSecondary();
}
inline G4GPILSelection G4SteppingManager::GetfGPILSelection() { return fGPILSelection; }
inline void G4SteppingManager::SetNavigator(G4Navigator* value)
{
fNavigator = value;
}
inline const G4TrackVector* G4SteppingManager::GetSecondary() const
{
return fStep->GetSecondary();
}
inline void G4SteppingManager::SetUserAction(G4UserSteppingAction* apAction)
{
fUserSteppingAction = apAction;
}
inline void G4SteppingManager::SetNavigator(G4Navigator* value) { fNavigator = value; }
inline G4UserSteppingAction* G4SteppingManager::GetUserAction()
{
return fUserSteppingAction;
}
inline void G4SteppingManager::SetUserAction(G4UserSteppingAction* apAction)
{
fUserSteppingAction = apAction;
}
inline G4Track* G4SteppingManager::GetTrack() const
{
return fTrack;
}
inline G4UserSteppingAction* G4SteppingManager::GetUserAction() { return fUserSteppingAction; }
inline void G4SteppingManager::SetVerboseLevel(G4int vLevel)
{
verboseLevel = vLevel;
}
inline G4Track* G4SteppingManager::GetTrack() const { return fTrack; }
inline void G4SteppingManager::SetVerbose(G4VSteppingVerbose* yourVerbose)
{
fVerbose = yourVerbose;
}
inline void G4SteppingManager::SetVerboseLevel(G4int vLevel) { verboseLevel = vLevel; }
inline G4Step* G4SteppingManager::GetStep() const
{
return fStep;
}
inline void G4SteppingManager::SetVerbose(G4VSteppingVerbose* yourVerbose)
{
fVerbose = yourVerbose;
}
inline G4double G4SteppingManager::CalculateSafety()
{
return std::max( endpointSafety -
(endpointSafOrigin - fPostStepPoint->GetPosition()).mag(),
kCarTolerance );
}
inline G4Step* G4SteppingManager::GetStep() const { return fStep; }
inline G4double G4SteppingManager::CalculateSafety()
{
return std::max(
endpointSafety - (endpointSafOrigin - fPostStepPoint->GetPosition()).mag(), kCarTolerance);
}
#endif
+27 -30
View File
@@ -27,7 +27,7 @@
//
// Class description:
//
// This class manages the verbose outputs in G4SteppingManager.
// This class manages the verbose outputs in G4SteppingManager.
// Contact:
// Questions and comments to this code should be sent to
@@ -41,41 +41,38 @@
class G4SteppingVerbose : public G4VSteppingVerbose
{
public:
public:
// Constructor/Destructor
// Constructor/Destructor
G4SteppingVerbose() = default;
~G4SteppingVerbose() override = default;
G4SteppingVerbose();
virtual ~G4SteppingVerbose();
G4VSteppingVerbose* Clone() override { return new G4SteppingVerbose; }
virtual G4VSteppingVerbose* Clone()
{ return new G4SteppingVerbose; }
// Methods to be invoked in the SteppingManager
// Methods to be invoked in the SteppingManager
void NewStep() override;
void AtRestDoItInvoked() override;
void AlongStepDoItAllDone() override;
void PostStepDoItAllDone() override;
void AlongStepDoItOneByOne() override;
void PostStepDoItOneByOne() override;
void StepInfo() override;
void TrackingStarted() override;
void DPSLStarted() override;
void DPSLUserLimit() override;
void DPSLPostStep() override;
void DPSLAlongStep() override;
void VerboseTrack() override;
void VerboseParticleChange() override;
virtual void ShowStep() const;
virtual void NewStep();
virtual void AtRestDoItInvoked();
virtual void AlongStepDoItAllDone();
virtual void PostStepDoItAllDone();
virtual void AlongStepDoItOneByOne();
virtual void PostStepDoItOneByOne();
virtual void StepInfo();
virtual void TrackingStarted();
virtual void DPSLStarted();
virtual void DPSLUserLimit();
virtual void DPSLPostStep();
virtual void DPSLAlongStep();
virtual void VerboseTrack();
virtual void VerboseParticleChange();
virtual void ShowStep() const;
private:
static G4int useBestUnitPrecision;
public:
static void UseBestUnit(G4int prec = 4);
static G4int BestUnitPrecision();
public:
static void UseBestUnit(G4int prec = 4);
static G4int BestUnitPrecision();
private:
static G4int useBestUnitPrecision;
};
#endif
@@ -23,9 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file
/// \file
/// \brief Definition of the G4SteppingVerboseWithUnits class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// Stepping Verbose with units for all the applicable double values
@@ -47,36 +47,33 @@ class G4GenericMessenger;
class G4SteppingVerboseWithUnits : public G4SteppingVerbose
{
public:
public:
G4SteppingVerboseWithUnits(G4int precision = 4);
~G4SteppingVerboseWithUnits() override;
G4SteppingVerboseWithUnits(G4int precision = 4);
~G4SteppingVerboseWithUnits() override;
G4VSteppingVerbose* Clone() override
{ return new G4SteppingVerboseWithUnits; }
G4VSteppingVerbose* Clone() override { return new G4SteppingVerboseWithUnits; }
void SetManager(G4SteppingManager* const) override;
void TrackingStarted() override;
void StepInfo() override;
void SetManager(G4SteppingManager* const) override;
void AtRestDoItInvoked() override;
void AlongStepDoItAllDone()override;
void PostStepDoItAllDone()override;
void AlongStepDoItOneByOne()override;
void PostStepDoItOneByOne()override;
void DPSLStarted() override;
void DPSLUserLimit() override;
void DPSLPostStep() override;
void DPSLAlongStep() override;
void VerboseTrack() override;
void VerboseParticleChange() override;
void ShowStep() const override;
private:
void TrackingStarted() override;
void StepInfo() override;
G4int fprec;
G4GenericMessenger* fmessenger = nullptr;
void AtRestDoItInvoked() override;
void AlongStepDoItAllDone() override;
void PostStepDoItAllDone() override;
void AlongStepDoItOneByOne() override;
void PostStepDoItOneByOne() override;
void DPSLStarted() override;
void DPSLUserLimit() override;
void DPSLPostStep() override;
void DPSLAlongStep() override;
void VerboseTrack() override;
void VerboseParticleChange() override;
void ShowStep() const override;
private:
G4int fprec;
G4GenericMessenger* fmessenger = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+81 -102
View File
@@ -42,141 +42,125 @@
#ifndef G4TrackingManager_hh
#define G4TrackingManager_hh 1
#include "globals.hh" // Include from 'global'
#include "G4SteppingManager.hh" // Include from 'tracking'
#include "G4Track.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'tracking'
#include "G4SteppingManager.hh" // Include from 'tracking'
#include "G4Track.hh" // Include from 'tracking'
#include "G4TrackStatus.hh" // Include from 'tracking'
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4TrackingMessenger.hh"
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4TrackStatus.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'tracking'
#include "G4UserTrackingAction.hh" // Include from 'tracking'
#include "G4UserSteppingAction.hh" // Include from 'tracking'
#include "G4VTrajectory.hh" // Include from 'tracking'
#include "G4UserSteppingAction.hh" // Include from 'tracking'
#include "G4UserTrackingAction.hh" // Include from 'tracking'
#include "G4VTrajectory.hh" // Include from 'tracking'
#include "globals.hh" // Include from 'global'
class G4VUserTrackInformation;
////////////////////////
class G4TrackingManager
class G4TrackingManager
////////////////////////
{
public:
using ProfilerConfig = G4Track::ProfilerConfig;
public:
public:
// Constructor/Destructor
// Constructor/Destructor
// G4TrackingManger should be dynamically allocated, therefore you
// need to invoke new() when you call this constructor.
// G4SteppingManger and G4UserTrackingAction will be created
// in this constructor. "This" pointer will be passed to
// G4UserTrackingAction.
G4TrackingManager();
~G4TrackingManager();
G4TrackingManager();
// G4TrackingManger should be dynamically allocated, therefore you
// need to invoke new() when you call this constructor.
// G4SteppingManger and G4UserTrackingAction will be created
// in this constructor. "This" pointer will be passed to
// G4UserTrackingAction.
// Get/Set functions
~G4TrackingManager();
G4Track* GetTrack() const;
// Get/Set functions
G4int GetStoreTrajectory() const;
void SetStoreTrajectory(G4int value);
G4Track* GetTrack() const;
G4SteppingManager* GetSteppingManager() const;
G4int GetStoreTrajectory() const;
void SetStoreTrajectory(G4int value);
G4UserTrackingAction* GetUserTrackingAction() const;
G4SteppingManager* GetSteppingManager() const;
G4VTrajectory* GimmeTrajectory() const;
void SetTrajectory(G4VTrajectory* aTrajectory);
G4UserTrackingAction* GetUserTrackingAction() const;
G4TrackVector* GimmeSecondaries() const;
G4VTrajectory* GimmeTrajectory() const;
void SetTrajectory(G4VTrajectory* aTrajectory);
G4TrackVector* GimmeSecondaries() const;
void SetUserAction(G4UserTrackingAction* apAction);
void SetUserAction(G4UserSteppingAction* apAction);
void SetUserAction(G4UserTrackingAction* apAction);
void SetUserAction(G4UserSteppingAction* apAction);
void SetVerboseLevel(G4int vLevel);
G4int GetVerboseLevel() const;
void SetVerboseLevel(G4int vLevel);
G4int GetVerboseLevel() const;
// Other member functions
// Other member functions
void ProcessOneTrack(G4Track* apValueG4Track);
// Invoking this function, a G4Track given by the argument
// will be tracked.
void ProcessOneTrack(G4Track* apValueG4Track);
// Invoking this function, a G4Track given by the argument
// will be tracked.
void EventAborted();
// Invoking this function, the current tracking will be
// aborted immediately. The tracking will return the
// G4TrackStatus in 'fUserKillTrackAndSecondaries'.
// By this the EventManager deletes the current track and all
// its associated secondaries.
void EventAborted();
// Invoking this function, the current tracking will be
// aborted immediately. The tracking will return the
// G4TrackStatus in 'fUserKillTrackAndSecondaries'.
// By this the EventManager deletes the current track and all
// its associated secondaries.
void SetUserTrackInformation(G4VUserTrackInformation* aValue);
// This method can be invoked from the user's G4UserTrackingAction
// implementation to set his/her own G4VUserTrackInformation concrete
// class object to a G4Track object.
void SetUserTrackInformation(G4VUserTrackInformation* aValue);
// This method can be invoked from the user's G4UserTrackingAction
// implementation to set his/her own G4VUserTrackInformation concrete
// class object to a G4Track object.
private:
void TrackBanner(); // verbose
private:
// Member data
void TrackBanner(); // verbose
// Member data
G4Track* fpTrack = nullptr;
G4SteppingManager* fpSteppingManager = nullptr;
G4UserTrackingAction* fpUserTrackingAction = nullptr;
G4VTrajectory* fpTrajectory = nullptr;
G4int StoreTrajectory = 0;
G4int verboseLevel = 0;
G4TrackingMessenger* messenger = nullptr;
G4bool EventIsAborted = false;
G4Track* fpTrack = nullptr;
G4SteppingManager* fpSteppingManager = nullptr;
G4UserTrackingAction* fpUserTrackingAction = nullptr;
G4VTrajectory* fpTrajectory = nullptr;
G4int StoreTrajectory = 0;
G4int verboseLevel = 0;
G4TrackingMessenger* messenger = nullptr;
G4bool EventIsAborted = false;
};
//*******************************************************************
//
// Inline function
// Inline function
//
//*******************************************************************
inline G4Track* G4TrackingManager::GetTrack() const
{
return fpTrack;
}
inline G4Track* G4TrackingManager::GetTrack() const { return fpTrack; }
inline G4int G4TrackingManager::GetStoreTrajectory() const
{
return StoreTrajectory;
}
inline G4int G4TrackingManager::GetStoreTrajectory() const { return StoreTrajectory; }
inline void G4TrackingManager::SetStoreTrajectory(G4int value)
{
StoreTrajectory = value;
}
inline void G4TrackingManager::SetStoreTrajectory(G4int value) { StoreTrajectory = value; }
inline G4SteppingManager* G4TrackingManager::GetSteppingManager() const
{
return fpSteppingManager;
{
return fpSteppingManager;
}
inline G4UserTrackingAction* G4TrackingManager::GetUserTrackingAction() const
{
return fpUserTrackingAction;
{
return fpUserTrackingAction;
}
inline G4VTrajectory* G4TrackingManager::GimmeTrajectory() const
{
return fpTrajectory;
}
inline G4VTrajectory* G4TrackingManager::GimmeTrajectory() const { return fpTrajectory; }
inline G4TrackVector* G4TrackingManager::GimmeSecondaries() const
{
return fpSteppingManager->GetfSecondary();
{
return fpSteppingManager->GetfSecondary();
}
inline void G4TrackingManager::SetUserAction(G4UserTrackingAction* apAction)
{
fpUserTrackingAction = apAction;
if(apAction != nullptr)
{
if (apAction != nullptr) {
apAction->SetTrackingManagerPointer(this);
}
}
@@ -184,27 +168,22 @@ inline void G4TrackingManager::SetUserAction(G4UserTrackingAction* apAction)
inline void G4TrackingManager::SetUserAction(G4UserSteppingAction* apAction)
{
fpSteppingManager->SetUserAction(apAction);
if(apAction != nullptr)
{
apAction->SetSteppingManagerPointer(fpSteppingManager);
if (apAction != nullptr) {
apAction->SetSteppingManagerPointer(fpSteppingManager);
}
}
inline void G4TrackingManager::SetVerboseLevel(G4int vLevel)
{
verboseLevel = vLevel;
fpSteppingManager -> SetVerboseLevel( vLevel );
}
inline G4int G4TrackingManager::GetVerboseLevel() const
{
return verboseLevel;
}
inline void
G4TrackingManager::SetUserTrackInformation(G4VUserTrackInformation* aValue)
{
if(fpTrack != nullptr) fpTrack->SetUserInformation(aValue);
verboseLevel = vLevel;
fpSteppingManager->SetVerboseLevel(vLevel);
}
inline G4int G4TrackingManager::GetVerboseLevel() const { return verboseLevel; }
inline void G4TrackingManager::SetUserTrackInformation(G4VUserTrackInformation* aValue)
{
if (fpTrack != nullptr) fpTrack->SetUserInformation(aValue);
}
#endif
+14 -17
View File
@@ -50,26 +50,23 @@ class G4SteppingManager;
class G4TrackingMessenger : public G4UImessenger
{
public:
G4TrackingMessenger(G4TrackingManager* trMan);
~G4TrackingMessenger() override;
void SetNewValue(G4UIcommand* command, G4String newValues) override;
G4String GetCurrentValue(G4UIcommand* command) override;
public:
private:
G4TrackingManager* trackingManager = nullptr;
G4SteppingManager* steppingManager = nullptr;
G4TrackingMessenger(G4TrackingManager* trMan);
~G4TrackingMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
// commands
private:
G4TrackingManager* trackingManager = nullptr;
G4SteppingManager* steppingManager = nullptr;
// commands
G4UIdirectory* TrackingDirectory = nullptr;
G4UIcmdWithoutParameter* AbortCmd = nullptr;
G4UIcmdWithoutParameter* ResumeCmd = nullptr;
G4UIcmdWithAnInteger* StoreTrajectoryCmd = nullptr;
G4UIcmdWithAnInteger* VerboseCmd = nullptr;
G4UIdirectory* TrackingDirectory = nullptr;
G4UIcmdWithoutParameter* AbortCmd = nullptr;
G4UIcmdWithoutParameter* ResumeCmd = nullptr;
G4UIcmdWithAnInteger* StoreTrajectoryCmd = nullptr;
G4UIcmdWithAnInteger* VerboseCmd = nullptr;
};
#endif
+51 -66
View File
@@ -30,7 +30,7 @@
// This class represents the trajectory of a particle being tracked.
// It includes information of:
// 1) List of trajectory points which compose the trajectory;
// 2) Static information of the particle which generated the
// 2) Static information of the particle which generated the
// trajectory;
// 3) Track ID and parent particle ID of the trajectory.
@@ -43,92 +43,80 @@
#ifndef G4Trajectory_hh
#define G4Trajectory_hh 1
#include <stdlib.h> // Include from 'system'
#include <vector>
#include "G4Allocator.hh"
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4TrajectoryPoint.hh" // Include from 'tracking'
#include "G4VTrajectory.hh"
#include "G4ios.hh" // Include from 'system'
#include "globals.hh" // Include from 'global'
#include "trkgdefs.hh"
#include "G4VTrajectory.hh"
#include "G4Allocator.hh"
#include "G4ios.hh" // Include from 'system'
#include "globals.hh" // Include from 'global'
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
#include "G4TrajectoryPoint.hh" // Include from 'tracking'
#include "G4Track.hh"
#include "G4Step.hh"
#include <stdlib.h> // Include from 'system'
#include <vector>
class G4Polyline;
class G4Trajectory : public G4VTrajectory
{
using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
public:
public:
// Constructors/Destructor
// Constructors/Destructor
G4Trajectory() = default;
G4Trajectory(const G4Track* aTrack);
G4Trajectory(G4Trajectory&);
~G4Trajectory() override;
G4Trajectory();
G4Trajectory(const G4Track* aTrack);
G4Trajectory(G4Trajectory &);
virtual ~G4Trajectory();
// Operators
// Operators
inline void* operator new(size_t);
inline void operator delete(void*);
inline G4bool operator==(const G4Trajectory& r) const;
inline void* operator new(size_t);
inline void operator delete(void*);
inline G4int operator == (const G4Trajectory& r) const;
// Get/Set functions
// Get/Set functions
inline G4int GetTrackID() const override { return fTrackID; }
inline G4int GetParentID() const override { return fParentID; }
inline G4String GetParticleName() const override { return ParticleName; }
inline G4double GetCharge() const override { return PDGCharge; }
inline G4int GetPDGEncoding() const override { return PDGEncoding; }
inline G4double GetInitialKineticEnergy() const { return initialKineticEnergy; }
inline G4ThreeVector GetInitialMomentum() const override { return initialMomentum; }
inline G4int GetTrackID() const
{ return fTrackID; }
inline G4int GetParentID() const
{ return fParentID; }
inline G4String GetParticleName() const
{ return ParticleName; }
inline G4double GetCharge() const
{ return PDGCharge; }
inline G4int GetPDGEncoding() const
{ return PDGEncoding; }
inline G4double GetInitialKineticEnergy() const
{ return initialKineticEnergy; }
inline G4ThreeVector GetInitialMomentum() const
{ return initialMomentum; }
// Other member functions
// Other member functions
void ShowTrajectory(std::ostream& os = G4cout) const override;
void DrawTrajectory() const override;
void AppendStep(const G4Step* aStep) override;
G4int GetPointEntries() const override { return G4int(positionRecord->size()); }
G4VTrajectoryPoint* GetPoint(G4int i) const override { return (*positionRecord)[i]; }
void MergeTrajectory(G4VTrajectory* secondTrajectory) override;
virtual void ShowTrajectory(std::ostream& os=G4cout) const;
virtual void DrawTrajectory() const;
virtual void AppendStep(const G4Step* aStep);
virtual G4int GetPointEntries() const
{ return G4int(positionRecord->size()); }
virtual G4VTrajectoryPoint* GetPoint(G4int i) const
{ return (*positionRecord)[i]; }
virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
G4ParticleDefinition* GetParticleDefinition();
G4ParticleDefinition* GetParticleDefinition();
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
std::vector<G4AttValue>* CreateAttValues() const override;
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
private:
G4TrajectoryPointContainer* positionRecord = nullptr;
G4int fTrackID = 0;
G4int fParentID = 0;
G4int PDGEncoding = 0;
G4double PDGCharge = 0.0;
G4String ParticleName = "";
G4double initialKineticEnergy = 0.0;
G4ThreeVector initialMomentum;
private:
G4TrajectoryPointContainer* positionRecord = nullptr;
G4int fTrackID = 0;
G4int fParentID = 0;
G4int PDGEncoding = 0;
G4double PDGCharge = 0.0;
G4String ParticleName = "";
G4double initialKineticEnergy = 0.0;
G4ThreeVector initialMomentum;
};
extern G4TRACKING_DLL G4Allocator<G4Trajectory>*& aTrajectoryAllocator();
inline void* G4Trajectory::operator new(size_t)
{
if (aTrajectoryAllocator() == nullptr)
{
if (aTrajectoryAllocator() == nullptr) {
aTrajectoryAllocator() = new G4Allocator<G4Trajectory>;
}
return (void*)aTrajectoryAllocator()->MallocSingle();
@@ -139,9 +127,6 @@ inline void G4Trajectory::operator delete(void* aTrajectory)
aTrajectoryAllocator()->FreeSingle((G4Trajectory*)aTrajectory);
}
inline G4int G4Trajectory::operator == (const G4Trajectory& r) const
{
return (this==&r);
}
inline G4bool G4Trajectory::operator==(const G4Trajectory& r) const { return (this == &r); }
#endif
+29 -37
View File
@@ -37,67 +37,59 @@
#ifndef G4TrajectoryPoint_hh
#define G4TrajectoryPoint_hh 1
#include "trkgdefs.hh"
#include "G4Allocator.hh" // Include from 'particle+matter'
#include "G4ThreeVector.hh" // Include from 'geometry'
#include "G4VTrajectoryPoint.hh"
#include "globals.hh" // Include from 'global'
#include "G4ThreeVector.hh" // Include from 'geometry'
#include "G4Allocator.hh" // Include from 'particle+matter'
#include "globals.hh" // Include from 'global'
#include "trkgdefs.hh"
class G4TrajectoryPoint : public G4VTrajectoryPoint
{
public:
public:
// Constructors/Destructor
// Constructors/Destructor
G4TrajectoryPoint() = default;
G4TrajectoryPoint(G4ThreeVector pos);
G4TrajectoryPoint(const G4TrajectoryPoint& right);
~G4TrajectoryPoint() override;
G4TrajectoryPoint();
G4TrajectoryPoint(G4ThreeVector pos);
G4TrajectoryPoint(const G4TrajectoryPoint& right);
virtual ~G4TrajectoryPoint();
// Operators
// Operators
inline void* operator new(size_t);
inline void operator delete(void* aTrajectoryPoint);
inline G4bool operator==(const G4TrajectoryPoint& right) const;
inline void *operator new(size_t);
inline void operator delete(void *aTrajectoryPoint);
inline G4bool operator==(const G4TrajectoryPoint& right) const;
// Get/Set functions
// Get/Set functions
inline const G4ThreeVector GetPosition() const override { return fPosition; }
inline const G4ThreeVector GetPosition() const
{ return fPosition; }
// Get method for HEPRep style attributes
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
std::vector<G4AttValue>* CreateAttValues() const override;
// Get method for HEPRep style attributes
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
private:
G4ThreeVector fPosition;
private:
G4ThreeVector fPosition{0., 0., 0.};
};
extern G4TRACKING_DLL
G4Allocator<G4TrajectoryPoint>*& aTrajectoryPointAllocator();
extern G4TRACKING_DLL G4Allocator<G4TrajectoryPoint>*& aTrajectoryPointAllocator();
inline void* G4TrajectoryPoint::operator new(size_t)
{
if (aTrajectoryPointAllocator() == nullptr)
{
if (aTrajectoryPointAllocator() == nullptr) {
aTrajectoryPointAllocator() = new G4Allocator<G4TrajectoryPoint>;
}
return (void *) aTrajectoryPointAllocator()->MallocSingle();
return (void*)aTrajectoryPointAllocator()->MallocSingle();
}
inline void G4TrajectoryPoint::operator delete(void *aTrajectoryPoint)
inline void G4TrajectoryPoint::operator delete(void* aTrajectoryPoint)
{
aTrajectoryPointAllocator()
->FreeSingle((G4TrajectoryPoint *) aTrajectoryPoint);
aTrajectoryPointAllocator()->FreeSingle((G4TrajectoryPoint*)aTrajectoryPoint);
}
inline G4bool
G4TrajectoryPoint::operator==(const G4TrajectoryPoint& right) const
inline G4bool G4TrajectoryPoint::operator==(const G4TrajectoryPoint& right) const
{
return (this==&right);
return (this == &right);
}
#endif
+10 -12
View File
@@ -41,23 +41,21 @@
class G4Step;
class G4SteppingManager;
class G4UserSteppingAction
class G4UserSteppingAction
{
public:
public:
// Constructor and destructor
// Constructor and destructor
G4UserSteppingAction();
virtual ~G4UserSteppingAction() = default;
G4UserSteppingAction();
virtual ~G4UserSteppingAction();
// Member functions
// Member functions
virtual void SetSteppingManagerPointer(G4SteppingManager* pValue);
virtual void UserSteppingAction(const G4Step*) {}
virtual void SetSteppingManagerPointer(G4SteppingManager* pValue);
virtual void UserSteppingAction(const G4Step*){}
protected:
G4SteppingManager* fpSteppingManager = nullptr;
protected:
G4SteppingManager* fpSteppingManager = nullptr;
};
#endif
+12 -14
View File
@@ -28,7 +28,7 @@
// Class description:
//
// This class represents any action taking place by the user at the
// start/end point of processing one track.
// start/end point of processing one track.
// Contact:
// Questions and comments to this code should be sent to
@@ -41,24 +41,22 @@
class G4TrackingManager;
class G4Track;
class G4UserTrackingAction
class G4UserTrackingAction
{
public:
public:
// Constructor & Destructor
// Constructor & Destructor
G4UserTrackingAction();
virtual ~G4UserTrackingAction() = default;
G4UserTrackingAction();
virtual ~G4UserTrackingAction();
// Member functions
// Member functions
virtual void SetTrackingManagerPointer(G4TrackingManager* pValue);
virtual void PreUserTrackingAction(const G4Track*) {}
virtual void PostUserTrackingAction(const G4Track*) {}
virtual void SetTrackingManagerPointer(G4TrackingManager* pValue);
virtual void PreUserTrackingAction(const G4Track*){}
virtual void PostUserTrackingAction(const G4Track*){}
protected:
G4TrackingManager* fpTrackingManager = nullptr;
protected:
G4TrackingManager* fpTrackingManager = nullptr;
};
#endif
+103 -109
View File
@@ -27,8 +27,8 @@
//
// Class description:
//
// This class manages the verbose outputs in G4SteppingManager.
// The instance should be a singleton. Users can inherit this
// This class manages the verbose outputs in G4SteppingManager.
// The instance should be a singleton. Users can inherit this
// class to make their own verbosity class.
// Contact:
@@ -39,17 +39,18 @@
#ifndef G4VSteppingVerbose_hh
#define G4VSteppingVerbose_hh 1
#include <vector>
#include "globals.hh" // Include from 'global'
#include "G4VProcess.hh"
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'track'
#include "G4ForceCondition.hh" // enum 'track'
#include "G4GPILSelection.hh" // enum 'track'
#include "G4StepStatus.hh" // Include from 'track'
#include "G4TouchableHandle.hh"
#include "G4ForceCondition.hh" // enum 'track'
#include "G4GPILSelection.hh" // enum 'track'
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4VProcess.hh"
#include "globals.hh" // Include from 'global'
#include "trkgdefs.hh"
#include <vector>
class G4SteppingManager;
class G4Navigator;
class G4VPhysicalVolume;
@@ -63,132 +64,125 @@ class G4VParticleChange;
class G4VSteppingVerbose
{
public:
public:
virtual ~G4VSteppingVerbose();
virtual ~G4VSteppingVerbose();
// static methods to set/get the object's pointer
// static methods to set/get the object's pointer
static void SetInstance(G4VSteppingVerbose* Instance);
static G4VSteppingVerbose* GetInstance();
static G4VSteppingVerbose* GetMasterInstance();
static G4int GetSilent();
static void SetSilent(G4int fSilent);
static G4int GetSilentStepInfo();
static void SetSilentStepInfo(G4int fSilent);
static void SetInstance(G4VSteppingVerbose* Instance);
static G4VSteppingVerbose* GetInstance();
static G4VSteppingVerbose* GetMasterInstance();
static G4int GetSilent();
static void SetSilent(G4int fSilent);
static G4int GetSilentStepInfo();
static void SetSilentStepInfo(G4int fSilent);
virtual G4VSteppingVerbose* Clone();
virtual G4VSteppingVerbose* Clone();
// these method are invoked by G4SteppingManager
// these method are invoked by G4SteppingManager
virtual void NewStep() = 0;
void CopyState();
virtual void SetManager(G4SteppingManager* const);
virtual void AtRestDoItInvoked() = 0;
virtual void AlongStepDoItAllDone() = 0;
virtual void PostStepDoItAllDone() = 0;
virtual void AlongStepDoItOneByOne() = 0;
virtual void PostStepDoItOneByOne() = 0;
virtual void StepInfo() = 0;
virtual void TrackingStarted() = 0;
virtual void DPSLStarted() = 0;
virtual void DPSLUserLimit() = 0;
virtual void DPSLPostStep() = 0;
virtual void DPSLAlongStep() = 0;
virtual void VerboseTrack() = 0;
virtual void VerboseParticleChange() = 0;
virtual void NewStep() = 0;
void CopyState();
virtual void SetManager(G4SteppingManager* const);
virtual void AtRestDoItInvoked() = 0;
virtual void AlongStepDoItAllDone() = 0;
virtual void PostStepDoItAllDone() = 0;
virtual void AlongStepDoItOneByOne() = 0;
virtual void PostStepDoItOneByOne() = 0;
virtual void StepInfo() = 0;
virtual void TrackingStarted() = 0;
virtual void DPSLStarted() = 0;
virtual void DPSLUserLimit() = 0;
virtual void DPSLPostStep() = 0;
virtual void DPSLAlongStep() = 0;
virtual void VerboseTrack() = 0;
virtual void VerboseParticleChange() = 0;
protected:
protected:
G4VSteppingVerbose(); // 'singleton'
G4VSteppingVerbose(); // 'singleton'
static G4ThreadLocal G4VSteppingVerbose* fInstance; // pointer to the instance
static G4VSteppingVerbose* fMasterInstance; // pointer to the instance in master thread
G4TRACKING_DLL static G4ThreadLocal G4int Silent; // flag for verbosity
G4TRACKING_DLL static G4ThreadLocal G4int SilentStepInfo; // another flag for verbosity
static G4ThreadLocal G4VSteppingVerbose* fInstance;
// pointer to the instance
static G4VSteppingVerbose* fMasterInstance;
// pointer to the instance in master thread
G4TRACKING_DLL static G4ThreadLocal G4int Silent;
//flag for verbosity
G4TRACKING_DLL static G4ThreadLocal G4int SilentStepInfo;
//another flag for verbosity
G4SteppingManager* fManager = nullptr;
G4UserSteppingAction* fUserSteppingAction = nullptr;
G4SteppingManager* fManager = nullptr;
G4UserSteppingAction* fUserSteppingAction = nullptr;
G4double PhysicalStep = 0.0;
G4double GeometricalStep = 0.0;
G4double CorrectedStep = 0.0;
G4bool PreStepPointIsGeom = false;
G4bool FirstStep = false;
G4StepStatus fStepStatus = fUndefined;
G4double PhysicalStep = 0.0;
G4double GeometricalStep = 0.0;
G4double CorrectedStep = 0.0;
G4bool PreStepPointIsGeom = false;
G4bool FirstStep = false;
G4StepStatus fStepStatus = fUndefined;
G4double TempInitVelocity = 0.0;
G4double TempVelocity = 0.0;
G4double Mass = 0.0;
G4double TempInitVelocity = 0.0;
G4double TempVelocity = 0.0;
G4double Mass = 0.0;
G4double sumEnergyChange = 0.0;
G4double sumEnergyChange = 0.0;
G4VParticleChange* fParticleChange = nullptr;
G4Track* fTrack = nullptr;
G4TrackVector* fSecondary = nullptr;
G4Step* fStep = nullptr;
G4StepPoint* fPreStepPoint = nullptr;
G4StepPoint* fPostStepPoint = nullptr;
G4VParticleChange* fParticleChange = nullptr;
G4Track* fTrack = nullptr;
G4TrackVector* fSecondary = nullptr;
G4Step* fStep = nullptr;
G4StepPoint* fPreStepPoint = nullptr;
G4StepPoint* fPostStepPoint = nullptr;
G4VPhysicalVolume* fCurrentVolume = nullptr;
G4VSensitiveDetector* fSensitive = nullptr;
G4VProcess* fCurrentProcess = nullptr;
// The pointer to the process whose DoIt() or
// GetPhysicalInteractionLength() has been just executed
G4VPhysicalVolume* fCurrentVolume = nullptr;
G4VSensitiveDetector* fSensitive = nullptr;
G4VProcess* fCurrentProcess = nullptr; // The pointer to the process whose DoIt() or
// GetPhysicalInteractionLength() has been just executed
G4ProcessVector* fAtRestDoItVector = nullptr;
G4ProcessVector* fAlongStepDoItVector = nullptr;
G4ProcessVector* fPostStepDoItVector = nullptr;
G4ProcessVector* fAtRestDoItVector = nullptr;
G4ProcessVector* fAlongStepDoItVector = nullptr;
G4ProcessVector* fPostStepDoItVector = nullptr;
G4ProcessVector* fAtRestGetPhysIntVector = nullptr;
G4ProcessVector* fAlongStepGetPhysIntVector = nullptr;
G4ProcessVector* fPostStepGetPhysIntVector = nullptr;
G4ProcessVector* fAtRestGetPhysIntVector = nullptr;
G4ProcessVector* fAlongStepGetPhysIntVector = nullptr;
G4ProcessVector* fPostStepGetPhysIntVector = nullptr;
std::size_t MAXofAtRestLoops = 0;
std::size_t MAXofAlongStepLoops = 0;
std::size_t MAXofPostStepLoops = 0;
G4double currentMinimumStep = 0.0;
G4double numberOfInteractionLengthLeft = 0.0;
std::size_t MAXofAtRestLoops = 0;
std::size_t MAXofAlongStepLoops = 0;
std::size_t MAXofPostStepLoops = 0;
std::size_t fAtRestDoItProcTriggered = 0;
std::size_t fAlongStepDoItProcTriggered = 0;
std::size_t fPostStepDoItProcTriggered = 0;
G4double currentMinimumStep = 0.0;
G4double numberOfInteractionLengthLeft = 0.0;
G4int fN2ndariesAtRestDoIt = 0;
G4int fN2ndariesAlongStepDoIt = 0;
G4int fN2ndariesPostStepDoIt = 0;
// These are the numbers of secondaries generated by the process
// just executed
std::size_t fAtRestDoItProcTriggered = 0;
std::size_t fAlongStepDoItProcTriggered = 0;
std::size_t fPostStepDoItProcTriggered = 0;
G4Navigator* fNavigator = nullptr;
G4int fN2ndariesAtRestDoIt = 0;
G4int fN2ndariesAlongStepDoIt = 0;
G4int fN2ndariesPostStepDoIt = 0;
// These are the numbers of secondaries generated by the process
// just executed
G4int verboseLevel = 0;
G4Navigator* fNavigator = nullptr;
using G4SelectedAtRestDoItVector = std::vector<G4int>;
using G4SelectedAlongStepDoItVector = std::vector<G4int>;
using G4SelectedPostStepDoItVector = std::vector<G4int>;
G4int verboseLevel = 0;
G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector = nullptr;
G4SelectedAlongStepDoItVector* fSelectedAlongStepDoItVector = nullptr;
G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector = nullptr;
using G4SelectedAtRestDoItVector = std::vector<G4int>;
using G4SelectedAlongStepDoItVector = std::vector<G4int>;
using G4SelectedPostStepDoItVector = std::vector<G4int>;
G4double fPreviousStepSize = 0.0;
G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector = nullptr;
G4SelectedAlongStepDoItVector* fSelectedAlongStepDoItVector = nullptr;
G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector = nullptr;
G4TouchableHandle fTouchableHandle;
G4double fPreviousStepSize = 0.0;
G4SteppingControl StepControlFlag = NormalCondition;
G4TouchableHandle fTouchableHandle;
G4double physIntLength = 0.0;
G4ForceCondition fCondition = InActivated;
G4GPILSelection fGPILSelection = NotCandidateForSelection;
// Above three variables are for the method DefinePhysicalStepLength().
// To pass this information to the method Verbose(), they are kept at
// here. Need a more elegant mechanism
G4SteppingControl StepControlFlag = NormalCondition;
G4double physIntLength = 0.0;
G4ForceCondition fCondition = InActivated;
G4GPILSelection fGPILSelection = NotCandidateForSelection;
// Above three variables are for the method DefinePhysicalStepLength().
// To pass this information to the method Verbose(), they are kept at
// here. Need a more elegant mechanism
};
#endif
+18 -20
View File
@@ -42,30 +42,28 @@ class G4Track;
class G4VTrackingManager
////////////////////////
{
public:
virtual ~G4VTrackingManager() = default;
public:
virtual ~G4VTrackingManager() {}
// Messaged by the Particle definition whenever cross-section tables have
// to be rebuilt (i.e. if new materials have been defined).
virtual void BuildPhysicsTable(const G4ParticleDefinition&) {}
virtual void BuildPhysicsTable(const G4ParticleDefinition&) {}
// Messaged by the Particle definition whenever cross-section tables have
// to be rebuilt (i.e. if new materials have been defined).
// Messaged by the Particle definition whenever cross-section tables have
// to be prepared for rebuild (i.e. if new materials have been defined).
virtual void PreparePhysicsTable(const G4ParticleDefinition&) {}
virtual void PreparePhysicsTable(const G4ParticleDefinition&) {}
// Messaged by the Particle definition whenever cross-section tables have
// to be prepared for rebuild (i.e. if new materials have been defined).
virtual void HandOverOneTrack(G4Track* aTrack) = 0;
// Invoking this function, a G4Track given by the argument will be
// handed over to this tracking manager. It may be tracked immediately
// or processing may be deferred to a later time, at the latest when
// calling FlushEvent().
virtual void FlushEvent() {}
// Signal that all tracks in the current event have been finished and
// this manager should process all tracks that may have been deferred.
// When called via this method, the tracking manager may stack new
// secondaries which will be tracked afterwards.
// Invoking this function, a G4Track given by the argument will be
// handed over to this tracking manager. It may be tracked immediately
// or processing may be deferred to a later time, at the latest when
// calling FlushEvent().
virtual void HandOverOneTrack(G4Track* aTrack) = 0;
// Signal that all tracks in the current event have been finished and
// this manager should process all tracks that may have been deferred.
// When called via this method, the tracking manager may stack new
// secondaries which will be tracked afterwards.
virtual void FlushEvent() {}
};
#endif
+57 -53
View File
@@ -27,7 +27,7 @@
//
// Class description:
//
// This class is the abstract base class representing a trajectory of
// This class is the abstract base class representing a trajectory of
// a particle being tracked.
// Its concrete class includes information of:
// 1) List of trajectory points composing the trajectory;
@@ -43,11 +43,11 @@
#ifndef G4VTrajectory_hh
#define G4VTrajectory_hh 1
#include <vector>
#include <map>
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include <map>
#include <vector>
class G4Step;
class G4VTrajectoryPoint;
@@ -56,60 +56,64 @@ class G4AttValue;
class G4VTrajectory
{
public:
public:
// Constructor/Destrcutor
G4VTrajectory() = default;
virtual ~G4VTrajectory() = default;
G4VTrajectory();
virtual ~G4VTrajectory();
// Constructor/Destrcutor
// Equality operator
G4bool operator==(const G4VTrajectory& right) const;
G4bool operator == (const G4VTrajectory& right) const;
// Equality operator
// Accessors
virtual G4int GetTrackID() const = 0;
virtual G4int GetParentID() const = 0;
virtual G4String GetParticleName() const = 0;
virtual G4int GetTrackID() const = 0;
virtual G4int GetParentID() const = 0;
virtual G4String GetParticleName() const = 0;
virtual G4double GetCharge() const = 0;
// Accessors
// Charge is that of G4DynamicParticle
virtual G4double GetCharge() const = 0;
virtual G4int GetPDGEncoding() const = 0;
// Charge is that of G4DynamicParticle
virtual G4ThreeVector GetInitialMomentum() const = 0;
// Zero will be returned if the particle does not have PDG code.
// Momentum at the origin of the track in global coordinate system
// Zero will be returned if the particle does not have PDG code.
virtual G4int GetPDGEncoding() const = 0;
virtual G4int GetPointEntries() const = 0;
// Returns the number of trajectory points
virtual G4VTrajectoryPoint* GetPoint(G4int i) const = 0;
// Returns i-th trajectory point
virtual void ShowTrajectory(std::ostream& os=G4cout) const;
// Converts attributes in trajectory (and trajectory point if
// needed) to ostream. A default implementation in this base class
// may be used or may be overridden in the concrete class. Note:
// the user needs to follow with new-line or end-of-string,
// depending on the nature of os
virtual void DrawTrajectory() const;
// Draw the trajectory. A default implementation in this base
// class may be used or may be overridden in the concrete class
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const
{ return nullptr; }
// If implemented by a derived class, returns a pointer to a map of
// attribute definitions for the attribute values below. The user
// must test the validity of this pointer. See G4Trajectory for an
// example of a concrete implementation of this method
virtual std::vector<G4AttValue>* CreateAttValues() const
{ return nullptr; }
// If implemented by a derived class, returns a pointer to a list
// of attribute values suitable, e.g., for picking. Each must
// refer to an attribute definition in the above map; its name is
// the key. The user must test the validity of this pointer (it
// must be non-zero and conform to the G4AttDefs, which may be
// checked with G4AttCheck) and delete the list after use. See
// G4Trajectory for an example of a concrete implementation of this
// method and G4VTrajectory::ShowTrajectory for an example of its use.
// Momentum at the origin of the track in global coordinate system
virtual G4ThreeVector GetInitialMomentum() const = 0;
virtual void AppendStep(const G4Step* aStep) = 0;
virtual void MergeTrajectory(G4VTrajectory* secondTrajectory) = 0;
// Methods invoked exclusively by G4TrackingManager
// Returns the number of trajectory points
virtual G4int GetPointEntries() const = 0;
// Returns i-th trajectory point
virtual G4VTrajectoryPoint* GetPoint(G4int i) const = 0;
// Converts attributes in trajectory (and trajectory point if
// needed) to ostream. A default implementation in this base class
// may be used or may be overridden in the concrete class. Note:
// the user needs to follow with new-line or end-of-string,
// depending on the nature of os
virtual void ShowTrajectory(std::ostream& os = G4cout) const;
// Draw the trajectory. A default implementation in this base
// class may be used or may be overridden in the concrete class
virtual void DrawTrajectory() const;
// If implemented by a derived class, returns a pointer to a map of
// attribute definitions for the attribute values below. The user
// must test the validity of this pointer. See G4Trajectory for an
// example of a concrete implementation of this method
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const { return nullptr; }
// If implemented by a derived class, returns a pointer to a list
// of attribute values suitable, e.g., for picking. Each must
// refer to an attribute definition in the above map; its name is
// the key. The user must test the validity of this pointer (it
// must be non-zero and conform to the G4AttDefs, which may be
// checked with G4AttCheck) and delete the list after use. See
// G4Trajectory for an example of a concrete implementation of this
// method and G4VTrajectory::ShowTrajectory for an example of its use.
virtual std::vector<G4AttValue>* CreateAttValues() const { return nullptr; }
// Methods invoked exclusively by G4TrackingManager
virtual void AppendStep(const G4Step* aStep) = 0;
virtual void MergeTrajectory(G4VTrajectory* secondTrajectory) = 0;
};
#endif
+34 -38
View File
@@ -38,56 +38,52 @@
#ifndef G4VTrajectoryPoint_hh
#define G4VTrajectoryPoint_hh 1
#include <vector>
#include <map>
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include <map>
#include <vector>
class G4AttDef;
class G4AttValue;
class G4VTrajectoryPoint
{
public:
public:
// Constructor/Destructor
G4VTrajectoryPoint() = default;
virtual ~G4VTrajectoryPoint() = default;
G4VTrajectoryPoint();
virtual ~G4VTrajectoryPoint();
// Constructor/Destructor
// Equality operator
G4bool operator==(const G4VTrajectoryPoint& right) const { return (this == &right); }
G4bool operator==(const G4VTrajectoryPoint& right) const;
// Equality operator
// Return point position
virtual const G4ThreeVector GetPosition() const = 0;
virtual const G4ThreeVector GetPosition() const = 0;
// Return point position
// Get method for a vector of auxiliary points.
// If implemented by a derived class, returns a pointer to a list
// of auxiliary points, e.g., intermediate points used during the
// calculation of the step that can be used for drawing a smoother
// trajectory. The user must test the validity of this pointer
virtual const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const { return nullptr; }
virtual const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const
{ return nullptr; }
// Get method for a vector of auxiliary points.
// If implemented by a derived class, returns a pointer to a list
// of auxiliary points, e.g., intermediate points used during the
// calculation of the step that can be used for drawing a smoother
// trajectory. The user must test the validity of this pointer
// Get method for HEPRep style attribute definitions.
// If implemented by a derived class, returns a pointer to a map of
// attribute definitions for the attribute values below. The user
// must test the validity of this pointer. See G4Trajectory for an
// example of a concrete implementation of this method
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const { return nullptr; }
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const
{ return nullptr; }
// Get method for HEPRep style attribute definitions.
// If implemented by a derived class, returns a pointer to a map of
// attribute definitions for the attribute values below. The user
// must test the validity of this pointer. See G4Trajectory for an
// example of a concrete implementation of this method
virtual std::vector<G4AttValue>* CreateAttValues() const
{ return nullptr; }
// Get method for HEPRep style attribute values.
// If implemented by a derived class, returns a pointer to a list
// of attribute values suitable, e.g., for picking. Each must
// refer to an attribute definition in the above map; its name is
// the key. The user must test the validity of this pointer (it
// must be non-zero and conform to the G4AttDefs, which may be
// checked with G4AttCheck) and delete the list after use. See
// G4Trajectory for an example of a concrete implementation of this
// method and G4VTrajectory::ShowTrajectory() for an example of its use.
// Get method for HEPRep style attribute values.
// If implemented by a derived class, returns a pointer to a list
// of attribute values suitable, e.g., for picking. Each must
// refer to an attribute definition in the above map; its name is
// the key. The user must test the validity of this pointer (it
// must be non-zero and conform to the G4AttDefs, which may be
// checked with G4AttCheck) and delete the list after use. See
// G4Trajectory for an example of a concrete implementation of this
// method and G4VTrajectory::ShowTrajectory() for an example of its use.
virtual std::vector<G4AttValue>* CreateAttValues() const { return nullptr; }
};
#endif
+9 -9
View File
@@ -33,16 +33,16 @@
#include "G4Types.hh"
#ifdef WIN32
//
// Unique identifier for global module
//
#if defined G4TRACKING_ALLOC_EXPORT
#define G4TRACKING_DLL G4DLLEXPORT
#else
#define G4TRACKING_DLL G4DLLIMPORT
#endif
//
// Unique identifier for global module
//
# if defined G4TRACKING_ALLOC_EXPORT
# define G4TRACKING_DLL G4DLLEXPORT
# else
# define G4TRACKING_DLL G4DLLIMPORT
# endif
#else
#define G4TRACKING_DLL
# define G4TRACKING_DLL
#endif
#endif /* G4TRKGDEFS_HH */