Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -35,7 +35,7 @@
* Minimal hit containing energy and position, for use in the fast simulation
* classes.
* Hits of G4FastHit type can be created in user implementation of fast
* simulation model and then deposited in the detector using G4FastSimHitMaker
* simulation model and then deposited in the detector using G4FastSimHitMaker
* helper class. The helper will locate the sensitive volume and check if it
* inherits from both base classes:
* - G4VSensitiveDetector: for processing of detailed/non-fast simulation hits;
@@ -46,28 +46,27 @@
class G4FastHit
{
public:
G4FastHit();
G4FastHit(const G4ThreeVector& aPosition, G4double aEnergy);
G4FastHit(const G4ThreeVector& aPosition, G4double aEnergy, G4bool aDebug);
virtual ~G4FastHit(){};
public:
G4FastHit() = default;
G4FastHit(const G4ThreeVector& aPosition, G4double aEnergy)
: fEnergy(aEnergy), fPosition(aPosition)
{}
virtual ~G4FastHit() = default;
/// Set energy
inline void SetEnergy(const G4double& aEnergy) { fEnergy = aEnergy; }
/// Get energy
inline G4double GetEnergy() const { return fEnergy; }
/// Set position
inline void SetPosition(const G4ThreeVector& aPosition)
{
fPosition = aPosition;
}
/// Get position
inline G4ThreeVector GetPosition() const { return fPosition; }
private:
/// energy
G4double fEnergy = 0;
/// position
G4ThreeVector fPosition = G4ThreeVector();
/// Set energy
inline void SetEnergy(const G4double& aEnergy) { fEnergy = aEnergy; }
/// Get energy
inline G4double GetEnergy() const { return fEnergy; }
/// Set position
inline void SetPosition(const G4ThreeVector& aPosition) { fPosition = aPosition; }
/// Get position
inline G4ThreeVector GetPosition() const { return fPosition; }
private:
/// energy
G4double fEnergy = 0;
/// position
G4ThreeVector fPosition = G4ThreeVector();
};
#endif /* G4FASTHIT_HH */
@@ -27,10 +27,10 @@
#ifndef G4FASTSIMHITMAKER_HH
#define G4FASTSIMHITMAKER_HH
#include "G4TouchableHandle.hh"
#include "G4Navigator.hh"
#include "G4FastHit.hh"
#include "G4FastTrack.hh"
#include "G4Navigator.hh"
#include "G4TouchableHandle.hh"
class G4Step;
class G4StepPoint;
class G4VProcess;
@@ -40,7 +40,7 @@ class G4VProcess;
*
* Helper class that can be employed in the fast simulation models.
* It allows to deposit energy at given position (G4FastHit), provided it is
* located within the sensitive detector that derives from
* located within the sensitive detector that derives from
* G4VFastSimSensitiveDetector base class.
* An extended example extended/parameterisations/Par03 demonstrates how to use
* G4FastSimHitMaker to create multiple deposits from the fast simulation model.
@@ -49,38 +49,35 @@ class G4VProcess;
class G4FastSimHitMaker
{
public:
G4FastSimHitMaker();
~G4FastSimHitMaker();
public:
G4FastSimHitMaker();
~G4FastSimHitMaker();
/// Deposit energy at given position.
/// @param[in] aHit Created hit (energy and position)
/// @param[in] aTrack Fast track with access to particle's track and
/// properties in envelope's local coordinates
void make(const G4FastHit& aHit, const G4FastTrack& aTrack);
/// If sensitive detector class is in the parallel world, it must be
/// specified, otherwise no sensitive detector will be found (mass geometry
/// will be checked).
/// @param[in] aName Name of the parallel world
inline void SetNameOfWorldWithSD(const G4String& aName)
{
fWorldWithSdName = aName;
};
inline void SetProcess(G4VProcess* proc) { fpProcess = proc; }
/// Deposit energy at given position.
/// @param[in] aHit Created hit (energy and position)
/// @param[in] aTrack Fast track with access to particle's track and
/// properties in envelope's local coordinates
void make(const G4FastHit& aHit, const G4FastTrack& aTrack);
/// If sensitive detector class is in the parallel world, it must be
/// specified, otherwise no sensitive detector will be found (mass geometry
/// will be checked).
/// @param[in] aName Name of the parallel world
inline void SetNameOfWorldWithSD(const G4String& aName) { fWorldWithSdName = aName; };
inline void SetProcess(G4VProcess* proc) { fpProcess = proc; }
private:
/// Touchable
G4TouchableHandle fTouchableHandle;
/// Navigator
G4Navigator* fpNavigator;
/// Flag specifying if navigator has been already set up
G4bool fNaviSetup;
/// Name of the world containing the sensitive detector. If empty, default
/// mass world is used.
G4String fWorldWithSdName;
private:
/// Touchable
G4TouchableHandle fTouchableHandle;
/// Navigator
G4Navigator* fpNavigator;
/// Flag specifying if navigator has been already set up
G4bool fNaviSetup;
/// Name of the world containing the sensitive detector. If empty, default
/// mass world is used.
G4String fWorldWithSdName;
G4Step* fpSpotS;
G4StepPoint* fpSpotP;
G4VProcess* fpProcess = nullptr;
G4Step* fpSpotS;
G4StepPoint* fpSpotP;
G4VProcess* fpProcess = nullptr;
};
#endif
@@ -25,7 +25,7 @@
//
//
//
//
//
//---------------------------------------------------------------
//
// G4FastSimulationHelper.hh
@@ -39,7 +39,6 @@
//
//---------------------------------------------------------------
#ifndef G4FastSimulationHelper_h
#define G4FastSimulationHelper_h 1
@@ -48,14 +47,13 @@
class G4ProcessManager;
class G4FastSmulationManagerProcess;
class G4FastSimulationHelper
{
public:
// Activate fast simulation for particle with pmanager in the mass geometry: (without geometry name) or
// activate fast simulation for particle with pmanager in the parallel geometry:
static void ActivateFastSimulation(G4ProcessManager* pmanager, G4String parallelGeometryName = "");
public:
// Activate fast simulation for particle with pmanager in the mass geometry: (without geometry
// name) or activate fast simulation for particle with pmanager in the parallel geometry:
static void ActivateFastSimulation(G4ProcessManager* pmanager,
G4String parallelGeometryName = "");
};
#endif
@@ -25,7 +25,7 @@
//
//
//
//
//
//---------------------------------------------------------------
//
// G4FastSimulationManager.hh
@@ -38,27 +38,24 @@
//
//---------------------------------------------------------------
#ifndef G4FastSimulationManager_h
#define G4FastSimulationManager_h 1
#include "globals.hh"
#include "G4LogicalVolume.hh"
#include "G4Region.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4VParticleChange.hh"
#include "G4FastTrack.hh"
#include "G4FastSimulationVector.hh"
#include "G4FastStep.hh"
#include "G4VFastSimulationModel.hh"
#include "G4FastTrack.hh"
#include "G4LogicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4Region.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4FastSimulationVector.hh"
#include "G4VFastSimulationModel.hh"
#include "G4VParticleChange.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ios.hh"
#include "globals.hh"
//-------------------------------------------
//
@@ -73,132 +70,117 @@
// at tracking time.
//
class G4FastSimulationManager
{
public: // with description
//------------------------
// Constructor/Destructor
//------------------------
// Only one Constructor. By default the envelope can
// be placed n-Times.
// If the user is sure that it is placed just one time,
// the IsUnique flag should be set TRUE to avoid the
// G4AffineTransform re-calculations each time we reach
// the envelope.
public: // with description
//------------------------
// Constructor/Destructor
//------------------------
// Only one Constructor. By default the envelope can
// be placed n-Times.
// If the user is sure that it is placed just one time,
// the IsUnique flag should be set TRUE to avoid the
// G4AffineTransform re-calculations each time we reach
// the envelope.
G4FastSimulationManager(G4Envelope *anEnvelope,
G4bool IsUnique = FALSE);
// This is the only constructor. In this constructor you specify
// the envelope by giving the G4Region (typedef-ed as G4Envelope)
// pointer. The G4FastSimulationManager object will bind itself to
// this envelope and will notify this G4Region to become an envelope.
// If you know that this region is used for only one logical volume,
// you can turn the IsUnique boolean to "true" to allow some optimization.
//
// Note that if you choose to use the G4VFastSimulationModel(const G4String&,
// G4Region*, G4bool) constructor for you model, the G4FastSimulationManager
// will be constructed using the given G4Region* and G4bool values of the
// model constructor.
//
G4FastSimulationManager(G4Envelope* anEnvelope, G4bool IsUnique = FALSE);
// This is the only constructor. In this constructor you specify
// the envelope by giving the G4Region (typedef-ed as G4Envelope)
// pointer. The G4FastSimulationManager object will bind itself to
// this envelope and will notify this G4Region to become an envelope.
// If you know that this region is used for only one logical volume,
// you can turn the IsUnique boolean to "true" to allow some optimization.
//
// Note that if you choose to use the G4VFastSimulationModel(const G4String&,
// G4Region*, G4bool) constructor for you model, the G4FastSimulationManager
// will be constructed using the given G4Region* and G4bool values of the
// model constructor.
//
public: // without description
~G4FastSimulationManager();
// Destructor
~G4FastSimulationManager();
// Add a model to the Model List.
void AddFastSimulationModel(G4VFastSimulationModel*);
public: // with description
// Methods to add/remove models to/from the Model
// List.
//
void AddFastSimulationModel(G4VFastSimulationModel*);
// Add a model to the Model List.
// Remove a model from the Model List.
void RemoveFastSimulationModel(G4VFastSimulationModel*);
void RemoveFastSimulationModel(G4VFastSimulationModel*);
// Remove a model from the Model List.
// Activate a model in the Model List.
G4bool ActivateFastSimulationModel(const G4String&);
// Methods to activate/inactivate models from the Model
// List.
// Inactivate a model in the Model List.
G4bool InActivateFastSimulationModel(const G4String&);
G4bool ActivateFastSimulationModel(const G4String&);
// Activate a model in the Model List.
// Methods for print/control commands
void ListTitle() const;
void ListModels() const;
void ListModels(const G4ParticleDefinition*) const;
void ListModels(const G4String& aName) const;
const G4Envelope* GetEnvelope() const;
G4bool InActivateFastSimulationModel(const G4String&);
// Inactivate a model in the Model List.
G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName,
const G4VFastSimulationModel* previousFound,
G4bool& foundPrevious) const;
public: // without description
// Methods for print/control commands
void ListTitle() const;
void ListModels() const;
void ListModels(const G4ParticleDefinition*) const;
void ListModels(const G4String& aName) const;
const G4Envelope* GetEnvelope() const;
const std::vector<G4VFastSimulationModel*>& GetFastSimulationModelList() const
{
return ModelList;
}
G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName,
const G4VFastSimulationModel* previousFound,
bool &foundPrevious) const;
void FlushModels();
const std::vector<G4VFastSimulationModel*>& GetFastSimulationModelList() const
{return ModelList;}
//----------------------------------------------
// Interface methods for the
// G4FastSimulationManagerProcess process.
//----------------------------------------------
// Trigger
G4bool PostStepGetFastSimulationManagerTrigger(const G4Track&, const G4Navigator* a = nullptr);
// DoIt
G4VParticleChange* InvokePostStepDoIt();
void FlushModels();
// AtRest methods:
G4bool AtRestGetFastSimulationManagerTrigger(const G4Track&, const G4Navigator* a = nullptr);
G4VParticleChange* InvokeAtRestDoIt();
//----------------------------------------------
// Interface methods for the
// G4FastSimulationManagerProcess process.
//----------------------------------------------
// Trigger
G4bool PostStepGetFastSimulationManagerTrigger(const G4Track &,
const G4Navigator* a = 0);
// DoIt
G4VParticleChange* InvokePostStepDoIt();
// For management
G4bool operator==(const G4FastSimulationManager&) const;
// AtRest methods:
G4bool AtRestGetFastSimulationManagerTrigger(const G4Track &,
const G4Navigator* a = 0);
G4VParticleChange* InvokeAtRestDoIt();
private:
// Private members :
G4FastTrack fFastTrack;
G4FastStep fFastStep;
G4VFastSimulationModel* fTriggedFastSimulationModel{nullptr};
G4FastSimulationVector<G4VFastSimulationModel> ModelList;
G4FastSimulationVector<G4VFastSimulationModel> fInactivatedModels;
// For management
G4bool operator == ( const G4FastSimulationManager&) const;
G4ParticleDefinition* fLastCrossedParticle{nullptr};
G4FastSimulationVector<G4VFastSimulationModel> fApplicableModelList;
private:
// Private members :
G4FastTrack fFastTrack;
G4FastStep fFastStep;
G4VFastSimulationModel* fTriggedFastSimulationModel;
G4FastSimulationVector <G4VFastSimulationModel> ModelList;
G4FastSimulationVector <G4VFastSimulationModel> fInactivatedModels;
G4ParticleDefinition* fLastCrossedParticle;
G4FastSimulationVector <G4VFastSimulationModel> fApplicableModelList;
// -- *** depracating, to be dropped @ next major release:
G4FastSimulationVector <G4Transform3D> GhostPlacements;
// -- *** depracating, to be dropped @ next major release:
G4FastSimulationVector<G4Transform3D> GhostPlacements;
};
inline void
G4FastSimulationManager::AddFastSimulationModel(G4VFastSimulationModel* fsm)
inline void G4FastSimulationManager::AddFastSimulationModel(G4VFastSimulationModel* fsm)
{
ModelList.push_back(fsm);
// forces the fApplicableModelList to be rebuild
fLastCrossedParticle = 0;
fLastCrossedParticle = nullptr;
}
inline void
G4FastSimulationManager::RemoveFastSimulationModel(G4VFastSimulationModel* fsm)
inline void G4FastSimulationManager::RemoveFastSimulationModel(G4VFastSimulationModel* fsm)
{
if(!ModelList.remove(fsm)) fInactivatedModels.remove(fsm);
if (ModelList.remove(fsm) == nullptr) fInactivatedModels.remove(fsm);
// forces the fApplicableModelList to be rebuild
fLastCrossedParticle = 0;
fLastCrossedParticle = nullptr;
}
inline G4bool
G4FastSimulationManager::operator == (const G4FastSimulationManager& fsm) const
inline G4bool G4FastSimulationManager::operator==(const G4FastSimulationManager& fsm) const
{
return (this==&fsm) ? true : false;
return this == &fsm;
}
inline const G4Envelope*
G4FastSimulationManager::GetEnvelope() const
inline const G4Envelope* G4FastSimulationManager::GetEnvelope() const
{
return fFastTrack.GetEnvelope();
}
@@ -25,7 +25,7 @@
//
//
//
//
//
//---------------------------------------------------------------
//
// G4FastSimulationManagerProcess.hh
@@ -35,7 +35,7 @@
//
// History:
// Feb 98: Parallel geometry sensitivity. MoraDeFreitas.
// Oct 97: "Fast" replaces "Parameterisation" in class/method names.
// Oct 97: "Fast" replaces "Parameterisation" in class/method names.
// (release B.00 for parameterisation). MoraDeFreitas.
// Aug 97: First implementation. Verderi && MoraDeFreitas.
// Apr 98: modified for new particle change. H.Kurashige
@@ -47,19 +47,18 @@
//
//---------------------------------------------------------------
#ifndef G4FastSimulationManagerProcess_hh
#define G4FastSimulationManagerProcess_hh
#include "globals.hh"
#include "G4VProcess.hh"
#include "G4FastSimulationManager.hh"
#include "G4FastSimulationProcessType.hh"
#include "G4Step.hh"
#include "G4Navigator.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VParticleChange.hh"
#include "G4FieldTrack.hh"
#include "G4Navigator.hh"
#include "G4Step.hh"
#include "G4VParticleChange.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VProcess.hh"
#include "globals.hh"
class G4PathFinder;
class G4TransportationManager;
@@ -69,103 +68,83 @@ class G4TransportationManager;
//
// ---------------------------------------------------------------------
// Class Description:
// -- G4VProcess providing the interface between the tracking and the fast simulation.
//
class G4FastSimulationManagerProcess : public G4VProcess
{
public:
// -------------------------
// Constructor/Destructor:
// -------------------------
// -- Constructor for parameterisation in mass geometry
G4FastSimulationManagerProcess(const G4String& processName = "G4FastSimulationManagerProcess",
G4ProcessType theType = fParameterisation);
// -- Contructors for parameterisation attached a parallel geometry.
// -- Can also be used for the mass geometry, providing world volume name.
// -- World volume specified by name or pointer.
G4FastSimulationManagerProcess(const G4String& processName,
const G4String& worldVolumeName,
G4ProcessType theType = fParameterisation);
G4FastSimulationManagerProcess(const G4String& processName,
G4VPhysicalVolume* worldVolume,
G4ProcessType theType = fParameterisation);
virtual ~G4FastSimulationManagerProcess();
// -----------------------
// User access methods:
// -----------------------
G4VPhysicalVolume* GetWorldVolume() const {return fWorldVolume;}
// -- Set new world volume to the process
void SetWorldVolume(G4String );
void SetWorldVolume(G4VPhysicalVolume*);
// --------------------------------------------------------------
// Process interface
// --------------------------------------------------------------
// -- Start/End tracking:
void StartTracking(G4Track*);
void EndTracking();
public:
// Constructor for parameterisation in mass geometry
G4FastSimulationManagerProcess(const G4String& processName = "G4FastSimulationManagerProcess",
G4ProcessType theType = fParameterisation);
// -- PostStep methods:
G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
// -- Contructors for parameterisation attached a parallel geometry.
// -- Can also be used for the mass geometry, providing world volume name.
// -- World volume specified by name or pointer.
G4FastSimulationManagerProcess(const G4String& processName, const G4String& worldVolumeName,
G4ProcessType theType = fParameterisation);
G4FastSimulationManagerProcess(const G4String& processName, G4VPhysicalVolume* worldVolume,
G4ProcessType theType = fParameterisation);
// -- Responsible for limiting the step on ghost boundaries:
G4double AlongStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& proposedSafety,
G4GPILSelection* selection);
G4VParticleChange* AlongStepDoIt(const G4Track& track,
const G4Step& step);
~G4FastSimulationManagerProcess() override;
// -- AtRest methods (still there after many years of no use...):
G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*);
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
// -----------------------
// User access methods:
// -----------------------
G4VPhysicalVolume* GetWorldVolume() const { return fWorldVolume; }
// -- debug:
void Verbose() const;
private:
//-- would be better to my taste to have "const G4VPhysicalVolume* fWorldVolume;", but clashes at compilation
G4VPhysicalVolume* fWorldVolume;
G4bool fIsTrackingTime;
G4bool fIsFirstStep;
G4Navigator* fGhostNavigator;
G4int fGhostNavigatorIndex;
G4bool fIsGhostGeometry;
G4double fGhostSafety;
G4FieldTrack fFieldTrack;
G4FastSimulationManager* fFastSimulationManager;
G4bool fFastSimulationTrigger;
G4VParticleChange fDummyParticleChange;
G4PathFinder* fPathFinder;
G4TransportationManager* fTransportationManager;
// -- Set new world volume to the process
void SetWorldVolume(G4String);
void SetWorldVolume(G4VPhysicalVolume*);
// --------------------------------------------------------------
// Process interface
// --------------------------------------------------------------
// -- Start/End tracking:
void StartTracking(G4Track*) override;
void EndTracking() override;
// -- PostStep methods:
G4double PostStepGetPhysicalInteractionLength(const G4Track& track, G4double previousStepSize,
G4ForceCondition* condition) override;
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override;
// -- Responsible for limiting the step on ghost boundaries:
G4double AlongStepGetPhysicalInteractionLength(const G4Track& track, G4double previousStepSize,
G4double currentMinimumStep,
G4double& proposedSafety,
G4GPILSelection* selection) override;
G4VParticleChange* AlongStepDoIt(const G4Track& track, const G4Step& step) override;
// -- AtRest methods (still there after many years of no use...):
G4double AtRestGetPhysicalInteractionLength(const G4Track&, G4ForceCondition*) override;
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) override;
// -- debug:
[[deprecated("obsolete: will be remove in next major release")]] void Verbose() const {}
private:
//-- would be better to my taste to have "const G4VPhysicalVolume* fWorldVolume;", but clashes
// at compilation
G4VPhysicalVolume* fWorldVolume;
G4bool fIsTrackingTime;
G4bool fIsFirstStep;
G4Navigator* fGhostNavigator;
G4int fGhostNavigatorIndex;
G4bool fIsGhostGeometry;
G4double fGhostSafety;
G4FieldTrack fFieldTrack;
G4FastSimulationManager* fFastSimulationManager;
G4bool fFastSimulationTrigger;
G4VParticleChange fDummyParticleChange;
G4PathFinder* fPathFinder;
G4TransportationManager* fTransportationManager;
};
#endif
@@ -25,7 +25,7 @@
//
//
//
//
//
//---------------------------------------------------------------
//
// G4FastSimulationVector.hh
@@ -41,25 +41,24 @@
#ifndef G4FastSimulationVector_h
#define G4FastSimulationVector_h 1
#include <vector>
#include "G4Types.hh"
#include <vector>
template<class T>
class G4FastSimulationVector : public std::vector<T*>
{
typedef std::vector<T*> std_pvector;
typedef typename std_pvector::iterator iterator;
typedef typename std_pvector::const_iterator const_iterator;
using std_pvector = std::vector<T*>;
using iterator = typename std_pvector::iterator;
using const_iterator = typename std_pvector::const_iterator;
public:
public:
G4FastSimulationVector() = default;
G4FastSimulationVector(){};
// G4FastSimulationVector(const G4FastSimulationVector<T>&){};
virtual ~G4FastSimulationVector(){};
T* remove (const T*);
T* removeAt (G4int);
void clearAndDestroy ();
virtual ~G4FastSimulationVector() = default;
T* remove(const T*);
T* removeAt(G4int);
void clearAndDestroy();
};
#include "G4FastSimulationVector.icc"
@@ -25,7 +25,7 @@
//
//
//
//
//
//---------------------------------------------------------------
//
// G4FastSimulationVector.hh
@@ -38,41 +38,38 @@
//
//---------------------------------------------------------------
template<class T>
T* G4FastSimulationVector<T>::remove (const T* a)
{
for (iterator it = std_pvector::begin();it<std_pvector::end(); it++)
{
if (**it==*a)
{
T* tmp=*it;
std_pvector::erase(it);
return tmp;
}
}
return 0;
}
template<class T>
T* G4FastSimulationVector<T>::removeAt (G4int i)
T* G4FastSimulationVector<T>::remove(const T* a)
{
iterator it=std_pvector::begin();
int j;
for(j=0;j<i;j++) it++;
if(it!=std_pvector::end())
{
T* tmp = std_pvector::operator[](i);
for (auto it = std_pvector::begin(); it < std_pvector::end(); ++it) {
if (**it == *a) {
T* tmp = *it;
std_pvector::erase(it);
return tmp;
}
else
return 0;
}
return nullptr;
}
template<class T>
void G4FastSimulationVector<T>::clearAndDestroy ()
T* G4FastSimulationVector<T>::removeAt(G4int i)
{
for (iterator it = std_pvector::begin();it<std_pvector::end(); it++)
if(*it) delete *it;
auto it = std_pvector::begin();
int j;
for (j = 0; j < i; ++j)
++it;
if (it != std_pvector::end()) {
T* tmp = std_pvector::operator[](i);
std_pvector::erase(it);
return tmp;
}
return nullptr;
}
template<class T>
void G4FastSimulationVector<T>::clearAndDestroy()
{
for (auto it = std_pvector::begin(); it < std_pvector::end(); ++it)
if (*it) delete *it;
std_pvector::clear();
}
@@ -25,21 +25,21 @@
//
//
//
//
//
//---------------------------------------------------------------
//
// G4FastStep.hh
//
// Description:
// The G4FastStep class insures a friendly interface
// to manage the primary/secondaries final state for
// to manage the primary/secondaries final state for
// Fast Simulation Models. This includes final states of parent
// particle (normalized direction of the momentum, energy, etc) and
// particle (normalized direction of the momentum, energy, etc) and
// secondary particles generated by the parameterisation.
//
// The G4FastStep class acts also as the G4ParticleChange
// for the Fast Simulation Process. So it inherites from
// the G4VParticleChange class and redefines the four virtual
// for the Fast Simulation Process. So it inherites from
// the G4VParticleChange class and redefines the four virtual
// methods :
//
// virtual G4Step* UpdateStepForAtRest(G4Step* Step);
@@ -54,21 +54,20 @@
// Apr 98: MoraDeFreitas - G4FastStep becomes the G4ParticleChange
// for the Fast Simulation Process.
// Nov 04: Verderi - Add ProposeXXX methods. SetXXX ones are kept
// for backward compatibility.
// for backward compatibility.
//
//---------------------------------------------------------------
#ifndef G4FastStep_h
#define G4FastStep_h
#include "globals.hh"
#include "G4ios.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4ThreeVector.hh"
#include "G4ios.hh"
#include "globals.hh"
class G4DynamicParticle;
#include "G4VParticleChange.hh"
#include "G4FastTrack.hh"
#include "G4VParticleChange.hh"
//-------------------------------------------
//
@@ -77,293 +76,270 @@ class G4DynamicParticle;
//-------------------------------------------
// Class Description:
// The final state of the particles after parameterisation has to be returned through a G4FastStep
// reference. This final state is described as "requests" the tracking will apply after your
// The final state of the particles after parameterisation has to be returned through a G4FastStep
// reference. This final state is described as "requests" the tracking will apply after your
// parameterisation has been invoked.
//
// To facilitate the developers work, changes of position/normalized direction of the
// momentum/polarization can be specified in the local coordinate system of the envelope or in the
// To facilitate the developers work, changes of position/normalized direction of the
// momentum/polarization can be specified in the local coordinate system of the envelope or in the
// global one.
// The default is local system coordinates.
//
class G4FastStep: public G4VParticleChange
class G4FastStep : public G4VParticleChange
{
public: // with Description
void KillPrimaryTrack();
// Set the kinetic energy of the primary to zero, and set the "fStopAndKill" signal
// used by the stepping.
public: // Without description
//------------------------
// Constructor/Destructor
//------------------------
G4FastStep() = default;
~G4FastStep() override = default;
// -- Methods used to change the position, normalized direction of
// the momentum, time etc... of the primary.
// .. space and time:
void ProposePrimaryTrackFinalPosition (const G4ThreeVector &,
G4bool localCoordinates = true);
// Set the primary track final position.
void SetPrimaryTrackFinalPosition (const G4ThreeVector &,
G4bool localCoordinates = true);
// Set the primary track final position -- maintained for backward compatibility.
void ProposePrimaryTrackFinalTime (G4double);
// Set the primary track final time.
void SetPrimaryTrackFinalTime (G4double);
// Set the primary track final time -- maintained for backward compatibility.
G4FastStep(const G4FastStep& right) = delete;
G4FastStep& operator=(const G4FastStep& right) = delete;
// Set the kinetic energy of the primary to zero, and set the "fStopAndKill" signal
// used by the stepping.
void KillPrimaryTrack();
void ProposePrimaryTrackFinalProperTime (G4double);
// Set the primary final track Proper Time.
void SetPrimaryTrackFinalProperTime (G4double);
// Set the primary final track Proper Time -- maintained for backward compatibility.
// -- Methods used to change the position, normalized direction of
// the momentum, time etc... of the primary.
// .. space and time:
// Set the primary track final position.
void ProposePrimaryTrackFinalPosition(const G4ThreeVector&, G4bool localCoordinates = true);
// .. dynamics:
void ProposePrimaryTrackFinalMomentumDirection (const G4ThreeVector &,
G4bool localCoordinates = true);
// Be careful: the Track Final Momentum means the normalized direction
// of the momentum!
void SetPrimaryTrackFinalMomentum (const G4ThreeVector &,
G4bool localCoordinates = true);
// Set the primary track final momentum -- maintained for backward compatibility. Same as ProposePrimaryTrackMomentumDirection(...)
// Set the primary track final position -- maintained for backward compatibility.
[[deprecated("use ProposePrimaryTrackFinalPosition instead")]]
void SetPrimaryTrackFinalPosition(const G4ThreeVector&, G4bool localCoordinates = true);
// Set the primary track final time.
void ProposePrimaryTrackFinalTime(G4double);
void ProposePrimaryTrackFinalKineticEnergy (G4double);
// Set the primary track final kinetic energy.
void SetPrimaryTrackFinalKineticEnergy (G4double);
// Set the primary track final kinetic energy-- maintained for backward compatibility.
// Set the primary track final time -- maintained for backward compatibility.
[[deprecated("use ProposePrimaryTrackFinalTime instead")]]
void SetPrimaryTrackFinalTime(G4double);
// Set the primary final track Proper Time.
void ProposePrimaryTrackFinalProperTime(G4double);
void ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double,
const G4ThreeVector &,
G4bool localCoordinates
= true);
// Set the primary track final kinetic energy and direction.
void SetPrimaryTrackFinalKineticEnergyAndDirection(G4double,
const G4ThreeVector &,
G4bool localCoordinates
= true);
// Set the primary track final kinetic energy and direction -- maintained for backward compatibility.
// Set the primary final track Proper Time -- maintained for backward compatibility.
[[deprecated("use ProposePrimaryTrackProperTime instead")]]
void SetPrimaryTrackFinalProperTime(G4double);
// .. dynamics:
// Be careful: the Track Final Momentum means the normalized direction
// of the momentum!
void ProposePrimaryTrackFinalMomentumDirection(const G4ThreeVector&,
G4bool localCoordinates = true);
void ProposePrimaryTrackFinalPolarization(const G4ThreeVector &,
G4bool localCoordinates = true);
// Set the primary track final polarization.
void SetPrimaryTrackFinalPolarization(const G4ThreeVector &,
G4bool localCoordinates = true);
// Set the primary track final polarization.
// Set the primary track final momentum -- maintained for backward compatibility. Same as
// ProposePrimaryTrackMomentumDirection(...)
[[deprecated("use ProposePrimaryTrackMomentumDirection instead")]]
void SetPrimaryTrackFinalMomentum(const G4ThreeVector&, G4bool localCoordinates = true);
// Set the primary track final kinetic energy.
void ProposePrimaryTrackFinalKineticEnergy(G4double);
void ProposePrimaryTrackPathLength (G4double);
// Set the true path length of the primary track during the step.
void SetPrimaryTrackPathLength (G4double);
// Set the true path length of the primary track during the step -- maintained for backward compatibility.
// Set the primary track final kinetic energy-- maintained for backward compatibility.
[[deprecated("use ProposePrimaryTrackFinalKineticEnergy instead")]]
void SetPrimaryTrackFinalKineticEnergy(G4double);
void ProposePrimaryTrackFinalEventBiasingWeight (G4double);
// Set the weight applied for event biasing mechanism.
void SetPrimaryTrackFinalEventBiasingWeight (G4double);
// Set the weight applied for event biasing mechanism -- kept for backward compatibility.
// Set the primary track final kinetic energy and direction.
void ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double, const G4ThreeVector&,
G4bool localCoordinates = true);
// ------------------------------
// -- Management of secondaries:
// ------------------------------
// Set the primary track final kinetic energy and direction -- maintained for backward
// compatibility.
[[deprecated("use ProposePrimaryTrackFinalKineticEnergyAndDirection instead")]]
void SetPrimaryTrackFinalKineticEnergyAndDirection(G4double, const G4ThreeVector&,
G4bool localCoordinates = true);
// ----------------------------------------------------
// -- The creation of secondaries is Done in two steps:
// -- 1) Give the total number of secondaries
// -- that the FastStep returns
// -- to the tracking using:
// -- SetNumberOfSecondaryTracks()
// --
// -- 2) Invoke the CreateSecondaryTrack() method
// -- to create one secondary at each time.
// ----------------------------------------------------
// Set the primary track final polarization.
void ProposePrimaryTrackFinalPolarization(const G4ThreeVector&, G4bool localCoordinates = true);
// -- Total Number of secondaries to be created,
// -- (to be called first)
void SetNumberOfSecondaryTracks(G4int);
// Set the total number of secondaries that will be created.
// Set the primary track final polarization.
[[deprecated("use ProposePrimaryTrackFinalPolarization instead")]]
void SetPrimaryTrackFinalPolarization(const G4ThreeVector&, G4bool localCoordinates = true);
// -- Number of secondaries effectively stored:
// -- (incremented at each CreateSecondaryTrack()
// -- call)
G4int GetNumberOfSecondaryTracks();
// Returns the number of secondaries effectively stored.
// Set the true path length of the primary track during the step.
void ProposePrimaryTrackPathLength(G4double);
// -- Create a secondary: the arguments are:
// -- * G4DynamicsParticle: see header file, many constructors exist
// -- (allow to set particle type + energy +
// -- the normalized direction of momentum...)
// -- * G4ThreeVector : Polarization (not in G4ParticleChange constructor)
// -- * G4ThreeVector : Position
// -- * G4double : Time
// -- * G4bool : says if Position/Momentum are given in the
// -- local coordinate system (true by default)
// -- Returned value: pointer to the track created.
G4Track* CreateSecondaryTrack(const G4DynamicParticle&,
G4ThreeVector,
G4ThreeVector,
G4double,
G4bool localCoordinates=true);
// Create a secondary. The arguments are:
//
// G4DynamicsParticle: see the G4DynamicsParticle reference, many constructors exist
// (allow to set particle type + energy + the normalized direction of
// momentum...);
// G4ThreeVector : Polarization;
// G4ThreeVector : Position;
// G4double : Time;
// G4bool : says if Position/Momentum are given in the local envelope coordinate
// system (true by default).
//
// Returned value: pointer to the track created.
//
//-- Create a secondary: the difference with he above declaration
//-- is that the Polarization is not given and is assumed already set
//-- in the G4DynamicParticle.
//-- Returned value: pointer to the track created
G4Track* CreateSecondaryTrack(const G4DynamicParticle&,
G4ThreeVector,
G4double,
G4bool localCoordinates=true);
// Create a secondary. The difference with he above declaration is that the Polarization is not
// given and is assumed already set in the G4DynamicParticle.
//
// Returned value: pointer to the track created
// Set the true path length of the primary track during the step -- maintained for backward
// compatibility.
[[deprecated("use ProposePrimaryTrackPathLength instead")]]
void SetPrimaryTrackPathLength(G4double);
// Set the weight applied for event biasing mechanism.
void ProposePrimaryTrackFinalEventBiasingWeight(G4double);
G4Track* GetSecondaryTrack(G4int);
// Returns a pointer on the i-th secondary track created.
// Set the weight applied for event biasing mechanism -- kept for backward compatibility.
[[deprecated("use ProposePrimaryTrackFinalEventBiasingWeight instead")]]
void SetPrimaryTrackFinalEventBiasingWeight(G4double);
//------------------------------------------------
//
// Total energy deposit in the "fast Step"
// (a default should be provided in future,
// which can be:
// delta energy of primary -
// energy of the secondaries)
// This allow the user to Store a consistent
// information in the G4Trajectory.
//
//------------------------------------------------
void ProposeTotalEnergyDeposited(G4double anEnergyPart);
// Set the total energy deposited.
void SetTotalEnergyDeposited(G4double anEnergyPart);
// Set the total energy deposited -- kept for backward compatibility.
// It should be the delta energy of primary less the energy of the secondaries.
// ------------------------------
// -- Management of secondaries:
// ------------------------------
G4double GetTotalEnergyDeposited() const;
// Returns the total energy deposited.
// ----------------------------------------------------
// -- The creation of secondaries is Done in two steps:
// -- 1) Give the total number of secondaries
// -- that the FastStep returns
// -- to the tracking using:
// -- SetNumberOfSecondaryTracks()
// --
// -- 2) Invoke the CreateSecondaryTrack() method
// -- to create one secondary at each time.
// ----------------------------------------------------
void ForceSteppingHitInvocation();
// Control of the stepping manager Hit invocation.
//
// In a usual parameterisation, the control of the hits production is under the user
// responsability in his G4VFastSimulationModel (he generally produces several hits at once.)
//
// However, in the particular case the G4FastSimulation user's model acts as the physics
// replacement only (ie replaces all the ***DoIt() and leads to the construction of a meaningful
// G4Step), the user can delegate to the G4SteppingManager the responsability to invoke
// the Hit()method of the current sensitive if any.
//
// By default, the G4SteppingManager is asked to NOT invoke this Hit() method when parameterisation
// is invoked.
//
// Set the total number of secondaries that will be created.
// -- Total Number of secondaries to be created,
// -- (to be called first)
void SetNumberOfSecondaryTracks(G4int);
// Returns the number of secondaries effectively stored.
// -- Number of secondaries effectively stored:
// -- (incremented at each CreateSecondaryTrack()
// -- call)
G4int GetNumberOfSecondaryTracks();
public: // Without description
//=======================================================
// Implementation section and kernel interfaces.
//=======================================================
//------------------------
// Constructor/Destructor
//------------------------
G4FastStep();
virtual ~G4FastStep();
G4FastStep (const G4FastStep &right) = delete;
G4FastStep & operator= (const G4FastStep &right) = delete;
// -- Create a secondary: the arguments are:
// -- * G4DynamicsParticle: see header file, many constructors exist
// -- (allow to set particle type + energy +
// -- the normalized direction of momentum...)
// -- * G4ThreeVector : Polarization (not in G4ParticleChange constructor)
// -- * G4ThreeVector : Position
// -- * G4double : Time
// -- * G4bool : says if Position/Momentum are given in the
// -- local coordinate system (true by default)
// -- Returned value: pointer to the track created.
G4Track* CreateSecondaryTrack(const G4DynamicParticle&, G4ThreeVector, G4ThreeVector, G4double,
G4bool localCoordinates = true);
public:
// ===============================================
// Stepping interface.
// ===============================================
// --- the following methods are for updating G4Step -----
// Return the pointer to the G4Step after updating the Step information
// by using final state information of the track given by a Model.
//
// The Fast Simulation Mechanism doesn't change the track's final
// state on the AlongDoIt loop, so the default one all we need.
//virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
//-- Create a secondary: the difference with he above declaration
//-- is that the Polarization is not given and is assumed already set
//-- in the G4DynamicParticle.
//-- Returned value: pointer to the track created
G4Track* CreateSecondaryTrack(const G4DynamicParticle&, G4ThreeVector, G4double,
G4bool localCoordinates = true);
G4Step* UpdateStepForAtRest(G4Step* Step);
G4Step* UpdateStepForPostStep(G4Step* Step);
// Returns a pointer on the i-th secondary track created.
G4Track* GetSecondaryTrack(G4int);
// A Model gives the final state of the particle
// based on information of G4FastTrack. So the
// Initialize method is an interface to the
// G4FastSimulationManager to Initialize the
// G4FastStep.
//------------------------------------------------
//
// Total energy deposit in the "fast Step"
// (a default should be provided in future,
// which can be:
// delta energy of primary -
// energy of the secondaries)
// This allow the user to Store a consistent
// information in the G4Trajectory.
//
//------------------------------------------------
// Set the total energy deposited.
void ProposeTotalEnergyDeposited(G4double anEnergyPart);
void Initialize(const G4FastTrack&);
// Set the total energy deposited -- kept for backward compatibility.
// It should be the delta energy of primary less the energy of the secondaries.
[[deprecated("use ProposeTotalEnergyDeposited instead")]]
void SetTotalEnergyDeposited(G4double anEnergyPart);
// for Debug
void DumpInfo() const;
G4bool CheckIt(const G4Track&);
// Returns the total energy deposited.
G4double GetTotalEnergyDeposited() const;
private:
//===================================================
// Private Internal methods (implementation).
//===================================================
// Control of the stepping manager Hit invocation.
//
// In a usual parameterisation, the control of the hits production is under the user
// responsability in his G4VFastSimulationModel (he generally produces several hits at once.)
//
// However, in the particular case the G4FastSimulation user's model acts as the physics
// replacement only (ie replaces all the ***DoIt() and leads to the construction of a meaningful
// G4Step), the user can delegate to the G4SteppingManager the responsability to invoke
// the Hit()method of the current sensitive if any.
//
// By default, the G4SteppingManager is asked to NOT invoke this Hit() method when
// parameterisation is invoked.
void ForceSteppingHitInvocation();
// G4FastStep should never be Initialized in this way
// but we must define it to avoid compiler warnings.
void Initialize(const G4Track&);
// ===============================================
// Stepping interface.
// ===============================================
// --- the following methods are for updating G4Step -----
// Return the pointer to the G4Step after updating the Step information
// by using final state information of the track given by a Model.
//
// The Fast Simulation Mechanism doesn't change the track's final
// state on the AlongDoIt loop, so the default one all we need.
// virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
// -- Utility functions --
//--- methods to keep information of the final state--
// IMPORTANT NOTE: Although the name of the class and methods are
// "Change", what it stores (and returns in get) are the "FINAL"
// values of the Position, the normalized direction of Momentum,
// etc.
// Set theMomentumChange vector: it is the final unitary momentum
// direction.
void SetMomentumChange(G4double Px, G4double Py, G4double Pz);
void SetMomentumChange(const G4ThreeVector& Pfinal);
//=====================================================
// Data members.
//=====================================================
// theMomentumChange is the vector containing the final momentum
// direction after the invoked process. The application of the change
// of the momentum direction of the particle is not Done here.
// The responsibility to apply the change is up the entity
// which invoked the process.
G4ParticleMomentum theMomentumChange;
G4Step* UpdateStepForAtRest(G4Step* Step) override;
G4Step* UpdateStepForPostStep(G4Step* Step) override;
// The changed (final) polarization of a given particle.
G4ThreeVector thePolarizationChange;
// A Model gives the final state of the particle
// based on information of G4FastTrack. So the
// Initialize method is an interface to the
// G4FastSimulationManager to Initialize the
// G4FastStep.
// The final kinetic energy of the current particle.
G4double theEnergyChange = 0.0;
void Initialize(const G4FastTrack&);
// The changed (final) position of a given particle.
G4ThreeVector thePositionChange;
// for Debug
void DumpInfo() const override;
G4bool CheckIt(const G4Track&) override;
// The changed (final) global time of a given particle.
G4double theTimeChange = 0.0;
private:
//===================================================
// Private Internal methods (implementation).
//===================================================
// The changed (final) proper time of a given particle.
G4double theProperTimeChange = 0.0;
// G4FastStep should never be Initialized in this way
// but we must define it to avoid compiler warnings.
void Initialize(const G4Track&) override;
// The reference G4FastTrack
const G4FastTrack* fFastTrack = nullptr;
// -- Utility functions --
//--- methods to keep information of the final state--
// IMPORTANT NOTE: Although the name of the class and methods are
// "Change", what it stores (and returns in get) are the "FINAL"
// values of the Position, the normalized direction of Momentum,
// etc.
// weight for event biasing mechanism:
G4double theWeightChange = 0.0;
// Set theMomentumChange vector: it is the final unitary momentum
// direction.
void SetMomentumChange(G4double Px, G4double Py, G4double Pz);
void SetMomentumChange(const G4ThreeVector& Pfinal);
//=====================================================
// Data members.
//=====================================================
// theMomentumChange is the vector containing the final momentum
// direction after the invoked process. The application of the change
// of the momentum direction of the particle is not Done here.
// The responsibility to apply the change is up the entity
// which invoked the process.
G4ParticleMomentum theMomentumChange;
// The changed (final) polarization of a given particle.
G4ThreeVector thePolarizationChange;
// The final kinetic energy of the current particle.
G4double theEnergyChange = 0.0;
// The changed (final) position of a given particle.
G4ThreeVector thePositionChange;
// The changed (final) global time of a given particle.
G4double theTimeChange = 0.0;
// The changed (final) proper time of a given particle.
G4double theProperTimeChange = 0.0;
// The reference G4FastTrack
const G4FastTrack* fFastTrack = nullptr;
// weight for event biasing mechanism:
G4double theWeightChange = 0.0;
};
//*******************************************************************
@@ -27,69 +27,54 @@
//
// $id: G4ParticleChange.icc,v 1.6 1998/04/14 02:25:54 kurasige Exp $
inline void
G4FastStep::ProposePrimaryTrackFinalTime(G4double time)
inline void G4FastStep::ProposePrimaryTrackFinalTime(G4double time)
{
theTimeChange = time;
}
inline void
G4FastStep:: SetPrimaryTrackFinalTime(G4double time)
inline void G4FastStep::SetPrimaryTrackFinalTime(G4double time)
{
ProposePrimaryTrackFinalTime(time);
}
inline void
G4FastStep::ProposePrimaryTrackFinalProperTime(G4double properTime)
inline void G4FastStep::ProposePrimaryTrackFinalProperTime(G4double properTime)
{
theProperTimeChange = properTime;
}
inline void
G4FastStep:: SetPrimaryTrackFinalProperTime(G4double properTime)
inline void G4FastStep::SetPrimaryTrackFinalProperTime(G4double properTime)
{
ProposePrimaryTrackFinalProperTime(properTime);
}
inline void
G4FastStep::
ProposePrimaryTrackFinalKineticEnergy(G4double kineticEnergy)
inline void G4FastStep::ProposePrimaryTrackFinalKineticEnergy(G4double kineticEnergy)
{
theEnergyChange = kineticEnergy;
}
inline void
G4FastStep::
SetPrimaryTrackFinalKineticEnergy(G4double kineticEnergy)
inline void G4FastStep::SetPrimaryTrackFinalKineticEnergy(G4double kineticEnergy)
{
ProposePrimaryTrackFinalKineticEnergy(kineticEnergy);
}
inline void
G4FastStep::ProposePrimaryTrackPathLength(G4double pathLength)
inline void G4FastStep::ProposePrimaryTrackPathLength(G4double pathLength)
{
ProposeTrueStepLength(pathLength);
}
inline void
G4FastStep::SetPrimaryTrackPathLength(G4double pathLength)
inline void G4FastStep::SetPrimaryTrackPathLength(G4double pathLength)
{
ProposePrimaryTrackPathLength(pathLength);
}
//-----------------------------------------
//
// Creation of eventual secondaries:
// Creation of eventual secondaries:
//
//-----------------------------------------
inline void
G4FastStep::SetNumberOfSecondaryTracks(G4int nSecondaries)
inline void G4FastStep::SetNumberOfSecondaryTracks(G4int nSecondaries)
{
SetNumberOfSecondaries(nSecondaries);
}
inline G4int
G4FastStep::GetNumberOfSecondaryTracks()
inline G4int G4FastStep::GetNumberOfSecondaryTracks()
{
return GetNumberOfSecondaries();
}
@@ -99,7 +84,6 @@ inline G4Track* G4FastStep::GetSecondaryTrack(G4int i)
return GetSecondary(i);
}
//---------------------------------------
//
//---------------------------------------
@@ -112,44 +96,33 @@ inline void G4FastStep::SetTotalEnergyDeposited(G4double anEnergyPart)
ProposeTotalEnergyDeposited(anEnergyPart);
}
inline G4double G4FastStep::GetTotalEnergyDeposited() const
{
return GetLocalEnergyDeposit();
}
inline void G4FastStep::ForceSteppingHitInvocation()
{
ProposeSteppingControl(NormalCondition);
}
inline
void G4FastStep::SetMomentumChange(
G4double Px,
G4double Py,
G4double Pz )
inline void G4FastStep::SetMomentumChange(G4double Px, G4double Py, G4double Pz)
{
theMomentumChange.setX(Px);
theMomentumChange.setY(Py);
theMomentumChange.setZ(Pz);
}
inline
void G4FastStep::SetMomentumChange(const G4ThreeVector& P)
inline void G4FastStep::SetMomentumChange(const G4ThreeVector& P)
{
theMomentumChange = P;
}
inline
void G4FastStep::ProposePrimaryTrackFinalEventBiasingWeight (G4double w)
inline void G4FastStep::ProposePrimaryTrackFinalEventBiasingWeight(G4double w)
{
theWeightChange = w;
}
inline
void G4FastStep::SetPrimaryTrackFinalEventBiasingWeight (G4double w)
inline void G4FastStep::SetPrimaryTrackFinalEventBiasingWeight(G4double w)
{
ProposePrimaryTrackFinalEventBiasingWeight(w);
}
@@ -38,22 +38,20 @@
//
//---------------------------------------------------------------
#ifndef G4FastTrack_h
#define G4FastTrack_h
#include "G4VSolid.hh"
#include "G4LogicalVolume.hh"
#include "G4Region.hh"
#include "G4AffineTransform.hh"
#include "G4Track.hh"
#include "G4LogicalVolume.hh"
#include "G4Navigator.hh"
#include "G4Region.hh"
#include "G4Track.hh"
#include "G4VSolid.hh"
//---------------------------
// For possible future needs:
//---------------------------
typedef G4Region G4Envelope;
using G4Envelope = G4Region;
//-------------------------------------------
//
@@ -69,116 +67,105 @@ typedef G4Region G4Envelope;
// simple access to the position, momentum expressed in the
// envelope coordinate system. Using those quantities and the
// G4VSolid methods, you can for example easily check how far you
// are from the envelope boundary.
// are from the envelope boundary.
//
class G4FastTrack
{
public: // without description
//------------------------
// Constructor/Destructor
//------------------------
// Only one Constructor. By default the envelope can
// be placed n-Times. If the user is sure that it'll be
// placed just one time, the IsUnique flag should be set
// TRUE to avoid the G4AffineTransform re-calculations each
// time we reach the envelope.
G4FastTrack(G4Envelope *anEnvelope,
G4bool IsUnique);
~G4FastTrack();
public: // without description
//------------------------
// Constructor/Destructor
//------------------------
// Only one Constructor. By default the envelope can
// be placed n-Times. If the user is sure that it'll be
// placed just one time, the IsUnique flag should be set
// TRUE to avoid the G4AffineTransform re-calculations each
// time we reach the envelope.
G4FastTrack(G4Envelope* anEnvelope, G4bool IsUnique);
~G4FastTrack() = default;
//------------------------------------------------------------
// The fast simulation manager uses the SetCurrentTrack
// method to setup the current G4FastTrack object
//------------------------------------------------------------
void SetCurrentTrack(const G4Track&, const G4Navigator* a = 0);
//------------------------------------------------------------
// The fast simulation manager uses the SetCurrentTrack
// method to setup the current G4FastTrack object
//------------------------------------------------------------
void SetCurrentTrack(const G4Track&, const G4Navigator* a = nullptr);
//------------------------------------------------------------
// The fast simulation manager uses the OnTheBoundaryButExiting
// method to test if the particle is leaving the envelope.
//------------------------------------------------------------
G4bool OnTheBoundaryButExiting() const;
//------------------------------------------------------------
// The fast simulation manager uses the OnTheBoundaryButExiting
// method to test if the particle is leaving the envelope.
//------------------------------------------------------------
G4bool OnTheBoundaryButExiting() const;
//----------------------------------
// Informations useful to the user :
// General public get functions.
//----------------------------------
//----------------------------------
// Informations useful to the user :
// General public get functions.
//----------------------------------
public: // with Description
// Returns the current G4Track.
const G4Track* GetPrimaryTrack() const;
const G4Track* GetPrimaryTrack() const;
// Returns the current G4Track.
// Returns the Envelope G4Region pointer.
G4Envelope* GetEnvelope() const;
G4Envelope* GetEnvelope() const;
// Returns the Envelope G4Region pointer.
// Returns the Envelope G4LogicalVolume pointer.
G4LogicalVolume* GetEnvelopeLogicalVolume() const;
G4LogicalVolume* GetEnvelopeLogicalVolume() const;
// Returns the Envelope G4LogicalVolume pointer.
// Returns the Envelope G4VPhysicalVolume pointer.
G4VPhysicalVolume* GetEnvelopePhysicalVolume() const;
G4VPhysicalVolume* GetEnvelopePhysicalVolume() const;
// Returns the Envelope G4VPhysicalVolume pointer.
// Returns the Envelope G4VSolid pointer.
G4VSolid* GetEnvelopeSolid() const;
G4VSolid* GetEnvelopeSolid() const;
// Returns the Envelope G4VSolid pointer.
//-----------------------------------
// Primary track informations in the
// Envelope coordinate system.
//-----------------------------------
//-----------------------------------
// Primary track informations in the
// Envelope coordinate system.
//-----------------------------------
// Returns the particle position in envelope coordinates.
G4ThreeVector GetPrimaryTrackLocalPosition() const;
G4ThreeVector GetPrimaryTrackLocalPosition() const;
// Returns the particle position in envelope coordinates.
// Returns the particle momentum in envelope coordinates.
G4ThreeVector GetPrimaryTrackLocalMomentum() const;
G4ThreeVector GetPrimaryTrackLocalMomentum() const;
// Returns the particle momentum in envelope coordinates.
// Returns the particle direction in envelope coordinates.
G4ThreeVector GetPrimaryTrackLocalDirection() const;
G4ThreeVector GetPrimaryTrackLocalDirection() const;
// Returns the particle direction in envelope coordinates.
// Returns the particle polarization in envelope coordinates.
G4ThreeVector GetPrimaryTrackLocalPolarization() const;
G4ThreeVector GetPrimaryTrackLocalPolarization() const;
// Returns the particle polarization in envelope coordinates.
//------------------------------------
// 3D transformation of the envelope:
//------------------------------------
// Global -> Local
//------------------------------------
// 3D transformation of the envelope:
//------------------------------------
const G4AffineTransform* GetAffineTransformation() const;
// Returns the envelope Global -> Local G4AffineTransform
// Returns the envelope Global -> Local G4AffineTransform
const G4AffineTransform* GetAffineTransformation() const;
// Local -> Global
const G4AffineTransform* GetInverseAffineTransformation() const;
// Returns the envelope Local -> Global G4AffineTransform
// Returns the envelope Local -> Global G4AffineTransform
const G4AffineTransform* GetInverseAffineTransformation() const;
//-----------------
// Private members
//-----------------
private:
private:
//-----------------
// Private members
//-----------------
// Current G4Track pointer
const G4Track* fTrack{nullptr};
// Current G4Track pointer
const G4Track* fTrack;
//------------------------------------------------
// Records the Affine/InverseAffine transformation
// of the envelope.
//------------------------------------------------
void FRecordsAffineTransformation(const G4Navigator*);
G4bool fAffineTransformationDefined;
G4Envelope* fEnvelope;
G4bool fIsUnique;
G4LogicalVolume* fEnvelopeLogicalVolume;
G4VPhysicalVolume* fEnvelopePhysicalVolume;
G4VSolid* fEnvelopeSolid;
G4ThreeVector fLocalTrackPosition,
fLocalTrackMomentum,
fLocalTrackDirection,
fLocalTrackPolarization;
G4AffineTransform fAffineTransformation,
fInverseAffineTransformation;
//------------------------------------------------
// Records the Affine/InverseAffine transformation
// of the envelope.
//------------------------------------------------
void FRecordsAffineTransformation(const G4Navigator*);
G4bool fAffineTransformationDefined{false};
G4Envelope* fEnvelope;
G4bool fIsUnique;
G4LogicalVolume* fEnvelopeLogicalVolume{nullptr};
G4VPhysicalVolume* fEnvelopePhysicalVolume{nullptr};
G4VSolid* fEnvelopeSolid{nullptr};
G4ThreeVector fLocalTrackPosition, fLocalTrackMomentum, fLocalTrackDirection,
fLocalTrackPolarization;
G4AffineTransform fAffineTransformation, fInverseAffineTransformation;
};
// -----------------
// -- Inline methods
// -----------------
@@ -238,12 +225,12 @@ inline const G4AffineTransform* G4FastTrack::GetInverseAffineTransformation() co
return &fInverseAffineTransformation;
}
inline G4bool G4FastTrack::OnTheBoundaryButExiting() const
inline G4bool G4FastTrack::OnTheBoundaryButExiting() const
{
// tests if particle are on the boundary and leaving.
return GetEnvelopeSolid()->
DistanceToOut(GetPrimaryTrackLocalPosition(),
GetPrimaryTrackLocalDirection())==0.;
return GetEnvelopeSolid()->DistanceToOut(GetPrimaryTrackLocalPosition(),
GetPrimaryTrackLocalDirection())
== 0.;
}
#endif
@@ -25,47 +25,47 @@
//
//
//
//
//
//---------------------------------------------------------------
//
// G4GlobalFastSimulationManager.hh
//
// Description:
// A singleton class which manages the Fast Simulation managers
// A singleton class which manages the Fast Simulation managers
// attached to envelopes.
//
// History:
// June 98: Verderi && MoraDeFreitas - "G4ParallelWorld" becomes
// "G4FlavoredParallelWorld"; some method name changes;
// GetFlavoredWorldForThis now returns a
// GetFlavoredWorldForThis now returns a
// G4FlavoredParallelWorld pointer.
// Feb 98: Verderi && MoraDeFreitas - First Implementation.
//
//---------------------------------------------------------------
#ifndef G4GlobalFastSimulationManager_hh
#define G4GlobalFastSimulationManager_hh
#ifndef G4GLOBALFASTSIMULATIONMANAGER_HH
#define G4GLOBALFASTSIMULATIONMANAGER_HH
#include "globals.hh"
#include "G4FastSimulationVector.hh"
#include "G4VGlobalFastSimulationManager.hh"
#include "G4FastSimulationManager.hh"
#include "G4FastSimulationManagerProcess.hh"
#include "G4FastSimulationVector.hh"
#include "G4VGlobalFastSimulationManager.hh"
#include "globals.hh"
class G4FastSimulationMessenger;
template <class T>
class G4ThreadLocalSingleton;
enum listType {
enum listType
{
NAMES_ONLY,
MODELS,
ISAPPLICABLE
};
// Class Description:
// This a singleton class which provides the management of the G4FastSimulationManager
// objects and some ghost facilities.
// objects and some ghost facilities.
//
// You can get access to it by:
//
@@ -76,91 +76,81 @@ enum listType {
// globalFSM = G4GlobalFastSimulationManager::getGlobalFastSimulationManager();
// ...
// ...
//
// Presently, you will mainly need to use the GlobalFastSimulationManager if you use ghost
//
// Presently, you will mainly need to use the GlobalFastSimulationManager if you use ghost
// geometries.
//
class G4GlobalFastSimulationManager
{
friend class G4ThreadLocalSingleton<G4GlobalFastSimulationManager>;
public: // With description
public:
// Destructor
~G4GlobalFastSimulationManager();
static G4GlobalFastSimulationManager* GetGlobalFastSimulationManager();
// Provides a global access to the GlobalFastSimulationManager
static G4GlobalFastSimulationManager* GetInstance();
// Same as GetGlobalFastSimulationManager()
G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName,
const G4VFastSimulationModel* previousFound = 0) const;
// Iterative fetch of G4VFastSimulationModel objects by name:
// o returns the G4VFastSimulationModel* of model with name modelName;
// o returns 0 if no model found;
// o usage:
// myModel = gblManager->GetFastSimulationModel("MyModel");
// o note for the case of several models having the same name:
// - to get the first "MyModel" model:
// myModel1 = gblManager->GetFastSimulationModel("MyModel", 0);
// - to get the next one:
// myModel2 = gblManager->GetFastSimulationModel("MyModel", myModel1);
// - and so on.
// - When gblManager->GetFastSimulationModel("MyModel", myModel_n)
// returns a null pointer, no extra model with name "MyModel" exist.
// Provides a global access to the GlobalFastSimulationManager
static G4GlobalFastSimulationManager* GetGlobalFastSimulationManager();
public: // Without description
// Same as GetGlobalFastSimulationManager()
static G4GlobalFastSimulationManager* GetInstance();
// Destructor
~G4GlobalFastSimulationManager();
// Iterative fetch of G4VFastSimulationModel objects by name:
// o returns the G4VFastSimulationModel* of model with name modelName;
// o returns 0 if no model found;
// o usage:
// myModel = gblManager->GetFastSimulationModel("MyModel");
// o note for the case of several models having the same name:
// - to get the first "MyModel" model:
// myModel1 = gblManager->GetFastSimulationModel("MyModel", 0);
// - to get the next one:
// myModel2 = gblManager->GetFastSimulationModel("MyModel", myModel1);
// - and so on.
// - When gblManager->GetFastSimulationModel("MyModel", myModel_n)
// returns a null pointer, no extra model with name "MyModel" exist.
G4VFastSimulationModel*
GetFastSimulationModel(const G4String& modelName,
const G4VFastSimulationModel* previousFound = nullptr) const;
//
// G4FastSimulationManager(Process)'s management, no intended for general use.
//
// Methods for a G4FastSimulationManager to register itself
//
void AddFastSimulationManager(G4FastSimulationManager*);
void RemoveFastSimulationManager(G4FastSimulationManager*);
//
// G4FastSimulationManagerProcess bookeeping:
//
void AddFSMP(G4FastSimulationManagerProcess*);
void RemoveFSMP(G4FastSimulationManagerProcess*);
//
// G4FastSimulationManager(Process)'s management, no intended for general use.
//
// Methods for a G4FastSimulationManager to register itself
//
void AddFastSimulationManager(G4FastSimulationManager*);
void RemoveFastSimulationManager(G4FastSimulationManager*);
//
// G4FastSimulationManagerProcess bookeeping:
//
void AddFSMP(G4FastSimulationManagerProcess*);
void RemoveFSMP(G4FastSimulationManagerProcess*);
// Flag that the Parameterisation must be closed.
void FastSimulationNeedsToBeClosed();
// Flag that the Parameterisation must be closed.
void FastSimulationNeedsToBeClosed();
// Show the fast simulation setup : world(s), region(s), model(s) and links between them.
// Requires the geometry to be closed.
void ShowSetup();
void ListEnvelopes(const G4String& aName = "all", listType aListType = NAMES_ONLY);
void ListEnvelopes(const G4ParticleDefinition*);
public: // With description
void ShowSetup();
// Show the fast simulation setup : world(s), region(s), model(s) and links between them.
// Requires the geometry to be closed.
void ActivateFastSimulationModel(const G4String&);
void InActivateFastSimulationModel(const G4String&);
void Flush();
public: // Without description
private:
// Private construtor insures singleton class
G4GlobalFastSimulationManager();
void ListEnvelopes(const G4String& aName = "all",
listType aListType = NAMES_ONLY);
void ListEnvelopes(const G4ParticleDefinition* );
void ActivateFastSimulationModel(const G4String&);
void InActivateFastSimulationModel(const G4String&);
// recursive display of regions, models, etc...
void DisplayRegion(G4Region* motherRegion, G4int depth,
std::vector<G4ParticleDefinition*>& particles) const;
void Flush();
private:
// Private construtor insures singleton class
G4GlobalFastSimulationManager();
// recursive display of regions, models, etc...
void DisplayRegion(G4Region* motherRegion, G4int depth, std::vector<G4ParticleDefinition*>& particles) const;
// The single instance.
static G4ThreadLocal G4GlobalFastSimulationManager* fGlobalFastSimulationManager;
G4FastSimulationMessenger* fTheFastSimulationMessenger;
G4FastSimulationVector <G4FastSimulationManager> ManagedManagers;
G4FastSimulationVector <G4FastSimulationManagerProcess> fFSMPVector;
G4FastSimulationMessenger* fTheFastSimulationMessenger;
G4FastSimulationVector<G4FastSimulationManager> ManagedManagers;
G4FastSimulationVector<G4FastSimulationManagerProcess> fFSMPVector;
};
#endif
// end of #ifndef G4GlobalFastSimulationManager_hh
#endif
@@ -27,11 +27,11 @@
#ifndef G4VFASTSIMSENSITIVEDETECTOR_HH
#define G4VFASTSIMSENSITIVEDETECTOR_HH
#include "G4VReadOutGeometry.hh"
#include "G4TouchableHistory.hh"
#include "G4VSensitiveDetector.hh"
#include "G4FastHit.hh"
#include "G4FastTrack.hh"
#include "G4TouchableHistory.hh"
#include "G4VReadOutGeometry.hh"
#include "G4VSensitiveDetector.hh"
/**
* @brief Base class for the sensitive detector used within the fast simulation
@@ -53,71 +53,67 @@
class G4VFastSimSensitiveDetector
{
public:
virtual ~G4VFastSimSensitiveDetector() = default;
/// Create a hit.
///
/// It checks if G4VSensitiveDetector is also used as a base class,
/// and takes into account the readout geometry, if it is defined.
/// User instruction on how to deposit energy needs to be implemented in
/// ProcessHits method.
/// @param[in] aHit Created hit (energy and position)
/// @param[in] aTrack Fast track with access to particle's track and
/// properties in envelope's local coordinates
/// @param[in] aTouchable Touchable with relevant transformations
inline G4bool Hit(const G4FastHit* aHit, const G4FastTrack* aTrack,
G4TouchableHandle* aTouchable)
{
G4bool result = true;
G4VSensitiveDetector* sensDet = dynamic_cast<G4VSensitiveDetector*>(this);
if(sensDet == nullptr)
{
G4Exception("G4VFastSimSensitiveDetector::Hit()", "InvalidSetup",
FatalException,
"Sensitive detector needs also to inherit also from "
"G4VSensitiveDetector if full "
"simulation is used instead!");
}
if(sensDet->isActive())
{
G4VReadOutGeometry* ROgeometry = sensDet->GetROgeometry();
G4TouchableHistory* ROhistory = 0;
public:
virtual ~G4VFastSimSensitiveDetector() = default;
if(ROgeometry)
{
// create fake pre-step point updating the touchable from read-out
// geometry.
G4Step fakeStep;
const G4Track* currentTrack = aTrack->GetPrimaryTrack();
G4StepPoint* tmpPoint = fakeStep.GetPreStepPoint();
tmpPoint->SetTouchableHandle(*aTouchable);
tmpPoint->SetPosition(aHit->GetPosition());
tmpPoint->SetMomentumDirection(currentTrack->GetMomentumDirection());
result = ROgeometry->CheckROVolume(&fakeStep, ROhistory);
} else {
ROhistory = static_cast<G4TouchableHistory*>((*aTouchable)());
/// Create a hit.
///
/// It checks if G4VSensitiveDetector is also used as a base class,
/// and takes into account the readout geometry, if it is defined.
/// User instruction on how to deposit energy needs to be implemented in
/// ProcessHits method.
/// @param[in] aHit Created hit (energy and position)
/// @param[in] aTrack Fast track with access to particle's track and
/// properties in envelope's local coordinates
/// @param[in] aTouchable Touchable with relevant transformations
inline G4bool Hit(const G4FastHit* aHit, const G4FastTrack* aTrack,
G4TouchableHandle* aTouchable)
{
G4bool result = true;
auto sensDet = dynamic_cast<G4VSensitiveDetector*>(this);
if (sensDet == nullptr) {
G4Exception("G4VFastSimSensitiveDetector::Hit()", "InvalidSetup", FatalException,
"Sensitive detector needs also to inherit also from "
"G4VSensitiveDetector if full "
"simulation is used instead!");
}
if(result)
result = ProcessHits(aHit, aTrack, ROhistory);
}
else
{
result = false;
}
return result;
}
if (sensDet->isActive()) {
G4VReadOutGeometry* ROgeometry = sensDet->GetROgeometry();
G4TouchableHistory* ROhistory = nullptr;
private:
/// Describes how energy and position of deposits are inserted into the hits
/// collection. It is a private method and it will be invoked by Hit() method
/// of the base class once the readout geometry that may be associated to the
/// corresponding G4VSensitiveDetector is taken into account.
/// It needs to be implemented in the derived class.
/// @param[in] aHit Created hit (energy and position)
/// @param[in] aTrack Fast track with access to particle's track and
/// properties in envelope's local coordinates
/// @param[in] aROHistory Touchable history with relevant transformations
virtual G4bool ProcessHits(const G4FastHit* aHit, const G4FastTrack* aTrack,
G4TouchableHistory* aROHistory) = 0;
if (ROgeometry != nullptr) {
// create fake pre-step point updating the touchable from read-out
// geometry.
G4Step fakeStep;
const G4Track* currentTrack = aTrack->GetPrimaryTrack();
G4StepPoint* tmpPoint = fakeStep.GetPreStepPoint();
tmpPoint->SetTouchableHandle(*aTouchable);
tmpPoint->SetPosition(aHit->GetPosition());
tmpPoint->SetMomentumDirection(currentTrack->GetMomentumDirection());
result = ROgeometry->CheckROVolume(&fakeStep, ROhistory);
}
else {
ROhistory = static_cast<G4TouchableHistory*>((*aTouchable)());
}
if (result) result = ProcessHits(aHit, aTrack, ROhistory);
}
else {
result = false;
}
return result;
}
private:
/// Describes how energy and position of deposits are inserted into the hits
/// collection. It is a private method and it will be invoked by Hit() method
/// of the base class once the readout geometry that may be associated to the
/// corresponding G4VSensitiveDetector is taken into account.
/// It needs to be implemented in the derived class.
/// @param[in] aHit Created hit (energy and position)
/// @param[in] aTrack Fast track with access to particle's track and
/// properties in envelope's local coordinates
/// @param[in] aROHistory Touchable history with relevant transformations
virtual G4bool ProcessHits(const G4FastHit* aHit, const G4FastTrack* aTrack,
G4TouchableHistory* aROHistory) = 0;
};
#endif /* G4VFASTSIMSENSITIVEDETECTOR_HH */
@@ -25,7 +25,7 @@
//
//
//
//
//
//---------------------------------------------------------------
//
// G4VFastSimulationModel.hh
@@ -38,12 +38,11 @@
//
//---------------------------------------------------------------
#ifndef G4VFastSimulationModel_h
#define G4VFastSimulationModel_h
#include "G4FastTrack.hh"
#include "G4FastStep.hh"
#include "G4FastTrack.hh"
//-------------------------------------------
//
@@ -52,109 +51,98 @@
//-------------------------------------------
// Class Description:
// This is the abstract class for the implementation of parameterisations.
// You have to inherit from it to implement your concrete parameterisation
// This is the abstract class for the implementation of parameterisations.
// You have to inherit from it to implement your concrete parameterisation
// model.
//
class G4VFastSimulationModel
class G4VFastSimulationModel
{
public: // With description
public:
// aName identifies the parameterisation model.
G4VFastSimulationModel(const G4String& aName);
G4VFastSimulationModel(const G4String& aName);
// aName identifies the parameterisation model.
// This constructor allows you to get a quick "getting started".
// In addition to the model name, this constructor accepts a G4LogicalVolume
// pointer. This volume will automatically becomes the envelope, and the
// needed G4FastSimulationManager object is constructed if necessary giving
// it the G4LogicalVolume pointer and the boolean value. If it already
// exists, the model is simply added to this manager. However the
// G4VFastSimulationModel object will not keep track of the envelope given
// in the constructor.
// The boolean argument is there for optimization purpose: if you know that
// the G4LogicalVolume envelope is placed only once you can turn this
// boolean value to "true" (an automated mechanism is foreseen here.)
G4VFastSimulationModel(const G4String& aName, G4Envelope*, G4bool IsUnique = FALSE);
G4VFastSimulationModel(const G4String& aName, G4Envelope*,
G4bool IsUnique=FALSE);
// This constructor allows you to get a quick "getting started".
// In addition to the model name, this constructor accepts a G4LogicalVolume
// pointer. This volume will automatically becomes the envelope, and the
// needed G4FastSimulationManager object is constructed if necessary giving
// it the G4LogicalVolume pointer and the boolean value. If it already
// exists, the model is simply added to this manager. However the
// G4VFastSimulationModel object will not keep track of the envelope given
// in the constructor.
// The boolean argument is there for optimization purpose: if you know that
// the G4LogicalVolume envelope is placed only once you can turn this
// boolean value to "true" (an automated mechanism is foreseen here.)
virtual ~G4VFastSimulationModel() = default;
public: // Without description
virtual ~G4VFastSimulationModel() {};
// In your implementation, you have to return "true" when your model is
// applicable to the G4ParticleDefinition passed to this method. The
// G4ParticleDefinition provides all intrisic particle informations (mass,
// charge, spin, name ...).
virtual G4bool IsApplicable(const G4ParticleDefinition&) = 0;
public: // With description
// You have to return "true" when the dynamics conditions to trigger your
// parameterisation are fulfiled. The G4FastTrack provides you access to
// the current G4Track, gives simple access to envelope related features
// (G4LogicalVolume, G4VSolid, G4AffineTransform references between the
// global and the envelope local coordinates systems) and simple access to
// the position, momentum expressed in the envelope coordinate system.
// Using those quantities and the G4VSolid methods, you can for example
// easily check how far you are from the envelope boundary.
virtual G4bool ModelTrigger(const G4FastTrack&) = 0;
virtual G4bool IsApplicable(const G4ParticleDefinition&) = 0;
// In your implementation, you have to return "true" when your model is
// applicable to the G4ParticleDefinition passed to this method. The
// G4ParticleDefinition provides all intrisic particle informations (mass,
// charge, spin, name ...).
// Your parameterisation properly said. The G4FastTrack reference provides
// input informations. The final state of the particles after parameterisation
// has to be returned through the G4FastStep reference. This final state is
// described has "requests" the tracking will apply after your
// parameterisation has been invoked.
virtual void DoIt(const G4FastTrack&, G4FastStep&) = 0;
virtual G4bool ModelTrigger(const G4FastTrack &) = 0;
// You have to return "true" when the dynamics conditions to trigger your
// parameterisation are fulfiled. The G4FastTrack provides you access to
// the current G4Track, gives simple access to envelope related features
// (G4LogicalVolume, G4VSolid, G4AffineTransform references between the
// global and the envelope local coordinates systems) and simple access to
// the position, momentum expressed in the envelope coordinate system.
// Using those quantities and the G4VSolid methods, you can for example
// easily check how far you are from the envelope boundary.
// ---------------------------
// -- Idem for AtRest methods:
// ---------------------------
// -- A default dummy implementation is provided.
virtual void DoIt(const G4FastTrack&, G4FastStep&) = 0;
// Your parameterisation properly said. The G4FastTrack reference provides
// input informations. The final state of the particles after parameterisation
// has to be returned through the G4FastStep reference. This final state is
// described has "requests" the tracking will apply after your
// parameterisation has been invoked.
// You have to return "true" when the dynamics conditions to trigger your
// parameterisation are fulfiled. The G4FastTrack provides you access to
// the current G4Track, gives simple access to envelope related features
// (G4LogicalVolume, G4VSolid, G4AffineTransform references between the
// global and the envelope local coordinates systems) and simple access to
// the position, momentum expressed in the envelope coordinate system.
// Using those quantities and the G4VSolid methods, you can for example
// easily check how far you are from the envelope boundary.
virtual G4bool AtRestModelTrigger(const G4FastTrack&) { return false; }
// ---------------------------
// -- Idem for AtRest methods:
// ---------------------------
// -- A default dummy implementation is provided.
// Your parameterisation properly said. The G4FastTrack reference provides
// input informations. The final state of the particles after parameterisation
// has to be returned through the G4FastStep reference. This final state is
// described has "requests" the tracking will apply after your
// parameterisation has been invoked.
virtual void AtRestDoIt(const G4FastTrack&, G4FastStep&) {}
virtual
G4bool AtRestModelTrigger(const G4FastTrack&) {return false;}
// You have to return "true" when the dynamics conditions to trigger your
// parameterisation are fulfiled. The G4FastTrack provides you access to
// the current G4Track, gives simple access to envelope related features
// (G4LogicalVolume, G4VSolid, G4AffineTransform references between the
// global and the envelope local coordinates systems) and simple access to
// the position, momentum expressed in the envelope coordinate system.
// Using those quantities and the G4VSolid methods, you can for example
// easily check how far you are from the envelope boundary.
// Complete processing of any buffered or offloaded tracks at end of tracking
virtual void Flush() {}
virtual
void AtRestDoIt (const G4FastTrack&, G4FastStep&) {}
// Your parameterisation properly said. The G4FastTrack reference provides
// input informations. The final state of the particles after parameterisation
// has to be returned through the G4FastStep reference. This final state is
// described has "requests" the tracking will apply after your
// parameterisation has been invoked.
// Useful public methods :
const G4String GetName() const;
G4bool operator==(const G4VFastSimulationModel&) const;
virtual
void Flush(){}
public: // Without description
// Useful public methods :
const G4String GetName() const;
G4bool operator == ( const G4VFastSimulationModel&) const;
private:
//-------------
// Model Name:
//-------------
G4String theModelName;
private:
//-------------
// Model Name:
//-------------
G4String theModelName;
};
inline const G4String G4VFastSimulationModel::GetName() const
inline const G4String G4VFastSimulationModel::GetName() const
{
return theModelName;
}
inline G4bool
G4VFastSimulationModel::operator == (const G4VFastSimulationModel& fsm) const
inline G4bool G4VFastSimulationModel::operator==(const G4VFastSimulationModel& fsm) const
{
return (this==&fsm) ? true : false;
return this == &fsm;
}
#endif
@@ -25,17 +25,17 @@
//
//
//
//
// GEANT 4 class header file
//
// GEANT 4 class header file
//
// This is a messenger class for G4FastSimulation.
// Implemented commands are following;
//
// Commands :
// Commands :
// BeamOn * Start a Run.
//
//
// History
// first version by P.Mora de Freitas & M.Verderi
// first version by P.Mora de Freitas & M.Verderi
// ------------------------------------------------------------
#ifndef G4FastSimulationMessenger_h
@@ -45,32 +45,29 @@ class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithoutParameter;
#include "G4GlobalFastSimulationManager.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
#include "G4GlobalFastSimulationManager.hh"
class G4FastSimulationMessenger: public G4UImessenger
class G4FastSimulationMessenger : public G4UImessenger
{
public:
G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM);
virtual ~G4FastSimulationMessenger();
public:
void SetNewValue(G4UIcommand * command,G4String newValues);
private:
G4GlobalFastSimulationManager* fGlobalFastSimulationManager;
//commands
G4UIdirectory* fFSDirectory;
G4UIcmdWithoutParameter* fShowSetupCmd;
G4UIcmdWithAString* fListEnvelopesCmd;
G4UIcmdWithAString* fListModelsCmd;
G4UIcmdWithAString* fListIsApplicableCmd;
G4UIcmdWithAString* fActivateModel;
G4UIcmdWithAString* fInActivateModel;
public:
G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM);
~G4FastSimulationMessenger() override;
void SetNewValue(G4UIcommand* command, G4String newValues) override;
private:
G4GlobalFastSimulationManager* fGlobalFastSimulationManager;
// commands
G4UIdirectory* fFSDirectory;
G4UIcmdWithoutParameter* fShowSetupCmd;
G4UIcmdWithAString* fListEnvelopesCmd;
G4UIcmdWithAString* fListModelsCmd;
G4UIcmdWithAString* fListIsApplicableCmd;
G4UIcmdWithAString* fActivateModel;
G4UIcmdWithAString* fInActivateModel;
};
#endif