Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
# ----------------------------------------------------------
|
||||
# GNUmakefile for tracking library. Katsuya Amako, 5/9/95.
|
||||
# ----------------------------------------------------------
|
||||
|
||||
name := G4tracking
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../..
|
||||
endif
|
||||
|
||||
GLOBLIBS = libG4processes.lib libG4digits_hits.lib
|
||||
GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
|
||||
GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
|
||||
GLOBLIBS += libG4intercoms.lib libG4global.lib
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += -DG4TRACKING_ALLOC_EXPORT
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/navigation/include \
|
||||
-I$(G4BASE)/geometry/magneticfield/include \
|
||||
-I$(G4BASE)/geometry/solids/CSG/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/digits_hits/detector/include \
|
||||
-I$(G4BASE)/digits_hits/hits/include \
|
||||
-I$(G4BASE)/graphics_reps/include \
|
||||
-I$(G4BASE)/intercoms/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
.PHONY: global
|
||||
|
||||
global: lib
|
||||
@@ -6,6 +6,12 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2023-02-08 Ben Morgan (tracking V11-01-01)
|
||||
- Apply standard and extended set of clang-tidy/format fixes
|
||||
|
||||
## 2022-12-12 Ben Morgan (tracking-V11-01-00)
|
||||
- Remove obsolete GNUmakefile scripts
|
||||
|
||||
## 2022-11-16 Gabriele Cosmo (tracking-V11-00-09)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,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......
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -47,7 +47,6 @@ geant4_add_module(G4tracking
|
||||
G4MultiTrackingAction.cc
|
||||
G4VSteppingVerbose.cc
|
||||
G4VTrajectory.cc
|
||||
G4VTrajectoryPoint.cc
|
||||
G4MultiSteppingAction.cc)
|
||||
|
||||
geant4_module_compile_definitions(G4tracking PRIVATE G4TRACKING_ALLOC_EXPORT)
|
||||
|
||||
@@ -31,31 +31,22 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4AdjointCrossSurfChecker.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4ThreadLocal G4AdjointCrossSurfChecker*
|
||||
G4AdjointCrossSurfChecker::instance = nullptr;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointCrossSurfChecker::G4AdjointCrossSurfChecker()
|
||||
{
|
||||
}
|
||||
G4ThreadLocal G4AdjointCrossSurfChecker* G4AdjointCrossSurfChecker::instance = nullptr;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointCrossSurfChecker::~G4AdjointCrossSurfChecker()
|
||||
{
|
||||
delete instance;
|
||||
}
|
||||
G4AdjointCrossSurfChecker::~G4AdjointCrossSurfChecker() { delete instance; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -63,45 +54,40 @@ G4AdjointCrossSurfChecker* G4AdjointCrossSurfChecker::GetInstance()
|
||||
{
|
||||
if (instance == nullptr) instance = new G4AdjointCrossSurfChecker();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
CrossingASphere(const G4Step* aStep, G4double sphere_radius,
|
||||
G4ThreeVector sphere_center, G4ThreeVector& crossing_pos,
|
||||
G4double& cos_th , G4bool& GoingIn)
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingASphere(const G4Step* aStep, G4double sphere_radius,
|
||||
G4ThreeVector sphere_center, G4ThreeVector& crossing_pos, G4double& cos_th, G4bool& GoingIn)
|
||||
{
|
||||
G4ThreeVector pos1 = aStep->GetPreStepPoint()->GetPosition() - sphere_center;
|
||||
G4ThreeVector pos2 = aStep->GetPostStepPoint()->GetPosition() - sphere_center;
|
||||
G4double r1 = pos1.mag();
|
||||
G4double r2 = pos2.mag();
|
||||
G4bool did_cross = false;
|
||||
|
||||
if (r1<=sphere_radius && r2>sphere_radius)
|
||||
{
|
||||
G4bool did_cross = false;
|
||||
|
||||
if (r1 <= sphere_radius && r2 > sphere_radius) {
|
||||
did_cross = true;
|
||||
GoingIn = false;
|
||||
}
|
||||
else if (r2<=sphere_radius && r1>sphere_radius)
|
||||
{
|
||||
}
|
||||
else if (r2 <= sphere_radius && r1 > sphere_radius) {
|
||||
did_cross = true;
|
||||
GoingIn = true;
|
||||
}
|
||||
|
||||
if (did_cross)
|
||||
{
|
||||
G4ThreeVector dr = pos2-pos1;
|
||||
G4double r12 = r1*r1;
|
||||
if (did_cross) {
|
||||
G4ThreeVector dr = pos2 - pos1;
|
||||
G4double r12 = r1 * r1;
|
||||
G4double rdr = dr.mag();
|
||||
G4double a,b,c,d;
|
||||
a = rdr*rdr;
|
||||
b = 2.*pos1.dot(dr);
|
||||
c = r12-sphere_radius*sphere_radius;
|
||||
d = std::sqrt(b*b-4.*a*c);
|
||||
G4double l = (-b+d)/2./a;
|
||||
if (l > 1.) l=(-b-d)/2./a;
|
||||
crossing_pos = pos1+l*dr;
|
||||
G4double a, b, c, d;
|
||||
a = rdr * rdr;
|
||||
b = 2. * pos1.dot(dr);
|
||||
c = r12 - sphere_radius * sphere_radius;
|
||||
d = std::sqrt(b * b - 4. * a * c);
|
||||
G4double l = (-b + d) / 2. / a;
|
||||
if (l > 1.) l = (-b - d) / 2. / a;
|
||||
crossing_pos = pos1 + l * dr;
|
||||
cos_th = std::abs(dr.cosTheta(crossing_pos));
|
||||
}
|
||||
return did_cross;
|
||||
@@ -109,110 +95,86 @@ CrossingASphere(const G4Step* aStep, G4double sphere_radius,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
GoingInOrOutOfaVolume(const G4Step* aStep, const G4String& volume_name,
|
||||
G4double&, G4bool& GoingIn) // from external surface
|
||||
G4bool G4AdjointCrossSurfChecker::GoingInOrOutOfaVolume(const G4Step* aStep,
|
||||
const G4String& volume_name, G4double&, G4bool& GoingIn) // from external surface
|
||||
{
|
||||
G4bool step_at_boundary =
|
||||
(aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool step_at_boundary = (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool did_cross = false;
|
||||
if (step_at_boundary)
|
||||
{
|
||||
const G4VTouchable* postStepTouchable =
|
||||
aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable =
|
||||
aStep->GetPreStepPoint()->GetTouchable();
|
||||
if (preStepTouchable && postStepTouchable
|
||||
&& postStepTouchable->GetVolume() && preStepTouchable->GetVolume())
|
||||
if (step_at_boundary) {
|
||||
const G4VTouchable* postStepTouchable = aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable = aStep->GetPreStepPoint()->GetTouchable();
|
||||
if ((preStepTouchable != nullptr) && (postStepTouchable != nullptr) &&
|
||||
(postStepTouchable->GetVolume() != nullptr) && (preStepTouchable->GetVolume() != nullptr))
|
||||
{
|
||||
G4String post_vol_name = postStepTouchable->GetVolume()->GetName();
|
||||
G4String pre_vol_name = preStepTouchable->GetVolume()->GetName();
|
||||
|
||||
if (post_vol_name == volume_name )
|
||||
{
|
||||
if (post_vol_name == volume_name) {
|
||||
GoingIn = true;
|
||||
did_cross = true;
|
||||
}
|
||||
else if (pre_vol_name == volume_name)
|
||||
{
|
||||
else if (pre_vol_name == volume_name) {
|
||||
GoingIn = false;
|
||||
did_cross = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return did_cross; // still need to compute the cosine of the direction
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
GoingInOrOutOfaVolumeByExtSurface(const G4Step* aStep,
|
||||
const G4String& volume_name,
|
||||
const G4String& mother_logical_vol_name,
|
||||
G4double&,
|
||||
G4bool& GoingIn) // from external surf.
|
||||
G4bool G4AdjointCrossSurfChecker::GoingInOrOutOfaVolumeByExtSurface(const G4Step* aStep,
|
||||
const G4String& volume_name, const G4String& mother_logical_vol_name, G4double&,
|
||||
G4bool& GoingIn) // from external surf.
|
||||
{
|
||||
G4bool step_at_boundary =
|
||||
(aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool step_at_boundary = (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool did_cross = false;
|
||||
if (step_at_boundary)
|
||||
{
|
||||
const G4VTouchable* postStepTouchable =
|
||||
aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable =
|
||||
aStep->GetPreStepPoint()->GetTouchable();
|
||||
const G4VPhysicalVolume* postVol = (postStepTouchable != nullptr)
|
||||
? postStepTouchable->GetVolume() : nullptr;
|
||||
const G4VPhysicalVolume* preVol = (preStepTouchable != nullptr)
|
||||
? preStepTouchable->GetVolume() : nullptr;
|
||||
if (preStepTouchable != nullptr && postStepTouchable != nullptr
|
||||
&& postVol != nullptr && preVol != nullptr)
|
||||
if (step_at_boundary) {
|
||||
const G4VTouchable* postStepTouchable = aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable = aStep->GetPreStepPoint()->GetTouchable();
|
||||
const G4VPhysicalVolume* postVol =
|
||||
(postStepTouchable != nullptr) ? postStepTouchable->GetVolume() : nullptr;
|
||||
const G4VPhysicalVolume* preVol =
|
||||
(preStepTouchable != nullptr) ? preStepTouchable->GetVolume() : nullptr;
|
||||
if (preStepTouchable != nullptr && postStepTouchable != nullptr && postVol != nullptr &&
|
||||
preVol != nullptr)
|
||||
{
|
||||
G4String post_vol_name = postVol->GetName();
|
||||
G4String post_log_vol_name = postVol->GetLogicalVolume()->GetName();
|
||||
G4String pre_vol_name = preVol->GetName();
|
||||
G4String pre_log_vol_name = preVol->GetLogicalVolume()->GetName();
|
||||
if (post_vol_name == volume_name
|
||||
&& pre_log_vol_name == mother_logical_vol_name)
|
||||
{
|
||||
if (post_vol_name == volume_name && pre_log_vol_name == mother_logical_vol_name) {
|
||||
GoingIn = true;
|
||||
did_cross = true;
|
||||
}
|
||||
else if (pre_vol_name == volume_name
|
||||
&& post_log_vol_name == mother_logical_vol_name )
|
||||
{
|
||||
else if (pre_vol_name == volume_name && post_log_vol_name == mother_logical_vol_name) {
|
||||
GoingIn = false;
|
||||
did_cross = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return did_cross; // still need to compute the cosine of the direction
|
||||
return did_cross; // still need to compute the cosine of the direction
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
CrossingAGivenRegisteredSurface(const G4Step* aStep,
|
||||
const G4String& surface_name,
|
||||
G4ThreeVector& crossing_pos,
|
||||
G4double& cos_to_surface, G4bool& GoingIn)
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingAGivenRegisteredSurface(const G4Step* aStep,
|
||||
const G4String& surface_name, G4ThreeVector& crossing_pos, G4double& cos_to_surface,
|
||||
G4bool& GoingIn)
|
||||
{
|
||||
G4int ind = FindRegisteredSurface(surface_name);
|
||||
G4bool did_cross = false;
|
||||
if (ind >=0)
|
||||
{
|
||||
did_cross = CrossingAGivenRegisteredSurface(aStep, ind, crossing_pos,
|
||||
cos_to_surface, GoingIn);
|
||||
if (ind >= 0) {
|
||||
did_cross = CrossingAGivenRegisteredSurface(aStep, ind, crossing_pos, cos_to_surface, GoingIn);
|
||||
}
|
||||
return did_cross;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
CrossingAGivenRegisteredSurface(const G4Step* aStep, G4int ind,
|
||||
G4ThreeVector& crossing_pos,
|
||||
G4double& cos_to_surface, G4bool& GoingIn)
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingAGivenRegisteredSurface(const G4Step* aStep, G4int ind,
|
||||
G4ThreeVector& crossing_pos, G4double& cos_to_surface, G4bool& GoingIn)
|
||||
{
|
||||
G4String surf_type = ListOfSurfaceType[ind];
|
||||
G4double radius = ListOfSphereRadius[ind];
|
||||
@@ -221,39 +183,27 @@ CrossingAGivenRegisteredSurface(const G4Step* aStep, G4int ind,
|
||||
G4String vol2 = ListOfVol2Name[ind];
|
||||
|
||||
G4bool did_cross = false;
|
||||
if (surf_type == "Sphere")
|
||||
{
|
||||
did_cross = CrossingASphere(aStep, radius, center,crossing_pos,
|
||||
cos_to_surface, GoingIn);
|
||||
if (surf_type == "Sphere") {
|
||||
did_cross = CrossingASphere(aStep, radius, center, crossing_pos, cos_to_surface, GoingIn);
|
||||
}
|
||||
else if (surf_type == "ExternalSurfaceOfAVolume")
|
||||
{
|
||||
did_cross = GoingInOrOutOfaVolumeByExtSurface(aStep, vol1, vol2,
|
||||
cos_to_surface, GoingIn);
|
||||
crossing_pos= aStep->GetPostStepPoint()->GetPosition();
|
||||
else if (surf_type == "ExternalSurfaceOfAVolume") {
|
||||
did_cross = GoingInOrOutOfaVolumeByExtSurface(aStep, vol1, vol2, cos_to_surface, GoingIn);
|
||||
crossing_pos = aStep->GetPostStepPoint()->GetPosition();
|
||||
}
|
||||
else if (surf_type == "BoundaryBetweenTwoVolumes")
|
||||
{
|
||||
did_cross = CrossingAnInterfaceBetweenTwoVolumes(aStep, vol1, vol2,
|
||||
crossing_pos,
|
||||
cos_to_surface, GoingIn);
|
||||
else if (surf_type == "BoundaryBetweenTwoVolumes") {
|
||||
did_cross = CrossingAnInterfaceBetweenTwoVolumes(
|
||||
aStep, vol1, vol2, crossing_pos, cos_to_surface, GoingIn);
|
||||
}
|
||||
return did_cross;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
CrossingOneOfTheRegisteredSurface(const G4Step* aStep, G4String& surface_name,
|
||||
G4ThreeVector& crossing_pos,
|
||||
G4double& cos_to_surface,
|
||||
G4bool& GoingIn)
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingOneOfTheRegisteredSurface(const G4Step* aStep,
|
||||
G4String& surface_name, G4ThreeVector& crossing_pos, G4double& cos_to_surface, G4bool& GoingIn)
|
||||
{
|
||||
for (std::size_t i=0; i<ListOfSurfaceName.size(); ++i)
|
||||
{
|
||||
if (CrossingAGivenRegisteredSurface(aStep, G4int(i), crossing_pos,
|
||||
cos_to_surface, GoingIn))
|
||||
{
|
||||
for (std::size_t i = 0; i < ListOfSurfaceName.size(); ++i) {
|
||||
if (CrossingAGivenRegisteredSurface(aStep, G4int(i), crossing_pos, cos_to_surface, GoingIn)) {
|
||||
surface_name = ListOfSurfaceName[i];
|
||||
return true;
|
||||
}
|
||||
@@ -263,61 +213,44 @@ CrossingOneOfTheRegisteredSurface(const G4Step* aStep, G4String& surface_name,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
CrossingAnInterfaceBetweenTwoVolumes(const G4Step* aStep,
|
||||
const G4String& vol1_name,
|
||||
const G4String& vol2_name,
|
||||
G4ThreeVector&, G4double&,
|
||||
G4bool& GoingIn)
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingAnInterfaceBetweenTwoVolumes(const G4Step* aStep,
|
||||
const G4String& vol1_name, const G4String& vol2_name, G4ThreeVector&, G4double&, G4bool& GoingIn)
|
||||
{
|
||||
G4bool step_at_boundary =
|
||||
(aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool step_at_boundary = (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool did_cross = false;
|
||||
if (step_at_boundary)
|
||||
{
|
||||
const G4VTouchable* postStepTouchable =
|
||||
aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable =
|
||||
aStep->GetPreStepPoint()->GetTouchable();
|
||||
if (preStepTouchable && postStepTouchable)
|
||||
{
|
||||
if (step_at_boundary) {
|
||||
const G4VTouchable* postStepTouchable = aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable = aStep->GetPreStepPoint()->GetTouchable();
|
||||
if ((preStepTouchable != nullptr) && (postStepTouchable != nullptr)) {
|
||||
G4String post_vol_name = postStepTouchable->GetVolume()->GetName();
|
||||
if (post_vol_name == "")
|
||||
{
|
||||
post_vol_name = postStepTouchable->GetVolume()->GetLogicalVolume()
|
||||
->GetName();
|
||||
if (post_vol_name.empty()) {
|
||||
post_vol_name = postStepTouchable->GetVolume()->GetLogicalVolume()->GetName();
|
||||
}
|
||||
G4String pre_vol_name = preStepTouchable->GetVolume()->GetName();
|
||||
if (pre_vol_name == "")
|
||||
{
|
||||
pre_vol_name = preStepTouchable->GetVolume()->GetLogicalVolume()
|
||||
->GetName();
|
||||
if (pre_vol_name.empty()) {
|
||||
pre_vol_name = preStepTouchable->GetVolume()->GetLogicalVolume()->GetName();
|
||||
}
|
||||
if (pre_vol_name == vol1_name && post_vol_name == vol2_name)
|
||||
{
|
||||
GoingIn=true;
|
||||
did_cross=true;
|
||||
if (pre_vol_name == vol1_name && post_vol_name == vol2_name) {
|
||||
GoingIn = true;
|
||||
did_cross = true;
|
||||
}
|
||||
else if (pre_vol_name == vol2_name && post_vol_name == vol1_name)
|
||||
{
|
||||
GoingIn=false;
|
||||
did_cross=true;
|
||||
else if (pre_vol_name == vol2_name && post_vol_name == vol1_name) {
|
||||
GoingIn = false;
|
||||
did_cross = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return did_cross; // still need to compute the cosine of the direction
|
||||
return did_cross; // still need to compute the cosine of the direction
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
AddaSphericalSurface(const G4String& SurfaceName, G4double radius,
|
||||
G4ThreeVector pos, G4double& Area)
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::AddaSphericalSurface(
|
||||
const G4String& SurfaceName, G4double radius, G4ThreeVector pos, G4double& Area)
|
||||
{
|
||||
G4int ind = FindRegisteredSurface(SurfaceName);
|
||||
Area = 4.*pi*radius*radius;
|
||||
if (ind>=0)
|
||||
{
|
||||
Area = 4. * pi * radius * radius;
|
||||
if (ind >= 0) {
|
||||
ListOfSurfaceType[ind] = "Sphere";
|
||||
ListOfSphereRadius[ind] = radius;
|
||||
ListOfSphereCenter[ind] = pos;
|
||||
@@ -325,57 +258,47 @@ AddaSphericalSurface(const G4String& SurfaceName, G4double radius,
|
||||
ListOfVol2Name[ind] = "";
|
||||
AreaOfSurface[ind] = Area;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ListOfSurfaceName.push_back(SurfaceName);
|
||||
ListOfSurfaceType.push_back("Sphere");
|
||||
ListOfSurfaceType.emplace_back("Sphere");
|
||||
ListOfSphereRadius.push_back(radius);
|
||||
ListOfSphereCenter.push_back(pos);
|
||||
ListOfVol1Name.push_back("");
|
||||
ListOfVol2Name.push_back("");
|
||||
ListOfVol1Name.emplace_back("");
|
||||
ListOfVol2Name.emplace_back("");
|
||||
AreaOfSurface.push_back(Area);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String& SurfaceName,
|
||||
G4double radius,
|
||||
const G4String& volume_name,
|
||||
G4ThreeVector& center,
|
||||
G4double& area)
|
||||
{
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(
|
||||
const G4String& SurfaceName, G4double radius, const G4String& volume_name, G4ThreeVector& center,
|
||||
G4double& area)
|
||||
{
|
||||
G4VPhysicalVolume* thePhysicalVolume = nullptr;
|
||||
G4PhysicalVolumeStore* thePhysVolStore = G4PhysicalVolumeStore::GetInstance();
|
||||
thePhysicalVolume = thePhysVolStore->GetVolume(volume_name);
|
||||
if (thePhysicalVolume != nullptr)
|
||||
{
|
||||
if (thePhysicalVolume != nullptr) {
|
||||
G4VPhysicalVolume* daughter = thePhysicalVolume;
|
||||
G4LogicalVolume* mother = thePhysicalVolume->GetMotherLogical();
|
||||
G4AffineTransform theTransformationFromPhysVolToWorld = G4AffineTransform();
|
||||
while (mother != nullptr)
|
||||
{
|
||||
while (mother != nullptr) {
|
||||
theTransformationFromPhysVolToWorld *=
|
||||
G4AffineTransform(daughter->GetFrameRotation(),
|
||||
daughter->GetObjectTranslation());
|
||||
for ( std::size_t i=0; i<thePhysVolStore->size(); ++i)
|
||||
{
|
||||
if ((*thePhysVolStore)[i]->GetLogicalVolume() == mother)
|
||||
{
|
||||
G4AffineTransform(daughter->GetFrameRotation(), daughter->GetObjectTranslation());
|
||||
for (std::size_t i = 0; i < thePhysVolStore->size(); ++i) {
|
||||
if ((*thePhysVolStore)[i]->GetLogicalVolume() == mother) {
|
||||
daughter = (*thePhysVolStore)[i];
|
||||
mother =daughter->GetMotherLogical();
|
||||
mother = daughter->GetMotherLogical();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
center = theTransformationFromPhysVolToWorld.NetTranslation();
|
||||
G4cout << "Center of the spherical surface is at the position: "
|
||||
<< center/cm << " cm" << G4endl;
|
||||
G4cout << "Center of the spherical surface is at the position: " << center / cm << " cm"
|
||||
<< G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return AddaSphericalSurface(SurfaceName, radius, center, area);
|
||||
@@ -383,39 +306,35 @@ AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String& SurfaceName,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
AddanExtSurfaceOfAvolume(const G4String& SurfaceName,
|
||||
const G4String& volume_name, G4double& Area)
|
||||
G4bool G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(
|
||||
const G4String& SurfaceName, const G4String& volume_name, G4double& Area)
|
||||
{
|
||||
G4int ind = FindRegisteredSurface(SurfaceName);
|
||||
|
||||
G4VPhysicalVolume* thePhysicalVolume = nullptr;
|
||||
G4PhysicalVolumeStore* thePhysVolStore = G4PhysicalVolumeStore::GetInstance();
|
||||
thePhysicalVolume = thePhysVolStore->GetVolume(volume_name);
|
||||
if (thePhysicalVolume == nullptr)
|
||||
{
|
||||
if (thePhysicalVolume == nullptr) {
|
||||
return false;
|
||||
}
|
||||
Area = thePhysicalVolume->GetLogicalVolume()->GetSolid()->GetSurfaceArea();
|
||||
G4String mother_vol_name = "";
|
||||
G4String mother_vol_name = "";
|
||||
G4LogicalVolume* theMother = thePhysicalVolume->GetMotherLogical();
|
||||
|
||||
if (theMother != nullptr) mother_vol_name= theMother->GetName();
|
||||
if (ind>=0)
|
||||
{
|
||||
|
||||
if (theMother != nullptr) mother_vol_name = theMother->GetName();
|
||||
if (ind >= 0) {
|
||||
ListOfSurfaceType[ind] = "ExternalSurfaceOfAVolume";
|
||||
ListOfSphereRadius[ind] = 0.;
|
||||
ListOfSphereCenter[ind] = G4ThreeVector(0.,0.,0.);
|
||||
ListOfSphereCenter[ind] = G4ThreeVector(0., 0., 0.);
|
||||
ListOfVol1Name[ind] = volume_name;
|
||||
ListOfVol2Name[ind] = mother_vol_name;
|
||||
AreaOfSurface[ind] = Area;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ListOfSurfaceName.push_back(SurfaceName);
|
||||
ListOfSurfaceType.push_back("ExternalSurfaceOfAVolume");
|
||||
ListOfSurfaceType.emplace_back("ExternalSurfaceOfAVolume");
|
||||
ListOfSphereRadius.push_back(0.);
|
||||
ListOfSphereCenter.push_back(G4ThreeVector(0.,0.,0.));
|
||||
ListOfSphereCenter.emplace_back(0., 0., 0.);
|
||||
ListOfVol1Name.push_back(volume_name);
|
||||
ListOfVol2Name.push_back(mother_vol_name);
|
||||
AreaOfSurface.push_back(Area);
|
||||
@@ -425,28 +344,24 @@ AddanExtSurfaceOfAvolume(const G4String& SurfaceName,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::
|
||||
AddanInterfaceBetweenTwoVolumes(const G4String& SurfaceName,
|
||||
const G4String& volume_name1,
|
||||
const G4String& volume_name2, G4double& Area)
|
||||
G4bool G4AdjointCrossSurfChecker::AddanInterfaceBetweenTwoVolumes(const G4String& SurfaceName,
|
||||
const G4String& volume_name1, const G4String& volume_name2, G4double& Area)
|
||||
{
|
||||
G4int ind = FindRegisteredSurface(SurfaceName);
|
||||
Area = -1.; // the way to compute the surface is not known yet
|
||||
if (ind>=0)
|
||||
{
|
||||
Area = -1.; // the way to compute the surface is not known yet
|
||||
if (ind >= 0) {
|
||||
ListOfSurfaceType[ind] = "BoundaryBetweenTwoVolumes";
|
||||
ListOfSphereRadius[ind] = 0.;
|
||||
ListOfSphereCenter[ind] = G4ThreeVector(0.,0.,0.);
|
||||
ListOfSphereCenter[ind] = G4ThreeVector(0., 0., 0.);
|
||||
ListOfVol1Name[ind] = volume_name1;
|
||||
ListOfVol2Name[ind] = volume_name2;
|
||||
AreaOfSurface[ind] = Area;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ListOfSurfaceName.push_back(SurfaceName);
|
||||
ListOfSurfaceType.push_back("BoundaryBetweenTwoVolumes");
|
||||
ListOfSurfaceType.emplace_back("BoundaryBetweenTwoVolumes");
|
||||
ListOfSphereRadius.push_back(0.);
|
||||
ListOfSphereCenter.push_back(G4ThreeVector(0.,0.,0.));
|
||||
ListOfSphereCenter.emplace_back(0., 0., 0.);
|
||||
ListOfVol1Name.push_back(volume_name1);
|
||||
ListOfVol2Name.push_back(volume_name2);
|
||||
AreaOfSurface.push_back(Area);
|
||||
@@ -470,9 +385,8 @@ void G4AdjointCrossSurfChecker::ClearListOfSelectedSurface()
|
||||
//
|
||||
G4int G4AdjointCrossSurfChecker::FindRegisteredSurface(const G4String& name)
|
||||
{
|
||||
for (std::size_t i=0; i<ListOfSurfaceName.size(); ++i)
|
||||
{
|
||||
if (name == ListOfSurfaceName[i]) return G4int(i);
|
||||
for (std::size_t i = 0; i < ListOfSurfaceName.size(); ++i) {
|
||||
if (name == ListOfSurfaceName[i]) return G4int(i);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -31,22 +31,17 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4AdjointSteppingAction.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
#include "G4AdjointCrossSurfChecker.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSteppingAction::G4AdjointSteppingAction()
|
||||
{
|
||||
theG4AdjointCrossSurfChecker = G4AdjointCrossSurfChecker::GetInstance();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSteppingAction::~G4AdjointSteppingAction()
|
||||
{
|
||||
theG4AdjointCrossSurfChecker = G4AdjointCrossSurfChecker::GetInstance();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -54,15 +49,13 @@ G4AdjointSteppingAction::~G4AdjointSteppingAction()
|
||||
void G4AdjointSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
G4Track* aTrack = aStep->GetTrack();
|
||||
if(!is_adjoint_tracking_mode) // forward tracking mode
|
||||
if (! is_adjoint_tracking_mode) // forward tracking mode
|
||||
{
|
||||
if (!did_one_adj_part_reach_ext_source_during_event)
|
||||
{
|
||||
if (! did_one_adj_part_reach_ext_source_during_event) {
|
||||
aTrack->SetTrackStatus(fStopAndKill);
|
||||
return;
|
||||
}
|
||||
if(theUserFwdSteppingAction)
|
||||
{
|
||||
if (theUserFwdSteppingAction != nullptr) {
|
||||
theUserFwdSteppingAction->UserSteppingAction(aStep);
|
||||
}
|
||||
return;
|
||||
@@ -72,29 +65,26 @@ void G4AdjointSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
// --------------------------------------------
|
||||
|
||||
did_adj_part_reach_ext_source = false;
|
||||
if (theUserAdjointSteppingAction)
|
||||
{
|
||||
if (theUserAdjointSteppingAction != nullptr) {
|
||||
theUserAdjointSteppingAction->UserSteppingAction(aStep);
|
||||
}
|
||||
|
||||
G4double nb_nuc = 1.;
|
||||
G4ParticleDefinition* thePartDef = aTrack->GetDefinition();
|
||||
|
||||
if (thePartDef->GetParticleType() == "adjoint_nucleus")
|
||||
{
|
||||
|
||||
if (thePartDef->GetParticleType() == "adjoint_nucleus") {
|
||||
nb_nuc = G4double(thePartDef->GetBaryonNumber());
|
||||
}
|
||||
|
||||
// Kill conditions for adjoint particles reaching the maximum energy
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
if(aTrack->GetKineticEnergy() >= ext_sourceEMax*nb_nuc)
|
||||
{
|
||||
if (aTrack->GetKineticEnergy() >= ext_sourceEMax * nb_nuc) {
|
||||
aTrack->SetTrackStatus(fStopAndKill);
|
||||
did_adj_part_reach_ext_source = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Kill conditions for surface crossing
|
||||
// --------------------------------------
|
||||
|
||||
@@ -102,12 +92,10 @@ void G4AdjointSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
G4double cos_to_surface;
|
||||
G4bool GoingIn;
|
||||
G4ThreeVector crossing_pos;
|
||||
if (theG4AdjointCrossSurfChecker
|
||||
->CrossingOneOfTheRegisteredSurface(aStep, surface_name,
|
||||
crossing_pos, cos_to_surface, GoingIn))
|
||||
if (theG4AdjointCrossSurfChecker->CrossingOneOfTheRegisteredSurface(
|
||||
aStep, surface_name, crossing_pos, cos_to_surface, GoingIn))
|
||||
{
|
||||
if (surface_name == "ExternalSource")
|
||||
{
|
||||
if (surface_name == "ExternalSource") {
|
||||
// Registering still needed
|
||||
did_adj_part_reach_ext_source = true;
|
||||
did_one_adj_part_reach_ext_source_during_event = true;
|
||||
@@ -121,22 +109,20 @@ void G4AdjointSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
last_pos = crossing_pos;
|
||||
return;
|
||||
}
|
||||
else if (surface_name == "AdjointSource" && GoingIn)
|
||||
{
|
||||
if (surface_name == "AdjointSource" && GoingIn) {
|
||||
did_adj_part_reach_ext_source = false;
|
||||
aTrack->SetTrackStatus(fStopAndKill);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for reaching out of world
|
||||
//
|
||||
if (aStep->GetPostStepPoint()->GetStepStatus() == fWorldBoundary)
|
||||
{
|
||||
if (aStep->GetPostStepPoint()->GetStepStatus() == fWorldBoundary) {
|
||||
did_adj_part_reach_ext_source = true;
|
||||
did_one_adj_part_reach_ext_source_during_event = true;
|
||||
last_momentum =aTrack->GetMomentum();
|
||||
last_ekin=aTrack->GetKineticEnergy();
|
||||
last_momentum = aTrack->GetMomentum();
|
||||
last_ekin = aTrack->GetKineticEnergy();
|
||||
last_weight = aTrack->GetWeight();
|
||||
last_part_def = aTrack->GetDefinition();
|
||||
last_pos = crossing_pos;
|
||||
|
||||
@@ -31,39 +31,29 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4AdjointTrackingAction.hh"
|
||||
|
||||
#include "G4AdjointSteppingAction.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4AdjointSteppingAction.hh"
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
G4AdjointTrackingAction::
|
||||
G4AdjointTrackingAction(G4AdjointSteppingAction* anAction)
|
||||
G4AdjointTrackingAction::G4AdjointTrackingAction(G4AdjointSteppingAction* anAction)
|
||||
: theAdjointSteppingAction(anAction)
|
||||
{
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
G4AdjointTrackingAction::~G4AdjointTrackingAction()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
void G4AdjointTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
G4String partType = aTrack->GetParticleDefinition()->GetParticleType();
|
||||
if (G4StrUtil::contains(partType, "adjoint"))
|
||||
{
|
||||
if (G4StrUtil::contains(partType, "adjoint")) {
|
||||
is_adjoint_tracking_mode = true;
|
||||
theAdjointSteppingAction->SetPrimWeight(aTrack->GetWeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
is_adjoint_tracking_mode = false;
|
||||
if (theUserFwdTrackingAction)
|
||||
{
|
||||
if (theUserFwdTrackingAction != nullptr) {
|
||||
theUserFwdTrackingAction->PreUserTrackingAction(aTrack);
|
||||
}
|
||||
}
|
||||
@@ -79,40 +69,33 @@ void G4AdjointTrackingAction::PostUserTrackingAction(const G4Track* aTrack)
|
||||
last_weight = theAdjointSteppingAction->GetLastWeight();
|
||||
last_ekin = theAdjointSteppingAction->GetLastEkin();
|
||||
|
||||
if(!is_adjoint_tracking_mode)
|
||||
{
|
||||
if (theUserFwdTrackingAction != nullptr)
|
||||
{
|
||||
if (! is_adjoint_tracking_mode) {
|
||||
if (theUserFwdTrackingAction != nullptr) {
|
||||
theUserFwdTrackingAction->PostUserTrackingAction(aTrack);
|
||||
}
|
||||
}
|
||||
else if (theAdjointSteppingAction->GetDidAdjParticleReachTheExtSource())
|
||||
{
|
||||
else if (theAdjointSteppingAction->GetDidAdjParticleReachTheExtSource()) {
|
||||
last_pos = theAdjointSteppingAction->GetLastPosition();
|
||||
last_direction = theAdjointSteppingAction->GetLastMomentum();
|
||||
last_direction /=last_direction.mag();
|
||||
last_direction /= last_direction.mag();
|
||||
last_cos_th = last_direction.z();
|
||||
G4ParticleDefinition* aPartDef= theAdjointSteppingAction->GetLastPartDef();
|
||||
last_fwd_part_name= aPartDef->GetParticleName();
|
||||
last_fwd_part_name.erase(0,4);
|
||||
last_fwd_part_PDGEncoding=G4ParticleTable::GetParticleTable()
|
||||
->FindParticle(last_fwd_part_name)->GetPDGEncoding();
|
||||
G4ParticleDefinition* aPartDef = theAdjointSteppingAction->GetLastPartDef();
|
||||
last_fwd_part_name = aPartDef->GetParticleName();
|
||||
last_fwd_part_name.erase(0, 4);
|
||||
last_fwd_part_PDGEncoding =
|
||||
G4ParticleTable::GetParticleTable()->FindParticle(last_fwd_part_name)->GetPDGEncoding();
|
||||
last_ekin = theAdjointSteppingAction->GetLastEkin();
|
||||
last_ekin_nuc = last_ekin;
|
||||
if (aPartDef->GetParticleType() == "adjoint_nucleus")
|
||||
{
|
||||
G4double nb_nuc = G4double(aPartDef->GetBaryonNumber());
|
||||
if (aPartDef->GetParticleType() == "adjoint_nucleus") {
|
||||
auto nb_nuc = G4double(aPartDef->GetBaryonNumber());
|
||||
last_ekin_nuc /= nb_nuc;
|
||||
}
|
||||
|
||||
last_fwd_part_index = -1;
|
||||
std::size_t i = 0;
|
||||
while(i< pListOfPrimaryFwdParticles->size() && last_fwd_part_index<0)
|
||||
{
|
||||
if ((*pListOfPrimaryFwdParticles)[i]->GetParticleName()
|
||||
== last_fwd_part_name)
|
||||
{
|
||||
last_fwd_part_index=(G4int)i;
|
||||
while (i < pListOfPrimaryFwdParticles->size() && last_fwd_part_index < 0) {
|
||||
if ((*pListOfPrimaryFwdParticles)[i]->GetParticleName() == last_fwd_part_name) {
|
||||
last_fwd_part_index = (G4int)i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
@@ -128,8 +111,7 @@ void G4AdjointTrackingAction::PostUserTrackingAction(const G4Track* aTrack)
|
||||
last_fwd_part_PDGEncoding_vec.push_back(last_fwd_part_PDGEncoding);
|
||||
last_fwd_part_index_vec.push_back(last_fwd_part_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,17 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include <G4MultiSteppingAction.hh>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
void G4MultiSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
{
|
||||
std::for_each( begin(), end(),
|
||||
[step](G4UserSteppingActionUPtr& e) { e->UserSteppingAction(step); }
|
||||
);
|
||||
std::for_each(
|
||||
begin(), end(), [step](G4UserSteppingActionUPtr& e) { e->UserSteppingAction(step); });
|
||||
}
|
||||
|
||||
void G4MultiSteppingAction::SetSteppingManagerPointer(G4SteppingManager* pVal)
|
||||
{
|
||||
std::for_each( begin(), end(),
|
||||
[pVal](G4UserSteppingActionUPtr& e) { e->SetSteppingManagerPointer(pVal); }
|
||||
);
|
||||
std::for_each(
|
||||
begin(), end(), [pVal](G4UserSteppingActionUPtr& e) { e->SetSteppingManagerPointer(pVal); });
|
||||
}
|
||||
|
||||
@@ -29,25 +29,23 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4MultiTrackingAction.hh"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
void G4MultiTrackingAction::SetTrackingManagerPointer(G4TrackingManager* pVal)
|
||||
{
|
||||
std::for_each( begin(), end(),
|
||||
[pVal](G4UserTrackingActionUPtr& e) { e->SetTrackingManagerPointer(pVal); }
|
||||
);
|
||||
std::for_each(
|
||||
begin(), end(), [pVal](G4UserTrackingActionUPtr& e) { e->SetTrackingManagerPointer(pVal); });
|
||||
}
|
||||
|
||||
void G4MultiTrackingAction::PreUserTrackingAction(const G4Track* trk)
|
||||
{
|
||||
std::for_each( begin(), end(),
|
||||
[trk](G4UserTrackingActionUPtr& e) { e->PreUserTrackingAction(trk); }
|
||||
);
|
||||
std::for_each(
|
||||
begin(), end(), [trk](G4UserTrackingActionUPtr& e) { e->PreUserTrackingAction(trk); });
|
||||
}
|
||||
|
||||
void G4MultiTrackingAction::PostUserTrackingAction(const G4Track* trk)
|
||||
{
|
||||
std::for_each( begin(), end(),
|
||||
[trk](G4UserTrackingActionUPtr& e) { e->PostUserTrackingAction(trk); }
|
||||
);
|
||||
std::for_each(
|
||||
begin(), end(), [trk](G4UserTrackingActionUPtr& e) { e->PostUserTrackingAction(trk); });
|
||||
}
|
||||
|
||||
@@ -37,18 +37,19 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4RichTrajectory.hh"
|
||||
#include "G4RichTrajectoryPoint.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4PhysicsModelCatalog.hh"
|
||||
#include "G4RichTrajectoryPoint.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4PhysicsModelCatalog.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
@@ -59,10 +60,6 @@ G4Allocator<G4RichTrajectory>*& aRichTrajectoryAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4RichTrajectory::G4RichTrajectory()
|
||||
{
|
||||
}
|
||||
|
||||
G4RichTrajectory::G4RichTrajectory(const G4Track* aTrack)
|
||||
: G4Trajectory(aTrack) // Note: this initialises the base class data
|
||||
// members and, unfortunately but never mind,
|
||||
@@ -92,8 +89,7 @@ G4RichTrajectory::G4RichTrajectory(const G4Track* aTrack)
|
||||
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(aTrack));
|
||||
}
|
||||
|
||||
G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right)
|
||||
: G4Trajectory(right)
|
||||
G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right) : G4Trajectory(right)
|
||||
{
|
||||
fpInitialVolume = right.fpInitialVolume;
|
||||
fpInitialNextVolume = right.fpInitialNextVolume;
|
||||
@@ -104,21 +100,17 @@ G4RichTrajectory::G4RichTrajectory(G4RichTrajectory& right)
|
||||
fpEndingProcess = right.fpEndingProcess;
|
||||
fFinalKineticEnergy = right.fFinalKineticEnergy;
|
||||
fpRichPointsContainer = new RichTrajectoryPointsContainer;
|
||||
for(std::size_t i=0; i<right.fpRichPointsContainer->size(); ++i)
|
||||
{
|
||||
G4RichTrajectoryPoint* rightPoint =
|
||||
(G4RichTrajectoryPoint*)((*(right.fpRichPointsContainer))[i]);
|
||||
for (auto& i : *right.fpRichPointsContainer) {
|
||||
auto rightPoint = (G4RichTrajectoryPoint*)i;
|
||||
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
G4RichTrajectory::~G4RichTrajectory()
|
||||
{
|
||||
if (fpRichPointsContainer)
|
||||
{
|
||||
for(std::size_t i=0; i<fpRichPointsContainer->size(); ++i)
|
||||
{
|
||||
delete (*fpRichPointsContainer)[i];
|
||||
if (fpRichPointsContainer != nullptr) {
|
||||
for (auto& i : *fpRichPointsContainer) {
|
||||
delete i;
|
||||
}
|
||||
fpRichPointsContainer->clear();
|
||||
delete fpRichPointsContainer;
|
||||
@@ -134,24 +126,22 @@ void G4RichTrajectory::AppendStep(const G4Step* aStep)
|
||||
//
|
||||
const G4Track* track = aStep->GetTrack();
|
||||
const G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
|
||||
if (track->GetCurrentStepNumber() > 0)
|
||||
{
|
||||
if (track->GetCurrentStepNumber() > 0) {
|
||||
fpFinalVolume = track->GetTouchableHandle();
|
||||
fpFinalNextVolume = track->GetNextTouchableHandle();
|
||||
fpEndingProcess = postStepPoint->GetProcessDefinedStep();
|
||||
fFinalKineticEnergy = aStep->GetPreStepPoint()->GetKineticEnergy()
|
||||
- aStep->GetTotalEnergyDeposit();
|
||||
fFinalKineticEnergy =
|
||||
aStep->GetPreStepPoint()->GetKineticEnergy() - aStep->GetTotalEnergyDeposit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4RichTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if(secondTrajectory == nullptr) return;
|
||||
if (secondTrajectory == nullptr) return;
|
||||
|
||||
G4RichTrajectory* seco = (G4RichTrajectory*)secondTrajectory;
|
||||
auto seco = (G4RichTrajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
for(G4int i=1; i<ent; ++i)
|
||||
{
|
||||
for (G4int i = 1; i < ent; ++i) {
|
||||
// initial point of the second trajectory should not be merged
|
||||
//
|
||||
fpRichPointsContainer->push_back((*(seco->fpRichPointsContainer))[i]);
|
||||
@@ -178,13 +168,11 @@ void G4RichTrajectory::DrawTrajectory() const
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
const std::map<G4String,G4AttDef>* G4RichTrajectory::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* G4RichTrajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4RichTrajectory",isNew);
|
||||
if (isNew)
|
||||
{
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4RichTrajectory", isNew);
|
||||
if (isNew) {
|
||||
// Get att defs from base class...
|
||||
//
|
||||
*store = *(G4Trajectory::GetAttDefs());
|
||||
@@ -192,48 +180,37 @@ const std::map<G4String,G4AttDef>* G4RichTrajectory::GetAttDefs() const
|
||||
G4String ID;
|
||||
|
||||
ID = "IVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Initial Volume Path",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Initial Volume Path", "Physics", "", "G4String");
|
||||
|
||||
ID = "INVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Initial Next Volume Path",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Initial Next Volume Path", "Physics", "", "G4String");
|
||||
|
||||
ID = "CPN";
|
||||
(*store)[ID] = G4AttDef(ID,"Creator Process Name",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Creator Process Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "CPTN";
|
||||
(*store)[ID] = G4AttDef(ID,"Creator Process Type Name",
|
||||
"Physics","","G4String");
|
||||
|
||||
(*store)[ID] = G4AttDef(ID, "Creator Process Type Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "CMID";
|
||||
(*store)[ID] = G4AttDef(ID,"Creator Model ID",
|
||||
"Physics","","G4int");
|
||||
(*store)[ID] = G4AttDef(ID, "Creator Model ID", "Physics", "", "G4int");
|
||||
|
||||
ID = "CMN";
|
||||
(*store)[ID] = G4AttDef(ID,"Creator Model Name",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Creator Model Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "FVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Final Volume Path",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Final Volume Path", "Physics", "", "G4String");
|
||||
|
||||
ID = "FNVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Final Next Volume Path",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Final Next Volume Path", "Physics", "", "G4String");
|
||||
|
||||
ID = "EPN";
|
||||
(*store)[ID] = G4AttDef(ID,"Ending Process Name",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Ending Process Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "EPTN";
|
||||
(*store)[ID] = G4AttDef(ID,"Ending Process Type Name",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Ending Process Type Name", "Physics", "", "G4String");
|
||||
|
||||
ID = "FKE";
|
||||
(*store)[ID] = G4AttDef(ID,"Final kinetic energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[ID] = G4AttDef(ID, "Final kinetic energy", "Physics", "G4BestUnit", "G4double");
|
||||
}
|
||||
|
||||
return store;
|
||||
@@ -243,10 +220,8 @@ static G4String Path(const G4TouchableHandle& th)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
G4int depth = th->GetHistoryDepth();
|
||||
for (G4int i = depth; i >= 0; --i)
|
||||
{
|
||||
oss << th->GetVolume(i)->GetName()
|
||||
<< ':' << th->GetCopyNumber(i);
|
||||
for (G4int i = depth; i >= 0; --i) {
|
||||
oss << th->GetVolume(i)->GetName() << ':' << th->GetCopyNumber(i);
|
||||
if (i != 0) oss << '/';
|
||||
}
|
||||
return oss.str();
|
||||
@@ -257,80 +232,63 @@ std::vector<G4AttValue>* G4RichTrajectory::CreateAttValues() const
|
||||
// Create base class att values...
|
||||
std::vector<G4AttValue>* values = G4Trajectory::CreateAttValues();
|
||||
|
||||
if (fpInitialVolume && fpInitialVolume->GetVolume())
|
||||
{
|
||||
values->push_back(G4AttValue("IVPath",Path(fpInitialVolume),""));
|
||||
if (fpInitialVolume && (fpInitialVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("IVPath", Path(fpInitialVolume), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("IVPath","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("IVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpInitialNextVolume && fpInitialNextVolume->GetVolume())
|
||||
{
|
||||
values->push_back(G4AttValue("INVPath",Path(fpInitialNextVolume),""));
|
||||
if (fpInitialNextVolume && (fpInitialNextVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("INVPath", Path(fpInitialNextVolume), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("INVPath","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("INVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpCreatorProcess != nullptr)
|
||||
{
|
||||
values->push_back
|
||||
(G4AttValue("CPN",fpCreatorProcess->GetProcessName(),""));
|
||||
if (fpCreatorProcess != nullptr) {
|
||||
values->push_back(G4AttValue("CPN", fpCreatorProcess->GetProcessName(), ""));
|
||||
G4ProcessType type = fpCreatorProcess->GetProcessType();
|
||||
values->push_back
|
||||
(G4AttValue("CPTN",G4VProcess::GetProcessTypeName(type),""));
|
||||
values->push_back
|
||||
(G4AttValue("CMID",G4UIcommand::ConvertToString(fCreatorModelID),""));
|
||||
const G4String& creatorModelName =
|
||||
G4PhysicsModelCatalog::GetModelNameFromID(fCreatorModelID);
|
||||
values->push_back(G4AttValue("CMN",creatorModelName,""));
|
||||
values->push_back(G4AttValue("CPTN", G4VProcess::GetProcessTypeName(type), ""));
|
||||
values->push_back(G4AttValue("CMID", G4UIcommand::ConvertToString(fCreatorModelID), ""));
|
||||
const G4String& creatorModelName = G4PhysicsModelCatalog::GetModelNameFromID(fCreatorModelID);
|
||||
values->push_back(G4AttValue("CMN", creatorModelName, ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("CPN","None",""));
|
||||
values->push_back(G4AttValue("CPTN","None",""));
|
||||
values->push_back(G4AttValue("CMID","None",""));
|
||||
values->push_back(G4AttValue("CMN","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("CPN", "None", ""));
|
||||
values->push_back(G4AttValue("CPTN", "None", ""));
|
||||
values->push_back(G4AttValue("CMID", "None", ""));
|
||||
values->push_back(G4AttValue("CMN", "None", ""));
|
||||
}
|
||||
|
||||
if (fpFinalVolume && fpFinalVolume->GetVolume())
|
||||
{
|
||||
values->push_back(G4AttValue("FVPath",Path(fpFinalVolume),""));
|
||||
if (fpFinalVolume && (fpFinalVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("FVPath", Path(fpFinalVolume), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("FVPath","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("FVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpFinalNextVolume && fpFinalNextVolume->GetVolume())
|
||||
{
|
||||
values->push_back(G4AttValue("FNVPath",Path(fpFinalNextVolume),""));
|
||||
if (fpFinalNextVolume && (fpFinalNextVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("FNVPath", Path(fpFinalNextVolume), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("FNVPath","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("FNVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpEndingProcess != nullptr)
|
||||
{
|
||||
values->push_back(G4AttValue("EPN",fpEndingProcess->GetProcessName(),""));
|
||||
if (fpEndingProcess != nullptr) {
|
||||
values->push_back(G4AttValue("EPN", fpEndingProcess->GetProcessName(), ""));
|
||||
G4ProcessType type = fpEndingProcess->GetProcessType();
|
||||
values->push_back(G4AttValue("EPTN",G4VProcess::GetProcessTypeName(type),""));
|
||||
values->push_back(G4AttValue("EPTN", G4VProcess::GetProcessTypeName(type), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("EPN","None",""));
|
||||
values->push_back(G4AttValue("EPTN","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("EPN", "None", ""));
|
||||
values->push_back(G4AttValue("EPTN", "None", ""));
|
||||
}
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("FKE",G4BestUnit(fFinalKineticEnergy,"Energy"),""));
|
||||
values->push_back(G4AttValue("FKE", G4BestUnit(fFinalKineticEnergy, "Energy"), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
|
||||
@@ -38,18 +38,17 @@
|
||||
|
||||
#include "G4RichTrajectoryPoint.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
@@ -60,9 +59,7 @@ G4Allocator<G4RichTrajectoryPoint>*& aRichTrajectoryPointAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint()
|
||||
{
|
||||
}
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint() = default;
|
||||
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Track* aTrack)
|
||||
: G4TrajectoryPoint(aTrack->GetPosition()),
|
||||
@@ -72,8 +69,7 @@ G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Track* aTrack)
|
||||
fpPostStepPointVolume(aTrack->GetNextTouchableHandle()),
|
||||
fPreStepPointWeight(aTrack->GetWeight()),
|
||||
fPostStepPointWeight(aTrack->GetWeight())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Step* aStep)
|
||||
: G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition()),
|
||||
@@ -86,8 +82,7 @@ G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Step* aStep)
|
||||
{
|
||||
fRemainingEnergy = aStep->GetTrack()->GetKineticEnergy();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
fRemainingEnergy = preStepPoint->GetKineticEnergy() - fTotEDep;
|
||||
}
|
||||
fpProcess = postStepPoint->GetProcessDefinedStep();
|
||||
@@ -101,79 +96,50 @@ G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Step* aStep)
|
||||
fPostStepPointWeight = postStepPoint->GetWeight();
|
||||
}
|
||||
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint( const G4RichTrajectoryPoint &r )
|
||||
: G4TrajectoryPoint(r),
|
||||
fpAuxiliaryPointVector(r.fpAuxiliaryPointVector),
|
||||
fTotEDep(r.fTotEDep),
|
||||
fRemainingEnergy(r.fRemainingEnergy),
|
||||
fpProcess(r.fpProcess),
|
||||
fPreStepPointStatus(r.fPreStepPointStatus),
|
||||
fPostStepPointStatus(r.fPostStepPointStatus),
|
||||
fPreStepPointGlobalTime(r.fPreStepPointGlobalTime),
|
||||
fPostStepPointGlobalTime(r.fPostStepPointGlobalTime),
|
||||
fpPreStepPointVolume(r.fpPreStepPointVolume),
|
||||
fpPostStepPointVolume(r.fpPostStepPointVolume),
|
||||
fPreStepPointWeight(r.fPreStepPointWeight),
|
||||
fPostStepPointWeight(r.fPostStepPointWeight)
|
||||
{
|
||||
}
|
||||
// This is certainly wrong. the fpAuxiliaryPointVector is owned by this class,
|
||||
// and must be deep copied. Note also the copy-assignment operator is deleted.
|
||||
// However, G4RichTrajectory requires a copy constructor....
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4RichTrajectoryPoint& r) = default;
|
||||
|
||||
G4RichTrajectoryPoint::~G4RichTrajectoryPoint()
|
||||
{
|
||||
delete fpAuxiliaryPointVector;
|
||||
}
|
||||
G4RichTrajectoryPoint::~G4RichTrajectoryPoint() { delete fpAuxiliaryPointVector; }
|
||||
|
||||
const std::map<G4String,G4AttDef>* G4RichTrajectoryPoint::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* G4RichTrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4RichTrajectoryPoint",isNew);
|
||||
if (isNew)
|
||||
{
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4RichTrajectoryPoint", isNew);
|
||||
if (isNew) {
|
||||
// Copy base class att defs...
|
||||
*store = *(G4TrajectoryPoint::GetAttDefs());
|
||||
|
||||
G4String ID;
|
||||
|
||||
ID = "Aux";
|
||||
(*store)[ID] = G4AttDef(ID, "Auxiliary Point Position",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
(*store)[ID] =
|
||||
G4AttDef(ID, "Auxiliary Point Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
ID = "TED";
|
||||
(*store)[ID] = G4AttDef(ID,"Total Energy Deposit",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[ID] = G4AttDef(ID, "Total Energy Deposit", "Physics", "G4BestUnit", "G4double");
|
||||
ID = "RE";
|
||||
(*store)[ID] = G4AttDef(ID,"Remaining Energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[ID] = G4AttDef(ID, "Remaining Energy", "Physics", "G4BestUnit", "G4double");
|
||||
ID = "PDS";
|
||||
(*store)[ID] = G4AttDef(ID,"Process Defined Step",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Process Defined Step", "Physics", "", "G4String");
|
||||
ID = "PTDS";
|
||||
(*store)[ID] = G4AttDef(ID,"Process Type Defined Step",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Process Type Defined Step", "Physics", "", "G4String");
|
||||
ID = "PreStatus";
|
||||
(*store)[ID] = G4AttDef(ID,"Pre-step-point status",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Pre-step-point status", "Physics", "", "G4String");
|
||||
ID = "PostStatus";
|
||||
(*store)[ID] = G4AttDef(ID,"Post-step-point status",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Post-step-point status", "Physics", "", "G4String");
|
||||
ID = "PreT";
|
||||
(*store)[ID] = G4AttDef(ID,"Pre-step-point global time",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[ID] = G4AttDef(ID, "Pre-step-point global time", "Physics", "G4BestUnit", "G4double");
|
||||
ID = "PostT";
|
||||
(*store)[ID] = G4AttDef(ID,"Post-step-point global time",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[ID] = G4AttDef(ID, "Post-step-point global time", "Physics", "G4BestUnit", "G4double");
|
||||
ID = "PreVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Pre-step Volume Path",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Pre-step Volume Path", "Physics", "", "G4String");
|
||||
ID = "PostVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Post-step Volume Path",
|
||||
"Physics","","G4String");
|
||||
(*store)[ID] = G4AttDef(ID, "Post-step Volume Path", "Physics", "", "G4String");
|
||||
ID = "PreW";
|
||||
(*store)[ID] = G4AttDef(ID,"Pre-step-point weight",
|
||||
"Physics","","G4double");
|
||||
(*store)[ID] = G4AttDef(ID, "Pre-step-point weight", "Physics", "", "G4double");
|
||||
ID = "PostW";
|
||||
(*store)[ID] = G4AttDef(ID,"Post-step-point weight",
|
||||
"Physics","","G4double");
|
||||
(*store)[ID] = G4AttDef(ID, "Post-step-point weight", "Physics", "", "G4double");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
@@ -181,17 +147,34 @@ const std::map<G4String,G4AttDef>* G4RichTrajectoryPoint::GetAttDefs() const
|
||||
static G4String Status(G4StepStatus stps)
|
||||
{
|
||||
G4String status;
|
||||
switch (stps)
|
||||
{
|
||||
case fWorldBoundary: status = "fWorldBoundary"; break;
|
||||
case fGeomBoundary: status = "fGeomBoundary"; break;
|
||||
case fAtRestDoItProc: status = "fAtRestDoItProc"; break;
|
||||
case fAlongStepDoItProc: status = "fAlongStepDoItProc"; break;
|
||||
case fPostStepDoItProc: status = "fPostStepDoItProc"; break;
|
||||
case fUserDefinedLimit: status = "fUserDefinedLimit"; break;
|
||||
case fExclusivelyForcedProc: status = "fExclusivelyForcedProc"; break;
|
||||
case fUndefined: status = "fUndefined"; break;
|
||||
default: status = "Not recognised"; break;
|
||||
switch (stps) {
|
||||
case fWorldBoundary:
|
||||
status = "fWorldBoundary";
|
||||
break;
|
||||
case fGeomBoundary:
|
||||
status = "fGeomBoundary";
|
||||
break;
|
||||
case fAtRestDoItProc:
|
||||
status = "fAtRestDoItProc";
|
||||
break;
|
||||
case fAlongStepDoItProc:
|
||||
status = "fAlongStepDoItProc";
|
||||
break;
|
||||
case fPostStepDoItProc:
|
||||
status = "fPostStepDoItProc";
|
||||
break;
|
||||
case fUserDefinedLimit:
|
||||
status = "fUserDefinedLimit";
|
||||
break;
|
||||
case fExclusivelyForcedProc:
|
||||
status = "fExclusivelyForcedProc";
|
||||
break;
|
||||
case fUndefined:
|
||||
status = "fUndefined";
|
||||
break;
|
||||
default:
|
||||
status = "Not recognised";
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -200,10 +183,8 @@ static G4String Path(const G4TouchableHandle& th)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
G4int depth = th->GetHistoryDepth();
|
||||
for (G4int i = depth; i >= 0; --i)
|
||||
{
|
||||
oss << th->GetVolume(i)->GetName()
|
||||
<< ':' << th->GetCopyNumber(i);
|
||||
for (G4int i = depth; i >= 0; --i) {
|
||||
oss << th->GetVolume(i)->GetName() << ':' << th->GetCopyNumber(i);
|
||||
if (i != 0) oss << '/';
|
||||
}
|
||||
return oss.str();
|
||||
@@ -215,72 +196,57 @@ std::vector<G4AttValue>* G4RichTrajectoryPoint::CreateAttValues() const
|
||||
|
||||
std::vector<G4AttValue>* values = G4TrajectoryPoint::CreateAttValues();
|
||||
|
||||
if (fpAuxiliaryPointVector != nullptr)
|
||||
{
|
||||
for (auto iAux = fpAuxiliaryPointVector->cbegin();
|
||||
iAux != fpAuxiliaryPointVector->cend(); ++iAux)
|
||||
{
|
||||
values->push_back(G4AttValue("Aux",G4BestUnit(*iAux,"Length"),""));
|
||||
if (fpAuxiliaryPointVector != nullptr) {
|
||||
for (const auto& iAux : *fpAuxiliaryPointVector) {
|
||||
values->push_back(G4AttValue("Aux", G4BestUnit(iAux, "Length"), ""));
|
||||
}
|
||||
}
|
||||
|
||||
values->push_back(G4AttValue("TED",G4BestUnit(fTotEDep,"Energy"),""));
|
||||
values->push_back(G4AttValue("RE",G4BestUnit(fRemainingEnergy,"Energy"),""));
|
||||
values->push_back(G4AttValue("TED", G4BestUnit(fTotEDep, "Energy"), ""));
|
||||
values->push_back(G4AttValue("RE", G4BestUnit(fRemainingEnergy, "Energy"), ""));
|
||||
|
||||
if (fpProcess != nullptr)
|
||||
{
|
||||
values->push_back
|
||||
(G4AttValue("PDS",fpProcess->GetProcessName(),""));
|
||||
values->push_back
|
||||
(G4AttValue
|
||||
("PTDS",G4VProcess::GetProcessTypeName(fpProcess->GetProcessType()),""));
|
||||
if (fpProcess != nullptr) {
|
||||
values->push_back(G4AttValue("PDS", fpProcess->GetProcessName(), ""));
|
||||
values->push_back(
|
||||
G4AttValue("PTDS", G4VProcess::GetProcessTypeName(fpProcess->GetProcessType()), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("PDS","None",""));
|
||||
values->push_back(G4AttValue("PTDS","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("PDS", "None", ""));
|
||||
values->push_back(G4AttValue("PTDS", "None", ""));
|
||||
}
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PreStatus",Status(fPreStepPointStatus),""));
|
||||
values->push_back(G4AttValue("PreStatus", Status(fPreStepPointStatus), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PostStatus",Status(fPostStepPointStatus),""));
|
||||
values->push_back(G4AttValue("PostStatus", Status(fPostStepPointStatus), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PreT",G4BestUnit(fPreStepPointGlobalTime,"Time"),""));
|
||||
values->push_back(G4AttValue("PreT", G4BestUnit(fPreStepPointGlobalTime, "Time"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PostT",G4BestUnit(fPostStepPointGlobalTime,"Time"),""));
|
||||
values->push_back(G4AttValue("PostT", G4BestUnit(fPostStepPointGlobalTime, "Time"), ""));
|
||||
|
||||
if (fpPreStepPointVolume && fpPreStepPointVolume->GetVolume())
|
||||
{
|
||||
values->push_back(G4AttValue("PreVPath",Path(fpPreStepPointVolume),""));
|
||||
if (fpPreStepPointVolume && (fpPreStepPointVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("PreVPath", Path(fpPreStepPointVolume), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("PreVPath","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("PreVPath", "None", ""));
|
||||
}
|
||||
|
||||
if (fpPostStepPointVolume && fpPostStepPointVolume->GetVolume())
|
||||
{
|
||||
values->push_back(G4AttValue("PostVPath",Path(fpPostStepPointVolume),""));
|
||||
if (fpPostStepPointVolume && (fpPostStepPointVolume->GetVolume() != nullptr)) {
|
||||
values->push_back(G4AttValue("PostVPath", Path(fpPostStepPointVolume), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
values->push_back(G4AttValue("PostVPath","None",""));
|
||||
else {
|
||||
values->push_back(G4AttValue("PostVPath", "None", ""));
|
||||
}
|
||||
|
||||
std::ostringstream oss1;
|
||||
oss1 << fPreStepPointWeight;
|
||||
values->push_back(G4AttValue("PreW",oss1.str(),""));
|
||||
values->push_back(G4AttValue("PreW", oss1.str(), ""));
|
||||
|
||||
std::ostringstream oss2;
|
||||
oss2 << fPostStepPointWeight;
|
||||
values->push_back(G4AttValue("PostW",oss2.str(),""));
|
||||
values->push_back(G4AttValue("PostW", oss2.str(), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
|
||||
@@ -33,17 +33,18 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4SmoothTrajectory.hh"
|
||||
#include "G4SmoothTrajectoryPoint.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4SmoothTrajectoryPoint.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<G4SmoothTrajectory>*& aSmoothTrajectoryAllocator()
|
||||
@@ -52,11 +53,6 @@ G4Allocator<G4SmoothTrajectory>*& aSmoothTrajectoryAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4SmoothTrajectory::G4SmoothTrajectory()
|
||||
: initialMomentum( G4ThreeVector() )
|
||||
{
|
||||
}
|
||||
|
||||
G4SmoothTrajectory::G4SmoothTrajectory(const G4Track* aTrack)
|
||||
{
|
||||
G4ParticleDefinition* fpParticleDefinition = aTrack->GetDefinition();
|
||||
@@ -71,18 +67,15 @@ G4SmoothTrajectory::G4SmoothTrajectory(const G4Track* aTrack)
|
||||
|
||||
// Following is for the first trajectory point
|
||||
//
|
||||
positionRecord
|
||||
->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition()));
|
||||
positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition()));
|
||||
|
||||
// The first point has no auxiliary points, so set the auxiliary
|
||||
// points vector to NULL
|
||||
//
|
||||
positionRecord
|
||||
->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition(), nullptr));
|
||||
positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition(), nullptr));
|
||||
}
|
||||
|
||||
G4SmoothTrajectory::G4SmoothTrajectory(G4SmoothTrajectory& right)
|
||||
: G4VTrajectory()
|
||||
{
|
||||
ParticleName = right.ParticleName;
|
||||
PDGCharge = right.PDGCharge;
|
||||
@@ -93,21 +86,17 @@ G4SmoothTrajectory::G4SmoothTrajectory(G4SmoothTrajectory& right)
|
||||
initialMomentum = right.initialMomentum;
|
||||
positionRecord = new G4TrajectoryPointContainer();
|
||||
|
||||
for(std::size_t i=0; i<right.positionRecord->size(); ++i)
|
||||
{
|
||||
G4SmoothTrajectoryPoint* rightPoint
|
||||
= (G4SmoothTrajectoryPoint*)((*(right.positionRecord))[i]);
|
||||
for (auto& i : *right.positionRecord) {
|
||||
auto rightPoint = (G4SmoothTrajectoryPoint*)i;
|
||||
positionRecord->push_back(new G4SmoothTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
G4SmoothTrajectory::~G4SmoothTrajectory()
|
||||
{
|
||||
if (positionRecord)
|
||||
{
|
||||
for(std::size_t i=0; i<positionRecord->size(); ++i)
|
||||
{
|
||||
delete (*positionRecord)[i];
|
||||
if (positionRecord != nullptr) {
|
||||
for (auto& i : *positionRecord) {
|
||||
delete i;
|
||||
}
|
||||
positionRecord->clear();
|
||||
delete positionRecord;
|
||||
@@ -132,79 +121,66 @@ void G4SmoothTrajectory::DrawTrajectory() const
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
const std::map<G4String,G4AttDef>* G4SmoothTrajectory::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* G4SmoothTrajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4SmoothTrajectory",isNew);
|
||||
if (isNew)
|
||||
{
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4SmoothTrajectory", isNew);
|
||||
if (isNew) {
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID,"Track ID","Physics","","G4int");
|
||||
(*store)[ID] = G4AttDef(ID, "Track ID", "Physics", "", "G4int");
|
||||
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID,"Parent ID","Physics","","G4int");
|
||||
(*store)[PID] = G4AttDef(PID, "Parent ID", "Physics", "", "G4int");
|
||||
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
|
||||
(*store)[PN] = G4AttDef(PN, "Particle Name", "Physics", "", "G4String");
|
||||
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch,"Charge","Physics","e+","G4double");
|
||||
(*store)[Ch] = G4AttDef(Ch, "Charge", "Physics", "e+", "G4double");
|
||||
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
|
||||
(*store)[PDG] = G4AttDef(PDG, "PDG Encoding", "Physics", "", "G4int");
|
||||
|
||||
G4String IKE("IKE");
|
||||
(*store)[IKE] = G4AttDef(IKE, "Initial kinetic energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[IKE] = G4AttDef(IKE, "Initial kinetic energy", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Initial momentum",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Initial momentum", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] = G4AttDef(IMag, "Initial momentum magnitude",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[IMag] =
|
||||
G4AttDef(IMag, "Initial momentum magnitude", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP,"No. of points","Physics","","G4int");
|
||||
(*store)[NTP] = G4AttDef(NTP, "No. of points", "Physics", "", "G4int");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
std::vector<G4AttValue>* G4SmoothTrajectory::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
|
||||
values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fTrackID), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PID",G4UIcommand::ConvertToString(fParentID),""));
|
||||
values->push_back(G4AttValue("PID", G4UIcommand::ConvertToString(fParentID), ""));
|
||||
|
||||
values->push_back(G4AttValue("PN",ParticleName,""));
|
||||
values->push_back(G4AttValue("PN", ParticleName, ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("Ch",G4UIcommand::ConvertToString(PDGCharge),""));
|
||||
values->push_back(G4AttValue("Ch", G4UIcommand::ConvertToString(PDGCharge), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PDG",G4UIcommand::ConvertToString(PDGEncoding),""));
|
||||
values->push_back(G4AttValue("PDG", G4UIcommand::ConvertToString(PDGEncoding), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IKE",G4BestUnit(initialKineticEnergy,"Energy"),""));
|
||||
values->push_back(G4AttValue("IKE", G4BestUnit(initialKineticEnergy, "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMom",G4BestUnit(initialMomentum,"Energy"),""));
|
||||
values->push_back(G4AttValue("IMom", G4BestUnit(initialMomentum, "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMag",G4BestUnit(initialMomentum.mag(),"Energy"),""));
|
||||
values->push_back(G4AttValue("IMag", G4BestUnit(initialMomentum.mag(), "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("NTP",G4UIcommand::ConvertToString(GetPointEntries()),""));
|
||||
values->push_back(G4AttValue("NTP", G4UIcommand::ConvertToString(GetPointEntries()), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
@@ -212,27 +188,25 @@ std::vector<G4AttValue>* G4SmoothTrajectory::CreateAttValues() const
|
||||
|
||||
void G4SmoothTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
positionRecord->push_back(
|
||||
new G4SmoothTrajectoryPoint(aStep->GetPostStepPoint()->GetPosition(),
|
||||
aStep->GetPointerToVectorOfAuxiliaryPoints()));
|
||||
positionRecord->push_back(new G4SmoothTrajectoryPoint(
|
||||
aStep->GetPostStepPoint()->GetPosition(), aStep->GetPointerToVectorOfAuxiliaryPoints()));
|
||||
}
|
||||
|
||||
|
||||
G4ParticleDefinition* G4SmoothTrajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
}
|
||||
|
||||
void G4SmoothTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if(secondTrajectory == nullptr) return;
|
||||
if (secondTrajectory == nullptr) return;
|
||||
|
||||
G4SmoothTrajectory* seco = (G4SmoothTrajectory*)secondTrajectory;
|
||||
auto seco = (G4SmoothTrajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
|
||||
// initial point of the second trajectory should not be merged
|
||||
//
|
||||
for(G4int i=1; i<ent; ++i)
|
||||
{
|
||||
for (G4int i = 1; i < ent; ++i) {
|
||||
positionRecord->push_back((*(seco->positionRecord))[i]);
|
||||
}
|
||||
delete (*seco->positionRecord)[0];
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
|
||||
#include "G4SmoothTrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<G4SmoothTrajectoryPoint>*& aSmoothTrajectoryPointAllocator()
|
||||
@@ -50,72 +50,48 @@ G4Allocator<G4SmoothTrajectoryPoint>*& aSmoothTrajectoryPointAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint()
|
||||
{
|
||||
fPosition = G4ThreeVector(0.,0.,0.);
|
||||
}
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(G4ThreeVector pos) { fPosition = pos; }
|
||||
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(G4ThreeVector pos)
|
||||
{
|
||||
fPosition = pos;
|
||||
}
|
||||
|
||||
G4SmoothTrajectoryPoint::
|
||||
G4SmoothTrajectoryPoint(G4ThreeVector pos,
|
||||
std::vector<G4ThreeVector>* auxiliaryPoints)
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(
|
||||
G4ThreeVector pos, std::vector<G4ThreeVector>* auxiliaryPoints)
|
||||
: fPosition(pos), fAuxiliaryPointVector(auxiliaryPoints)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
G4SmoothTrajectoryPoint::
|
||||
G4SmoothTrajectoryPoint(const G4SmoothTrajectoryPoint& right)
|
||||
: G4VTrajectoryPoint(),
|
||||
fPosition(right.fPosition),
|
||||
fAuxiliaryPointVector(right.fAuxiliaryPointVector)
|
||||
{
|
||||
}
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(const G4SmoothTrajectoryPoint& right)
|
||||
: fPosition(right.fPosition), fAuxiliaryPointVector(right.fAuxiliaryPointVector)
|
||||
{}
|
||||
|
||||
G4SmoothTrajectoryPoint::~G4SmoothTrajectoryPoint()
|
||||
{
|
||||
delete fAuxiliaryPointVector;
|
||||
}
|
||||
G4SmoothTrajectoryPoint::~G4SmoothTrajectoryPoint() { delete fAuxiliaryPointVector; }
|
||||
|
||||
|
||||
const std::map<G4String,G4AttDef>*
|
||||
G4SmoothTrajectoryPoint::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* G4SmoothTrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4SmoothTrajectoryPoint",isNew);
|
||||
if (isNew)
|
||||
{
|
||||
std::map<G4String, G4AttDef>* store =
|
||||
G4AttDefStore::GetInstance("G4SmoothTrajectoryPoint", isNew);
|
||||
if (isNew) {
|
||||
G4String Pos("Pos");
|
||||
(*store)[Pos] = G4AttDef(Pos, "Step Position",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
(*store)[Pos] = G4AttDef(Pos, "Step Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
G4String Aux("Aux");
|
||||
(*store)[Aux] = G4AttDef(Aux, "Auxiliary Point Position",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
(*store)[Aux] =
|
||||
G4AttDef(Aux, "Auxiliary Point Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4SmoothTrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
if (fAuxiliaryPointVector != nullptr)
|
||||
{
|
||||
for (auto iAux = fAuxiliaryPointVector->cbegin();
|
||||
iAux != fAuxiliaryPointVector->cend(); ++iAux)
|
||||
{
|
||||
values->push_back(G4AttValue("Aux",G4BestUnit(*iAux,"Length"),""));
|
||||
if (fAuxiliaryPointVector != nullptr) {
|
||||
for (const auto& iAux : *fAuxiliaryPointVector) {
|
||||
values->push_back(G4AttValue("Aux", G4BestUnit(iAux, "Length"), ""));
|
||||
}
|
||||
}
|
||||
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPosition,"Length"),""));
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPosition, "Length"), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -32,12 +32,13 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4TrackingManager.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4SmoothTrajectory.hh"
|
||||
#include "G4RichTrajectory.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4Profiler.hh"
|
||||
#include "G4RichTrajectory.hh"
|
||||
#include "G4SmoothTrajectory.hh"
|
||||
#include "G4TiMemory.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//////////////////////////////////////
|
||||
G4TrackingManager::G4TrackingManager()
|
||||
@@ -68,14 +69,13 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
|
||||
// Clear secondary particle vector
|
||||
//
|
||||
for(std:: size_t itr=0; itr<GimmeSecondaries()->size(); ++itr)
|
||||
{
|
||||
delete (*GimmeSecondaries())[itr];
|
||||
for (auto& itr : *GimmeSecondaries()) {
|
||||
delete itr;
|
||||
}
|
||||
GimmeSecondaries()->clear();
|
||||
|
||||
if(verboseLevel>0 && (G4VSteppingVerbose::GetSilent()!=1) ) TrackBanner();
|
||||
|
||||
GimmeSecondaries()->clear();
|
||||
|
||||
if (verboseLevel > 0 && (G4VSteppingVerbose::GetSilent() != 1)) TrackBanner();
|
||||
|
||||
// Give SteppingManger the pointer to the track which will be tracked
|
||||
//
|
||||
fpSteppingManager->SetInitialStep(fpTrack);
|
||||
@@ -83,8 +83,7 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
// Pre tracking user intervention process
|
||||
|
||||
fpTrajectory = nullptr;
|
||||
if( fpUserTrackingAction != nullptr )
|
||||
{
|
||||
if (fpUserTrackingAction != nullptr) {
|
||||
fpUserTrackingAction->PreUserTrackingAction(fpTrack);
|
||||
}
|
||||
|
||||
@@ -92,17 +91,15 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
// the PreUserTrackingAction and PostUserTrackingAction
|
||||
{
|
||||
#if defined(GEANT4_USE_TIMEMORY)
|
||||
ProfilerConfig profiler{ fpTrack };
|
||||
ProfilerConfig profiler{fpTrack};
|
||||
#endif
|
||||
|
||||
#ifdef G4_STORE_TRAJECTORY
|
||||
// Construct a trajectory if it is requested
|
||||
//
|
||||
if(StoreTrajectory && (fpTrajectory == nullptr))
|
||||
{
|
||||
if ((StoreTrajectory != 0) && (fpTrajectory == nullptr)) {
|
||||
// default trajectory concrete class object
|
||||
switch(StoreTrajectory)
|
||||
{
|
||||
switch (StoreTrajectory) {
|
||||
default:
|
||||
case 1:
|
||||
fpTrajectory = new G4Trajectory(fpTrack);
|
||||
@@ -131,19 +128,15 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
|
||||
// Track the particle Step-by-Step while it is alive
|
||||
//
|
||||
while((fpTrack->GetTrackStatus() == fAlive) ||
|
||||
(fpTrack->GetTrackStatus() == fStopButAlive))
|
||||
{
|
||||
while ((fpTrack->GetTrackStatus() == fAlive) || (fpTrack->GetTrackStatus() == fStopButAlive)) {
|
||||
fpTrack->IncrementCurrentStepNumber();
|
||||
fpSteppingManager->Stepping();
|
||||
#ifdef G4_STORE_TRAJECTORY
|
||||
if(StoreTrajectory)
|
||||
{
|
||||
if (StoreTrajectory != 0) {
|
||||
fpTrajectory->AppendStep(fpSteppingManager->GetStep());
|
||||
}
|
||||
#endif
|
||||
if(EventIsAborted)
|
||||
{
|
||||
if (EventIsAborted) {
|
||||
fpTrack->SetTrackStatus(fKillTrackAndSecondaries);
|
||||
}
|
||||
}
|
||||
@@ -152,20 +145,17 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
}
|
||||
|
||||
// Post tracking user intervention process.
|
||||
if( fpUserTrackingAction != nullptr )
|
||||
{
|
||||
if (fpUserTrackingAction != nullptr) {
|
||||
fpUserTrackingAction->PostUserTrackingAction(fpTrack);
|
||||
}
|
||||
|
||||
// Destruct the trajectory if it was created
|
||||
#ifdef G4VERBOSE
|
||||
if(StoreTrajectory&&verboseLevel>10)
|
||||
{
|
||||
if ((StoreTrajectory != 0) && verboseLevel > 10) {
|
||||
fpTrajectory->ShowTrajectory();
|
||||
}
|
||||
#endif
|
||||
if( (!StoreTrajectory) && (fpTrajectory != nullptr) )
|
||||
{
|
||||
if ((StoreTrajectory == 0) && (fpTrajectory != nullptr)) {
|
||||
delete fpTrajectory;
|
||||
fpTrajectory = nullptr;
|
||||
}
|
||||
@@ -176,9 +166,8 @@ void G4TrackingManager::SetTrajectory(G4VTrajectory* aTrajectory)
|
||||
//////////////////////////////////////
|
||||
{
|
||||
#ifndef G4_STORE_TRAJECTORY
|
||||
G4Exception("G4TrackingManager::SetTrajectory()",
|
||||
"Tracking0015", FatalException,
|
||||
"Invoked without G4_STORE_TRAJECTORY option set!");
|
||||
G4Exception("G4TrackingManager::SetTrajectory()", "Tracking0015", FatalException,
|
||||
"Invoked without G4_STORE_TRAJECTORY option set!");
|
||||
#endif
|
||||
fpTrajectory = aTrajectory;
|
||||
}
|
||||
@@ -187,7 +176,7 @@ void G4TrackingManager::SetTrajectory(G4VTrajectory* aTrajectory)
|
||||
void G4TrackingManager::EventAborted()
|
||||
//////////////////////////////////////
|
||||
{
|
||||
fpTrack->SetTrackStatus( fKillTrackAndSecondaries );
|
||||
fpTrack->SetTrackStatus(fKillTrackAndSecondaries);
|
||||
EventIsAborted = true;
|
||||
}
|
||||
|
||||
@@ -197,17 +186,12 @@ void G4TrackingManager::TrackBanner()
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "*******************************************************"
|
||||
<< "**************************************************"
|
||||
<< G4endl;
|
||||
<< "**************************************************" << G4endl;
|
||||
G4cout << "* G4Track Information: "
|
||||
<< " Particle = " << fpTrack->GetDefinition()->GetParticleName()
|
||||
<< ","
|
||||
<< " Track ID = " << fpTrack->GetTrackID()
|
||||
<< ","
|
||||
<< " Parent ID = " << fpTrack->GetParentID()
|
||||
<< G4endl;
|
||||
<< " Particle = " << fpTrack->GetDefinition()->GetParticleName() << ","
|
||||
<< " Track ID = " << fpTrack->GetTrackID() << ","
|
||||
<< " Parent ID = " << fpTrack->GetParentID() << G4endl;
|
||||
G4cout << "*******************************************************"
|
||||
<< "**************************************************"
|
||||
<< G4endl;
|
||||
<< "**************************************************" << G4endl;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
@@ -33,22 +33,23 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4TrackingMessenger.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4TrackingManager.hh"
|
||||
|
||||
#include "G4IdentityTrajectoryFilter.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4TrackStatus.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4TrackingManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4IdentityTrajectoryFilter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
G4TrackingMessenger::G4TrackingMessenger(G4TrackingManager* trMan)
|
||||
///////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////
|
||||
: trackingManager(trMan)
|
||||
{
|
||||
steppingManager = trackingManager->GetSteppingManager();
|
||||
@@ -56,13 +57,13 @@ G4TrackingMessenger::G4TrackingMessenger(G4TrackingManager* trMan)
|
||||
TrackingDirectory = new G4UIdirectory("/tracking/");
|
||||
TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
|
||||
|
||||
AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
|
||||
AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort", this);
|
||||
AbortCmd->SetGuidance("Abort current G4Track processing.");
|
||||
|
||||
ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume",this);
|
||||
ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume", this);
|
||||
ResumeCmd->SetGuidance("Resume current G4Track processing.");
|
||||
|
||||
StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory",this);
|
||||
StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory", this);
|
||||
StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
|
||||
StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
|
||||
StoreTrajectoryCmd->SetGuidance(" !=0 : Store trajectories.");
|
||||
@@ -70,11 +71,11 @@ G4TrackingMessenger::G4TrackingMessenger(G4TrackingManager* trMan)
|
||||
StoreTrajectoryCmd->SetGuidance(" 2 : Choose G4SmoothTrajectory as default.");
|
||||
StoreTrajectoryCmd->SetGuidance(" 3 : Choose G4RichTrajectory as default.");
|
||||
StoreTrajectoryCmd->SetGuidance(" 4 : Choose G4RichTrajectory with auxiliary points as default.");
|
||||
StoreTrajectoryCmd->SetParameterName("Store",true);
|
||||
StoreTrajectoryCmd->SetParameterName("Store", true);
|
||||
StoreTrajectoryCmd->SetDefaultValue(0);
|
||||
StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 4");
|
||||
StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 4");
|
||||
|
||||
VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose",this);
|
||||
VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose", this);
|
||||
#ifdef G4VERBOSE
|
||||
VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
|
||||
VerboseCmd->SetGuidance(" -1 : Silent.");
|
||||
@@ -84,14 +85,14 @@ G4TrackingMessenger::G4TrackingMessenger(G4TrackingManager* trMan)
|
||||
VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
|
||||
VerboseCmd->SetGuidance(" after all AlongStep/PostStep process executions.");
|
||||
VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
|
||||
VerboseCmd->SetGuidance(" at each AlongStepPostStep process execution.");
|
||||
VerboseCmd->SetGuidance(" at each AlongStepPostStep process execution.");
|
||||
VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
|
||||
VerboseCmd->SetGuidance(" from each AlongStepPostStep process.");
|
||||
VerboseCmd->SetParameterName("verbose_level",true);
|
||||
VerboseCmd->SetGuidance(" from each AlongStepPostStep process.");
|
||||
VerboseCmd->SetParameterName("verbose_level", true);
|
||||
VerboseCmd->SetDefaultValue(0);
|
||||
VerboseCmd->SetRange("verbose_level >=-1 ");
|
||||
#else
|
||||
VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");
|
||||
#else
|
||||
VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -107,43 +108,37 @@ G4TrackingMessenger::~G4TrackingMessenger()
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void G4TrackingMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
|
||||
void G4TrackingMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
if( command == VerboseCmd )
|
||||
{
|
||||
if (command == VerboseCmd) {
|
||||
trackingManager->SetVerboseLevel(VerboseCmd->ConvertToInt(newValues));
|
||||
}
|
||||
|
||||
if( command == AbortCmd )
|
||||
{
|
||||
if (command == AbortCmd) {
|
||||
steppingManager->GetTrack()->SetTrackStatus(fStopAndKill);
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
|
||||
}
|
||||
|
||||
if( command == ResumeCmd )
|
||||
{
|
||||
if (command == ResumeCmd) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
|
||||
}
|
||||
|
||||
static G4ThreadLocal
|
||||
G4IdentityTrajectoryFilter* auxiliaryPointsFilter = nullptr;
|
||||
if(auxiliaryPointsFilter == nullptr)
|
||||
{
|
||||
static G4ThreadLocal G4IdentityTrajectoryFilter* auxiliaryPointsFilter = nullptr;
|
||||
if (auxiliaryPointsFilter == nullptr) {
|
||||
auxiliaryPointsFilter = new G4IdentityTrajectoryFilter;
|
||||
}
|
||||
if( command == StoreTrajectoryCmd )
|
||||
{
|
||||
if (command == StoreTrajectoryCmd) {
|
||||
G4int trajType = StoreTrajectoryCmd->ConvertToInt(newValues);
|
||||
if(trajType==2||trajType==4)
|
||||
{
|
||||
if (trajType == 2 || trajType == 4) {
|
||||
G4TransportationManager::GetTransportationManager()
|
||||
->GetPropagatorInField()->SetTrajectoryFilter(auxiliaryPointsFilter);
|
||||
->GetPropagatorInField()
|
||||
->SetTrajectoryFilter(auxiliaryPointsFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
G4TransportationManager::GetTransportationManager()
|
||||
->GetPropagatorInField()->SetTrajectoryFilter(0);
|
||||
->GetPropagatorInField()
|
||||
->SetTrajectoryFilter(nullptr);
|
||||
}
|
||||
trackingManager->SetStoreTrajectory(trajType);
|
||||
}
|
||||
@@ -153,14 +148,11 @@ void G4TrackingMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
|
||||
G4String G4TrackingMessenger::GetCurrentValue(G4UIcommand* command)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
if( command == VerboseCmd )
|
||||
{
|
||||
if (command == VerboseCmd) {
|
||||
return VerboseCmd->ConvertToString(trackingManager->GetVerboseLevel());
|
||||
}
|
||||
else if( command == StoreTrajectoryCmd )
|
||||
{
|
||||
return StoreTrajectoryCmd
|
||||
->ConvertToString(trackingManager->GetStoreTrajectory());
|
||||
if (command == StoreTrajectoryCmd) {
|
||||
return StoreTrajectoryCmd->ConvertToString(trackingManager->GetStoreTrajectory());
|
||||
}
|
||||
return G4String(1,'\0');
|
||||
return G4String(1, '\0');
|
||||
}
|
||||
|
||||
@@ -33,17 +33,18 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<G4Trajectory>*& aTrajectoryAllocator()
|
||||
@@ -52,11 +53,6 @@ G4Allocator<G4Trajectory>*& aTrajectoryAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4Trajectory::G4Trajectory()
|
||||
: initialMomentum( G4ThreeVector() )
|
||||
{
|
||||
}
|
||||
|
||||
G4Trajectory::G4Trajectory(const G4Track* aTrack)
|
||||
{
|
||||
G4ParticleDefinition* fpParticleDefinition = aTrack->GetDefinition();
|
||||
@@ -74,7 +70,6 @@ G4Trajectory::G4Trajectory(const G4Track* aTrack)
|
||||
}
|
||||
|
||||
G4Trajectory::G4Trajectory(G4Trajectory& right)
|
||||
: G4VTrajectory()
|
||||
{
|
||||
ParticleName = right.ParticleName;
|
||||
PDGCharge = right.PDGCharge;
|
||||
@@ -85,21 +80,17 @@ G4Trajectory::G4Trajectory(G4Trajectory& right)
|
||||
initialMomentum = right.initialMomentum;
|
||||
positionRecord = new G4TrajectoryPointContainer();
|
||||
|
||||
for(std::size_t i=0; i<right.positionRecord->size(); ++i)
|
||||
{
|
||||
G4TrajectoryPoint* rightPoint
|
||||
= (G4TrajectoryPoint*)((*(right.positionRecord))[i]);
|
||||
for (auto& i : *right.positionRecord) {
|
||||
auto rightPoint = (G4TrajectoryPoint*)i;
|
||||
positionRecord->push_back(new G4TrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
G4Trajectory::~G4Trajectory()
|
||||
{
|
||||
if (positionRecord != nullptr)
|
||||
{
|
||||
for(std::size_t i=0; i<positionRecord->size(); ++i)
|
||||
{
|
||||
delete (*positionRecord)[i];
|
||||
if (positionRecord != nullptr) {
|
||||
for (auto& i : *positionRecord) {
|
||||
delete i;
|
||||
}
|
||||
positionRecord->clear();
|
||||
delete positionRecord;
|
||||
@@ -122,81 +113,66 @@ void G4Trajectory::DrawTrajectory() const
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
const std::map<G4String,G4AttDef>* G4Trajectory::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* G4Trajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4Trajectory",isNew);
|
||||
if (isNew)
|
||||
{
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4Trajectory", isNew);
|
||||
if (isNew) {
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID,"Track ID","Physics","","G4int");
|
||||
(*store)[ID] = G4AttDef(ID, "Track ID", "Physics", "", "G4int");
|
||||
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID,"Parent ID","Physics","","G4int");
|
||||
(*store)[PID] = G4AttDef(PID, "Parent ID", "Physics", "", "G4int");
|
||||
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
|
||||
(*store)[PN] = G4AttDef(PN, "Particle Name", "Physics", "", "G4String");
|
||||
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch,"Charge","Physics","e+","G4double");
|
||||
(*store)[Ch] = G4AttDef(Ch, "Charge", "Physics", "e+", "G4double");
|
||||
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
|
||||
(*store)[PDG] = G4AttDef(PDG, "PDG Encoding", "Physics", "", "G4int");
|
||||
|
||||
G4String IKE("IKE");
|
||||
(*store)[IKE] =
|
||||
G4AttDef(IKE, "Initial kinetic energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[IKE] = G4AttDef(IKE, "Initial kinetic energy", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Initial momentum",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Initial momentum", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] =
|
||||
G4AttDef(IMag, "Initial momentum magnitude",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[IMag] =
|
||||
G4AttDef(IMag, "Initial momentum magnitude", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP,"No. of points","Physics","","G4int");
|
||||
|
||||
(*store)[NTP] = G4AttDef(NTP, "No. of points", "Physics", "", "G4int");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4Trajectory::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
|
||||
values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fTrackID), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PID",G4UIcommand::ConvertToString(fParentID),""));
|
||||
values->push_back(G4AttValue("PID", G4UIcommand::ConvertToString(fParentID), ""));
|
||||
|
||||
values->push_back(G4AttValue("PN",ParticleName,""));
|
||||
values->push_back(G4AttValue("PN", ParticleName, ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("Ch",G4UIcommand::ConvertToString(PDGCharge),""));
|
||||
values->push_back(G4AttValue("Ch", G4UIcommand::ConvertToString(PDGCharge), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PDG",G4UIcommand::ConvertToString(PDGEncoding),""));
|
||||
values->push_back(G4AttValue("PDG", G4UIcommand::ConvertToString(PDGEncoding), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IKE",G4BestUnit(initialKineticEnergy,"Energy"),""));
|
||||
values->push_back(G4AttValue("IKE", G4BestUnit(initialKineticEnergy, "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMom",G4BestUnit(initialMomentum,"Energy"),""));
|
||||
values->push_back(G4AttValue("IMom", G4BestUnit(initialMomentum, "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMag",G4BestUnit(initialMomentum.mag(),"Energy"),""));
|
||||
values->push_back(G4AttValue("IMag", G4BestUnit(initialMomentum.mag(), "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("NTP",G4UIcommand::ConvertToString(GetPointEntries()),""));
|
||||
values->push_back(G4AttValue("NTP", G4UIcommand::ConvertToString(GetPointEntries()), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
@@ -204,10 +180,9 @@ std::vector<G4AttValue>* G4Trajectory::CreateAttValues() const
|
||||
|
||||
void G4Trajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
positionRecord->push_back( new G4TrajectoryPoint(aStep->GetPostStepPoint()->
|
||||
GetPosition()) );
|
||||
positionRecord->push_back(new G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition()));
|
||||
}
|
||||
|
||||
|
||||
G4ParticleDefinition* G4Trajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
@@ -215,11 +190,11 @@ G4ParticleDefinition* G4Trajectory::GetParticleDefinition()
|
||||
|
||||
void G4Trajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if(secondTrajectory == nullptr) return;
|
||||
if (secondTrajectory == nullptr) return;
|
||||
|
||||
G4Trajectory* seco = (G4Trajectory*)secondTrajectory;
|
||||
auto seco = (G4Trajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
for(G4int i=1; i<ent; ++i) // initial pt of 2nd trajectory shouldn't be merged
|
||||
for (G4int i = 1; i < ent; ++i) // initial pt of 2nd trajectory shouldn't be merged
|
||||
{
|
||||
positionRecord->push_back((*(seco->positionRecord))[i]);
|
||||
}
|
||||
|
||||
@@ -33,14 +33,14 @@
|
||||
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<G4TrajectoryPoint>*& aTrajectoryPointAllocator()
|
||||
@@ -49,47 +49,31 @@ G4Allocator<G4TrajectoryPoint>*& aTrajectoryPointAllocator()
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4TrajectoryPoint::G4TrajectoryPoint()
|
||||
{
|
||||
fPosition = G4ThreeVector(0.,0.,0.);
|
||||
}
|
||||
G4TrajectoryPoint::G4TrajectoryPoint(G4ThreeVector pos) { fPosition = pos; }
|
||||
|
||||
G4TrajectoryPoint::G4TrajectoryPoint(G4ThreeVector pos)
|
||||
{
|
||||
fPosition = pos;
|
||||
}
|
||||
G4TrajectoryPoint::G4TrajectoryPoint(const G4TrajectoryPoint& right) : fPosition(right.fPosition) {}
|
||||
|
||||
G4TrajectoryPoint::G4TrajectoryPoint(const G4TrajectoryPoint& right)
|
||||
: G4VTrajectoryPoint(),fPosition(right.fPosition)
|
||||
{
|
||||
}
|
||||
G4TrajectoryPoint::~G4TrajectoryPoint() = default;
|
||||
|
||||
G4TrajectoryPoint::~G4TrajectoryPoint()
|
||||
{
|
||||
}
|
||||
|
||||
const std::map<G4String,G4AttDef>* G4TrajectoryPoint::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* G4TrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4TrajectoryPoint",isNew);
|
||||
if (isNew)
|
||||
{
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("G4TrajectoryPoint", isNew);
|
||||
if (isNew) {
|
||||
G4String Pos("Pos");
|
||||
(*store)[Pos] =
|
||||
G4AttDef(Pos, "Position", "Physics","G4BestUnit","G4ThreeVector");
|
||||
(*store)[Pos] = G4AttDef(Pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4TrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back(G4AttValue("Pos",G4BestUnit(fPosition,"Length"),""));
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPosition, "Length"), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
@@ -39,29 +40,22 @@
|
||||
G4UserSteppingAction::G4UserSteppingAction()
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
if(!(G4ParticleTable::GetParticleTable()->GetReadiness()))
|
||||
{
|
||||
if (! (G4ParticleTable::GetParticleTable()->GetReadiness())) {
|
||||
G4String msg;
|
||||
msg = " You are instantiating G4UserSteppingAction BEFORE your\n";
|
||||
msg = " You are instantiating G4UserSteppingAction BEFORE your\n";
|
||||
msg += "G4VUserPhysicsList is instantiated and assigned to G4RunManager.\n";
|
||||
msg += " Such an instantiation is prohibited. To fix this problem,\n";
|
||||
msg += "please make sure that your main() instantiates G4VUserPhysicsList AND\n";
|
||||
msg += "set it to G4RunManager before instantiating other user action classes\n";
|
||||
msg += "such as G4UserSteppingAction.";
|
||||
G4Exception("G4UserSteppingAction::G4UserSteppingAction()",
|
||||
"Tracking0002", FatalException, msg);
|
||||
G4Exception(
|
||||
"G4UserSteppingAction::G4UserSteppingAction()", "Tracking0002", FatalException, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
G4UserSteppingAction::~G4UserSteppingAction()
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
void G4UserSteppingAction::SetSteppingManagerPointer(G4SteppingManager* pValue)
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
fpSteppingManager = pValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4UserTrackingAction.hh"
|
||||
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
@@ -39,26 +40,19 @@
|
||||
G4UserTrackingAction::G4UserTrackingAction()
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
if(!(G4ParticleTable::GetParticleTable()->GetReadiness()))
|
||||
{
|
||||
if (! (G4ParticleTable::GetParticleTable()->GetReadiness())) {
|
||||
G4String msg;
|
||||
msg = " You are instantiating G4UserTrackingAction BEFORE your\n";
|
||||
msg = " You are instantiating G4UserTrackingAction BEFORE your\n";
|
||||
msg += "G4VUserPhysicsList is instantiated and assigned to G4RunManager.\n";
|
||||
msg += " Such an instantiation is prohibited. To fix this problem,\n";
|
||||
msg += "please make sure that your main() instantiates G4VUserPhysicsList AND\n";
|
||||
msg += "set it to G4RunManager before instantiating other user action classes\n";
|
||||
msg += "such as G4UserTrackingAction.";
|
||||
G4Exception("G4UserTrackingAction::G4UserTrackingAction()",
|
||||
"Tracking0001", FatalException, msg);
|
||||
G4Exception(
|
||||
"G4UserTrackingAction::G4UserTrackingAction()", "Tracking0001", FatalException, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
G4UserTrackingAction::~G4UserTrackingAction()
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
void G4UserTrackingAction::SetTrackingManagerPointer(G4TrackingManager* pValue)
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
@@ -32,9 +32,10 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4VSteppingVerbose.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
G4ThreadLocal G4VSteppingVerbose* G4VSteppingVerbose::fInstance = nullptr;
|
||||
G4VSteppingVerbose* G4VSteppingVerbose::fMasterInstance = nullptr;
|
||||
@@ -45,14 +46,12 @@ G4ThreadLocal G4int G4VSteppingVerbose::SilentStepInfo = 0;
|
||||
G4VSteppingVerbose::G4VSteppingVerbose()
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
if(fInstance!= nullptr)
|
||||
{
|
||||
G4Exception("G4VSteppingVerbose::G4VSteppingVerbose()",
|
||||
"Tracking0014", FatalException,
|
||||
"Only one SteppingVerbose class can be instantiated.");
|
||||
if (fInstance != nullptr) {
|
||||
G4Exception("G4VSteppingVerbose::G4VSteppingVerbose()", "Tracking0014", FatalException,
|
||||
"Only one SteppingVerbose class can be instantiated.");
|
||||
}
|
||||
fInstance = this;
|
||||
if(!fMasterInstance) fMasterInstance = this;
|
||||
if (fMasterInstance == nullptr) fMasterInstance = this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
@@ -66,7 +65,7 @@ G4VSteppingVerbose::~G4VSteppingVerbose()
|
||||
G4VSteppingVerbose* G4VSteppingVerbose::Clone()
|
||||
//////////////////////////////////////////////////////////////////
|
||||
{
|
||||
G4Exception("G4VSteppingVerbose::Clone","TRKING000",FatalException,
|
||||
G4Exception("G4VSteppingVerbose::Clone", "TRKING000", FatalException,
|
||||
"Base class method must not be invoked.");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -97,7 +96,7 @@ void G4VSteppingVerbose::CopyState()
|
||||
sumEnergyChange = fManager->GetsumEnergyChange();
|
||||
|
||||
fParticleChange = fManager->GetfParticleChange();
|
||||
fTrack = fManager->GetfTrack();
|
||||
fTrack = fManager->GetfTrack();
|
||||
fSecondary = fManager->GetfSecondary();
|
||||
fStep = fManager->GetfStep();
|
||||
fPreStepPoint = fManager->GetfPreStepPoint();
|
||||
@@ -107,7 +106,7 @@ void G4VSteppingVerbose::CopyState()
|
||||
fSensitive = fManager->GetfSensitive();
|
||||
fCurrentProcess = fManager->GetfCurrentProcess();
|
||||
|
||||
fAtRestDoItVector = fManager->GetfAtRestDoItVector();
|
||||
fAtRestDoItVector = fManager->GetfAtRestDoItVector();
|
||||
fAlongStepDoItVector = fManager->GetfAlongStepDoItVector();
|
||||
fPostStepDoItVector = fManager->GetfPostStepDoItVector();
|
||||
|
||||
@@ -146,35 +145,16 @@ void G4VSteppingVerbose::CopyState()
|
||||
fGPILSelection = fManager->GetfGPILSelection();
|
||||
}
|
||||
|
||||
void G4VSteppingVerbose::SetInstance(G4VSteppingVerbose* /*Instance*/)
|
||||
{;}
|
||||
void G4VSteppingVerbose::SetInstance(G4VSteppingVerbose* /*Instance*/) {}
|
||||
|
||||
G4VSteppingVerbose* G4VSteppingVerbose::GetInstance()
|
||||
{
|
||||
return fInstance;
|
||||
}
|
||||
G4VSteppingVerbose* G4VSteppingVerbose::GetInstance() { return fInstance; }
|
||||
|
||||
G4VSteppingVerbose* G4VSteppingVerbose::GetMasterInstance()
|
||||
{
|
||||
return fMasterInstance;
|
||||
}
|
||||
G4VSteppingVerbose* G4VSteppingVerbose::GetMasterInstance() { return fMasterInstance; }
|
||||
|
||||
G4int G4VSteppingVerbose::GetSilent()
|
||||
{
|
||||
return Silent;
|
||||
}
|
||||
G4int G4VSteppingVerbose::GetSilent() { return Silent; }
|
||||
|
||||
void G4VSteppingVerbose::SetSilent(G4int fSilent)
|
||||
{
|
||||
Silent=fSilent;
|
||||
}
|
||||
void G4VSteppingVerbose::SetSilent(G4int fSilent) { Silent = fSilent; }
|
||||
|
||||
G4int G4VSteppingVerbose::GetSilentStepInfo()
|
||||
{
|
||||
return SilentStepInfo;
|
||||
}
|
||||
G4int G4VSteppingVerbose::GetSilentStepInfo() { return SilentStepInfo; }
|
||||
|
||||
void G4VSteppingVerbose::SetSilentStepInfo(G4int fSilent)
|
||||
{
|
||||
SilentStepInfo = fSilent;
|
||||
}
|
||||
void G4VSteppingVerbose::SetSilentStepInfo(G4int fSilent) { SilentStepInfo = fSilent; }
|
||||
|
||||
@@ -33,29 +33,19 @@
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
|
||||
#include "G4AttCheck.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Polymarker.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
G4VTrajectory::G4VTrajectory()
|
||||
{
|
||||
}
|
||||
|
||||
G4VTrajectory::~G4VTrajectory()
|
||||
{
|
||||
}
|
||||
|
||||
G4bool G4VTrajectory::operator == (const G4VTrajectory& right) const
|
||||
{
|
||||
return (this==&right);
|
||||
}
|
||||
G4bool G4VTrajectory::operator==(const G4VTrajectory& right) const { return (this == &right); }
|
||||
|
||||
void G4VTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
{
|
||||
@@ -64,52 +54,41 @@ void G4VTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
// depending on the nature of os
|
||||
|
||||
std::vector<G4AttValue>* attValues = CreateAttValues();
|
||||
const std::map<G4String,G4AttDef>* attDefs = GetAttDefs();
|
||||
const std::map<G4String, G4AttDef>* attDefs = GetAttDefs();
|
||||
|
||||
// Ensure validity...
|
||||
//
|
||||
if (G4AttCheck(attValues,attDefs).Check("G4VTrajectory::ShowTrajectory"))
|
||||
{
|
||||
if (G4AttCheck(attValues, attDefs).Check("G4VTrajectory::ShowTrajectory")) {
|
||||
return;
|
||||
}
|
||||
|
||||
os << "Trajectory:";
|
||||
|
||||
for (auto iAttVal = attValues->cbegin();
|
||||
iAttVal != attValues->cend(); ++iAttVal)
|
||||
{
|
||||
std::map<G4String,G4AttDef>::const_iterator iAttDef =
|
||||
attDefs->find(iAttVal->GetName());
|
||||
os << "\n " << iAttDef->second.GetDesc()
|
||||
<< " (" << iAttVal->GetName()
|
||||
<< "): " << iAttVal->GetValue();
|
||||
for (const auto& attValue : *attValues) {
|
||||
auto iAttDef = attDefs->find(attValue.GetName());
|
||||
os << "\n " << iAttDef->second.GetDesc() << " (" << attValue.GetName()
|
||||
<< "): " << attValue.GetValue();
|
||||
}
|
||||
|
||||
delete attValues; // AttValues must be deleted after use.
|
||||
|
||||
// Now do trajectory points...
|
||||
|
||||
for (G4int i=0; i<GetPointEntries(); ++i)
|
||||
{
|
||||
for (G4int i = 0; i < GetPointEntries(); ++i) {
|
||||
G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
|
||||
attValues = aTrajectoryPoint->CreateAttValues();
|
||||
attDefs = aTrajectoryPoint->GetAttDefs();
|
||||
|
||||
// Ensure validity...
|
||||
//
|
||||
if (G4AttCheck(attValues,attDefs).Check("G4VTrajectory::ShowTrajectory"))
|
||||
{
|
||||
if (G4AttCheck(attValues, attDefs).Check("G4VTrajectory::ShowTrajectory")) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto iAttVal = attValues->cbegin();
|
||||
iAttVal != attValues->cend(); ++iAttVal)
|
||||
{
|
||||
std::map<G4String,G4AttDef>::const_iterator iAttDef =
|
||||
attDefs->find(iAttVal->GetName());
|
||||
os << "\n " << iAttDef->second.GetDesc()
|
||||
<< " (" << iAttVal->GetName()
|
||||
<< "): " << iAttVal->GetValue();
|
||||
for (const auto& attValue : *attValues) {
|
||||
const auto iAttDef = attDefs->find(attValue.GetName());
|
||||
os << "\n " << iAttDef->second.GetDesc() << " (" << attValue.GetName()
|
||||
<< "): " << attValue.GetValue();
|
||||
}
|
||||
|
||||
delete attValues; // AttValues must be deleted after use.
|
||||
@@ -121,8 +100,7 @@ void G4VTrajectory::DrawTrajectory() const
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
|
||||
if (pVVisManager != nullptr)
|
||||
{
|
||||
if (pVVisManager != nullptr) {
|
||||
pVVisManager->DispatchToModel(*this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4VTrajectoryPoint class implementation
|
||||
//
|
||||
// Contact:
|
||||
// Questions and comments to this code should be sent to
|
||||
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
|
||||
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
|
||||
G4VTrajectoryPoint::G4VTrajectoryPoint()
|
||||
{
|
||||
}
|
||||
|
||||
G4VTrajectoryPoint::~G4VTrajectoryPoint()
|
||||
{
|
||||
}
|
||||
|
||||
G4bool G4VTrajectoryPoint::operator==(const G4VTrajectoryPoint& right) const
|
||||
{
|
||||
return (this==&right);
|
||||
}
|
||||
Reference in New Issue
Block a user