Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,178 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FastSimulationManager.hh,v 2.7 1998/10/26 14:31:33 mora Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4FastSimulationManager.hh
//
// Description:
// Manages the Fast Simulation models attached to a envelope.
//
// History:
// Oct 97: Verderi && MoraDeFreitas - First Implementation.
//
//---------------------------------------------------------------
#ifndef G4FastSimulationManager_h
#define G4FastSimulationManager_h 1
#include <rw/tpordvec.h>
#include "globals.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4VParticleChange.hh"
#include "G4FastTrack.hh"
#include "G4FastStep.hh"
#include "G4VFastSimulationModel.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4ios.hh"
//---------------------------
// For possible future needs:
//---------------------------
typedef G4LogicalVolume G4Envelope;
//-------------------------------------------
//
// G4FastSimulationManager class
//
//-------------------------------------------
class G4FastSimulationManager
{
public:
//------------------------
// 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.
G4FastSimulationManager(G4Envelope *anEnvelope,
G4bool IsUnique=FALSE);
~G4FastSimulationManager();
// Methods to add/remove models to/from the Model
// List.
//
void AddFastSimulationModel(G4VFastSimulationModel*);
void RemoveFastSimulationModel(G4VFastSimulationModel*);
// Methods to activate/inactivate models from the Model
// List.
G4bool ActivateFastSimulationModel(const G4String&);
G4bool InActivateFastSimulationModel(const G4String&);
// Methods to add/remove GhostPlacements to/from the
// GhostPlacements List.
//
G4Transform3D* AddGhostPlacement(G4RotationMatrix*,
const G4ThreeVector&);
G4Transform3D* AddGhostPlacement(G4Transform3D*);
G4bool RemoveGhostPlacement(const G4Transform3D*);
// 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;
//
//----------------------------------------------
// Interface methods for the G4GlobalFastSimulationManager
//----------------------------------------------
// Parallel geometry placements
G4bool InsertGhostHereIfNecessary(G4VPhysicalVolume* ,
const G4ParticleDefinition&);
//
//----------------------------------------------
// Interface methods for the
// G4FastSimulationManagerProcess process.
//----------------------------------------------
// Trigger
G4bool PostStepGetFastSimulationManagerTrigger(const G4Track &,
const G4Navigator* a = NULL);
// DoIt
void InvokePostStepDoIt();
// AtRest methods:
G4bool AtRestGetFastSimulationManagerTrigger(const G4Track &,
const G4Navigator* a = NULL);
void InvokeAtRestDoIt();
//Final G4VParticleChange* to return to the Stepping.
G4VParticleChange* GettheParticleChange();
// For RW management
G4bool operator == ( const G4FastSimulationManager&) const;
private:
// Private members :
G4FastTrack fFastTrack;
G4FastStep fFastStep;
G4VFastSimulationModel* fTriggedFastSimulationModel;
RWTPtrOrderedVector<G4VFastSimulationModel> ModelList;
RWTPtrOrderedVector<G4VFastSimulationModel> fInactivatedModels;
RWTPtrOrderedVector<G4Transform3D> GhostPlacements;
G4ParticleDefinition* fLastCrossedParticle;
RWTPtrOrderedVector<G4VFastSimulationModel> fApplicableModelList;
};
inline void
G4FastSimulationManager::AddFastSimulationModel(G4VFastSimulationModel* fsm)
{
ModelList.insert(fsm);
// forces the fApplicableModelList to be rebuild
fLastCrossedParticle=NULL;
}
inline void
G4FastSimulationManager::RemoveFastSimulationModel(G4VFastSimulationModel* fsm)
{
if(!ModelList.remove(fsm)) fInactivatedModels.remove(fsm);
// forces the fApplicableModelList to be rebuild
fLastCrossedParticle=NULL;
}
inline G4VParticleChange* G4FastSimulationManager::GettheParticleChange()
{
return &fFastStep;
}
inline G4bool
G4FastSimulationManager::operator == (const G4FastSimulationManager& fsm) const
{
return (this==&fsm) ? true : false;
}
inline const G4Envelope*
G4FastSimulationManager::GetEnvelope() const
{
return fFastTrack.GetEnvelope();
}
#endif
@@ -0,0 +1,164 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FastSimulationManagerProcess.hh,v 2.4 1998/12/08 04:06:44 verderi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4FastSimulationManagerProcess.hh
//
// Description:
// The process that triggers parameterised simulations
// if any.
//
// History:
// Feb 98: Parallel geometry sensitivity. MoraDeFreitas.
// 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
//
//---------------------------------------------------------------
#ifndef G4FastSimulationManagerProcess_h
#define G4FastSimulationManagerProcess_h 1
#include <rw/tpordvec.h>
#include "globals.hh"
#include "G4VProcess.hh"
#include "G4FastSimulationManager.hh"
#include "G4Step.hh"
#include "G4Navigator.hh"
#include "G4PropagatorInField.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VParticleChange.hh"
#include "G4FlavoredParallelWorld.hh"
//------------------------------------------
//
// G4FastSimulationManagerProcess class
//
//------------------------------------------
class G4FastSimulationManagerProcess : public G4VProcess
{
public:
//------------------------
// Constructor/Destructor
//------------------------
G4FastSimulationManagerProcess(const G4String&
processName =
"G4FastSimulationManagerProcess",
G4ProcessType
theType = fParameterisation);
~G4FastSimulationManagerProcess();
//--------------------------------------------------------------
// Process interface
//--------------------------------------------------------------
void StartTracking();
//---------------------------------------------------
// GetPhysicalInteractionLength() and DoIt() methods:
//---------------------------------------------------
G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4VParticleChange* PostStepDoIt(const G4Track& ,const G4Step& );
//------------------------------------------------------------------------
// GetPhysicalInteractionLength() and DoIt() methods for AtRest particles:
//------------------------------------------------------------------------
G4double AtRestGetPhysicalInteractionLength(
const G4Track& ,
G4ForceCondition*
);
G4VParticleChange* AtRestDoIt(
const G4Track& ,
const G4Step&
);
// -- no operation in AlongStepDoIt --
G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double ,
G4double ,
G4double&,
G4GPILSelection*
);
G4VParticleChange* AlongStepDoIt(
const G4Track& ,
const G4Step&
);
private:
// When trigged, the *fFastSimulationManager holds
// the pointer used to call the DoIt() method.
G4FastSimulationManager* fFastSimulationManager;
G4bool fFastSimulationTrigger;
// this G4VParticleChange is used only when the safety limites the Step.
G4VParticleChange aDummyParticleChange;
G4ParticleChange xParticleChange;
// Flags that the track is starting
G4bool fStartTracking;
// -------------------------------
// Navigation in the Ghost World:
// -------------------------------
// Current parallel "ghost" world, related Navigator
// and touchable history:
G4VPhysicalVolume* fGhostWorld;
G4Navigator fGhostNavigator;
G4TouchableHistory* fGhostTouchable;
G4bool fUpdateGhostTouchable;
G4bool fOutOfGhostWorld;
// Isotropic safety value to the next ghost volume
// and allowed Step length:
G4double fGhostSafety,
fGhostStepLength;
// Navigation with field:
G4PropagatorInField* fGhostFieldPropagator;
G4double fParticleCharge;
G4bool fFieldExertsForce;
// Tracking Navigation used in PostStep, in case of mag-field:
G4Navigator fTrackingNavigator;
G4TouchableHistory fTrackingHistory;
// ******************************************************
// ******************************************************
//
// For TESTS:
//
// ******************************************************
// ******************************************************
public:
G4double GetPreSafety() {return fPreSafety;}
G4double GetPreLinearSafety() {return fPreLinearSafety;}
G4double GetSafety() {return fGhostSafety;}
G4double GetLinearSafety() {return fGhostStepLength;}
void Verbose() const;
private:
G4double fPreSafety, fPreLinearSafety;
};
#endif
@@ -0,0 +1,58 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FastSimulationMessenger.hh,v 2.3 1998/10/13 09:54:26 mora Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// GEANT 4 class header file
//
// This is a messenger class for G4FastSimulation.
// Implemented commands are following;
//
// Commands :
// BeamOn * Start a Run.
//
// History
// first version by P.Mora de Freitas & M.Verderi
// ------------------------------------------------------------
#ifndef G4FastSimulationMessenger_h
#define G4FastSimulationMessenger_h 1
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithoutParameter;
#include "G4UImessenger.hh"
#include "globals.hh"
#include "G4GlobalFastSimulationManager.hh"
class G4FastSimulationMessenger: public G4UImessenger
{
public:
G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM);
~G4FastSimulationMessenger();
public:
void SetNewValue(G4UIcommand * command,G4String newValues);
private:
G4GlobalFastSimulationManager* fGlobalFastSimulationManager;
//commands
G4UIdirectory *fFSDirectory;
G4UIcmdWithAString *fListEnvelopesCmd;
G4UIcmdWithAString *fListModelsCmd;
G4UIcmdWithAString *fListIsApplicableCmd;
G4UIcmdWithAString *fActivateModel;
G4UIcmdWithAString *fInActivateModel;
};
#endif
@@ -0,0 +1,317 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FastStep.hh,v 2.6 1998/11/20 19:00:26 verderi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4FastStep.hh
//
// Description:
// The G4FastStep class insures a friendly interface
// 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
// 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
// methods :
//
// virtual G4Step* UpdateStepForAtRest(G4Step* Step);
// virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
// virtual G4Step* UpdateStepForPostStep(G4Step* Step);
// virtual void Initialize(const G4Track&);
//
// History:
// Oct 97: Verderi && MoraDeFreitas - First Implementation.
// Dec 97: Verderi - ForceSteppingHitInvocation(),
// Set/GetTotalEnergyDeposited() methods.
// Apr 98: MoraDeFreitas - G4FastStep becomes the G4ParticleChange
// for the Fast Simulation Process.
//
//---------------------------------------------------------------
#ifndef G4FastStep_h
#define G4FastStep_h
#include "globals.hh"
#include "G4ios.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleMomentum.hh"
class G4DynamicParticle;
#include "G4VParticleChange.hh"
#include "G4FastTrack.hh"
//-------------------------------------------
//
// G4FastStep class
//
//-------------------------------------------
class G4FastStep: public G4VParticleChange
{
public:
//===================================================
//Fast Simulation Model Interface (section for users)
//===================================================
//
// Particle management
// -------------------
//
// The methods here provide an implementation of the
// G4VParticleChange class for parameterisations.
// They have to be filled to describe the FINAL STATE
// of the particles.
//
// 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.
// -- The KillPrimaryTrack() set the kinetic energy of the
// -- primary to zero, and set the "fStopAndKill" signal
// -- used by the stepping.
void KillPrimaryTrack();
// -- Methods used to change the position, normalized direction of
// the momentum, time etc... of the primary.
// .. space and time:
void SetPrimaryTrackFinalPosition (const G4ThreeVector &,
G4bool localCoordinates = true);
void SetPrimaryTrackFinalTime (G4double);
void SetPrimaryTrackFinalProperTime (G4double);
// .. dynamics:
// Be careful: the Track Final Momentum means the normalized direction
// of the momentum!
void SetPrimaryTrackFinalMomentum (const G4ThreeVector &,
G4bool localCoordinates = true);
void SetPrimaryTrackFinalKineticEnergy (G4double);
void SetPrimaryTrackFinalKineticEnergyAndDirection(G4double,
const G4ThreeVector &,
G4bool localCoordinates
= true);
void SetPrimaryTrackFinalPolarization(const G4ThreeVector &,
G4bool localCoordinates = true);
// .. true path length of the primary during the FastStep:
void SetPrimaryTrackPathLength (G4double);
// Weight applied for event biasing mechanism:
void SetPrimaryTrackFinalEventBiasingWeight (G4double);
// ------------------------------
// -- Management of secondaries:
// ------------------------------
// ----------------------------------------------------
// -- 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.
// ----------------------------------------------------
// -- Total Number of secondaries to be created,
// -- (to be called first)
void SetNumberOfSecondaryTracks(G4int);
// -- Number of secondaries effectively stored:
// -- (incremented at each CreateSecondaryTrack()
// -- call)
G4int GetNumberOfSecondaryTracks();
// -- 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 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);
// -- Gives a pointer on the i-th secondary track created:
G4Track* GetSecondaryTrack(G4int);
//------------------------------------------------
//
// 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 SetTotalEnergyDeposited(G4double anEnergyPart);
G4double GetTotalEnergyDeposited() const;
//----------------------------------------------------
//
// 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 G4Fast-
// Simulation 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. (See Initialize() method of G4FastStep)
//
//----------------------------------------------------
void ForceSteppingHitInvocation();
//=======================================================
// Implementation section and kernel interfaces.
//=======================================================
//------------------------
// Constructor/Destructor
//------------------------
G4FastStep();
~G4FastStep();
// equal/unequal operator
G4bool operator==(const G4FastStep &right) const;
G4bool operator!=(const G4FastStep &right) const;
protected:
// hide copy constructor and assignment operator as protected
G4FastStep (const G4FastStep &right);
G4FastStep & operator= (const G4FastStep &right);
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);
G4Step* UpdateStepForAtRest(G4Step* Step);
G4Step* UpdateStepForPostStep(G4Step* Step);
// 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.
void Initialize(const G4FastTrack&);
private:
//===================================================
// Private Internal methods (implementation).
//===================================================
// G4FastStep should never be Initialized in this way
// but we must define it to avoid compiler warnings.
void Initialize(const G4Track&);
// -- 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;
// The changed (final) polarization of a given particle.
G4ThreeVector thePolarizationChange;
// The final kinetic energy of the current particle.
G4double theEnergyChange;
// The changed (final) position of a given particle.
G4ThreeVector thePositionChange;
// The changed (final) global time of a given particle.
G4double theTimeChange;
// The changed (final) proper time of a given particle.
G4double theProperTimeChange;
// The reference G4FastTrack
const G4FastTrack* fFastTrack;
// weight for event biasing mechanism:
G4double theWeightChange;
public:
// for Debug
void DumpInfo() const;
G4bool debugFlag;
G4bool CheckIt(const G4Track&);
};
//*******************************************************************
//
// Inline functions
//
//*******************************************************************
#include "G4FastStep.icc"
#endif
@@ -0,0 +1,102 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FastStep.icc,v 2.3 1998/11/20 19:00:27 verderi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// $id: G4ParticleChange.icc,v 1.6 1998/04/14 02:25:54 kurasige Exp $
inline void
G4FastStep::SetPrimaryTrackFinalTime(G4double time)
{
theTimeChange = time;
}
inline void
G4FastStep::SetPrimaryTrackFinalProperTime(G4double properTime)
{
theProperTimeChange = properTime;
}
inline void
G4FastStep::
SetPrimaryTrackFinalKineticEnergy(G4double kineticEnergy)
{
theEnergyChange = kineticEnergy;
}
inline void
G4FastStep::SetPrimaryTrackPathLength(G4double pathLength)
{
SetTrueStepLength(pathLength);
}
//-----------------------------------------
//
// Creation of eventual secondaries:
//
//-----------------------------------------
inline void
G4FastStep::SetNumberOfSecondaryTracks(G4int nSecondaries)
{
SetNumberOfSecondaries(nSecondaries);
}
inline G4int
G4FastStep::GetNumberOfSecondaryTracks()
{
return GetNumberOfSecondaries();
}
inline G4Track* G4FastStep::GetSecondaryTrack(G4int i)
{
return GetSecondary(i);
}
//---------------------------------------
//
//---------------------------------------
inline void G4FastStep::SetTotalEnergyDeposited(G4double anEnergyPart)
{
SetLocalEnergyDeposit(anEnergyPart);
}
inline G4double G4FastStep::GetTotalEnergyDeposited() const
{
return GetLocalEnergyDeposit();
}
inline void G4FastStep::ForceSteppingHitInvocation()
{
SetSteppingControl(NormalCondition);
}
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)
{
theMomentumChange = P;
}
inline
void G4FastStep::SetPrimaryTrackFinalEventBiasingWeight (G4double w)
{
theWeightChange = w;
}
@@ -0,0 +1,186 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FastTrack.hh,v 2.3 1998/10/13 09:54:30 mora Exp $
// GEANT4 tag $Name: geant4-00 $
//
// $Id:
//---------------------------------------------------------------
//
// G4FastTrack.hh
//
// Description:
// Keeps the current track information and special features
// for Parameterised Simulation Models.
//
// History:
// Oct 97: Verderi && MoraDeFreitas - First Implementation.
//
//---------------------------------------------------------------
#ifndef G4FastTrack_h
#define G4FastTrack_h
#include "G4VSolid.hh"
#include "G4LogicalVolume.hh"
#include "G4AffineTransform.hh"
#include "G4Track.hh"
#include "G4Navigator.hh"
//---------------------------
// For possible future needs:
//---------------------------
typedef G4LogicalVolume G4Envelope;
//-------------------------------------------
//
// G4FastTrack class
//
//-------------------------------------------
class G4FastTrack
{
public:
//------------------------
// 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();
//------------------------------------------------------------
// The fast simulation manager uses the SetCurrentTrack
// method to setup the current G4FastTrack object
//------------------------------------------------------------
void SetCurrentTrack(const G4Track&, const G4Navigator* a = NULL);
//------------------------------------------------------------
// 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.
//----------------------------------
const G4Track* GetPrimaryTrack() const;
G4Envelope* GetEnvelope() const;
G4VPhysicalVolume* GetEnvelopePhysicalVolume() const;
G4VSolid* GetEnvelopeSolid() const;
//-----------------------------------
// Primary track informations in the
// Envelope coordinate system.
//-----------------------------------
G4ThreeVector GetPrimaryTrackLocalPosition() const;
G4ThreeVector GetPrimaryTrackLocalMomentum() const;
G4ThreeVector GetPrimaryTrackLocalDirection() const;
G4ThreeVector GetPrimaryTrackLocalPolarization() const;
//------------------------------------
// 3D transformation of the envelope:
//------------------------------------
// Global -> Local
const G4AffineTransform* GetAffineTransformation() const;
// Local -> Global
const G4AffineTransform* GetInverseAffineTransformation() const;
//-----------------
// Private members
//-----------------
private:
// Current G4Track pointer
const G4Track* fTrack;
//------------------------------------------------
// Records the Affine/InverseAffine transformation
// of the envelope.
//------------------------------------------------
void FRecordsAffineTransformation(const G4Navigator*);
G4bool fAffineTransformationDefined;
G4Envelope* fEnvelope;
G4bool fIsUnique;
G4VPhysicalVolume* fEnvelopePhysicalVolume;
G4VSolid* fEnvelopeSolid;
G4ThreeVector fLocalTrackPosition, fLocalTrackMomentum,
fLocalTrackDirection, fLocalTrackPolarization;
G4AffineTransform fAffineTransformation, fInverseAffineTransformation;
};
//*******************************************************************
//
// Inline functions
//
//*******************************************************************
inline G4Envelope* G4FastTrack::GetEnvelope() const
{
return fEnvelope;
}
inline G4VPhysicalVolume* G4FastTrack::GetEnvelopePhysicalVolume() const
{
return fEnvelopePhysicalVolume;
}
inline G4VSolid* G4FastTrack::GetEnvelopeSolid() const
{
return fEnvelopeSolid;
}
inline const G4Track* G4FastTrack::GetPrimaryTrack() const
{
return fTrack;
}
inline G4ThreeVector G4FastTrack::GetPrimaryTrackLocalPosition() const
{
return fLocalTrackPosition;
}
inline G4ThreeVector G4FastTrack::GetPrimaryTrackLocalMomentum() const
{
return fLocalTrackMomentum;
}
inline G4ThreeVector G4FastTrack::GetPrimaryTrackLocalDirection() const
{
return fLocalTrackDirection;
}
inline G4ThreeVector G4FastTrack::GetPrimaryTrackLocalPolarization() const
{
return fLocalTrackPolarization;
}
inline const G4AffineTransform* G4FastTrack::GetAffineTransformation() const
{
return &fAffineTransformation;
}
inline const G4AffineTransform* G4FastTrack::GetInverseAffineTransformation() const
{
return &fInverseAffineTransformation;
}
inline G4bool G4FastTrack::OnTheBoundaryButExiting() const
{
// tests if particle are on the boundary and leaving.
return GetEnvelopeSolid()->
DistanceToOut(GetPrimaryTrackLocalPosition(),
GetPrimaryTrackLocalDirection())==0.;
}
#endif
@@ -0,0 +1,71 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FlavoredParallelWorld.hh,v 2.1 1998/10/13 09:54:32 mora Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4FlavoredParallelWorld.hh
//
// Description:
// Internal class to keep ParticleType X Parallel world
// relationship.
//
// History:
// June 98: Verderi && MoraDeFreitas - "G4ParallelWorld" becomes
// "G4FlavoredParallelWorld".
// Mars 98: Verderi && MoraDeFreitas - First Implementation.
//
//---------------------------------------------------------------
#ifndef G4FlavoredParallelWorld_hh
#define G4FlavoredParallelWorld_hh
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4VPhysicalVolume.hh"
class G4FlavoredParallelWorld
{
public:
//
// Constructor
G4FlavoredParallelWorld(G4ParticleDefinition *pParticleType,
G4VPhysicalVolume *pWorld) {
ParticleType=pParticleType;
World=pWorld;
}
//
// Destructor
~G4FlavoredParallelWorld() {
delete [] World;
}
// Get/Set
inline G4ParticleDefinition* GetTheParticleType() const {
return ParticleType;
}
inline G4VPhysicalVolume* GetThePhysicalVolumeWorld() const {
return World;
}
// operator ==
inline G4bool
operator == (const G4FlavoredParallelWorld& pw) const {
return (this==&pw) ? true : false;
}
private:
G4ParticleDefinition *ParticleType;
G4VPhysicalVolume *World;
};
#endif
// end of #ifndef G4FlavoredParallelWorld_hh
@@ -0,0 +1,106 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GlobalFastSimulationManager.hh,v 2.5 1998/10/13 09:54:33 mora Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4GlobalFastSimulationManager.hh
//
// Description:
// 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
// G4FlavoredParallelWorld pointer.
// Feb 98: Verderi && MoraDeFreitas - First Implementation.
//
//---------------------------------------------------------------
#ifndef G4GlobalFastSimulationManager_hh
#define G4GlobalFastSimulationManager_hh
#include <rw/tpordvec.h>
#include "G4FastSimulationManager.hh"
#include "G4FastSimulationManagerProcess.hh"
#include "G4StateManager.hh"
#include "G4VStateDependent.hh"
#include "G4FlavoredParallelWorld.hh"
enum listType {
NAMES_ONLY,
MODELS,
ISAPPLICABLE
};
class G4FastSimulationMessenger;
class G4GlobalFastSimulationManager : public G4VStateDependent
{
public:
// Global access to the GlobalFastSimulationManager
static G4GlobalFastSimulationManager* GetGlobalFastSimulationManager();
// Destructor
~G4GlobalFastSimulationManager();
// G4FastSimulationManager's management :
//
// Methods for a G4FastSimulationManager to register itself
//
void AddFastSimulationManager(G4FastSimulationManager*);
void RemoveFastSimulationManager(G4FastSimulationManager*);
// Open/Close Parameterisation
void FastSimulationNeedsToBeClosed();
void CloseFastSimulation();
// print/control commands
void ListEnvelopes(const G4String& aName = "all",
listType aListType = NAMES_ONLY);
void ListEnvelopes(const G4ParticleDefinition*);
void ActivateFastSimulationModel(const G4String&);
void InActivateFastSimulationModel(const G4String&);
// G4FastSimulationProcess interface
G4FlavoredParallelWorld* GetFlavoredWorldForThis(G4ParticleDefinition *);
// G4StateManager interface
G4bool Notify(G4ApplicationState requestedState);
private:
// Private construtor insures singleton class
G4GlobalFastSimulationManager();
// The single instance.
static G4GlobalFastSimulationManager* fGlobalFastSimulationManager;
// The G4FastSimulationMessenger
G4FastSimulationMessenger* fTheFastSimulationMessenger;
// List of G4FastSimulationManagers
RWTPtrOrderedVector<G4FastSimulationManager> ManagedManagers;
// fClosed flags if the NeededFlavoredWorlds List was Build.
G4bool fClosed;
// List of needed ParallelWorlds after close
RWTPtrOrderedVector<G4FlavoredParallelWorld> NeededFlavoredWorlds;
// Internal fonction to Build world volume clones.
G4VPhysicalVolume* GiveMeAWorldVolumeClone();
};
#endif
// end of #ifndef G4GlobalFastSimulationManager_hh
@@ -0,0 +1,111 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VFastSimulationModel.hh,v 2.2 1998/10/13 09:54:34 mora Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4VFastSimulationModel.hh
//
// Description:
// Base class for fast simulation models.
//
// History:
// Oct 97: Verderi && MoraDeFreitas - First Implementation.
//
//---------------------------------------------------------------
#ifndef G4VFastSimulationModel_h
#define G4VFastSimulationModel_h
#include "G4FastTrack.hh"
#include "G4FastStep.hh"
//---------------------------
// For possible future needs:
//---------------------------
typedef G4LogicalVolume G4Envelope;
//-------------------------------------------
//
// G4VFastSimulationModel class
//
//-------------------------------------------
class G4VFastSimulationModel
{
public:
//------------------------
// Constructor/Destructor
//------------------------
// constructors require at least the model name.
G4VFastSimulationModel(const G4String& aName);
// About the IsUnique flag, 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.
G4VFastSimulationModel(const G4String& aName, G4Envelope*,
G4bool IsUnique=FALSE);
~G4VFastSimulationModel() {};
//
//----------------------------------------------
// Interface IsApplicable virtual method for the
// G4FastSimulationManager
//----------------------------------------------
virtual G4bool IsApplicable(const G4ParticleDefinition&) = 0;
//
//----------------------------------------------
// Interface trigger virtual method for the
// G4FastSimulationManager
//----------------------------------------------
virtual G4bool ModelTrigger(const G4FastTrack &) = 0;
// -- Pure virtual DoIt() method : the FastSimulationModel
// properly said. The user has to compute the detector
// response and to manage the particle changes state:
// -- * change position/momentum or kill the primary
// -- * create secondaries
virtual void DoIt(const G4FastTrack&, G4FastStep&) = 0;
// ---------------------------
// -- Idem for AtRest methods:
// ---------------------------
// -- A default dummy implementation is provided.
virtual
G4bool AtRestModelTrigger(const G4FastTrack& fastTrack) {return false;}
virtual
void AtRestDoIt (const G4FastTrack& fastTrack, G4FastStep& fastStep) {}
// Useful public methods :
const G4String GetName() const;
G4bool operator == ( const G4VFastSimulationModel&) const;
private:
//-------------
// Model Name:
//-------------
G4String theModelName;
};
inline const G4String G4VFastSimulationModel::GetName() const
{
return theModelName;
}
inline G4bool
G4VFastSimulationModel::operator == (const G4VFastSimulationModel& fsm) const
{
return (this==&fsm) ? true : false;
}
#endif