Import Geant4 11.2.0 source tree
This commit is contained in:
@@ -6,6 +6,22 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2023-11-21 I. Hrivnacova (param-V11-01-04)
|
||||
- In G4GlobalFastSimulationManager:
|
||||
use G4ThreadLocalSingleton to avoid undeleted static object at exit
|
||||
|
||||
## 2023-10-18 Ben Morgan (param-V11-01-03)
|
||||
- Apply standard and extended clang-tidy fixes
|
||||
- Mark empty/obsolete functions as deprecated
|
||||
|
||||
## 2023-10-16 Ben Morgan (param-V11-01-02)
|
||||
- Apply standard clang-format-ing.
|
||||
- Normal order accessors and docstrings.
|
||||
|
||||
## 2023-09-04 Gabriele Cosmo (param-V11-01-01)
|
||||
- In G4FastTrack, removed references to G4TouchableHistoryHandle,
|
||||
which is now deprecated.
|
||||
|
||||
## 2023-03-23 Anna Zaborowska (param-V11-01-00)
|
||||
- Added missing virtual destructor to G4VFastSimSensitiveDetector
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+24
-27
@@ -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
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ geant4_add_module(G4parameterisation
|
||||
G4FastSimulationHelper.hh
|
||||
G4FastSimulationManager.hh
|
||||
G4FastSimulationManagerProcess.hh
|
||||
G4FastSimulationMessenger.hh
|
||||
G4FastSimulationProcessType.hh
|
||||
G4FastSimulationVector.hh
|
||||
G4FastSimulationVector.icc
|
||||
@@ -18,8 +17,9 @@ geant4_add_module(G4parameterisation
|
||||
G4GlobalFastSimulationManager.hh
|
||||
G4VFastSimSensitiveDetector.hh
|
||||
G4VFastSimulationModel.hh
|
||||
PRIVATE_HEADERS
|
||||
G4FastSimulationMessenger.hh
|
||||
SOURCES
|
||||
G4FastHit.cc
|
||||
G4FastSimHitMaker.cc
|
||||
G4FastSimulationHelper.cc
|
||||
G4FastSimulationManager.cc
|
||||
@@ -42,6 +42,6 @@ geant4_module_link_libraries(G4parameterisation
|
||||
G4partman
|
||||
G4procman
|
||||
G4track
|
||||
G4volumes
|
||||
PRIVATE
|
||||
G4materials)
|
||||
G4materials
|
||||
G4volumes)
|
||||
|
||||
@@ -1,39 +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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
#include "G4FastHit.hh"
|
||||
|
||||
G4FastHit::G4FastHit()
|
||||
: fEnergy()
|
||||
, fPosition(G4ThreeVector())
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4FastHit::G4FastHit(const G4ThreeVector& aPosition, G4double aEnergy)
|
||||
: fEnergy(aEnergy)
|
||||
, fPosition(aPosition)
|
||||
{}
|
||||
@@ -26,19 +26,18 @@
|
||||
|
||||
#include "G4FastSimHitMaker.hh"
|
||||
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VFastSimSensitiveDetector.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
G4FastSimHitMaker::G4FastSimHitMaker()
|
||||
{
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
fWorldWithSdName = "";
|
||||
fpSpotS = new G4Step();
|
||||
fpSpotP = new G4StepPoint();
|
||||
@@ -49,9 +48,9 @@ G4FastSimHitMaker::G4FastSimHitMaker()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4FastSimHitMaker::~G4FastSimHitMaker()
|
||||
G4FastSimHitMaker::~G4FastSimHitMaker()
|
||||
{
|
||||
delete fpNavigator;
|
||||
delete fpNavigator;
|
||||
delete fpSpotP;
|
||||
fpSpotS->ResetPreStepPoint();
|
||||
fpSpotS->ResetPostStepPoint();
|
||||
@@ -63,54 +62,44 @@ G4FastSimHitMaker::~G4FastSimHitMaker()
|
||||
void G4FastSimHitMaker::make(const G4FastHit& aHit, const G4FastTrack& aTrack)
|
||||
{
|
||||
// do not make empty deposit
|
||||
if(aHit.GetEnergy() <= 0)
|
||||
return;
|
||||
if (aHit.GetEnergy() <= 0) return;
|
||||
// Locate the spot
|
||||
if(!fNaviSetup)
|
||||
{
|
||||
if (!fNaviSetup) {
|
||||
// Choose the world volume that contains the sensitive detector based on its
|
||||
// name (empty name for mass geometry)
|
||||
G4VPhysicalVolume* worldWithSD = nullptr;
|
||||
if(fWorldWithSdName.empty())
|
||||
{
|
||||
if (fWorldWithSdName.empty()) {
|
||||
worldWithSD = G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->GetWorldVolume();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
worldWithSD =
|
||||
G4TransportationManager::GetTransportationManager()->GetParallelWorld(
|
||||
fWorldWithSdName);
|
||||
G4TransportationManager::GetTransportationManager()->GetParallelWorld(fWorldWithSdName);
|
||||
}
|
||||
fpNavigator->SetWorldVolume(worldWithSD);
|
||||
// use track global position
|
||||
fpNavigator->LocateGlobalPointAndUpdateTouchable(
|
||||
aTrack.GetPrimaryTrack()->GetPosition(), fTouchableHandle(), false);
|
||||
fpNavigator->LocateGlobalPointAndUpdateTouchable(aTrack.GetPrimaryTrack()->GetPosition(),
|
||||
fTouchableHandle(), false);
|
||||
fNaviSetup = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// for further deposits use hit (local) position and local->global
|
||||
// transformation
|
||||
fpNavigator->LocateGlobalPointAndUpdateTouchable(
|
||||
aTrack.GetInverseAffineTransformation()->TransformPoint(
|
||||
aHit.GetPosition()),
|
||||
aTrack.GetInverseAffineTransformation()->TransformPoint(aHit.GetPosition()),
|
||||
fTouchableHandle());
|
||||
}
|
||||
G4VPhysicalVolume* currentVolume = fTouchableHandle()->GetVolume();
|
||||
|
||||
if(currentVolume != 0)
|
||||
{
|
||||
if (currentVolume != nullptr) {
|
||||
G4VSensitiveDetector* sensitive = currentVolume->GetLogicalVolume()->GetSensitiveDetector();
|
||||
G4VFastSimSensitiveDetector* fastSimSensitive =
|
||||
dynamic_cast<G4VFastSimSensitiveDetector*>(sensitive);
|
||||
if(fastSimSensitive)
|
||||
{
|
||||
auto fastSimSensitive = dynamic_cast<G4VFastSimSensitiveDetector*>(sensitive);
|
||||
if (fastSimSensitive != nullptr) {
|
||||
fastSimSensitive->Hit(&aHit, &aTrack, &fTouchableHandle);
|
||||
}
|
||||
else if(sensitive &&
|
||||
currentVolume->GetLogicalVolume()->GetFastSimulationManager())
|
||||
else if ((sensitive != nullptr)
|
||||
&& (currentVolume->GetLogicalVolume()->GetFastSimulationManager() != nullptr))
|
||||
{
|
||||
fpSpotS->SetTotalEnergyDeposit(aHit.GetEnergy());
|
||||
fpSpotS->SetTrack(const_cast<G4Track*>(aTrack.GetPrimaryTrack()));
|
||||
|
||||
@@ -25,31 +25,34 @@
|
||||
//
|
||||
#include "G4FastSimulationHelper.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4FastSimulationManagerProcess.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
void G4FastSimulationHelper::ActivateFastSimulation(G4ProcessManager* pmanager, G4String parallelGeometryName )
|
||||
void G4FastSimulationHelper::ActivateFastSimulation(G4ProcessManager* pmanager,
|
||||
G4String parallelGeometryName)
|
||||
{
|
||||
G4FastSimulationManagerProcess* fastSimProcess;
|
||||
if ( parallelGeometryName.empty() ) {
|
||||
if (parallelGeometryName.empty()) {
|
||||
fastSimProcess = new G4FastSimulationManagerProcess("fastSimProcess_massGeom");
|
||||
// -- For the parametrisation envelope belonging to the mass geometry case, the G4FastSimulationManagerProcess
|
||||
// -- For the parametrisation envelope belonging to the mass geometry case, the
|
||||
// G4FastSimulationManagerProcess
|
||||
// -- is a PostStep process, and ordering does not matter:
|
||||
pmanager-> AddDiscreteProcess(fastSimProcess);
|
||||
pmanager->AddDiscreteProcess(fastSimProcess);
|
||||
}
|
||||
else {
|
||||
fastSimProcess = new G4FastSimulationManagerProcess("fastSimProcess_parallelGeom",parallelGeometryName);
|
||||
// -- For the parallel geometry case, the G4FastSimulationManagerProcessz
|
||||
// -- is an Along+PostStep process, and ordering matters:
|
||||
pmanager->AddProcess(fastSimProcess);
|
||||
pmanager->SetProcessOrdering(fastSimProcess, idxAlongStep, 1);
|
||||
fastSimProcess =
|
||||
new G4FastSimulationManagerProcess("fastSimProcess_parallelGeom", parallelGeometryName);
|
||||
// -- For the parallel geometry case, the G4FastSimulationManagerProcessz
|
||||
// -- is an Along+PostStep process, and ordering matters:
|
||||
pmanager->AddProcess(fastSimProcess);
|
||||
pmanager->SetProcessOrdering(fastSimProcess, idxAlongStep, 1);
|
||||
}
|
||||
// If the parallel world
|
||||
// exists (with parallel world physics), e.g. for the sensitive detector.
|
||||
// In that case make sure fast simulation is the first process to be checked by the steppping manager
|
||||
// (highest ordering) so that user can kill the particle and/or deposit energy, ignoring other processes.
|
||||
// Otherwise the parallel world physics (which is a StronglyFroced process) will invoke a PostStepDoIt
|
||||
// on the same step, leading to e.g. duplicated energy deposits.
|
||||
// In that case make sure fast simulation is the first process to be checked by the steppping
|
||||
// manager (highest ordering) so that user can kill the particle and/or deposit energy, ignoring
|
||||
// other processes. Otherwise the parallel world physics (which is a StronglyFroced process) will
|
||||
// invoke a PostStepDoIt on the same step, leading to e.g. duplicated energy deposits.
|
||||
|
||||
// Register as the process with highest ordering so it is checked as the first one,
|
||||
// and since it is exclusively forced no other process will be considered (to be invoked).
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#include "G4FastSimulationManager.hh"
|
||||
|
||||
#include "G4GlobalFastSimulationManager.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
@@ -48,19 +49,15 @@
|
||||
// Constructor with envelope and IsUnique flag :
|
||||
// --------------------------------------------------
|
||||
//
|
||||
G4FastSimulationManager::
|
||||
G4FastSimulationManager(G4Envelope *anEnvelope,
|
||||
G4bool IsUnique) :
|
||||
fFastTrack(anEnvelope,IsUnique),fTriggedFastSimulationModel(0),
|
||||
fLastCrossedParticle(0)
|
||||
G4FastSimulationManager::G4FastSimulationManager(G4Envelope* anEnvelope, G4bool IsUnique)
|
||||
: fFastTrack(anEnvelope, IsUnique)
|
||||
{
|
||||
// Communicates to the region that it becomes a
|
||||
// envelope and with this fast simulation manager.
|
||||
anEnvelope->SetFastSimulationManager(this);
|
||||
|
||||
// Add itself to the GlobalFastSimulationManager
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->
|
||||
AddFastSimulationManager(this);
|
||||
// Add itself to the GlobalFastSimulationManager
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFastSimulationManager(this);
|
||||
}
|
||||
|
||||
// -----------
|
||||
@@ -69,108 +66,93 @@ G4FastSimulationManager(G4Envelope *anEnvelope,
|
||||
G4FastSimulationManager::~G4FastSimulationManager()
|
||||
{
|
||||
//
|
||||
// Check out the Envelope about this pointer. If in use,
|
||||
// Check out the Envelope about this pointer. If in use,
|
||||
// resets the Logical Volume IsEnvelope flag to avoid clash.
|
||||
//
|
||||
if(fFastTrack.GetEnvelope()->GetFastSimulationManager()==this)
|
||||
if (fFastTrack.GetEnvelope()->GetFastSimulationManager() == this)
|
||||
fFastTrack.GetEnvelope()->ClearFastSimulationManager();
|
||||
// Remove itself from the GlobalFastSimulationManager
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->
|
||||
RemoveFastSimulationManager(this);
|
||||
// Remove itself from the GlobalFastSimulationManager
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->RemoveFastSimulationManager(
|
||||
this);
|
||||
}
|
||||
|
||||
// ---------------------------------------
|
||||
// Methods to activate/inactivate models
|
||||
//----------------------------------------
|
||||
|
||||
G4bool
|
||||
G4FastSimulationManager::ActivateFastSimulationModel(const G4String& aName)
|
||||
G4bool G4FastSimulationManager::ActivateFastSimulationModel(const G4String& aName)
|
||||
{
|
||||
G4int iModel;
|
||||
|
||||
// If the model is already active, do nothing.
|
||||
for (iModel=0; iModel<(G4int)ModelList.size(); ++iModel)
|
||||
if(ModelList[iModel]->GetName() == aName)
|
||||
return true;
|
||||
|
||||
// Look for in the fInactivatedModels list, if found push_back it back to
|
||||
for (iModel = 0; iModel < (G4int)ModelList.size(); ++iModel)
|
||||
if (ModelList[iModel]->GetName() == aName) return true;
|
||||
|
||||
// Look for in the fInactivatedModels list, if found push_back it back to
|
||||
// the ModelList
|
||||
for (iModel=0; iModel<(G4int)fInactivatedModels.size(); ++iModel)
|
||||
if(fInactivatedModels[iModel]->GetName() == aName) {
|
||||
ModelList.
|
||||
push_back (fInactivatedModels.removeAt(iModel));
|
||||
for (iModel = 0; iModel < (G4int)fInactivatedModels.size(); ++iModel)
|
||||
if (fInactivatedModels[iModel]->GetName() == aName) {
|
||||
ModelList.push_back(fInactivatedModels.removeAt(iModel));
|
||||
// forces the fApplicableModelList to be rebuild
|
||||
fLastCrossedParticle=0;
|
||||
fLastCrossedParticle = nullptr;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
G4bool
|
||||
G4FastSimulationManager::InActivateFastSimulationModel(const G4String& aName)
|
||||
G4bool G4FastSimulationManager::InActivateFastSimulationModel(const G4String& aName)
|
||||
{
|
||||
// Look for in the ModelList, if found remove from it and keep the pointer
|
||||
// Look for in the ModelList, if found remove from it and keep the pointer
|
||||
// on the fInactivatedModels list.
|
||||
for (G4int iModel=0; iModel<(G4int)ModelList.size(); ++iModel)
|
||||
if(ModelList[iModel]->GetName() == aName) {
|
||||
fInactivatedModels.push_back (ModelList.removeAt(iModel));
|
||||
for (G4int iModel = 0; iModel < (G4int)ModelList.size(); ++iModel)
|
||||
if (ModelList[iModel]->GetName() == aName) {
|
||||
fInactivatedModels.push_back(ModelList.removeAt(iModel));
|
||||
// forces the fApplicableModelList to be rebuild
|
||||
fLastCrossedParticle=0;
|
||||
fLastCrossedParticle = nullptr;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
G4VFastSimulationModel*
|
||||
G4VFastSimulationModel*
|
||||
G4FastSimulationManager::GetFastSimulationModel(const G4String& modelName,
|
||||
const G4VFastSimulationModel* previousFound,
|
||||
bool &foundPrevious) const
|
||||
const G4VFastSimulationModel* previousFound,
|
||||
G4bool& foundPrevious) const
|
||||
{
|
||||
G4VFastSimulationModel* model = 0;
|
||||
for (std::size_t iModel=0; iModel<ModelList.size(); ++iModel)
|
||||
{
|
||||
if(ModelList[iModel]->GetName() == modelName)
|
||||
{
|
||||
if (previousFound == 0)
|
||||
{
|
||||
model = ModelList[iModel];
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ModelList[iModel] == previousFound)
|
||||
{
|
||||
foundPrevious = true;
|
||||
continue;
|
||||
}
|
||||
if (foundPrevious)
|
||||
{
|
||||
model = ModelList[iModel];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
G4VFastSimulationModel* model = nullptr;
|
||||
for (auto iModel : ModelList) {
|
||||
if (iModel->GetName() == modelName) {
|
||||
if (previousFound == nullptr) {
|
||||
model = iModel;
|
||||
break;
|
||||
}
|
||||
if (iModel == previousFound) {
|
||||
foundPrevious = true;
|
||||
continue;
|
||||
}
|
||||
if (foundPrevious) {
|
||||
model = iModel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
void G4FastSimulationManager::FlushModels()
|
||||
{
|
||||
for (std::size_t iModel=0; iModel<ModelList.size(); ++iModel)
|
||||
{
|
||||
ModelList[iModel]->Flush();
|
||||
}
|
||||
for (auto& iModel : ModelList) {
|
||||
iModel->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Interface trigger method for the G4ParameterisationManagerProcess
|
||||
//------------------------------------------------------------------
|
||||
// G4bool GetFastSimulationManagerTrigger(const G4Track &);
|
||||
//
|
||||
// This method is used to interface the G4FastSimulationManagerProcess
|
||||
// with the user Fast Simulation Models. It's called when the particle
|
||||
// with the user Fast Simulation Models. It's called when the particle
|
||||
// is inside the envelope.
|
||||
//
|
||||
// It :
|
||||
@@ -179,60 +161,59 @@ void G4FastSimulationManager::FlushModels()
|
||||
// on);
|
||||
// 2) loops on the IsApplicable() methods to find out the
|
||||
// ones should be applied.
|
||||
// 2) for these, loops on the ModelTrigger() methods to find out
|
||||
// 2) for these, loops on the ModelTrigger() methods to find out
|
||||
// perhaps one that must be applied just now.
|
||||
//
|
||||
// If the a Fast Simulation Model is triggered then it returns
|
||||
// If the a Fast Simulation Model is triggered then it returns
|
||||
// true, false otherwise.
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
G4bool
|
||||
G4FastSimulationManager::
|
||||
PostStepGetFastSimulationManagerTrigger(const G4Track& track,
|
||||
const G4Navigator* theNavigator)
|
||||
G4bool
|
||||
G4FastSimulationManager::PostStepGetFastSimulationManagerTrigger(const G4Track& track,
|
||||
const G4Navigator* theNavigator)
|
||||
{
|
||||
std::size_t iModel;
|
||||
|
||||
// If particle type changed re-build the fApplicableModelList.
|
||||
if(fLastCrossedParticle!=track.GetDefinition()) {
|
||||
fLastCrossedParticle=track.GetDefinition();
|
||||
if (fLastCrossedParticle != track.GetDefinition()) {
|
||||
fLastCrossedParticle = track.GetDefinition();
|
||||
fApplicableModelList.clear();
|
||||
// If Model List is empty, do nothing !
|
||||
if(ModelList.size()==0) return false;
|
||||
for (iModel=0; iModel<ModelList.size(); ++iModel)
|
||||
if(ModelList[iModel]->IsApplicable(*(track.GetDefinition())))
|
||||
fApplicableModelList.push_back (ModelList[iModel]);
|
||||
if (ModelList.empty()) return false;
|
||||
|
||||
for (auto iModel : ModelList) {
|
||||
if (iModel->IsApplicable(*(track.GetDefinition()))) {
|
||||
fApplicableModelList.push_back(iModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If Applicable Model List is empty, do nothing !
|
||||
if(fApplicableModelList.size()==0) return false;
|
||||
if (fApplicableModelList.empty()) return false;
|
||||
|
||||
// -- Register current track
|
||||
fFastTrack.SetCurrentTrack(track,theNavigator);
|
||||
fFastTrack.SetCurrentTrack(track, theNavigator);
|
||||
|
||||
// tests if particle are on the boundary and leaving,
|
||||
// in this case do nothing !
|
||||
if(fFastTrack.OnTheBoundaryButExiting()) return false;
|
||||
|
||||
if (fFastTrack.OnTheBoundaryButExiting()) return false;
|
||||
|
||||
// Loops on the ModelTrigger() methods
|
||||
for (iModel=0; iModel<fApplicableModelList.size(); ++iModel)
|
||||
|
||||
for (auto iModel : fApplicableModelList)
|
||||
//---------------------------------------------------
|
||||
// Asks the ModelTrigger method if it must be trigged now.
|
||||
//---------------------------------------------------
|
||||
|
||||
if(fApplicableModelList[iModel]->ModelTrigger(fFastTrack)) {
|
||||
|
||||
if (iModel->ModelTrigger(fFastTrack)) {
|
||||
//--------------------------------------------------
|
||||
// The model will be applied. Initializes the G4FastStep
|
||||
// with the current state of the G4Track and
|
||||
// The model will be applied. Initializes the G4FastStep
|
||||
// with the current state of the G4Track and
|
||||
// same usefull parameters.
|
||||
// In particular it does SetLocalEnergyDeposit(0.0).
|
||||
//--------------------------------------------------
|
||||
//--------------------------------------------------
|
||||
fFastStep.Initialize(fFastTrack);
|
||||
|
||||
|
||||
// Keeps the FastSimulationModel pointer to call the
|
||||
// DoIt() method.
|
||||
fTriggedFastSimulationModel=fApplicableModelList[iModel];
|
||||
fTriggedFastSimulationModel = iModel;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -242,89 +223,86 @@ PostStepGetFastSimulationManagerTrigger(const G4Track& track,
|
||||
return false;
|
||||
}
|
||||
|
||||
G4VParticleChange* G4FastSimulationManager::InvokePostStepDoIt()
|
||||
G4VParticleChange* G4FastSimulationManager::InvokePostStepDoIt()
|
||||
{
|
||||
// const G4FastTrack& parFastTrack=fFastTrack;
|
||||
fTriggedFastSimulationModel->DoIt(fFastTrack,fFastStep);
|
||||
fTriggedFastSimulationModel->DoIt(fFastTrack, fFastStep);
|
||||
return &fFastStep;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// -- Mostly the same as above, in the case of AtRest particles:
|
||||
// -------------------------------------------------------------
|
||||
G4bool
|
||||
G4bool
|
||||
G4FastSimulationManager::AtRestGetFastSimulationManagerTrigger(const G4Track& track,
|
||||
const G4Navigator* theNavigator)
|
||||
const G4Navigator* theNavigator)
|
||||
{
|
||||
std::size_t iModel;
|
||||
|
||||
// If particle type changed re-build the fApplicableModelList.
|
||||
if(fLastCrossedParticle!=track.GetDefinition()) {
|
||||
fLastCrossedParticle=track.GetDefinition();
|
||||
if (fLastCrossedParticle != track.GetDefinition()) {
|
||||
fLastCrossedParticle = track.GetDefinition();
|
||||
fApplicableModelList.clear();
|
||||
// If Model List is empty, do nothing !
|
||||
if(ModelList.size()==0) return false;
|
||||
for (iModel=0; iModel<ModelList.size(); ++iModel)
|
||||
if(ModelList[iModel]->IsApplicable(*(track.GetDefinition())))
|
||||
fApplicableModelList.push_back (ModelList[iModel]);
|
||||
if (ModelList.empty()) return false;
|
||||
|
||||
for (auto iModel : ModelList) {
|
||||
if (iModel->IsApplicable(*(track.GetDefinition()))) {
|
||||
fApplicableModelList.push_back(iModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If Applicable Model List is empty, do nothing !
|
||||
if(fApplicableModelList.size()==0) return false;
|
||||
if (fApplicableModelList.empty()) return false;
|
||||
|
||||
// -- Register current track
|
||||
fFastTrack.SetCurrentTrack(track,theNavigator);
|
||||
|
||||
fFastTrack.SetCurrentTrack(track, theNavigator);
|
||||
|
||||
// -- (note: compared to the PostStepGetFastSimulationManagerTrigger,
|
||||
// -- the test to see if the particle is on the boundary but leaving
|
||||
// -- is irrelevant here)
|
||||
|
||||
|
||||
// Loops on the models to see if one of them wants to trigger:
|
||||
for (iModel=0; iModel < fApplicableModelList.size(); ++iModel)
|
||||
if(fApplicableModelList[iModel]->AtRestModelTrigger(fFastTrack))
|
||||
{
|
||||
fFastStep.Initialize(fFastTrack);
|
||||
fTriggedFastSimulationModel=fApplicableModelList[iModel];
|
||||
return true;
|
||||
}
|
||||
|
||||
for (auto iModel : fApplicableModelList) {
|
||||
if (iModel->AtRestModelTrigger(fFastTrack)) {
|
||||
fFastStep.Initialize(fFastTrack);
|
||||
fTriggedFastSimulationModel = iModel;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------
|
||||
// Nobody asks to gain control, returns false
|
||||
//--------------------------------------------
|
||||
return false;
|
||||
}
|
||||
|
||||
G4VParticleChange* G4FastSimulationManager::InvokeAtRestDoIt()
|
||||
G4VParticleChange* G4FastSimulationManager::InvokeAtRestDoIt()
|
||||
{
|
||||
fTriggedFastSimulationModel->AtRestDoIt(fFastTrack,fFastStep);
|
||||
fTriggedFastSimulationModel->AtRestDoIt(fFastTrack, fFastStep);
|
||||
return &fFastStep;
|
||||
}
|
||||
|
||||
void
|
||||
G4FastSimulationManager::ListTitle() const
|
||||
void G4FastSimulationManager::ListTitle() const
|
||||
{
|
||||
G4cout << fFastTrack.GetEnvelope()->GetName();
|
||||
// if(GhostPlacements.size()!=0) G4cout << " (ghost)";
|
||||
if (fFastTrack.GetEnvelope()->GetWorldPhysical() == G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()) G4cout << " (mass geom.)";
|
||||
else G4cout << " (// geom.)";
|
||||
|
||||
if (fFastTrack.GetEnvelope()->GetWorldPhysical()
|
||||
== G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->GetWorldVolume())
|
||||
G4cout << " (mass geom.)";
|
||||
else
|
||||
G4cout << " (// geom.)";
|
||||
}
|
||||
|
||||
void
|
||||
G4FastSimulationManager::ListModels() const
|
||||
void G4FastSimulationManager::ListModels() const
|
||||
{
|
||||
std::size_t iModel;
|
||||
|
||||
G4cout << "Current Models for the ";
|
||||
ListTitle();
|
||||
G4cout << " envelope:\n";
|
||||
|
||||
for (iModel=0; iModel<ModelList.size(); ++iModel)
|
||||
G4cout << " " << ModelList[iModel]->GetName() << "\n";
|
||||
for (auto iModel : ModelList)
|
||||
G4cout << " " << iModel->GetName() << "\n";
|
||||
|
||||
for (iModel=0; iModel<fInactivatedModels.size(); ++iModel)
|
||||
G4cout << " " << fInactivatedModels[iModel]->GetName()
|
||||
<< "(inactivated)\n";
|
||||
for (auto iModel : fInactivatedModels)
|
||||
G4cout << " " << iModel->GetName() << "(inactivated)\n";
|
||||
}
|
||||
|
||||
void G4FastSimulationManager::ListModels(const G4String& modelName) const
|
||||
@@ -332,94 +310,79 @@ void G4FastSimulationManager::ListModels(const G4String& modelName) const
|
||||
std::size_t iModel;
|
||||
G4int titled = 0;
|
||||
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
|
||||
|
||||
|
||||
// Active Models
|
||||
for ( iModel=0; iModel<ModelList.size(); ++iModel )
|
||||
if( ModelList[iModel]->GetName() == modelName || modelName == "all" )
|
||||
{
|
||||
if( !(titled++) )
|
||||
{
|
||||
G4cout << "In the envelope ";
|
||||
ListTitle();
|
||||
G4cout << ",\n";
|
||||
}
|
||||
G4cout << " the model " << ModelList[iModel]->GetName()
|
||||
<< " is applicable for :\n ";
|
||||
|
||||
G4int list_started=0;
|
||||
for ( G4int iParticle = 0; iParticle<theParticleTable->entries(); iParticle++)
|
||||
if( ModelList[iModel] -> IsApplicable( *(theParticleTable->GetParticle(iParticle))) )
|
||||
{
|
||||
if(list_started++) G4cout << ", ";
|
||||
G4cout << theParticleTable->
|
||||
GetParticle(iParticle)->GetParticleName();
|
||||
}
|
||||
G4cout <<G4endl;
|
||||
for (iModel = 0; iModel < ModelList.size(); ++iModel)
|
||||
if (ModelList[iModel]->GetName() == modelName || modelName == "all") {
|
||||
if ((titled++) == 0) {
|
||||
G4cout << "In the envelope ";
|
||||
ListTitle();
|
||||
G4cout << ",\n";
|
||||
}
|
||||
|
||||
G4cout << " the model " << ModelList[iModel]->GetName() << " is applicable for :\n ";
|
||||
|
||||
G4int list_started = 0;
|
||||
for (G4int iParticle = 0; iParticle < theParticleTable->entries(); iParticle++)
|
||||
if (ModelList[iModel]->IsApplicable(*(theParticleTable->GetParticle(iParticle)))) {
|
||||
if ((list_started++) != 0) G4cout << ", ";
|
||||
G4cout << theParticleTable->GetParticle(iParticle)->GetParticleName();
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
// Inactive Models
|
||||
for (iModel=0; iModel<fInactivatedModels.size(); ++iModel)
|
||||
if(fInactivatedModels[iModel]->GetName() == modelName || modelName == "all" )
|
||||
{
|
||||
if( !(titled++) )
|
||||
{
|
||||
G4cout << "In the envelope ";
|
||||
ListTitle();
|
||||
G4cout << ",\n";
|
||||
}
|
||||
G4cout << " the model " << fInactivatedModels[iModel]->GetName()
|
||||
<< " (inactivated) is applicable for :\n ";
|
||||
|
||||
G4int list_started=0;
|
||||
for ( G4int iParticle=0; iParticle<theParticleTable->entries(); iParticle++ )
|
||||
if( fInactivatedModels[iModel] -> IsApplicable( *(theParticleTable->GetParticle(iParticle))) )
|
||||
{
|
||||
if(list_started++) G4cout << ", ";
|
||||
G4cout << theParticleTable->
|
||||
GetParticle(iParticle)->GetParticleName();
|
||||
}
|
||||
G4cout <<G4endl;
|
||||
for (iModel = 0; iModel < fInactivatedModels.size(); ++iModel)
|
||||
if (fInactivatedModels[iModel]->GetName() == modelName || modelName == "all") {
|
||||
if ((titled++) == 0) {
|
||||
G4cout << "In the envelope ";
|
||||
ListTitle();
|
||||
G4cout << ",\n";
|
||||
}
|
||||
G4cout << " the model " << fInactivatedModels[iModel]->GetName()
|
||||
<< " (inactivated) is applicable for :\n ";
|
||||
|
||||
G4int list_started = 0;
|
||||
for (G4int iParticle = 0; iParticle < theParticleTable->entries(); iParticle++)
|
||||
if (fInactivatedModels[iModel]->IsApplicable(*(theParticleTable->GetParticle(iParticle)))) {
|
||||
if ((list_started++) != 0) G4cout << ", ";
|
||||
G4cout << theParticleTable->GetParticle(iParticle)->GetParticleName();
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4FastSimulationManager::ListModels(const G4ParticleDefinition* particleDefinition) const
|
||||
{
|
||||
std::size_t iModel;
|
||||
G4bool unique = true;
|
||||
|
||||
|
||||
// Active Models
|
||||
for ( iModel=0; iModel<ModelList.size(); ++iModel )
|
||||
if ( ModelList[iModel]->IsApplicable(*particleDefinition) )
|
||||
{
|
||||
G4cout << "Envelope ";
|
||||
ListTitle();
|
||||
G4cout << ", Model "
|
||||
<< ModelList[iModel]->GetName()
|
||||
<< "." << G4endl;
|
||||
// -- Verify unicity of model attached to particleDefinition:
|
||||
for ( auto jModel = iModel + 1; jModel < ModelList.size(); jModel++ )
|
||||
if ( ModelList[jModel]->IsApplicable(*particleDefinition) ) unique = false;
|
||||
}
|
||||
|
||||
// Inactive Models
|
||||
for ( iModel=0; iModel<fInactivatedModels.size(); ++iModel )
|
||||
if( fInactivatedModels[iModel]->IsApplicable(*particleDefinition) )
|
||||
{
|
||||
G4cout << "Envelope ";
|
||||
ListTitle();
|
||||
G4cout << ", Model "
|
||||
<< fInactivatedModels[iModel]->GetName()
|
||||
<< " (inactivated)." << G4endl;
|
||||
}
|
||||
|
||||
if( !unique )
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Two or more active Models are available for the same particle type, in the same envelope/region." << G4endl;
|
||||
G4Exception("G4FastSimulationManager::ListModels(const G4ParticleDefinition* particleDefinition) const",
|
||||
"FastSim001",
|
||||
JustWarning, ed,
|
||||
"Models risk to exclude each other.");
|
||||
for (iModel = 0; iModel < ModelList.size(); ++iModel)
|
||||
if (ModelList[iModel]->IsApplicable(*particleDefinition)) {
|
||||
G4cout << "Envelope ";
|
||||
ListTitle();
|
||||
G4cout << ", Model " << ModelList[iModel]->GetName() << "." << G4endl;
|
||||
// -- Verify unicity of model attached to particleDefinition:
|
||||
for (auto jModel = iModel + 1; jModel < ModelList.size(); jModel++)
|
||||
if (ModelList[jModel]->IsApplicable(*particleDefinition)) unique = false;
|
||||
}
|
||||
unique=false;
|
||||
|
||||
// Inactive Models
|
||||
for (iModel = 0; iModel < fInactivatedModels.size(); ++iModel)
|
||||
if (fInactivatedModels[iModel]->IsApplicable(*particleDefinition)) {
|
||||
G4cout << "Envelope ";
|
||||
ListTitle();
|
||||
G4cout << ", Model " << fInactivatedModels[iModel]->GetName() << " (inactivated)." << G4endl;
|
||||
}
|
||||
|
||||
if (!unique) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Two or more active Models are available for the same particle type, in the same "
|
||||
"envelope/region."
|
||||
<< G4endl;
|
||||
G4Exception(
|
||||
"G4FastSimulationManager::ListModels(const G4ParticleDefinition* particleDefinition) const",
|
||||
"FastSim001", JustWarning, ed, "Models risk to exclude each other.");
|
||||
}
|
||||
unique = false;
|
||||
}
|
||||
|
||||
@@ -39,233 +39,211 @@
|
||||
// October 06: move to parallel geometry scheme, M. Verderi
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4FastSimulationManagerProcess.hh"
|
||||
#include "G4GlobalFastSimulationManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4PathFinder.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
|
||||
#include "G4FieldTrackUpdator.hh"
|
||||
#include "G4GlobalFastSimulationManager.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4PathFinder.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#define PARANOIA
|
||||
|
||||
G4FastSimulationManagerProcess::
|
||||
G4FastSimulationManagerProcess(const G4String& processName,
|
||||
G4ProcessType theType) :
|
||||
G4VProcess(processName,theType),
|
||||
fWorldVolume ( nullptr ),
|
||||
fIsTrackingTime ( false ),
|
||||
fIsFirstStep ( false ),
|
||||
fGhostNavigator ( nullptr ),
|
||||
fGhostNavigatorIndex ( -1 ),
|
||||
fIsGhostGeometry ( false ),
|
||||
fGhostSafety ( -1.0 ),
|
||||
fFieldTrack ( '0' ),
|
||||
fFastSimulationManager( nullptr ),
|
||||
fFastSimulationTrigger( false )
|
||||
G4FastSimulationManagerProcess::G4FastSimulationManagerProcess(const G4String& processName,
|
||||
G4ProcessType theType)
|
||||
: G4VProcess(processName, theType),
|
||||
fWorldVolume(nullptr),
|
||||
fIsTrackingTime(false),
|
||||
fIsFirstStep(false),
|
||||
fGhostNavigator(nullptr),
|
||||
fGhostNavigatorIndex(-1),
|
||||
fIsGhostGeometry(false),
|
||||
fGhostSafety(-1.0),
|
||||
fFieldTrack('0'),
|
||||
fFastSimulationManager(nullptr),
|
||||
fFastSimulationTrigger(false)
|
||||
{
|
||||
// -- set Process Sub Type
|
||||
SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
|
||||
|
||||
|
||||
fPathFinder = G4PathFinder::GetInstance();
|
||||
fPathFinder = G4PathFinder::GetInstance();
|
||||
fTransportationManager = G4TransportationManager::GetTransportationManager();
|
||||
|
||||
|
||||
SetWorldVolume(fTransportationManager->GetNavigatorForTracking()->GetWorldVolume()->GetName());
|
||||
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "' is created, and will message geometry with world volume `"
|
||||
<< fWorldVolume->GetName() << "'." << G4endl;
|
||||
if (verboseLevel > 0)
|
||||
G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "' is created, and will message geometry with world volume `"
|
||||
<< fWorldVolume->GetName() << "'." << G4endl;
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
|
||||
}
|
||||
|
||||
|
||||
G4FastSimulationManagerProcess::
|
||||
G4FastSimulationManagerProcess(const G4String& processName,
|
||||
const G4String& worldVolumeName,
|
||||
G4ProcessType theType) :
|
||||
G4VProcess(processName,theType),
|
||||
fWorldVolume ( nullptr ),
|
||||
fIsTrackingTime ( false ),
|
||||
fIsFirstStep ( false ),
|
||||
fGhostNavigator ( nullptr ),
|
||||
fGhostNavigatorIndex ( -1 ),
|
||||
fIsGhostGeometry ( false ),
|
||||
fGhostSafety ( -1.0 ),
|
||||
fFieldTrack ( '0' ),
|
||||
fFastSimulationManager( nullptr ),
|
||||
fFastSimulationTrigger( false )
|
||||
G4FastSimulationManagerProcess::G4FastSimulationManagerProcess(const G4String& processName,
|
||||
const G4String& worldVolumeName,
|
||||
G4ProcessType theType)
|
||||
: G4VProcess(processName, theType),
|
||||
fWorldVolume(nullptr),
|
||||
fIsTrackingTime(false),
|
||||
fIsFirstStep(false),
|
||||
fGhostNavigator(nullptr),
|
||||
fGhostNavigatorIndex(-1),
|
||||
fIsGhostGeometry(false),
|
||||
fGhostSafety(-1.0),
|
||||
fFieldTrack('0'),
|
||||
fFastSimulationManager(nullptr),
|
||||
fFastSimulationTrigger(false)
|
||||
{
|
||||
// -- set Process Sub Type
|
||||
SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
|
||||
|
||||
|
||||
fPathFinder = G4PathFinder::GetInstance();
|
||||
fPathFinder = G4PathFinder::GetInstance();
|
||||
fTransportationManager = G4TransportationManager::GetTransportationManager();
|
||||
|
||||
SetWorldVolume(worldVolumeName);
|
||||
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "' is created, and will message geometry with world volume `"
|
||||
<< fWorldVolume->GetName() << "'." << G4endl;
|
||||
if (verboseLevel > 0)
|
||||
G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "' is created, and will message geometry with world volume `"
|
||||
<< fWorldVolume->GetName() << "'." << G4endl;
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
|
||||
}
|
||||
|
||||
|
||||
G4FastSimulationManagerProcess::
|
||||
G4FastSimulationManagerProcess(const G4String& processName,
|
||||
G4VPhysicalVolume* worldVolume,
|
||||
G4ProcessType theType) :
|
||||
G4VProcess(processName,theType),
|
||||
fWorldVolume ( nullptr ),
|
||||
fIsTrackingTime ( false ),
|
||||
fIsFirstStep ( false ),
|
||||
fGhostNavigator ( nullptr ),
|
||||
fGhostNavigatorIndex ( -1 ),
|
||||
fIsGhostGeometry ( false ),
|
||||
fGhostSafety ( -1.0 ),
|
||||
fFieldTrack ( '0' ),
|
||||
fFastSimulationManager( nullptr ),
|
||||
fFastSimulationTrigger( false )
|
||||
G4FastSimulationManagerProcess::G4FastSimulationManagerProcess(const G4String& processName,
|
||||
G4VPhysicalVolume* worldVolume,
|
||||
G4ProcessType theType)
|
||||
: G4VProcess(processName, theType),
|
||||
fWorldVolume(nullptr),
|
||||
fIsTrackingTime(false),
|
||||
fIsFirstStep(false),
|
||||
fGhostNavigator(nullptr),
|
||||
fGhostNavigatorIndex(-1),
|
||||
fIsGhostGeometry(false),
|
||||
fGhostSafety(-1.0),
|
||||
fFieldTrack('0'),
|
||||
fFastSimulationManager(nullptr),
|
||||
fFastSimulationTrigger(false)
|
||||
{
|
||||
// -- set Process Sub Type
|
||||
SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
|
||||
|
||||
|
||||
fPathFinder = G4PathFinder::GetInstance();
|
||||
fPathFinder = G4PathFinder::GetInstance();
|
||||
fTransportationManager = G4TransportationManager::GetTransportationManager();
|
||||
|
||||
SetWorldVolume(worldVolume);
|
||||
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "' is created, and will message geometry with world volume `"
|
||||
<< fWorldVolume->GetName() << "'." << G4endl;
|
||||
if (verboseLevel > 0)
|
||||
G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "' is created, and will message geometry with world volume `"
|
||||
<< fWorldVolume->GetName() << "'." << G4endl;
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
|
||||
}
|
||||
|
||||
|
||||
G4FastSimulationManagerProcess::~G4FastSimulationManagerProcess()
|
||||
{
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->RemoveFSMP(this);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------
|
||||
// User access methods:
|
||||
// -----------------------
|
||||
void G4FastSimulationManagerProcess::SetWorldVolume(G4String newWorldName)
|
||||
{
|
||||
if (fIsTrackingTime)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "': changing of world volume at tracking time is not allowed." << G4endl;
|
||||
G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String)",
|
||||
"FastSim002",
|
||||
JustWarning, ed,
|
||||
"Call ignored.");
|
||||
if (fIsTrackingTime) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "': changing of world volume at tracking time is not allowed." << G4endl;
|
||||
G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String)", "FastSim002",
|
||||
JustWarning, ed, "Call ignored.");
|
||||
}
|
||||
else {
|
||||
G4VPhysicalVolume* newWorld = fTransportationManager->IsWorldExisting(newWorldName);
|
||||
if (newWorld == nullptr) {
|
||||
G4ExceptionDescription tellWhatIsWrong;
|
||||
tellWhatIsWrong << "Volume newWorldName = `" << newWorldName
|
||||
<< "' is not a parallel world nor the mass world volume." << G4endl;
|
||||
G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String)", "FastSim003",
|
||||
FatalException, tellWhatIsWrong);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4VPhysicalVolume* newWorld = fTransportationManager->IsWorldExisting(newWorldName);
|
||||
if (newWorld == 0)
|
||||
{
|
||||
G4ExceptionDescription tellWhatIsWrong;
|
||||
tellWhatIsWrong << "Volume newWorldName = `" << newWorldName
|
||||
<< "' is not a parallel world nor the mass world volume."
|
||||
<< G4endl;
|
||||
G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String)",
|
||||
"FastSim003",
|
||||
FatalException,
|
||||
tellWhatIsWrong);
|
||||
}
|
||||
if (verboseLevel>0)
|
||||
{
|
||||
if (fWorldVolume) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "': changing world volume from '" << fWorldVolume->GetName()
|
||||
<< "' to `" << newWorld << "'." << G4endl;
|
||||
else G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "': setting world volume from to `"<< newWorld->GetName() << "'." << G4endl;
|
||||
}
|
||||
fWorldVolume = newWorld;
|
||||
if (verboseLevel > 0) {
|
||||
if (fWorldVolume != nullptr)
|
||||
G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "': changing world volume from '" << fWorldVolume->GetName() << "' to `"
|
||||
<< newWorld << "'." << G4endl;
|
||||
else
|
||||
G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
|
||||
<< "': setting world volume from to `" << newWorld->GetName() << "'." << G4endl;
|
||||
}
|
||||
fWorldVolume = newWorld;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4FastSimulationManagerProcess::SetWorldVolume(G4VPhysicalVolume* newWorld)
|
||||
{
|
||||
if (newWorld) SetWorldVolume(newWorld->GetName());
|
||||
else
|
||||
{
|
||||
G4ExceptionDescription tellWhatIsWrong;
|
||||
tellWhatIsWrong << "Null pointer passed for world volume." << G4endl;
|
||||
G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4VPhysicalVolume* newWorld)",
|
||||
"FastSim004",
|
||||
FatalException,
|
||||
tellWhatIsWrong);
|
||||
}
|
||||
if (newWorld != nullptr)
|
||||
SetWorldVolume(newWorld->GetName());
|
||||
else {
|
||||
G4ExceptionDescription tellWhatIsWrong;
|
||||
tellWhatIsWrong << "Null pointer passed for world volume." << G4endl;
|
||||
G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4VPhysicalVolume* newWorld)",
|
||||
"FastSim004", FatalException, tellWhatIsWrong);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --------------------
|
||||
// Start/End tracking:
|
||||
// --------------------
|
||||
void G4FastSimulationManagerProcess::StartTracking(G4Track* track)
|
||||
{
|
||||
fIsTrackingTime = true;
|
||||
fIsFirstStep = true;
|
||||
|
||||
fIsFirstStep = true;
|
||||
|
||||
// -- fetch the navigator (and its index) and activate it:
|
||||
G4TransportationManager* transportationManager = G4TransportationManager::GetTransportationManager();
|
||||
fGhostNavigator = transportationManager->GetNavigator(fWorldVolume);
|
||||
fIsGhostGeometry = (fGhostNavigator != transportationManager->GetNavigatorForTracking());
|
||||
if (fIsGhostGeometry) fGhostNavigatorIndex = transportationManager->ActivateNavigator(fGhostNavigator);
|
||||
else fGhostNavigatorIndex = -1;
|
||||
G4TransportationManager* transportationManager =
|
||||
G4TransportationManager::GetTransportationManager();
|
||||
fGhostNavigator = transportationManager->GetNavigator(fWorldVolume);
|
||||
fIsGhostGeometry = (fGhostNavigator != transportationManager->GetNavigatorForTracking());
|
||||
if (fIsGhostGeometry)
|
||||
fGhostNavigatorIndex = transportationManager->ActivateNavigator(fGhostNavigator);
|
||||
else
|
||||
fGhostNavigatorIndex = -1;
|
||||
|
||||
fPathFinder->PrepareNewTrack(track->GetPosition(), track->GetMomentumDirection());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
G4FastSimulationManagerProcess::
|
||||
EndTracking()
|
||||
void G4FastSimulationManagerProcess::EndTracking()
|
||||
{
|
||||
fIsTrackingTime = false;
|
||||
if ( fIsGhostGeometry ) fTransportationManager->DeActivateNavigator(fGhostNavigator);
|
||||
if (fIsGhostGeometry) fTransportationManager->DeActivateNavigator(fGhostNavigator);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------
|
||||
// PostStepGetPhysicalInteractionLength():
|
||||
// ------------------------------------------
|
||||
G4double
|
||||
G4FastSimulationManagerProcess::
|
||||
PostStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double,
|
||||
G4ForceCondition* condition)
|
||||
G4double
|
||||
G4FastSimulationManagerProcess::PostStepGetPhysicalInteractionLength(const G4Track& track, G4double,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
// -- Get current volume, and check for presence of fast simulation manager.
|
||||
// -- For the case of the navigator for tracking (fGhostNavigatorIndex == 0)
|
||||
// -- we use the track volume. This allows the code to be valid for both
|
||||
// -- cases where the PathFinder is used (G4CoupledTranportation) or not
|
||||
// -- (G4Transportation).
|
||||
const G4VPhysicalVolume* currentVolume(0);
|
||||
if ( fIsGhostGeometry ) currentVolume = fPathFinder->GetLocatedVolume(fGhostNavigatorIndex);
|
||||
else currentVolume = track.GetVolume();
|
||||
const G4VPhysicalVolume* currentVolume(nullptr);
|
||||
if (fIsGhostGeometry)
|
||||
currentVolume = fPathFinder->GetLocatedVolume(fGhostNavigatorIndex);
|
||||
else
|
||||
currentVolume = track.GetVolume();
|
||||
|
||||
if ( currentVolume )
|
||||
{
|
||||
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
|
||||
if( fFastSimulationManager )
|
||||
{
|
||||
// Ask for trigger:
|
||||
fFastSimulationTrigger = fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track, fGhostNavigator);
|
||||
if( fFastSimulationTrigger )
|
||||
{
|
||||
// Take control over stepping:
|
||||
*condition = ExclusivelyForced;
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
if (currentVolume != nullptr) {
|
||||
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
|
||||
if (fFastSimulationManager != nullptr) {
|
||||
// Ask for trigger:
|
||||
fFastSimulationTrigger =
|
||||
fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track, fGhostNavigator);
|
||||
if (fFastSimulationTrigger) {
|
||||
// Take control over stepping:
|
||||
*condition = ExclusivelyForced;
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -- no fast simulation occuring there:
|
||||
*condition = NotForced;
|
||||
return DBL_MAX;
|
||||
@@ -274,80 +252,67 @@ PostStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
//------------------------------------
|
||||
// PostStepDoIt()
|
||||
//------------------------------------
|
||||
G4VParticleChange*
|
||||
G4FastSimulationManagerProcess::
|
||||
PostStepDoIt(const G4Track&,
|
||||
const G4Step&)
|
||||
G4VParticleChange* G4FastSimulationManagerProcess::PostStepDoIt(const G4Track&, const G4Step&)
|
||||
{
|
||||
G4VParticleChange* finalState = fFastSimulationManager->InvokePostStepDoIt();
|
||||
|
||||
|
||||
// If the particle is still alive, suspend it to force physics re-initialisation:
|
||||
if (finalState->GetTrackStatus() != fStopAndKill) finalState->ProposeTrackStatus(fSuspend);
|
||||
|
||||
|
||||
return finalState;
|
||||
}
|
||||
|
||||
|
||||
G4double
|
||||
G4FastSimulationManagerProcess::
|
||||
AlongStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& proposedSafety,
|
||||
G4GPILSelection* selection)
|
||||
G4double G4FastSimulationManagerProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
|
||||
G4double& proposedSafety, G4GPILSelection* selection)
|
||||
{
|
||||
|
||||
*selection = NotCandidateForSelection;
|
||||
*selection = NotCandidateForSelection;
|
||||
G4double returnedStep = DBL_MAX;
|
||||
|
||||
// ---------------------------------------------------
|
||||
// -- Below code valid for ghost geometry, otherwise
|
||||
// -- useless for fast simulation attached to mass
|
||||
// -- geometry. Warn user in case along used for
|
||||
// -- geometry. Warn user in case along used for
|
||||
// -- mass geometry ?
|
||||
// --------------------------------------------------
|
||||
if ( fIsGhostGeometry )
|
||||
{
|
||||
static G4ThreadLocal G4FieldTrack *endTrack_G4MT_TLS_ = 0 ;
|
||||
if (!endTrack_G4MT_TLS_) endTrack_G4MT_TLS_ = new G4FieldTrack ('0') ;
|
||||
G4FieldTrack &endTrack = *endTrack_G4MT_TLS_;
|
||||
|
||||
static G4ThreadLocal ELimited *eLimited_G4MT_TLS_ = 0 ;
|
||||
if (!eLimited_G4MT_TLS_) eLimited_G4MT_TLS_ = new ELimited ;
|
||||
ELimited &eLimited = *eLimited_G4MT_TLS_;
|
||||
|
||||
if (previousStepSize > 0.) fGhostSafety -= previousStepSize;
|
||||
if (fGhostSafety < 0.) fGhostSafety = 0.0;
|
||||
|
||||
// ------------------------------------------
|
||||
// Determination of the proposed step length:
|
||||
// ------------------------------------------
|
||||
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
|
||||
{
|
||||
// -- No chance to limit the step, as proposed move inside safety
|
||||
returnedStep = currentMinimumStep;
|
||||
proposedSafety = fGhostSafety - currentMinimumStep;
|
||||
}
|
||||
else
|
||||
{
|
||||
// -- Proposed move exceeds safety, need to state
|
||||
G4FieldTrackUpdator::Update(&fFieldTrack, &track);
|
||||
returnedStep = fPathFinder->ComputeStep(fFieldTrack,
|
||||
currentMinimumStep,
|
||||
fGhostNavigatorIndex,
|
||||
track.GetCurrentStepNumber(),
|
||||
fGhostSafety,
|
||||
eLimited,
|
||||
endTrack,
|
||||
track.GetVolume());
|
||||
|
||||
if(eLimited == kDoNot) fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition()); // -- step no limited by ghost
|
||||
proposedSafety = fGhostSafety;
|
||||
if (eLimited == kUnique || eLimited == kSharedOther) *selection = CandidateForSelection;
|
||||
else if (eLimited == kSharedTransport) returnedStep *= (1.0 + 1.0e-9); // -- Expand to disable its selection in Step Manager comparison
|
||||
}
|
||||
if (fIsGhostGeometry) {
|
||||
static G4ThreadLocal G4FieldTrack* endTrack_G4MT_TLS_ = nullptr;
|
||||
if (endTrack_G4MT_TLS_ == nullptr) endTrack_G4MT_TLS_ = new G4FieldTrack('0');
|
||||
G4FieldTrack& endTrack = *endTrack_G4MT_TLS_;
|
||||
|
||||
static G4ThreadLocal ELimited* eLimited_G4MT_TLS_ = nullptr;
|
||||
if (eLimited_G4MT_TLS_ == nullptr) eLimited_G4MT_TLS_ = new ELimited;
|
||||
ELimited& eLimited = *eLimited_G4MT_TLS_;
|
||||
|
||||
if (previousStepSize > 0.) fGhostSafety -= previousStepSize;
|
||||
if (fGhostSafety < 0.) fGhostSafety = 0.0;
|
||||
|
||||
// ------------------------------------------
|
||||
// Determination of the proposed step length:
|
||||
// ------------------------------------------
|
||||
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.) {
|
||||
// -- No chance to limit the step, as proposed move inside safety
|
||||
returnedStep = currentMinimumStep;
|
||||
proposedSafety = fGhostSafety - currentMinimumStep;
|
||||
}
|
||||
|
||||
else {
|
||||
// -- Proposed move exceeds safety, need to state
|
||||
G4FieldTrackUpdator::Update(&fFieldTrack, &track);
|
||||
returnedStep = fPathFinder->ComputeStep(fFieldTrack, currentMinimumStep, fGhostNavigatorIndex,
|
||||
track.GetCurrentStepNumber(), fGhostSafety, eLimited,
|
||||
endTrack, track.GetVolume());
|
||||
|
||||
if (eLimited == kDoNot)
|
||||
fGhostSafety =
|
||||
fGhostNavigator->ComputeSafety(endTrack.GetPosition()); // -- step no limited by ghost
|
||||
proposedSafety = fGhostSafety;
|
||||
if (eLimited == kUnique || eLimited == kSharedOther)
|
||||
*selection = CandidateForSelection;
|
||||
else if (eLimited == kSharedTransport)
|
||||
returnedStep *=
|
||||
(1.0 + 1.0e-9); // -- Expand to disable its selection in Step Manager comparison
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Returns the fGhostSafety as the proposedSafety
|
||||
@@ -357,42 +322,39 @@ AlongStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
return returnedStep;
|
||||
}
|
||||
|
||||
G4VParticleChange*
|
||||
G4FastSimulationManagerProcess::
|
||||
AlongStepDoIt(const G4Track& track,
|
||||
const G4Step&)
|
||||
G4VParticleChange* G4FastSimulationManagerProcess::AlongStepDoIt(const G4Track& track,
|
||||
const G4Step&)
|
||||
{
|
||||
fDummyParticleChange.Initialize(track);
|
||||
return &fDummyParticleChange;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------
|
||||
// At Rest parameterisation:
|
||||
//--------------------------------------------
|
||||
// AtRestGetPhysiscalInteractionLength:
|
||||
//--------------------------------------------
|
||||
G4double
|
||||
G4FastSimulationManagerProcess::
|
||||
AtRestGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4ForceCondition* condition)
|
||||
G4double
|
||||
G4FastSimulationManagerProcess::AtRestGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
const G4VPhysicalVolume* currentVolume(0);
|
||||
if ( fIsGhostGeometry ) currentVolume = fPathFinder->GetLocatedVolume(fGhostNavigatorIndex);
|
||||
else currentVolume = track.GetVolume();
|
||||
const G4VPhysicalVolume* currentVolume(nullptr);
|
||||
if (fIsGhostGeometry)
|
||||
currentVolume = fPathFinder->GetLocatedVolume(fGhostNavigatorIndex);
|
||||
else
|
||||
currentVolume = track.GetVolume();
|
||||
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
|
||||
if( fFastSimulationManager )
|
||||
{
|
||||
// Ask for trigger:
|
||||
fFastSimulationTrigger = fFastSimulationManager->AtRestGetFastSimulationManagerTrigger(track, fGhostNavigator);
|
||||
if( fFastSimulationTrigger )
|
||||
{
|
||||
// Dirty trick to take control over stepping. Does anyone will ever use that ?
|
||||
*condition = NotForced;
|
||||
return -1.0;
|
||||
}
|
||||
if (fFastSimulationManager != nullptr) {
|
||||
// Ask for trigger:
|
||||
fFastSimulationTrigger =
|
||||
fFastSimulationManager->AtRestGetFastSimulationManagerTrigger(track, fGhostNavigator);
|
||||
if (fFastSimulationTrigger) {
|
||||
// Dirty trick to take control over stepping. Does anyone will ever use that ?
|
||||
*condition = NotForced;
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -- no fast simulation occuring there:
|
||||
*condition = NotForced;
|
||||
return DBL_MAX;
|
||||
@@ -405,32 +367,3 @@ G4VParticleChange* G4FastSimulationManagerProcess::AtRestDoIt(const G4Track&, co
|
||||
{
|
||||
return fFastSimulationManager->InvokeAtRestDoIt();
|
||||
}
|
||||
|
||||
|
||||
void G4FastSimulationManagerProcess::Verbose() const
|
||||
{
|
||||
/* G4cout << " >>>>> Trigger Status : ";
|
||||
switch(fFastSimulationManager->GetTriggerStatus())
|
||||
{
|
||||
case NoModel:
|
||||
G4cout << "NoModel" << G4endl;
|
||||
break;
|
||||
case OnBoundaryButLeaving:
|
||||
G4cout << "OnBoundaryButLeaving" << G4endl;
|
||||
break;
|
||||
case OneModelTrigger:
|
||||
G4cout << "OneModelTrigger" << G4endl;
|
||||
break;
|
||||
case NoModelTrigger:
|
||||
G4cout << "NoModelTrigger" << G4endl;
|
||||
break;
|
||||
case Undefined:
|
||||
G4cout << "Undefined" << G4endl;
|
||||
break;
|
||||
default:
|
||||
G4cout << " Bizarre..." << G4endl;
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,21 +27,19 @@
|
||||
//
|
||||
|
||||
#include "G4FastSimulationMessenger.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4FastSimulationMessenger::
|
||||
G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM)
|
||||
G4FastSimulationMessenger::G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM)
|
||||
: fGlobalFastSimulationManager(theGFSM)
|
||||
{
|
||||
fFSDirectory = new G4UIdirectory("/param/");
|
||||
fFSDirectory->SetGuidance("Fast Simulation print/control commands.");
|
||||
|
||||
fShowSetupCmd =
|
||||
new G4UIcmdWithoutParameter("/param/showSetup", this);
|
||||
fShowSetupCmd = new G4UIcmdWithoutParameter("/param/showSetup", this);
|
||||
fShowSetupCmd->SetGuidance("Show fast simulation setup:");
|
||||
fShowSetupCmd->SetGuidance(" - for each world region:");
|
||||
fShowSetupCmd->SetGuidance(" 1) fast simulation manager process attached;");
|
||||
@@ -50,77 +48,61 @@ G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM)
|
||||
fShowSetupCmd->SetGuidance(" - with for each the fast simulation models attached;");
|
||||
fShowSetupCmd->AvailableForStates(G4State_Idle, G4State_GeomClosed);
|
||||
|
||||
fListEnvelopesCmd =
|
||||
new G4UIcmdWithAString("/param/listEnvelopes", this);
|
||||
fListEnvelopesCmd->SetParameterName("ParticleName",true);
|
||||
fListEnvelopesCmd = new G4UIcmdWithAString("/param/listEnvelopes", this);
|
||||
fListEnvelopesCmd->SetParameterName("ParticleName", true);
|
||||
fListEnvelopesCmd->SetDefaultValue("all");
|
||||
fListEnvelopesCmd->SetGuidance("List all the envelope names for a given Particle");
|
||||
fListEnvelopesCmd->SetGuidance("(or for all particles if without parameters).");
|
||||
fListEnvelopesCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fListModelsCmd =
|
||||
new G4UIcmdWithAString("/param/listModels", this);
|
||||
fListModelsCmd->SetParameterName("EnvelopeName",true);
|
||||
fListEnvelopesCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fListModelsCmd = new G4UIcmdWithAString("/param/listModels", this);
|
||||
fListModelsCmd->SetParameterName("EnvelopeName", true);
|
||||
fListModelsCmd->SetDefaultValue("all");
|
||||
fListModelsCmd->SetGuidance("List all the Model names for a given Envelope");
|
||||
fListModelsCmd->SetGuidance("(or for all envelopes if without parameters).");
|
||||
fListModelsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fListIsApplicableCmd =
|
||||
new G4UIcmdWithAString("/param/listIsApplicable", this);
|
||||
fListIsApplicableCmd->SetParameterName("ModelName",true);
|
||||
fListModelsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fListIsApplicableCmd = new G4UIcmdWithAString("/param/listIsApplicable", this);
|
||||
fListIsApplicableCmd->SetParameterName("ModelName", true);
|
||||
fListIsApplicableCmd->SetDefaultValue("all");
|
||||
fListIsApplicableCmd->SetGuidance("List all the Particle names a given Model is applicable");
|
||||
fListIsApplicableCmd->SetGuidance("(or for all Models if without parameters).");
|
||||
|
||||
fActivateModel =
|
||||
new G4UIcmdWithAString("/param/ActivateModel", this);
|
||||
fActivateModel->SetParameterName("ModelName",false);
|
||||
fActivateModel = new G4UIcmdWithAString("/param/ActivateModel", this);
|
||||
fActivateModel->SetParameterName("ModelName", false);
|
||||
fActivateModel->SetGuidance("Activate a given Model.");
|
||||
|
||||
fInActivateModel =
|
||||
new G4UIcmdWithAString("/param/InActivateModel", this);
|
||||
fInActivateModel->SetParameterName("ModelName",false);
|
||||
fInActivateModel = new G4UIcmdWithAString("/param/InActivateModel", this);
|
||||
fInActivateModel->SetParameterName("ModelName", false);
|
||||
fInActivateModel->SetGuidance("InActivate a given Model.");
|
||||
}
|
||||
|
||||
G4FastSimulationMessenger::~G4FastSimulationMessenger()
|
||||
{
|
||||
delete fShowSetupCmd;
|
||||
fShowSetupCmd = 0;
|
||||
delete fListIsApplicableCmd;
|
||||
fListIsApplicableCmd = 0;
|
||||
delete fActivateModel;
|
||||
fActivateModel = 0;
|
||||
delete fInActivateModel;
|
||||
fInActivateModel = 0;
|
||||
delete fListModelsCmd;
|
||||
fListModelsCmd = 0;
|
||||
delete fListEnvelopesCmd;
|
||||
fListEnvelopesCmd = 0;
|
||||
delete fFSDirectory;
|
||||
fFSDirectory = 0;
|
||||
}
|
||||
|
||||
void G4FastSimulationMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
void G4FastSimulationMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if (command == fShowSetupCmd)
|
||||
fGlobalFastSimulationManager->ShowSetup();
|
||||
if( command == fListEnvelopesCmd)
|
||||
{
|
||||
if(newValue == "all")
|
||||
if (command == fShowSetupCmd) fGlobalFastSimulationManager->ShowSetup();
|
||||
if (command == fListEnvelopesCmd) {
|
||||
if (newValue == "all")
|
||||
fGlobalFastSimulationManager->ListEnvelopes();
|
||||
else
|
||||
fGlobalFastSimulationManager->
|
||||
ListEnvelopes(G4ParticleTable::GetParticleTable()->
|
||||
FindParticle(newValue));
|
||||
else
|
||||
fGlobalFastSimulationManager->ListEnvelopes(
|
||||
G4ParticleTable::GetParticleTable()->FindParticle(newValue));
|
||||
}
|
||||
if( command == fListModelsCmd)
|
||||
fGlobalFastSimulationManager->ListEnvelopes(newValue, MODELS);
|
||||
if( command == fListIsApplicableCmd)
|
||||
if (command == fListModelsCmd) fGlobalFastSimulationManager->ListEnvelopes(newValue, MODELS);
|
||||
if (command == fListIsApplicableCmd)
|
||||
fGlobalFastSimulationManager->ListEnvelopes(newValue, ISAPPLICABLE);
|
||||
if( command == fActivateModel)
|
||||
if (command == fActivateModel)
|
||||
fGlobalFastSimulationManager->ActivateFastSimulationModel(newValue);
|
||||
if( command == fInActivateModel)
|
||||
if (command == fInActivateModel)
|
||||
fGlobalFastSimulationManager->InActivateFastSimulationModel(newValue);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
//
|
||||
// Description:
|
||||
// Encapsulates a G4ParticleChange and insure friendly interface
|
||||
// methods to manage the primary/secondaries final state for
|
||||
// methods to manage the primary/secondaries final state for
|
||||
// Fast Simulation Models.
|
||||
//
|
||||
// History:
|
||||
@@ -43,17 +43,17 @@
|
||||
|
||||
#include "G4FastStep.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4TrackFastVector.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4TrackFastVector.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
void G4FastStep::Initialize(const G4FastTrack& fastTrack)
|
||||
{
|
||||
// keeps the fastTrack reference
|
||||
fFastTrack=&fastTrack;
|
||||
fFastTrack = &fastTrack;
|
||||
|
||||
// currentTrack will be used to Initialize the other data members
|
||||
const G4Track& currentTrack = *(fFastTrack->GetPrimaryTrack());
|
||||
@@ -62,22 +62,22 @@ void G4FastStep::Initialize(const G4FastTrack& fastTrack)
|
||||
G4VParticleChange::Initialize(currentTrack);
|
||||
|
||||
// set Energy/Momentum etc. equal to those of the parent particle
|
||||
const G4DynamicParticle* pParticle = currentTrack.GetDynamicParticle();
|
||||
theEnergyChange = pParticle->GetKineticEnergy();
|
||||
theMomentumChange = pParticle->GetMomentumDirection();
|
||||
thePolarizationChange = pParticle->GetPolarization();
|
||||
theProperTimeChange = pParticle->GetProperTime();
|
||||
const G4DynamicParticle* pParticle = currentTrack.GetDynamicParticle();
|
||||
theEnergyChange = pParticle->GetKineticEnergy();
|
||||
theMomentumChange = pParticle->GetMomentumDirection();
|
||||
thePolarizationChange = pParticle->GetPolarization();
|
||||
theProperTimeChange = pParticle->GetProperTime();
|
||||
|
||||
// set Position/Time etc. equal to those of the parent track
|
||||
thePositionChange = currentTrack.GetPosition();
|
||||
theTimeChange = currentTrack.GetGlobalTime();
|
||||
thePositionChange = currentTrack.GetPosition();
|
||||
theTimeChange = currentTrack.GetGlobalTime();
|
||||
|
||||
// switch off stepping hit invokation by default:
|
||||
theSteppingControlFlag = AvoidHitInvocation;
|
||||
|
||||
// event biasing weigth:
|
||||
theWeightChange = currentTrack.GetWeight();
|
||||
}
|
||||
theWeightChange = currentTrack.GetWeight();
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// -- Set the StopAndKilled signal
|
||||
@@ -86,32 +86,27 @@ void G4FastStep::Initialize(const G4FastTrack& fastTrack)
|
||||
//----------------------------------------
|
||||
void G4FastStep::KillPrimaryTrack()
|
||||
{
|
||||
SetPrimaryTrackFinalKineticEnergy(0.) ;
|
||||
ProposeTrackStatus(fStopAndKill) ;
|
||||
ProposePrimaryTrackFinalKineticEnergy(0.);
|
||||
ProposeTrackStatus(fStopAndKill);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
//
|
||||
//--------------------
|
||||
void
|
||||
G4FastStep::
|
||||
ProposePrimaryTrackFinalPosition(const G4ThreeVector &position,
|
||||
G4bool localCoordinates)
|
||||
void G4FastStep::ProposePrimaryTrackFinalPosition(const G4ThreeVector& position,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
// Compute the position coordinate in global
|
||||
// reference system if needed ...
|
||||
G4ThreeVector globalPosition = position;
|
||||
if (localCoordinates)
|
||||
globalPosition = fFastTrack->GetInverseAffineTransformation()->
|
||||
TransformPoint(position);
|
||||
if (localCoordinates)
|
||||
globalPosition = fFastTrack->GetInverseAffineTransformation()->TransformPoint(position);
|
||||
// ...and feed the globalPosition:
|
||||
thePositionChange = globalPosition;
|
||||
}
|
||||
|
||||
void
|
||||
G4FastStep::
|
||||
SetPrimaryTrackFinalPosition(const G4ThreeVector &position,
|
||||
G4bool localCoordinates)
|
||||
void G4FastStep::SetPrimaryTrackFinalPosition(const G4ThreeVector& position,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
ProposePrimaryTrackFinalPosition(position, localCoordinates);
|
||||
}
|
||||
@@ -119,25 +114,20 @@ SetPrimaryTrackFinalPosition(const G4ThreeVector &position,
|
||||
//--------------------
|
||||
//
|
||||
//--------------------
|
||||
void
|
||||
G4FastStep::
|
||||
ProposePrimaryTrackFinalMomentumDirection(const G4ThreeVector &momentum,
|
||||
G4bool localCoordinates)
|
||||
void G4FastStep::ProposePrimaryTrackFinalMomentumDirection(const G4ThreeVector& momentum,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
// Compute the momentum in global reference
|
||||
// system if needed ...
|
||||
G4ThreeVector globalMomentum = momentum;
|
||||
if (localCoordinates)
|
||||
globalMomentum = fFastTrack->GetInverseAffineTransformation()->
|
||||
TransformAxis(momentum);
|
||||
globalMomentum = fFastTrack->GetInverseAffineTransformation()->TransformAxis(momentum);
|
||||
// ...and feed the globalMomentum (ensuring unitarity)
|
||||
SetMomentumChange(globalMomentum.unit());
|
||||
}
|
||||
|
||||
void
|
||||
G4FastStep::
|
||||
SetPrimaryTrackFinalMomentum(const G4ThreeVector &momentum,
|
||||
G4bool localCoordinates)
|
||||
void G4FastStep::SetPrimaryTrackFinalMomentum(const G4ThreeVector& momentum,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
ProposePrimaryTrackFinalMomentumDirection(momentum, localCoordinates);
|
||||
}
|
||||
@@ -145,27 +135,22 @@ SetPrimaryTrackFinalMomentum(const G4ThreeVector &momentum,
|
||||
//--------------------
|
||||
//
|
||||
//--------------------
|
||||
void
|
||||
G4FastStep::
|
||||
ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
const G4ThreeVector &direction,
|
||||
G4bool localCoordinates)
|
||||
void G4FastStep::ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
const G4ThreeVector& direction,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
// Compute global direction if needed...
|
||||
G4ThreeVector globalDirection = direction;
|
||||
if (localCoordinates)
|
||||
globalDirection =fFastTrack->GetInverseAffineTransformation()->
|
||||
TransformAxis(direction);
|
||||
globalDirection = fFastTrack->GetInverseAffineTransformation()->TransformAxis(direction);
|
||||
// ...and feed the globalMomentum (ensuring unitarity)
|
||||
SetMomentumChange(globalDirection.unit());
|
||||
SetPrimaryTrackFinalKineticEnergy(kineticEnergy);
|
||||
ProposePrimaryTrackFinalKineticEnergy(kineticEnergy);
|
||||
}
|
||||
|
||||
void
|
||||
G4FastStep::
|
||||
SetPrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
const G4ThreeVector &direction,
|
||||
G4bool localCoordinates)
|
||||
void G4FastStep::SetPrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
const G4ThreeVector& direction,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
ProposePrimaryTrackFinalKineticEnergyAndDirection(kineticEnergy, direction, localCoordinates);
|
||||
}
|
||||
@@ -173,24 +158,20 @@ SetPrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
//--------------------
|
||||
//
|
||||
//--------------------
|
||||
void
|
||||
G4FastStep::
|
||||
ProposePrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
|
||||
G4bool localCoordinates)
|
||||
void G4FastStep::ProposePrimaryTrackFinalPolarization(const G4ThreeVector& polarization,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
// Compute polarization in global system if needed:
|
||||
G4ThreeVector globalPolarization(polarization);
|
||||
if (localCoordinates)
|
||||
globalPolarization = fFastTrack->GetInverseAffineTransformation()->
|
||||
TransformAxis(globalPolarization);
|
||||
globalPolarization =
|
||||
fFastTrack->GetInverseAffineTransformation()->TransformAxis(globalPolarization);
|
||||
// Feed the particle globalPolarization:
|
||||
thePolarizationChange = globalPolarization;
|
||||
}
|
||||
|
||||
void
|
||||
G4FastStep::
|
||||
SetPrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
|
||||
G4bool localCoordinates)
|
||||
void G4FastStep::SetPrimaryTrackFinalPolarization(const G4ThreeVector& polarization,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
ProposePrimaryTrackFinalPolarization(polarization, localCoordinates);
|
||||
}
|
||||
@@ -198,83 +179,64 @@ SetPrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
|
||||
//--------------------
|
||||
//
|
||||
//--------------------
|
||||
G4Track* G4FastStep::
|
||||
CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
G4ThreeVector polarization,
|
||||
G4ThreeVector position,
|
||||
G4double time,
|
||||
G4bool localCoordinates )
|
||||
G4Track* G4FastStep::CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
G4ThreeVector polarization, G4ThreeVector position,
|
||||
G4double time, G4bool localCoordinates)
|
||||
{
|
||||
G4DynamicParticle dummyDynamics(dynamics);
|
||||
|
||||
|
||||
// ------------------------------------------
|
||||
// Add the polarization to the dummyDynamics:
|
||||
// ------------------------------------------
|
||||
dummyDynamics.SetPolarization(polarization.x(),
|
||||
polarization.y(),
|
||||
polarization.z());
|
||||
|
||||
dummyDynamics.SetPolarization(polarization.x(), polarization.y(), polarization.z());
|
||||
|
||||
return CreateSecondaryTrack(dummyDynamics, position, time, localCoordinates);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
//
|
||||
//--------------------
|
||||
G4Track* G4FastStep::
|
||||
CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
G4ThreeVector position,
|
||||
G4double time,
|
||||
G4bool localCoordinates )
|
||||
G4Track* G4FastStep::CreateSecondaryTrack(const G4DynamicParticle& dynamics, G4ThreeVector position,
|
||||
G4double time, G4bool localCoordinates)
|
||||
{
|
||||
// ----------------------------------------
|
||||
// Quantities in global coordinates system.
|
||||
//
|
||||
//
|
||||
// The allocated globalDynamics is deleted
|
||||
// by the destructor of the G4Track.
|
||||
// ----------------------------------------
|
||||
G4DynamicParticle* globalDynamics =
|
||||
new G4DynamicParticle(dynamics);
|
||||
auto globalDynamics = new G4DynamicParticle(dynamics);
|
||||
G4ThreeVector globalPosition(position);
|
||||
|
||||
|
||||
// -----------------------------------
|
||||
// Convert to global system if needed:
|
||||
// -----------------------------------
|
||||
if (localCoordinates)
|
||||
{
|
||||
// -- Momentum Direction:
|
||||
globalDynamics->SetMomentumDirection(fFastTrack->
|
||||
GetInverseAffineTransformation()->
|
||||
TransformAxis(globalDynamics->
|
||||
GetMomentumDirection()));
|
||||
// -- Polarization:
|
||||
G4ThreeVector globalPolarization;
|
||||
globalPolarization = fFastTrack->GetInverseAffineTransformation()->
|
||||
TransformAxis(globalDynamics->GetPolarization());
|
||||
globalDynamics->SetPolarization(
|
||||
globalPolarization.x(),
|
||||
globalPolarization.y(),
|
||||
globalPolarization.z()
|
||||
);
|
||||
|
||||
// -- Position:
|
||||
globalPosition = fFastTrack->GetInverseAffineTransformation()->
|
||||
TransformPoint(globalPosition);
|
||||
}
|
||||
|
||||
if (localCoordinates) {
|
||||
// -- Momentum Direction:
|
||||
globalDynamics->SetMomentumDirection(
|
||||
fFastTrack->GetInverseAffineTransformation()->TransformAxis(
|
||||
globalDynamics->GetMomentumDirection()));
|
||||
// -- Polarization:
|
||||
G4ThreeVector globalPolarization;
|
||||
globalPolarization = fFastTrack->GetInverseAffineTransformation()->TransformAxis(
|
||||
globalDynamics->GetPolarization());
|
||||
globalDynamics->SetPolarization(globalPolarization.x(), globalPolarization.y(),
|
||||
globalPolarization.z());
|
||||
|
||||
// -- Position:
|
||||
globalPosition = fFastTrack->GetInverseAffineTransformation()->TransformPoint(globalPosition);
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
// Create the G4Track of the secondary:
|
||||
//-------------------------------------
|
||||
G4Track* secondary = new G4Track(
|
||||
globalDynamics,
|
||||
time,
|
||||
globalPosition
|
||||
);
|
||||
|
||||
auto secondary = new G4Track(globalDynamics, time, globalPosition);
|
||||
|
||||
//-------------------------------
|
||||
// and feed the changes:
|
||||
//-------------------------------
|
||||
AddSecondary(secondary);
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
// returns the pointer on the secondary:
|
||||
//--------------------------------------
|
||||
@@ -285,129 +247,112 @@ CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
// but we must define it to avoid warnings.
|
||||
void G4FastStep::Initialize(const G4Track&)
|
||||
{
|
||||
G4ExceptionDescription tellWhatIsWrong;
|
||||
tellWhatIsWrong << "G4FastStep can be initialised only through G4FastTrack."
|
||||
<< G4endl;
|
||||
G4Exception("G4FastStep::Initialize(const G4Track&)",
|
||||
"FastSim005",
|
||||
FatalException,
|
||||
tellWhatIsWrong);
|
||||
}
|
||||
|
||||
G4FastStep::G4FastStep()
|
||||
: G4VParticleChange()
|
||||
{
|
||||
if (verboseLevel>2)
|
||||
{
|
||||
G4cerr << "G4FastStep::G4FastStep()" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
G4FastStep::~G4FastStep()
|
||||
{
|
||||
if (verboseLevel>2)
|
||||
{
|
||||
G4cerr << "G4FastStep::~G4FastStep()" << G4endl;
|
||||
}
|
||||
G4ExceptionDescription tellWhatIsWrong;
|
||||
tellWhatIsWrong << "G4FastStep can be initialised only through G4FastTrack." << G4endl;
|
||||
G4Exception("G4FastStep::Initialize(const G4Track&)", "FastSim005", FatalException,
|
||||
tellWhatIsWrong);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// methods for updating G4Step
|
||||
// methods for updating G4Step
|
||||
//
|
||||
|
||||
G4Step* G4FastStep::UpdateStepForPostStep(G4Step* pStep)
|
||||
{
|
||||
{
|
||||
// A physics process always calculates the final state of the particle
|
||||
|
||||
// Take note that the return type of GetMomentumChange is a
|
||||
// pointer to G4ParticleMometum. Also it is a normalized
|
||||
// pointer to G4ParticleMometum. Also it is a normalized
|
||||
// momentum vector.
|
||||
|
||||
// G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
G4Track* aTrack = pStep->GetTrack();
|
||||
// G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
G4Track* aTrack = pStep->GetTrack();
|
||||
// G4double mass = aTrack->GetDynamicParticle()->GetMass();
|
||||
|
||||
|
||||
// update kinetic energy and momentum direction
|
||||
pPostStepPoint->SetMomentumDirection(theMomentumChange);
|
||||
pPostStepPoint->SetKineticEnergy( theEnergyChange );
|
||||
pPostStepPoint->SetKineticEnergy(theEnergyChange);
|
||||
|
||||
// update polarization
|
||||
pPostStepPoint->SetPolarization(thePolarizationChange);
|
||||
|
||||
// update polarization
|
||||
pPostStepPoint->SetPolarization( thePolarizationChange );
|
||||
|
||||
// update position and time
|
||||
pPostStepPoint->SetPosition( thePositionChange );
|
||||
pPostStepPoint->SetGlobalTime( theTimeChange );
|
||||
pPostStepPoint->AddLocalTime( theTimeChange
|
||||
- aTrack->GetGlobalTime());
|
||||
pPostStepPoint->SetProperTime( theProperTimeChange );
|
||||
pPostStepPoint->SetPosition(thePositionChange);
|
||||
pPostStepPoint->SetGlobalTime(theTimeChange);
|
||||
pPostStepPoint->AddLocalTime(theTimeChange - aTrack->GetGlobalTime());
|
||||
pPostStepPoint->SetProperTime(theProperTimeChange);
|
||||
|
||||
// update weight
|
||||
pPostStepPoint->SetWeight( theWeightChange );
|
||||
pPostStepPoint->SetWeight(theWeightChange);
|
||||
|
||||
if (debugFlag) CheckIt(*aTrack);
|
||||
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
// Update the G4Step specific attributes
|
||||
return UpdateStepInfo(pStep);
|
||||
}
|
||||
|
||||
G4Step* G4FastStep::UpdateStepForAtRest(G4Step* pStep)
|
||||
{
|
||||
{
|
||||
// A physics process always calculates the final state of the particle
|
||||
|
||||
// G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
G4Track* aTrack = pStep->GetTrack();
|
||||
// G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
G4Track* aTrack = pStep->GetTrack();
|
||||
// G4double mass = aTrack->GetDynamicParticle()->GetMass();
|
||||
|
||||
|
||||
// update kinetic energy and momentum direction
|
||||
pPostStepPoint->SetMomentumDirection(theMomentumChange);
|
||||
pPostStepPoint->SetKineticEnergy( theEnergyChange );
|
||||
pPostStepPoint->SetKineticEnergy(theEnergyChange);
|
||||
|
||||
// update polarization
|
||||
pPostStepPoint->SetPolarization( thePolarizationChange );
|
||||
|
||||
pPostStepPoint->SetPolarization(thePolarizationChange);
|
||||
|
||||
// update position and time
|
||||
pPostStepPoint->SetPosition( thePositionChange );
|
||||
pPostStepPoint->SetGlobalTime( theTimeChange );
|
||||
pPostStepPoint->AddLocalTime( theTimeChange
|
||||
- aTrack->GetGlobalTime());
|
||||
pPostStepPoint->SetProperTime( theProperTimeChange );
|
||||
pPostStepPoint->SetPosition(thePositionChange);
|
||||
pPostStepPoint->SetGlobalTime(theTimeChange);
|
||||
pPostStepPoint->AddLocalTime(theTimeChange - aTrack->GetGlobalTime());
|
||||
pPostStepPoint->SetProperTime(theProperTimeChange);
|
||||
|
||||
// update weight
|
||||
pPostStepPoint->SetWeight( theWeightChange );
|
||||
pPostStepPoint->SetWeight(theWeightChange);
|
||||
|
||||
if (debugFlag) CheckIt(*aTrack);
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
// Update the G4Step specific attributes
|
||||
return UpdateStepInfo(pStep);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// methods for printing messages
|
||||
// methods for printing messages
|
||||
//
|
||||
|
||||
void G4FastStep::DumpInfo() const
|
||||
{
|
||||
// use base-class DumpInfo
|
||||
// use base-class DumpInfo
|
||||
G4VParticleChange::DumpInfo();
|
||||
|
||||
G4cout << " Position - x (mm) : " << G4BestUnit( thePositionChange.x(), "Length" ) << G4endl;
|
||||
G4cout << " Position - y (mm) : " << G4BestUnit( thePositionChange.y(), "Length" ) << G4endl;
|
||||
G4cout << " Position - z (mm) : " << G4BestUnit( thePositionChange.z(), "Length" ) << G4endl;
|
||||
G4cout << " Time (ns) : " << G4BestUnit( theTimeChange, "Time" ) << G4endl;
|
||||
G4cout << " Proper Time (ns) : " << G4BestUnit( theProperTimeChange, "Time" ) << G4endl;
|
||||
|
||||
G4cout << " Position - x (mm) : " << G4BestUnit(thePositionChange.x(), "Length")
|
||||
<< G4endl;
|
||||
G4cout << " Position - y (mm) : " << G4BestUnit(thePositionChange.y(), "Length")
|
||||
<< G4endl;
|
||||
G4cout << " Position - z (mm) : " << G4BestUnit(thePositionChange.z(), "Length")
|
||||
<< G4endl;
|
||||
G4cout << " Time (ns) : " << G4BestUnit(theTimeChange, "Time") << G4endl;
|
||||
G4cout << " Proper Time (ns) : " << G4BestUnit(theProperTimeChange, "Time") << G4endl;
|
||||
G4long olprc = G4cout.precision(3);
|
||||
G4cout << " Momentum Direct - x : " << std::setw(20) << theMomentumChange.x() << G4endl;
|
||||
G4cout << " Momentum Direct - y : " << std::setw(20) << theMomentumChange.y() << G4endl;
|
||||
G4cout << " Momentum Direct - z : " << std::setw(20) << theMomentumChange.z() << G4endl;
|
||||
G4cout.precision(olprc);
|
||||
G4cout << " Kinetic Energy (MeV): " << G4BestUnit( theEnergyChange, "Energy" ) << G4endl;
|
||||
G4cout << " Kinetic Energy (MeV): " << G4BestUnit(theEnergyChange, "Energy") << G4endl;
|
||||
G4cout.precision(3);
|
||||
G4cout << " Polarization - x : " << std::setw(20) << thePolarizationChange.x() << G4endl;
|
||||
G4cout << " Polarization - y : " << std::setw(20) << thePolarizationChange.y() << G4endl;
|
||||
G4cout << " Polarization - z : " << std::setw(20) << thePolarizationChange.z() << G4endl;
|
||||
G4cout << " Polarization - x : " << std::setw(20) << thePolarizationChange.x()
|
||||
<< G4endl;
|
||||
G4cout << " Polarization - y : " << std::setw(20) << thePolarizationChange.y()
|
||||
<< G4endl;
|
||||
G4cout << " Polarization - z : " << std::setw(20) << thePolarizationChange.z()
|
||||
<< G4endl;
|
||||
G4cout.precision(olprc);
|
||||
}
|
||||
|
||||
@@ -416,7 +361,7 @@ G4bool G4FastStep::CheckIt(const G4Track& aTrack)
|
||||
//
|
||||
// In the G4FastStep::CheckIt
|
||||
// We only check a bit
|
||||
//
|
||||
//
|
||||
// If the user violates the energy,
|
||||
// We don't care, we agree.
|
||||
//
|
||||
@@ -431,84 +376,72 @@ G4bool G4FastStep::CheckIt(const G4Track& aTrack)
|
||||
// and it corrects it because it could cause problems for the ulterior
|
||||
// tracking.For the rest, only warning are issued.
|
||||
|
||||
G4bool itsOK = true;
|
||||
G4bool exitWithError = false;
|
||||
G4double accuracy;
|
||||
|
||||
G4bool itsOK = true;
|
||||
G4bool exitWithError = false;
|
||||
G4double accuracy;
|
||||
|
||||
// Energy should not be larger than the initial value
|
||||
accuracy = ( theEnergyChange - aTrack.GetKineticEnergy())/MeV;
|
||||
if (accuracy > GetAccuracyForWarning())
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "The energy becomes larger than the initial value, difference = " << accuracy << " MeV" << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
|
||||
"FastSim006",
|
||||
JustWarning, ed);
|
||||
itsOK = false;
|
||||
if (accuracy > GetAccuracyForException()) {exitWithError = true;}
|
||||
accuracy = (theEnergyChange - aTrack.GetKineticEnergy()) / MeV;
|
||||
if (accuracy > GetAccuracyForWarning()) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "The energy becomes larger than the initial value, difference = " << accuracy << " MeV"
|
||||
<< G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)", "FastSim006", JustWarning, ed);
|
||||
itsOK = false;
|
||||
if (accuracy > GetAccuracyForException()) {
|
||||
exitWithError = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4bool itsOKforMomentum = true;
|
||||
if ( theEnergyChange >0.)
|
||||
{
|
||||
accuracy = std::abs(theMomentumChange.mag2()-1.0);
|
||||
if (accuracy > GetAccuracyForWarning())
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "The Momentum Change is not a unit vector, difference = " << accuracy << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
|
||||
"FastSim007",
|
||||
JustWarning, ed);
|
||||
itsOK = itsOKforMomentum = false;
|
||||
if (accuracy > GetAccuracyForException()) {exitWithError = true;}
|
||||
}
|
||||
}
|
||||
|
||||
accuracy = (aTrack.GetGlobalTime()- theTimeChange)/ns;
|
||||
if (accuracy > GetAccuracyForWarning())
|
||||
{
|
||||
if (theEnergyChange > 0.) {
|
||||
accuracy = std::abs(theMomentumChange.mag2() - 1.0);
|
||||
if (accuracy > GetAccuracyForWarning()) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "The global time is getting backward, difference = " << accuracy << " ns" << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
|
||||
"FastSim008",
|
||||
JustWarning, ed);
|
||||
itsOK = false;
|
||||
ed << "The Momentum Change is not a unit vector, difference = " << accuracy << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)", "FastSim007", JustWarning, ed);
|
||||
itsOK = itsOKforMomentum = false;
|
||||
if (accuracy > GetAccuracyForException()) {
|
||||
exitWithError = true;
|
||||
}
|
||||
}
|
||||
|
||||
accuracy = (aTrack.GetProperTime() - theProperTimeChange )/ns;
|
||||
if (accuracy > GetAccuracyForWarning())
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "The proper time is getting backward, difference = " << accuracy << " ns" << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
|
||||
"FastSim009",
|
||||
JustWarning, ed);
|
||||
itsOK = false;
|
||||
}
|
||||
|
||||
if (!itsOK)
|
||||
{
|
||||
G4cout << "ERROR - G4FastStep::CheckIt() " << G4endl;
|
||||
G4cout << " Pointer : " << this << G4endl ;
|
||||
DumpInfo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
accuracy = (aTrack.GetGlobalTime() - theTimeChange) / ns;
|
||||
if (accuracy > GetAccuracyForWarning()) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "The global time is getting backward, difference = " << accuracy << " ns" << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)", "FastSim008", JustWarning, ed);
|
||||
itsOK = false;
|
||||
}
|
||||
|
||||
accuracy = (aTrack.GetProperTime() - theProperTimeChange) / ns;
|
||||
if (accuracy > GetAccuracyForWarning()) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "The proper time is getting backward, difference = " << accuracy << " ns" << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)", "FastSim009", JustWarning, ed);
|
||||
itsOK = false;
|
||||
}
|
||||
|
||||
if (!itsOK) {
|
||||
G4cout << "ERROR - G4FastStep::CheckIt() " << G4endl;
|
||||
G4cout << " Pointer : " << this << G4endl;
|
||||
DumpInfo();
|
||||
}
|
||||
|
||||
// Exit with error
|
||||
if (exitWithError)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "An inaccuracy in G4FastStep is beyond tolerance." << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
|
||||
"FastSim010",
|
||||
FatalException, ed);
|
||||
}
|
||||
|
||||
//correction for Momentum only.
|
||||
if (exitWithError) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "An inaccuracy in G4FastStep is beyond tolerance." << G4endl;
|
||||
G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)", "FastSim010", FatalException, ed);
|
||||
}
|
||||
|
||||
// correction for Momentum only.
|
||||
if (!itsOKforMomentum) {
|
||||
G4double vmag = theMomentumChange.mag();
|
||||
theMomentumChange = (1./vmag)*theMomentumChange;
|
||||
theMomentumChange = (1. / vmag) * theMomentumChange;
|
||||
}
|
||||
|
||||
itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
|
||||
|
||||
itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
|
||||
return itsOK;
|
||||
}
|
||||
|
||||
@@ -38,52 +38,39 @@
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4FastTrack.hh"
|
||||
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4TouchableHistoryHandle.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
// -----------
|
||||
// Constructor
|
||||
// -----------
|
||||
//
|
||||
G4FastTrack::G4FastTrack(G4Envelope *anEnvelope, G4bool IsUnique)
|
||||
: fTrack ( nullptr ),
|
||||
fAffineTransformationDefined( false ),
|
||||
fEnvelope ( anEnvelope ),
|
||||
fIsUnique ( IsUnique ),
|
||||
fEnvelopeLogicalVolume ( nullptr ),
|
||||
fEnvelopePhysicalVolume ( nullptr ),
|
||||
fEnvelopeSolid ( nullptr )
|
||||
{}
|
||||
|
||||
// -----------
|
||||
// Destructor:
|
||||
// -----------
|
||||
G4FastTrack::~G4FastTrack()
|
||||
G4FastTrack::G4FastTrack(G4Envelope* anEnvelope, G4bool IsUnique)
|
||||
: fEnvelope(anEnvelope), fIsUnique(IsUnique)
|
||||
{}
|
||||
|
||||
//------------------------------------------------------------
|
||||
// The parameterised simulation manager uses the SetCurrentTrack
|
||||
// method to setup the current G4FastTrack object
|
||||
// method to setup the current G4FastTrack object
|
||||
//------------------------------------------------------------
|
||||
void G4FastTrack::SetCurrentTrack(const G4Track& track,
|
||||
const G4Navigator* theNavigator)
|
||||
void G4FastTrack::SetCurrentTrack(const G4Track& track, const G4Navigator* theNavigator)
|
||||
{
|
||||
|
||||
// -- Register track pointer (used everywhere):
|
||||
fTrack = &track;
|
||||
|
||||
//-----------------------------------------------------
|
||||
// First time the track enters the volume or if the
|
||||
// Logical Volume was placed n-Times in the geometry :
|
||||
//
|
||||
//
|
||||
// Records the Rotation+Translation for the Envelope !
|
||||
// When the particle is inside or on the boundary, the
|
||||
// When the particle is inside or on the boundary, the
|
||||
// NavigationHistory IS UP TO DATE.
|
||||
//------------------------------------------------------
|
||||
if (!fAffineTransformationDefined || !fIsUnique) FRecordsAffineTransformation(theNavigator);
|
||||
|
||||
|
||||
//-------------------------------------------
|
||||
// Records local position/momentum/direction
|
||||
// of the Track.
|
||||
@@ -107,10 +94,8 @@ void G4FastTrack::SetCurrentTrack(const G4Track& track,
|
||||
// This is Done only one time.
|
||||
//
|
||||
//------------------------------------
|
||||
void
|
||||
G4FastTrack::FRecordsAffineTransformation(const G4Navigator* theNavigator)
|
||||
void G4FastTrack::FRecordsAffineTransformation(const G4Navigator* theNavigator)
|
||||
{
|
||||
|
||||
//--------------------------------------------------------
|
||||
// Get the touchable history which represents the current
|
||||
// volume hierachy the particle is in.
|
||||
@@ -118,27 +103,27 @@ G4FastTrack::FRecordsAffineTransformation(const G4Navigator* theNavigator)
|
||||
// must be deleted by G4FastTrack.
|
||||
//--------------------------------------------------------
|
||||
const G4Navigator* NavigatorToUse;
|
||||
if(theNavigator != nullptr ) NavigatorToUse = theNavigator;
|
||||
else NavigatorToUse = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
|
||||
|
||||
G4TouchableHistoryHandle history = NavigatorToUse->CreateTouchableHistoryHandle();
|
||||
|
||||
if (theNavigator != nullptr)
|
||||
NavigatorToUse = theNavigator;
|
||||
else
|
||||
NavigatorToUse = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
|
||||
|
||||
G4TouchableHandle history = NavigatorToUse->CreateTouchableHistoryHandle();
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Run accross the hierarchy to find the physical volume
|
||||
// associated with the envelope
|
||||
//-----------------------------------------------------
|
||||
G4int depth = (G4int)history->GetHistory()->GetDepth();
|
||||
auto depth = (G4int)history->GetHistory()->GetDepth();
|
||||
G4int idepth;
|
||||
G4bool Done = false;
|
||||
for (idepth = 0; idepth <= depth; ++idepth)
|
||||
{
|
||||
for (idepth = 0; idepth <= depth; ++idepth) {
|
||||
G4VPhysicalVolume* currPV = history->GetHistory()->GetVolume(idepth);
|
||||
G4LogicalVolume* currLV = currPV->GetLogicalVolume();
|
||||
if ( (currLV->GetRegion() == fEnvelope) && (currLV->IsRootRegion()) )
|
||||
{
|
||||
G4LogicalVolume* currLV = currPV->GetLogicalVolume();
|
||||
if ((currLV->GetRegion() == fEnvelope) && (currLV->IsRootRegion())) {
|
||||
fEnvelopePhysicalVolume = currPV;
|
||||
fEnvelopeLogicalVolume = currLV;
|
||||
fEnvelopeSolid = currLV->GetSolid();
|
||||
fEnvelopeLogicalVolume = currLV;
|
||||
fEnvelopeSolid = currLV->GetSolid();
|
||||
Done = true;
|
||||
break;
|
||||
}
|
||||
@@ -146,22 +131,18 @@ G4FastTrack::FRecordsAffineTransformation(const G4Navigator* theNavigator)
|
||||
//---------------------------------------------
|
||||
//-- Verification: should be removed in future:
|
||||
//---------------------------------------------
|
||||
if ( Done == false )
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Can't find transformation for `" << fEnvelopePhysicalVolume->GetName() << "'" << G4endl;
|
||||
G4Exception("G4FastTrack::FRecordsAffineTransformation()",
|
||||
"FastSim011",
|
||||
JustWarning, ed);
|
||||
}
|
||||
else
|
||||
{
|
||||
//-------------------------------------------------------
|
||||
// Records the transformation and inverse transformation:
|
||||
//-------------------------------------------------------
|
||||
fAffineTransformation = history->GetHistory()->GetTransform(idepth);
|
||||
fInverseAffineTransformation = fAffineTransformation.Inverse();
|
||||
|
||||
fAffineTransformationDefined = true;
|
||||
}
|
||||
if (!Done) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Can't find transformation for `" << fEnvelopePhysicalVolume->GetName() << "'" << G4endl;
|
||||
G4Exception("G4FastTrack::FRecordsAffineTransformation()", "FastSim011", JustWarning, ed);
|
||||
}
|
||||
else {
|
||||
//-------------------------------------------------------
|
||||
// Records the transformation and inverse transformation:
|
||||
//-------------------------------------------------------
|
||||
fAffineTransformation = history->GetHistory()->GetTransform(idepth);
|
||||
fInverseAffineTransformation = fAffineTransformation.Inverse();
|
||||
|
||||
fAffineTransformationDefined = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4GlobalFastSimulationManager.cc
|
||||
//
|
||||
// Description:
|
||||
// A singleton class which manages the Fast Simulation managers
|
||||
// A singleton class which manages the Fast Simulation managers
|
||||
// attached to envelopes. Implementation.
|
||||
//
|
||||
// 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.
|
||||
// March 98: correction to instanciate dynamically the manager
|
||||
@@ -46,36 +46,29 @@
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#include "G4GlobalFastSimulationManager.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
#include "G4FastSimulationMessenger.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
|
||||
|
||||
// ------------------------------------------
|
||||
// -- static instance pointer initialisation:
|
||||
// ------------------------------------------
|
||||
G4ThreadLocal G4GlobalFastSimulationManager* G4GlobalFastSimulationManager::fGlobalFastSimulationManager = 0;
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4ThreadLocalSingleton.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
// --------------------------------------------------
|
||||
// -- static methods to retrieve the manager pointer:
|
||||
// --------------------------------------------------
|
||||
G4GlobalFastSimulationManager* G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()
|
||||
{
|
||||
if(!fGlobalFastSimulationManager)
|
||||
fGlobalFastSimulationManager = new G4GlobalFastSimulationManager;
|
||||
|
||||
return fGlobalFastSimulationManager;
|
||||
static G4ThreadLocalSingleton<G4GlobalFastSimulationManager> instance;
|
||||
return instance.Instance();
|
||||
}
|
||||
|
||||
|
||||
G4GlobalFastSimulationManager* G4GlobalFastSimulationManager::GetInstance()
|
||||
{
|
||||
return G4GlobalFastSimulationManager::GetGlobalFastSimulationManager();
|
||||
@@ -95,20 +88,17 @@ G4GlobalFastSimulationManager::G4GlobalFastSimulationManager()
|
||||
G4GlobalFastSimulationManager::~G4GlobalFastSimulationManager()
|
||||
{
|
||||
delete fTheFastSimulationMessenger;
|
||||
fTheFastSimulationMessenger = 0;
|
||||
}
|
||||
|
||||
// ----------------------
|
||||
// -- management methods:
|
||||
// ----------------------
|
||||
void G4GlobalFastSimulationManager::
|
||||
AddFastSimulationManager(G4FastSimulationManager* fsmanager)
|
||||
void G4GlobalFastSimulationManager::AddFastSimulationManager(G4FastSimulationManager* fsmanager)
|
||||
{
|
||||
ManagedManagers.push_back(fsmanager);
|
||||
}
|
||||
|
||||
void G4GlobalFastSimulationManager::
|
||||
RemoveFastSimulationManager(G4FastSimulationManager* fsmanager)
|
||||
void G4GlobalFastSimulationManager::RemoveFastSimulationManager(G4FastSimulationManager* fsmanager)
|
||||
{
|
||||
ManagedManagers.remove(fsmanager);
|
||||
}
|
||||
@@ -126,32 +116,26 @@ void G4GlobalFastSimulationManager::RemoveFSMP(G4FastSimulationManagerProcess* f
|
||||
void G4GlobalFastSimulationManager::ActivateFastSimulationModel(const G4String& aName)
|
||||
{
|
||||
G4bool result = false;
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
result = result || ManagedManagers[ifsm]->
|
||||
ActivateFastSimulationModel(aName);
|
||||
if(result)
|
||||
G4cout << "Model " << aName << " activated.";
|
||||
else
|
||||
G4cout << "Model " << aName << " not found.";
|
||||
G4cout << G4endl;
|
||||
for (auto& ManagedManager : ManagedManagers)
|
||||
result = result || ManagedManager->ActivateFastSimulationModel(aName);
|
||||
|
||||
G4cout << "Model " << aName << (result ? " activated." : " not found.") << G4endl;
|
||||
}
|
||||
|
||||
void G4GlobalFastSimulationManager::InActivateFastSimulationModel(const G4String& aName)
|
||||
{
|
||||
G4bool result = false;
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
result = result || ManagedManagers[ifsm]->
|
||||
InActivateFastSimulationModel(aName);
|
||||
if (result) G4cout << "Model " << aName << " inactivated.";
|
||||
else G4cout << "Model " << aName << " not found.";
|
||||
G4cout << G4endl;
|
||||
for (auto& ManagedManager : ManagedManagers)
|
||||
result = result || ManagedManager->InActivateFastSimulationModel(aName);
|
||||
|
||||
G4cout << "Model " << aName << (result ? " inactivated." : " not found.") << G4endl;
|
||||
}
|
||||
|
||||
void G4GlobalFastSimulationManager::Flush()
|
||||
{
|
||||
// loop over all models (that need flushing?) and flush
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
ManagedManagers[ifsm]->FlushModels();
|
||||
for (auto& ManagedManager : ManagedManagers)
|
||||
ManagedManager->FlushModels();
|
||||
}
|
||||
|
||||
// ---------------------------------
|
||||
@@ -166,156 +150,153 @@ void G4GlobalFastSimulationManager::ShowSetup()
|
||||
// -- loop on regions to get the list of world volumes:
|
||||
// ----------------------------------------------------
|
||||
G4cout << "\nFast simulation setup:" << G4endl;
|
||||
for (size_t i=0; i<regions->size(); i++)
|
||||
for (auto& region : *regions) {
|
||||
world = region->GetWorldPhysical();
|
||||
if (world == nullptr) // region does not belong to any (existing) world
|
||||
{
|
||||
world = (*regions)[i]->GetWorldPhysical();
|
||||
if (world == nullptr) // region does not belong to any (existing) world
|
||||
{
|
||||
continue;
|
||||
}
|
||||
G4bool newWorld = true;
|
||||
for (size_t ii=0; ii<worldDone.size(); ii++) if (worldDone[ii] == world) {newWorld = false; break;}
|
||||
if (newWorld)
|
||||
{
|
||||
worldDone.push_back(world);
|
||||
G4Region* worldRegion = world->GetLogicalVolume()->GetRegion();
|
||||
// -- preambule: print physical volume and region names...
|
||||
if (world == G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume())
|
||||
G4cout << "\n * Mass Geometry with ";
|
||||
else
|
||||
G4cout << "\n * Parallel Geometry with ";
|
||||
G4cout << "world volume: `" << world->GetName() << "' [region : `" << worldRegion->GetName() << "']" << G4endl;
|
||||
// -- ... and print G4FSMP(s) attached to this world volume:
|
||||
G4bool findG4FSMP(false);
|
||||
// -- show to what particles this G4FSMP is attached to:
|
||||
std::vector<G4ParticleDefinition*> particlesKnown;
|
||||
for (size_t ip=0; ip<fFSMPVector.size(); ip++)
|
||||
if (fFSMPVector[ip]->GetWorldVolume() == world)
|
||||
{
|
||||
G4cout << " o G4FastSimulationProcess: '" << fFSMPVector[ip]->GetProcessName() << "'" << G4endl;
|
||||
G4cout << " Attached to:";
|
||||
G4ParticleTable* particles = G4ParticleTable::GetParticleTable();
|
||||
for (G4int iParticle=0; iParticle<particles->entries(); iParticle++)
|
||||
{
|
||||
G4ParticleDefinition* particle = particles->GetParticle(iParticle);
|
||||
G4ProcessVector* processes = particle->GetProcessManager()->GetProcessList();
|
||||
if (processes->contains(fFSMPVector[ip])) {G4cout << " " << particle->GetParticleName(); findG4FSMP = true; particlesKnown.push_back(particle);}
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
if (!findG4FSMP) G4cout << " o G4FastSimulationProcess: (none)" << G4endl;
|
||||
// -- now display the regions in this world volume, with mother<->daughter link shown by indentation:
|
||||
G4cout << " o Region(s) and model(s) setup:" << G4endl;
|
||||
DisplayRegion(worldRegion, 1, particlesKnown);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
G4bool newWorld = true;
|
||||
for (auto& ii : worldDone)
|
||||
if (ii == world) {
|
||||
newWorld = false;
|
||||
break;
|
||||
}
|
||||
if (newWorld) {
|
||||
worldDone.push_back(world);
|
||||
G4Region* worldRegion = world->GetLogicalVolume()->GetRegion();
|
||||
// -- preambule: print physical volume and region names...
|
||||
if (world
|
||||
== G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->GetWorldVolume())
|
||||
G4cout << "\n * Mass Geometry with ";
|
||||
else
|
||||
G4cout << "\n * Parallel Geometry with ";
|
||||
G4cout << "world volume: `" << world->GetName() << "' [region : `" << worldRegion->GetName()
|
||||
<< "']" << G4endl;
|
||||
// -- ... and print G4FSMP(s) attached to this world volume:
|
||||
G4bool findG4FSMP(false);
|
||||
// -- show to what particles this G4FSMP is attached to:
|
||||
std::vector<G4ParticleDefinition*> particlesKnown;
|
||||
for (auto& ip : fFSMPVector)
|
||||
if (ip->GetWorldVolume() == world) {
|
||||
G4cout << " o G4FastSimulationProcess: '" << ip->GetProcessName() << "'" << G4endl;
|
||||
G4cout << " Attached to:";
|
||||
G4ParticleTable* particles = G4ParticleTable::GetParticleTable();
|
||||
for (G4int iParticle = 0; iParticle < particles->entries(); iParticle++) {
|
||||
G4ParticleDefinition* particle = particles->GetParticle(iParticle);
|
||||
G4ProcessVector* processes = particle->GetProcessManager()->GetProcessList();
|
||||
if (processes->contains(ip)) {
|
||||
G4cout << " " << particle->GetParticleName();
|
||||
findG4FSMP = true;
|
||||
particlesKnown.push_back(particle);
|
||||
}
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
if (!findG4FSMP) G4cout << " o G4FastSimulationProcess: (none)" << G4endl;
|
||||
// -- now display the regions in this world volume, with mother<->daughter link shown by
|
||||
// indentation:
|
||||
G4cout << " o Region(s) and model(s) setup:" << G4endl;
|
||||
DisplayRegion(worldRegion, 1, particlesKnown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4GlobalFastSimulationManager::DisplayRegion(G4Region* region, G4int depth, std::vector<G4ParticleDefinition*>& particlesKnown) const
|
||||
void G4GlobalFastSimulationManager::DisplayRegion(
|
||||
G4Region* region, G4int depth, std::vector<G4ParticleDefinition*>& particlesKnown) const
|
||||
{
|
||||
G4String indent = " ";
|
||||
for (G4int I=0; I<depth; I++) indent += " ";
|
||||
G4cout << indent << "Region: `" << region->GetName() <<"'" << G4endl;
|
||||
for (G4int I = 0; I < depth; I++)
|
||||
indent += " ";
|
||||
G4cout << indent << "Region: `" << region->GetName() << "'" << G4endl;
|
||||
G4FastSimulationManager* fastSimManager = region->GetFastSimulationManager();
|
||||
if (fastSimManager)
|
||||
{
|
||||
indent += " ";
|
||||
G4cout << indent << "Model(s):" << G4endl;
|
||||
indent += " ";
|
||||
for (size_t im=0; im<fastSimManager->GetFastSimulationModelList().size(); im++)
|
||||
{
|
||||
G4cout << indent << "`" << (fastSimManager->GetFastSimulationModelList())[im]->GetName() << "'";
|
||||
G4cout << " ; applicable to:";
|
||||
G4ParticleTable* particles = G4ParticleTable::GetParticleTable();
|
||||
for (G4int iParticle=0; iParticle<particles->entries(); iParticle++)
|
||||
{
|
||||
if ((fastSimManager->GetFastSimulationModelList())[im]->IsApplicable(*(particles->GetParticle(iParticle))))
|
||||
{
|
||||
G4cout << " " << particles->GetParticle(iParticle)->GetParticleName();
|
||||
G4bool known(false);
|
||||
for (size_t l=0; l<particlesKnown.size();l++) if(particlesKnown[l] == particles->GetParticle(iParticle)) {known = true; break;}
|
||||
if (!known) G4cout << "[!!]";
|
||||
}
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
if (fastSimManager != nullptr) {
|
||||
indent += " ";
|
||||
G4cout << indent << "Model(s):" << G4endl;
|
||||
indent += " ";
|
||||
for (auto im : fastSimManager->GetFastSimulationModelList()) {
|
||||
G4cout << indent << "`" << im->GetName() << "'";
|
||||
G4cout << " ; applicable to:";
|
||||
G4ParticleTable* particles = G4ParticleTable::GetParticleTable();
|
||||
for (G4int iParticle = 0; iParticle < particles->entries(); iParticle++) {
|
||||
if (im->IsApplicable(*(particles->GetParticle(iParticle)))) {
|
||||
G4cout << " " << particles->GetParticle(iParticle)->GetParticleName();
|
||||
G4bool known(false);
|
||||
for (auto& l : particlesKnown)
|
||||
if (l == particles->GetParticle(iParticle)) {
|
||||
known = true;
|
||||
break;
|
||||
}
|
||||
if (!known) G4cout << "[!!]";
|
||||
}
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -- all that to check mothership of "region"
|
||||
G4PhysicalVolumeStore* physVolStore = G4PhysicalVolumeStore::GetInstance();
|
||||
for (size_t ip=0; ip<physVolStore->size(); ip++)
|
||||
{
|
||||
G4VPhysicalVolume* physVol = (*physVolStore)[ip];
|
||||
if (physVol->GetLogicalVolume()->IsRootRegion())
|
||||
if (physVol->GetMotherLogical())
|
||||
{
|
||||
G4Region* thisVolMotherRegion = physVol->GetMotherLogical()->GetRegion();
|
||||
if (thisVolMotherRegion == region)
|
||||
DisplayRegion(physVol->GetLogicalVolume()->GetRegion(), depth+1, particlesKnown);
|
||||
}
|
||||
}
|
||||
for (auto physVol : *physVolStore) {
|
||||
if (physVol->GetLogicalVolume()->IsRootRegion())
|
||||
if (physVol->GetMotherLogical() != nullptr) {
|
||||
G4Region* thisVolMotherRegion = physVol->GetMotherLogical()->GetRegion();
|
||||
if (thisVolMotherRegion == region)
|
||||
DisplayRegion(physVol->GetLogicalVolume()->GetRegion(), depth + 1, particlesKnown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------
|
||||
// -- management methods : list
|
||||
// ----------------------------
|
||||
|
||||
void G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName,
|
||||
listType theType)
|
||||
void G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName, listType theType)
|
||||
{
|
||||
if (theType == ISAPPLICABLE)
|
||||
{
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++) ManagedManagers[ifsm]->ListModels(aName);
|
||||
return;
|
||||
}
|
||||
|
||||
if(aName == "all")
|
||||
{
|
||||
G4int titled = 0;
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
{
|
||||
if(theType == NAMES_ONLY)
|
||||
{
|
||||
if(!(titled++))
|
||||
G4cout << "Current Envelopes for Fast Simulation:\n";
|
||||
G4cout << " ";
|
||||
ManagedManagers[ifsm]->ListTitle();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
else ManagedManagers[ifsm]->ListModels();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
if(aName == ManagedManagers[ifsm]-> GetEnvelope()->GetName())
|
||||
{
|
||||
ManagedManagers[ifsm]->ListModels();
|
||||
break;
|
||||
}
|
||||
if (theType == ISAPPLICABLE) {
|
||||
for (auto& ManagedManager : ManagedManagers)
|
||||
ManagedManager->ListModels(aName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aName == "all") {
|
||||
G4int titled = 0;
|
||||
for (auto& ManagedManager : ManagedManagers) {
|
||||
if (theType == NAMES_ONLY) {
|
||||
if ((titled++) == 0) G4cout << "Current Envelopes for Fast Simulation:\n";
|
||||
G4cout << " ";
|
||||
ManagedManager->ListTitle();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
else
|
||||
ManagedManager->ListModels();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (auto& ManagedManager : ManagedManagers)
|
||||
if (aName == ManagedManager->GetEnvelope()->GetName()) {
|
||||
ManagedManager->ListModels();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4GlobalFastSimulationManager::ListEnvelopes(const G4ParticleDefinition* aPD)
|
||||
{
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
ManagedManagers[ifsm]->ListModels(aPD);
|
||||
for (auto& ManagedManager : ManagedManagers)
|
||||
ManagedManager->ListModels(aPD);
|
||||
}
|
||||
|
||||
|
||||
G4VFastSimulationModel* G4GlobalFastSimulationManager::GetFastSimulationModel(const G4String& modelName,
|
||||
const G4VFastSimulationModel* previousFound) const
|
||||
G4VFastSimulationModel* G4GlobalFastSimulationManager::GetFastSimulationModel(
|
||||
const G4String& modelName, const G4VFastSimulationModel* previousFound) const
|
||||
{
|
||||
G4VFastSimulationModel* model = 0;
|
||||
G4VFastSimulationModel* model = nullptr;
|
||||
// -- flag used to navigate accross the various managers;
|
||||
bool foundPrevious(false);
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
{
|
||||
model = ManagedManagers[ifsm]->
|
||||
GetFastSimulationModel(modelName, previousFound, foundPrevious);
|
||||
if (model) break;
|
||||
}
|
||||
for (auto ManagedManager : ManagedManagers) {
|
||||
model = ManagedManager->GetFastSimulationModel(modelName, previousFound, foundPrevious);
|
||||
if (model != nullptr) break;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -37,28 +37,26 @@
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
|
||||
#include "G4VFastSimulationModel.hh"
|
||||
|
||||
#include "G4FastSimulationManager.hh"
|
||||
|
||||
// ----------------------
|
||||
// -- Simple constructor:
|
||||
// ----------------------
|
||||
G4VFastSimulationModel::G4VFastSimulationModel(const G4String& aName)
|
||||
: theModelName(aName) {}
|
||||
G4VFastSimulationModel::G4VFastSimulationModel(const G4String& aName) : theModelName(aName) {}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
// -- Constructor with automatic G4FastSimulationManager constructed if needed fo given envelope:
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
G4VFastSimulationModel::G4VFastSimulationModel(const G4String& aName,
|
||||
G4Envelope* anEnvelope,
|
||||
G4bool IsUnique)
|
||||
: theModelName(aName)
|
||||
G4VFastSimulationModel::G4VFastSimulationModel(const G4String& aName, G4Envelope* anEnvelope,
|
||||
G4bool IsUnique)
|
||||
: theModelName(aName)
|
||||
{
|
||||
// Retrieves the Fast Simulation Manager ou creates one if needed.
|
||||
G4FastSimulationManager* theFastSimulationManager;
|
||||
if ((theFastSimulationManager = anEnvelope->GetFastSimulationManager()) == 0)
|
||||
theFastSimulationManager = new G4FastSimulationManager(anEnvelope,IsUnique);
|
||||
if ((theFastSimulationManager = anEnvelope->GetFastSimulationManager()) == nullptr)
|
||||
theFastSimulationManager = new G4FastSimulationManager(anEnvelope, IsUnique);
|
||||
// adds this model to the Fast Simulation Manager.
|
||||
theFastSimulationManager->AddFastSimulationModel(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user