Import Geant4 9.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:16:48 +02:00
parent 75c7fd177d
commit a8e9364cea
6592 changed files with 84274 additions and 69292 deletions
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationManager.cc,v 1.12 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4FastSimulationManager.cc,v 1.13 2007/05/11 13:50:20 mverderi Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//---------------------------------------------------------------
//
@@ -36,6 +36,8 @@
//
// History:
// Oct 97: Verderi && MoraDeFreitas - First Implementation.
// ...
// May 07: Move to parallel world scheme
//
//---------------------------------------------------------------
@@ -155,86 +157,10 @@ G4FastSimulationManager::GetFastSimulationModel(const G4String& modelName,
return model;
}
// ***************************************** TO BE DROPPED ********************************************** >>>> BEGINNING
//----------------------------------------
// Methods to add/remove GhostPlacements
//----------------------------------------
G4Transform3D*
G4FastSimulationManager::AddGhostPlacement(G4RotationMatrix *prot,
const G4ThreeVector &tlate)
{
G4Transform3D* newghostplace;
if(prot==0) prot = new G4RotationMatrix();
newghostplace = new G4Transform3D(*prot,tlate);
AddGhostPlacement(newghostplace);
return newghostplace;
}
G4Transform3D*
G4FastSimulationManager::AddGhostPlacement(G4Transform3D *trans3d)
{
GhostPlacements.push_back (trans3d);
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->
FastSimulationNeedsToBeClosed();
return trans3d;
}
G4bool
G4FastSimulationManager::RemoveGhostPlacement(const G4Transform3D *trans3d)
{
G4bool found;
if((found=(GhostPlacements.remove(trans3d) != 0)))
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->
FastSimulationNeedsToBeClosed();
return found;
}
G4bool
G4FastSimulationManager::
InsertGhostHereIfNecessary(G4VPhysicalVolume* theClone,
const G4ParticleDefinition& theParticle)
{
G4PVPlacement *GhostPhysical;
// Not to do if there aren't glost placements
if(GhostPlacements.size()==0) return false;
// If there are, verifies if at least one model is applicable
// for theParticle.
for (size_t iModel=0; iModel<ModelList.size(); iModel++)
if(ModelList[iModel]->IsApplicable(theParticle)) {
// Ok, we find one. Place the ghost(s).
for (size_t ighost=0; ighost<GhostPlacements.size(); ighost++)
{
std::vector<G4LogicalVolume*>::iterator ghostIter = fFastTrack.GetEnvelope()->GetRootLogicalVolumeIterator();
G4LogicalVolume* rootGhostLV = (*ghostIter);
GhostPhysical=new
G4PVPlacement(*(GhostPlacements[ighost]),
rootGhostLV->GetName(),
rootGhostLV,
theClone,
false,0);
// -- I'd like to check if other root LV exist, since it can not be handled today,
// -- but how stop the iterator loop ???
// ghostIter++;
// rootGhostLV = (*ghostIter);
// if (rootGhostLV) G4Exception("G4FastSimulationManager does not know today how to handle ghost regions with several root logical volumes.");
}
// And answer true
return true;
}
//otherwise answer false
return false;
}
// ***************************************** TO BE DROPPED **************************************** <<<< END
//
//-------------------------------------
// Interface trigger method for the
// G4ParameterisationManagerProcess
//-------------------------------------
//------------------------------------------------------------------
// Interface trigger method for the G4ParameterisationManagerProcess
//------------------------------------------------------------------
// G4bool GetFastSimulationManagerTrigger(const G4Track &);
//
// This method is used to interface the G4FastSimulationManagerProcess
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationManagerProcess.cc,v 1.14 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4FastSimulationManagerProcess.cc,v 1.15 2007/05/11 13:50:20 mverderi Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//---------------------------------------------------------------
@@ -38,501 +38,252 @@
//
// History:
// August 97: First implementation. Verderi && MoraDeFreitas.
// 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"
//----------------------------
// Constructor with only name:
//----------------------------
#define PARANOIA
G4FastSimulationManagerProcess::
G4FastSimulationManagerProcess(const G4String& processName,
G4ProcessType theType) :
G4VProcess(processName,theType)
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
pParticleChange = &aDummyParticleChange;
fGhostTouchable = new G4TouchableHistory();
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created " << G4endl;
}
fGhostFieldPropagator = new G4PropagatorInField(&fGhostNavigator,
G4TransportationManager::
GetTransportationManager()->
GetFieldManager());
SetWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()->GetName());
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
<< "' is created, and will message geometry with world volume `"
<< fWorldVolume->GetName() << "'." << G4endl;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
}
// -----------
// Destructor:
// -----------
G4FastSimulationManagerProcess::
G4FastSimulationManagerProcess(const G4String& processName,
const G4String& worldVolumeName,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
SetWorldVolume(worldVolumeName);
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(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
SetWorldVolume(worldVolume);
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
<< "' is created, and will message geometry with world volume `"
<< fWorldVolume->GetName() << "'." << G4endl;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
}
G4FastSimulationManagerProcess::~G4FastSimulationManagerProcess()
{
delete fGhostTouchable;
fGhostTouchable = 0;
delete fGhostFieldPropagator;
fGhostFieldPropagator = 0;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->RemoveFSMP(this);
}
//----------------------------------------------------------
//
// PostStepGetPhysicalInteractionLength()
//
// This method is used to trigger the parameterised
// simulation.
//
//----------------------------------------------------------
//
// To be triggered the conditions that must be
// fullfilled are :
//
// 1) a call to track->GetVolume()->GetLogicalVolume()->
// GetFastSimulationManager() returns a G4FastSimulationManager
// not NULL pointer (kept in fFastSimulationManager);
//
// AND
//
// 2)a call to this fFastSimulationManager->GetTrigger() method
/// returns a G4bool True.
//
//
// If the fFastSimulationManager* is triggered then:
//
// * condition = ExclusivelyForced
// * returns 0.0
//
// else:
// * condition = NotForced
// * returns DBL_MAX
//
//-----------------------------------------------------------
G4double
G4FastSimulationManagerProcess::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
// -----------------------
// User access methods:
// -----------------------
void
G4FastSimulationManagerProcess::
SetWorldVolume(G4String newWorldName)
{
// ------------------------------
// Prelude for initial Step only:
// ------------------------------
// ----------------------------------------------------------
// -- If starting a track, check if there is a parallel World
// -- for the new particle being tracked.
// -- (may be Done more than once in very special cases,
// -- since the fStarTracking is switched off lower.)
// ----------------------------------------------------------
if(fStartTracking)
{
G4VFlavoredParallelWorld* flavoredWorld =
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->
GetFlavoredWorldForThis(track.GetDynamicParticle()->GetDefinition());
fGhostWorld = 0;
if (flavoredWorld)
fGhostWorld = flavoredWorld->GetThePhysicalVolumeWorld();
if (fGhostWorld)
{
fGhostNavigator.SetWorldVolume(fGhostWorld);
fUpdateGhostTouchable = true;
fGhostSafety = -1.;
// Navigation in Field:
fParticleCharge = track.GetDynamicParticle()->GetDefinition()->GetPDGCharge();
}
else
{
fOutOfGhostWorld = true;
}
}
if (fGhostWorld == 0) fStartTracking = false; // -- case ghost world below
// -------------------------------------------------------
//
// Parameterisation Trigger invokation sequence :
//
// -------------------------------------------------------
fFastSimulationTrigger = false;
//---------------------------------------------
// Normal Dispatcher (for tracking geometry) :
//---------------------------------------------
if( (fFastSimulationManager =
track.GetVolume()->GetLogicalVolume()->GetFastSimulationManager()) )
{
// Yes, so should us trigger a fast simulation model now ?
if(fFastSimulationTrigger =
fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track))
{
// Yes, lets take the control over the stepping !
*condition = ExclusivelyForced;
return 0.0;
}
}
//-----------------------------------------
// * Parallel geometry Dispatcher if any.
// * If no trigger in the parallel geometry
// returns the Conditionally forced signal.
//-----------------------------------------
if(fGhostWorld)
{
// First, update the touchable history of ghost if necessary, ie when:
// - this is first Step of tracking
// - the last Step was limited by ghost geometry
// otherwise performs a single Locate
if (fUpdateGhostTouchable)
{
fUpdateGhostTouchable=false;
if (fStartTracking)
{
fGhostNavigator.LocateGlobalPointAndUpdateTouchable(
track.GetPosition(),
track.GetMomentumDirection(),
fGhostTouchable,
false);
fStartTracking = false;
}
else
{
fGhostNavigator.SetGeometricallyLimitedStep();
fGhostNavigator.LocateGlobalPointAndUpdateTouchable(
track.GetPosition(),
track.GetMomentumDirection(),
fGhostTouchable);
}
fOutOfGhostWorld = (fGhostTouchable->GetVolume() == 0);
}
else if (previousStepSize > 0.0)
{
// G4ThreeVector direction= track.GetMomentumDirection();
// fGhostNavigator.LocateGlobalPointAndSetup(track.GetPosition(), &direction, true);
// The above looks not enough in case of mag-field, not clear why ?!?
fGhostNavigator.LocateGlobalPointAndUpdateTouchable(
track.GetPosition(),
track.GetMomentumDirection(),
fGhostTouchable);
}
if (!fOutOfGhostWorld)
{
if( (fFastSimulationManager =
fGhostTouchable->GetVolume()->GetLogicalVolume()->GetFastSimulationManager()) )
{
// Yes, so should us trigger a fast simulation model now ?
if(fFastSimulationTrigger =
fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track,&fGhostNavigator))
{
// Yes, lets take the control over the stepping !
*condition = ExclusivelyForced;
return 0.0;
}
}
// No ghost trigger has occured (ie no manager or a manager but no trigger)
// Informs the stepping that PostStepDoIt may be called if the AlongGPIL
// will limit the Step.
// PostStepDoIt will switch on fUpdateGhostTouchable flag,
// and eventually correct position and mometum in case of
// mag-field.
*condition = Conditionally;
return DBL_MAX;
}
}
*condition = NotForced;
return DBL_MAX;
}
//------------------------------------
//
// PostStepDoIt()
//
//------------------------------------
G4VParticleChange* G4FastSimulationManagerProcess::PostStepDoIt(
const G4Track& track,
const G4Step& )
{
if (fFastSimulationTrigger)
{
// Executes the ParameterisedSimulation code.
// and gets the ParameterisedSimulation response.
G4VParticleChange* Response=
fFastSimulationManager->InvokePostStepDoIt();
// If the particle is still alive, suspend it
// to re-initialise the other process.
if (Response->GetTrackStatus() != fStopAndKill)
Response->ProposeTrackStatus(fSuspend);
// Returns the Response
return Response;
}
if (fIsTrackingTime)
G4cout << "!!! G4FastSimulationManagerProcess `" << GetProcessName()
<< "': changing world volume at tracking time is not allowed for now. Call ignored !!!" << G4endl;
else
{
if (fOutOfGhostWorld) G4cout << " ????????????? Problem of logic in GHOST param !!! " << G4endl;
// No FastSimulationManager has asked for trigger. That means here:
// - the PostStep is "Conditionally" forced because
// - the Step has been limited by the ALong of G4FSMP because
// - the track has reached a ghost boundary
// => the touchable history must be updated.
// fUpdateGhostTouchable = true; : MOVED BELOW: COMPLICATIONS WITH MAG-FIELD !!
if (fFieldExertsForce)
{
// -----------------------------------------------------------
// in case of field, correct for small discrepancy on position
// and momentum computed by the Transportation.
// HOWEVER, this correction can be somewhat problematic when
// the end point, which is close here to a Ghost boundary by
// construction, is also close to a boundary of the tracking
// geometry.
// Thus we correct when the safety in the tracking geometry
// allows to move the point enough. Otherwise we issue
// a warning.
// ----------------------------------------------------------
fTrackingNavigator.SetWorldVolume(G4TransportationManager::GetTransportationManager()->
GetNavigatorForTracking()->GetWorldVolume());
fTrackingNavigator.LocateGlobalPointAndUpdateTouchable(
track.GetPosition(),
track.GetMomentumDirection(),
&fTrackingHistory);
// G4VPhysicalVolume* trackingVolume = fTrackingHistory.GetVolume();
G4double trackingSafety(0.0);
// G4double trackingLinearDistance =
fTrackingNavigator.ComputeStep(
track.GetPosition(),
track.GetMomentumDirection(),
DBL_MAX,
trackingSafety);
xParticleChange.Initialize(track);
G4ThreeVector deltaPos = fGhostFieldPropagator->EndPosition() - track.GetPosition();
if (trackingSafety < deltaPos.mag())
{
fUpdateGhostTouchable = true; // What should we do here ?!?
// false => lot a microscopic steps
// is true rasonnably safe ?
G4cout << GetProcessName() << " : WARNING: Can not correct for\ndifference between tracking and ghost mag-field computations." << G4endl;
}
else
{
// easy case where we have enough room to displace the point where we need:
fUpdateGhostTouchable = true;
xParticleChange.ProposePosition (fGhostFieldPropagator->EndPosition() );
xParticleChange.ProposeMomentumDirection(fGhostFieldPropagator->EndMomentumDir());
}
return &xParticleChange;
}
else
{
fUpdateGhostTouchable = true;
pParticleChange->Initialize(track);
return pParticleChange;
}
G4VPhysicalVolume* newWorld = G4TransportationManager::GetTransportationManager()->IsWorldExisting(newWorldName);
G4String tellWhatIsWrong;
tellWhatIsWrong = "Volume newWorldName = `"; tellWhatIsWrong += newWorldName; tellWhatIsWrong += "' is not a parallel world nor the mass world volume.";
if (newWorld == 0) G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String&, G4bool verbose)",
"InvalidWorld",
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;
}
}
G4double G4FastSimulationManagerProcess::AlongStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& proposedSafety,
G4GPILSelection* selection
)
{
// Informs the stepping that G4FastsimulationProcess wants
// to be able to limit the Step.
*selection = CandidateForSelection;
G4double returnedStep = DBL_MAX;
if (!fOutOfGhostWorld)
{
if (previousStepSize > 0.) fGhostSafety -= previousStepSize;
else fGhostSafety = -1.;
if (fGhostSafety < 0.) fGhostSafety = 0.0;
// ------------------------------------------
// Determination of the proposed STEP LENGTH:
// ------------------------------------------
if (currentMinimumStep <= fGhostSafety)
{
returnedStep = currentMinimumStep;
}
else // (currentMinimumStep > fGhostSafety: GFSMP may limit the Step)
{
fFieldExertsForce = (fParticleCharge != 0.0) &&
(G4TransportationManager::GetTransportationManager()->
GetFieldManager()->DoesFieldExist());
if ( !fFieldExertsForce )
{
fGhostStepLength = fGhostNavigator.ComputeStep(
track.GetPosition(),
track.GetMomentumDirection(),
currentMinimumStep,
fGhostSafety);
}
else
{
fGhostFieldPropagator->SetChargeMomentumMass(
fParticleCharge,
track.GetDynamicParticle()->
GetTotalMomentum(),
track.GetDynamicParticle()->
GetMass());
G4double restMass= track.GetDynamicParticle()->GetMass();
G4ThreeVector spin = track.GetPolarization() ;
G4FieldTrack aFieldTrack =
G4FieldTrack( track.GetPosition(),
track.GetMomentumDirection(),
0.0,
track.GetKineticEnergy(),
restMass,
track.GetVelocity(),
track.GetLocalTime(), // tof lab ?
track.GetProperTime(), // tof proper
&spin ) ;
fGhostStepLength = fGhostFieldPropagator->ComputeStep(
aFieldTrack,
currentMinimumStep,
fGhostSafety);
}
fPreSafety = fGhostSafety;
returnedStep = fGhostStepLength;
}
// ----------------------------------------------
// Returns the fGhostSafety as the proposedSafety
// The SteppingManager will take care of keeping
// the smallest one.
// ----------------------------------------------
proposedSafety = fGhostSafety;
}
return returnedStep;
}
G4VParticleChange* G4FastSimulationManagerProcess::AlongStepDoIt(
const G4Track& track,
const G4Step& )
{
// Dummy ParticleChange ie: does nothing
pParticleChange->Initialize(track);
return pParticleChange;
}
//--------------------------------------------
//
// At Rest parameterisation:
//
//--------------------------------------------
//
// AtRestGetPhysiscalInteractionLength:
//
//--------------------------------------------
G4double
G4FastSimulationManagerProcess::AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition)
{
if ( (fFastSimulationManager =
track.GetVolume()->GetLogicalVolume()->GetFastSimulationManager())
!= 0 )
if (fFastSimulationManager->AtRestGetFastSimulationManagerTrigger(track))
{
// "*condition = ExclusivelyForced;" Not yet available
// for AtRest actions, so we use the trick below. However
// it is not garantee to work in the situation the track is
// alive after parameterisation.
// NOTE: Problem: the present stepping doesn't care if the particle
// has been killed between two AtRestDoIt() !!!
*condition = NotForced;
return -1.0; // TEMPORARY TRICK TO TAKE CONTROL !!!!
}
//-----------------------------------------
// * Parallel geometry Dispatcher if any.
// * If no trigger in the parallel geometry
// * returns DBL_MAX and NotForced signal.
//-----------------------------------------
if(fGhostWorld)
}
void
G4FastSimulationManagerProcess::
SetWorldVolume(G4VPhysicalVolume* newWorld)
{
if (newWorld) SetWorldVolume(newWorld->GetName());
else G4cout << "!!! G4FastSimulationManagerProcess::SetWorldVolume(const G4VPhysicalVolume* newWorld) : null pointer passed. !!! Continuing at your own risks..." << G4endl;
}
// --------------------
// Start/End tracking:
// --------------------
void
G4FastSimulationManagerProcess::
StartTracking(G4Track*)
{
fIsTrackingTime = true;
fIsFirstStep = true;
// -- fetch the navigator (and its index) and activate it:
G4TransportationManager* transportationManager = G4TransportationManager::GetTransportationManager();
fNavigator = transportationManager->GetNavigator(fWorldVolume);
if (fNavigator != transportationManager->GetNavigatorForTracking())
fNavigatorIndex = transportationManager->ActivateNavigator(fNavigator);
else
fNavigatorIndex = 0;
}
void
G4FastSimulationManagerProcess::
EndTracking()
{
fIsTrackingTime = false;
}
// ------------------------------------------
// PostStepGetPhysicalInteractionLength():
// ------------------------------------------
G4double
G4FastSimulationManagerProcess::
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double,
G4ForceCondition* condition)
{
#ifdef PARANOIA
if ( fNavigator->GetWorldVolume() != fWorldVolume ) G4Exception("!!! ??? INCONSISTENT NAVIGATORS/WORLD VOLUMES ??? !!!");
#endif
// -- Get current volume, and check for presence of fast simulation manager.
// -- For the case of the navigator for tracking (fNavigatorIndex == 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 (fNavigatorIndex == 0) currentVolume = track.GetVolume();
else currentVolume = G4PathFinder::GetInstance()->GetLocatedVolume(fNavigatorIndex);
if ( currentVolume )
{
// First, update the touchable history of ghost if necessary, ie when:
// - this is first Step of tracking
// - the last Step was limited by ghost geometry
// otherwise performs a single Locate
if (fUpdateGhostTouchable)
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
if( fFastSimulationManager )
{
fUpdateGhostTouchable=false;
if (fStartTracking)
// Ask for trigger:
fFastSimulationTrigger = fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track, fNavigator);
if( fFastSimulationTrigger )
{
fGhostNavigator.LocateGlobalPointAndUpdateTouchable(
track.GetPosition(),
fGhostTouchable,
false);
fStartTracking = false;
// Take control over stepping:
*condition = ExclusivelyForced;
return 0.0;
}
else
{
fGhostNavigator.SetGeometricallyLimitedStep();
fGhostNavigator.LocateGlobalPointAndUpdateTouchable(
track.GetPosition(),
fGhostTouchable);
}
fOutOfGhostWorld = (fGhostTouchable->GetVolume() == 0);
}
if (!fOutOfGhostWorld)
{
if( (fFastSimulationManager =
fGhostTouchable->GetVolume()->GetLogicalVolume()->GetFastSimulationManager()) )
{
// Should it trigger a fast simulation model now ?
if(fFastSimulationTrigger =
fFastSimulationManager->
AtRestGetFastSimulationManagerTrigger(track,&fGhostNavigator))
{
// "*condition = ExclusivelyForced;" Not yet available
// for AtRest actions, so we use the trick below. However
// it is not garantee to work in the situation the track is
// alive after parameterisation.
// NOTE: Problem: the present stepping doesn't care if the particle
// has been killed between two AtRestDoIt() !!!
*condition = NotForced;
return -1.0; // TEMPORARY TRICK TO TAKE CONTROL !!!!
}
}
}
}
}
// No, avoid to take control over the PostStepDoIt methods.
// -- no fast simulation occuring there:
*condition = NotForced;
return DBL_MAX;
}
//------------------------------------
// PostStepDoIt()
//------------------------------------
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;
}
//--------------------------------------------
// At Rest parameterisation:
//--------------------------------------------
// AtRestGetPhysiscalInteractionLength:
//--------------------------------------------
G4double
G4FastSimulationManagerProcess::
AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition)
{
const G4VPhysicalVolume* currentVolume(0);
if (fNavigatorIndex == 0) currentVolume = track.GetVolume();
else currentVolume = G4PathFinder::GetInstance()->GetLocatedVolume(fNavigatorIndex);
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
if( fFastSimulationManager )
{
// Ask for trigger:
fFastSimulationTrigger = fFastSimulationManager->AtRestGetFastSimulationManagerTrigger(track, fNavigator);
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;
}
//-----------------------------------------------
//
// AtRestDoIt:
//
//-----------------------------------------------
G4VParticleChange* G4FastSimulationManagerProcess::AtRestDoIt(
const G4Track&, const G4Step&)
G4VParticleChange* G4FastSimulationManagerProcess::AtRestDoIt(const G4Track&, const G4Step&)
{
return fFastSimulationManager->InvokeAtRestDoIt();
}
void G4FastSimulationManagerProcess::StartTracking(G4Track*)
{
fStartTracking = true;
}
void G4FastSimulationManagerProcess::Verbose() const
{
@@ -559,3 +310,5 @@ void G4FastSimulationManagerProcess::Verbose() const
break;
}*/
}
@@ -1,314 +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. *
// ********************************************************************
//
//
// $Id: G4FastSimulationManagerProcess81.cc,v 1.1 2006/11/10 13:23:07 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
//
// G4FastSimulationProcess.cc
//
// Description:
// The process that triggers the parameterised simulations,
// if any.
//
// History:
// August 97: First implementation. Verderi && MoraDeFreitas.
// October 06: move to parallel geometry scheme, M. Verderi
//---------------------------------------------------------------
#include "G4ios.hh"
#include "G4FastSimulationManagerProcess81.hh"
#include "G4GlobalFastSimulationManager.hh"
#include "G4TransportationManager.hh"
#include "G4PathFinder.hh"
#include "G4ParticleChange.hh"
#define PARANOIA
G4FastSimulationManagerProcess81::
G4FastSimulationManagerProcess81(const G4String& processName,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
SetWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()->GetName());
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "' is created, and will message geometry with world volume `"
<< fWorldVolume->GetName() << "'." << G4endl;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
}
G4FastSimulationManagerProcess81::
G4FastSimulationManagerProcess81(const G4String& processName,
const G4String& worldVolumeName,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
SetWorldVolume(worldVolumeName);
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "' is created, and will message geometry with world volume `"
<< fWorldVolume->GetName() << "'." << G4endl;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
}
G4FastSimulationManagerProcess81::
G4FastSimulationManagerProcess81(const G4String& processName,
G4VPhysicalVolume* worldVolume,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
SetWorldVolume(worldVolume);
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "' is created, and will message geometry with world volume `"
<< fWorldVolume->GetName() << "'." << G4endl;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
}
G4FastSimulationManagerProcess81::~G4FastSimulationManagerProcess81()
{
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->RemoveFSMP(this);
}
// -----------------------
// User access methods:
// -----------------------
void
G4FastSimulationManagerProcess81::
SetWorldVolume(G4String newWorldName)
{
if (fIsTrackingTime)
G4cout << "!!! G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "': changing world volume at tracking time is not allowed for now. Call ignored !!!" << G4endl;
else
{
G4VPhysicalVolume* newWorld = G4TransportationManager::GetTransportationManager()->IsWorldExisting(newWorldName);
G4String tellWhatIsWrong;
tellWhatIsWrong = "Volume newWorldName = `"; tellWhatIsWrong += newWorldName; tellWhatIsWrong += "' is not a parallel world nor the mass world volume.";
if (newWorld == 0) G4Exception("G4FastSimulationManagerProcess81::SetWorldVolume(const G4String&, G4bool verbose)",
"InvalidWorld",
FatalException,
tellWhatIsWrong);
if (verboseLevel>0)
if (fWorldVolume) G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "': changing world volume from '" << fWorldVolume->GetName()
<< "' to `" << newWorld << "'." << G4endl;
else G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "': setting world volume from to `"<< newWorld->GetName() << "'." << G4endl;
fWorldVolume = newWorld;
}
}
void
G4FastSimulationManagerProcess81::
SetWorldVolume(G4VPhysicalVolume* newWorld)
{
if (newWorld) SetWorldVolume(newWorld->GetName());
else G4cout << "!!! G4FastSimulationManagerProcess81::SetWorldVolume(const G4VPhysicalVolume* newWorld) : null pointer passed. !!! Continuing at your own risks..." << G4endl;
}
// --------------------
// Start/End tracking:
// --------------------
void
G4FastSimulationManagerProcess81::
StartTracking(G4Track*)
{
fIsTrackingTime = true;
fIsFirstStep = true;
// -- fetch the navigator (and its index) and activate it:
G4TransportationManager* transportationManager = G4TransportationManager::GetTransportationManager();
fNavigator = transportationManager->GetNavigator(fWorldVolume);
if (fNavigator != transportationManager->GetNavigatorForTracking())
fNavigatorIndex = transportationManager->ActivateNavigator(fNavigator);
else
fNavigatorIndex = 0;
}
void
G4FastSimulationManagerProcess81::
EndTracking()
{
fIsTrackingTime = false;
}
// ------------------------------------------
// PostStepGetPhysicalInteractionLength():
// ------------------------------------------
G4double
G4FastSimulationManagerProcess81::
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double,
G4ForceCondition* condition)
{
#ifdef PARANOIA
if ( fNavigator->GetWorldVolume() != fWorldVolume ) G4Exception("!!! ??? INCONSISTENT NAVIGATORS/WORLD VOLUMES ??? !!!");
#endif
// -- Get current volume, and check for presence of fast simulation manager.
// -- For the case of the navigator for tracking (fNavigatorIndex == 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 (fNavigatorIndex == 0) currentVolume = track.GetVolume();
else currentVolume = G4PathFinder::GetInstance()->GetLocatedVolume(fNavigatorIndex);
if ( currentVolume )
{
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
if( fFastSimulationManager )
{
// Ask for trigger:
fFastSimulationTrigger = fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track, fNavigator);
if( fFastSimulationTrigger )
{
// Take control over stepping:
*condition = ExclusivelyForced;
return 0.0;
}
}
}
// -- no fast simulation occuring there:
*condition = NotForced;
return DBL_MAX;
}
//------------------------------------
// PostStepDoIt()
//------------------------------------
G4VParticleChange*
G4FastSimulationManagerProcess81::
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;
}
//--------------------------------------------
// At Rest parameterisation:
//--------------------------------------------
// AtRestGetPhysiscalInteractionLength:
//--------------------------------------------
G4double
G4FastSimulationManagerProcess81::
AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition)
{
const G4VPhysicalVolume* currentVolume(0);
if (fNavigatorIndex == 0) currentVolume = track.GetVolume();
else currentVolume = G4PathFinder::GetInstance()->GetLocatedVolume(fNavigatorIndex);
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
if( fFastSimulationManager )
{
// Ask for trigger:
fFastSimulationTrigger = fFastSimulationManager->AtRestGetFastSimulationManagerTrigger(track, fNavigator);
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;
}
//-----------------------------------------------
// AtRestDoIt:
//-----------------------------------------------
G4VParticleChange* G4FastSimulationManagerProcess81::AtRestDoIt(const G4Track&, const G4Step&)
{
return fFastSimulationManager->InvokeAtRestDoIt();
}
void G4FastSimulationManagerProcess81::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;
}*/
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationMessenger.cc,v 1.7 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4FastSimulationMessenger.cc,v 1.8 2007/05/11 13:50:20 mverderi Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
#include "G4FastSimulationMessenger.hh"
@@ -44,8 +44,13 @@ G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM)
fShowSetupCmd =
new G4UIcmdWithoutParameter("/param/showSetup", this);
fShowSetupCmd->SetGuidance("Show fast simulation setup");
fShowSetupCmd->AvailableForStates(G4State_GeomClosed);
fShowSetupCmd->SetGuidance("Show fast simulation setup:");
fShowSetupCmd->SetGuidance(" - for each world region:");
fShowSetupCmd->SetGuidance(" 1) fast simulation manager process attached;");
fShowSetupCmd->SetGuidance(" - and to which particles the process is attached to;");
fShowSetupCmd->SetGuidance(" 2) region hierarchy;");
fShowSetupCmd->SetGuidance(" - with for each the fast simulation models attached;");
fShowSetupCmd->AvailableForStates(G4State_Idle, G4State_GeomClosed);
fListEnvelopesCmd =
new G4UIcmdWithAString("/param/listEnvelopes", this);
@@ -25,7 +25,7 @@
//
//
// $Id: G4FastStep.cc,v 1.16 2006/06/29 21:09:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//---------------------------------------------------------------
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4FastTrack.cc,v 1.10 2006/06/29 21:09:34 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//---------------------------------------------------------------
//
@@ -1,167 +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. *
// ********************************************************************
//
//
// $Id: G4GFSManager81.cc,v 1.1 2006/11/10 13:23:07 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
//
// G4GFSManager81.cc
//
// Description:
// Gathers code to be dropped at the next major release
//
// History:
// November 2006
//
//---------------------------------------------------------------
#include "G4GFSManager81.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4Material.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4TransportationManager.hh"
#include "G4FastSimulationMessenger.hh"
#include "G4GlobalFastSimulationManager.hh"
G4GFSManager81::G4GFSManager81()
{
// It starts closed.
fClosed=true;
}
void G4GFSManager81::FastSimulationNeedsToBeClosed()
{
fClosed=false;
}
void G4GFSManager81::CloseFastSimulation()
{
if(fClosed) return;
G4ParticleTable* theParticleTable;
// Reset the NeededFlavoredWorlds List
NeededFlavoredWorlds.clearAndDestroy();
// We'll look for models for all particle types
theParticleTable=G4ParticleTable::GetParticleTable();
// Creates the first world volume clone.
G4VPhysicalVolume* aClone = GiveMeAWorldVolumeClone();
G4cout << "Closing Fast-Simulation ..." << G4endl;
for (G4int iParticle=0;
iParticle<theParticleTable->entries(); iParticle++) {
G4bool Needed = false;
G4GlobalFastSimulationManager* global = G4GlobalFastSimulationManager::GetGlobalFastSimulationManager();
for (size_t ifsm=0; ifsm< global->ManagedManagers.size(); ifsm++)
Needed = Needed || global->ManagedManagers[ifsm]->
InsertGhostHereIfNecessary(aClone,
*(theParticleTable->
GetParticle(iParticle)));
// if some FSM inserted a ghost, keep this clone.
if(Needed)
{
G4Region* aWorldGhostRegion = new G4Region("Ghost world region for " + theParticleTable->GetParticle(iParticle)->GetParticleName());
aWorldGhostRegion->AddRootLogicalVolume(aClone->GetLogicalVolume());
NeededFlavoredWorlds.push_back(new G4FlavoredParallelWorld(theParticleTable->GetParticle(iParticle), aClone));
// and prepare a new one.
aClone=GiveMeAWorldVolumeClone();
}
}
fClosed=true;
}
G4VFlavoredParallelWorld*
G4GFSManager81::
GetFlavoredWorldForThis(G4ParticleDefinition* particle)
{
for (size_t ipw=0; ipw<NeededFlavoredWorlds.size(); ipw++)
if(NeededFlavoredWorlds[ipw]->GetTheParticleType()==particle)
return NeededFlavoredWorlds[ipw];
return 0;
}
G4VPhysicalVolume*
G4GFSManager81::GiveMeAWorldVolumeClone()
{
G4VPhysicalVolume* theParallelWorldPhysical;
G4TransportationManager *transportationManager=
G4TransportationManager::GetTransportationManager();
G4VSolid *parallelWorldSolid=transportationManager->
GetNavigatorForTracking()->GetWorldVolume()->
GetLogicalVolume()->GetSolid();
G4Material *parallelWorldMaterial=transportationManager->
GetNavigatorForTracking()->GetWorldVolume()->
GetLogicalVolume()->GetMaterial();
G4LogicalVolume *parallelWorldLog =
new G4LogicalVolume(parallelWorldSolid,
parallelWorldMaterial,
"ParallelWorldLogical",
0, 0, 0);
theParallelWorldPhysical= new G4PVPlacement(0,G4ThreeVector(),
"ParallelWorldPhysical",
parallelWorldLog,
0,false,0);
return theParallelWorldPhysical;
}
G4bool
G4GFSManager81::Notify(G4ApplicationState requestedState)
{
G4StateManager * stateManager = G4StateManager::GetStateManager();
if((stateManager->GetPreviousState()==G4State_Idle) &&
(requestedState==G4State_GeomClosed) && (!fClosed) )
{
G4cerr
<< "ERROR - G4GFSManager81::Notify()" << G4endl
<< " 1) you are using ghost volumes;" << G4endl
<< " 2) In this case the G4GFSManager81" << G4endl
<< " MUST be closed BEFORE closing the geometry;" << G4endl
<< " 3) To do this put in your code the call to" << G4endl
<< " GetGlobalFastSimulationManager()->CloseFastSimulation();"
<< G4endl
<< " just before closing the geometry." << G4endl;
G4Exception("G4GFSManager81::Notify()", "InvalidState",
FatalException, "Fast simulation must be closed.");
}
return true;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4GlobalFastSimulationManager.cc,v 1.19 2006/11/10 15:27:17 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4GlobalFastSimulationManager.cc,v 1.20 2007/05/11 13:50:20 mverderi Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//---------------------------------------------------------------
@@ -43,6 +43,7 @@
// G4FlavoredParallelWorld pointer.
// Feb 98: Verderi && MoraDeFreitas - First Implementation.
// March 98: correction to instanciate dynamically the manager
// May 07: Move to parallel world scheme
//
//---------------------------------------------------------------
@@ -59,47 +60,49 @@
#include "G4ProcessManager.hh"
#include "G4PhysicalVolumeStore.hh"
// -- *** to be dropped @ next major release: >>>>
#include "G4GFSManager81.hh"
// -- <<<<<<<<
G4GlobalFastSimulationManager*
G4GlobalFastSimulationManager::fGlobalFastSimulationManager = 0;
// ------------------------------------------
// -- static instance pointer initialisation:
// ------------------------------------------
G4GlobalFastSimulationManager* G4GlobalFastSimulationManager::fGlobalFastSimulationManager = 0;
G4GlobalFastSimulationManager*
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()
// --------------------------------------------------
// -- static methods to retrieve the manager pointer:
// --------------------------------------------------
G4GlobalFastSimulationManager* G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()
{
if(!fGlobalFastSimulationManager)
{
fGlobalFastSimulationManager = new G4GlobalFastSimulationManager;
SetConcreteInstance(fGlobalFastSimulationManager);
}
return fGlobalFastSimulationManager;
}
G4GlobalFastSimulationManager::G4GlobalFastSimulationManager()
G4GlobalFastSimulationManager* G4GlobalFastSimulationManager::GetInstance()
{
// Initialises the G4FastSimulationMessenger
fTheFastSimulationMessenger=new G4FastSimulationMessenger(this);
// -- *** to be dropped @ next major release ***:
_deprecated = new G4GFSManager81();
return G4GlobalFastSimulationManager::GetGlobalFastSimulationManager();
}
// ---------------
// -- constructor
// ---------------
G4GlobalFastSimulationManager::G4GlobalFastSimulationManager()
{
fTheFastSimulationMessenger = new G4FastSimulationMessenger(this);
}
// -------------
// -- destructor
// -------------
G4GlobalFastSimulationManager::~G4GlobalFastSimulationManager()
{
delete fTheFastSimulationMessenger;
fTheFastSimulationMessenger = 0;
}
void G4GlobalFastSimulationManager::FastSimulationNeedsToBeClosed()
{
_deprecated->FastSimulationNeedsToBeClosed();
}
// ----------------------
// -- management methods:
// ----------------------
void G4GlobalFastSimulationManager::
AddFastSimulationManager(G4FastSimulationManager* fsmanager)
{
@@ -112,39 +115,17 @@ RemoveFastSimulationManager(G4FastSimulationManager* fsmanager)
ManagedManagers.remove(fsmanager);
}
void G4GlobalFastSimulationManager::
AddFSMP(G4FastSimulationManagerProcess81* fp)
void G4GlobalFastSimulationManager::AddFSMP(G4FastSimulationManagerProcess* fp)
{
fFSMPVector.push_back(fp);
}
void G4GlobalFastSimulationManager::
RemoveFSMP(G4FastSimulationManagerProcess81* fp)
void G4GlobalFastSimulationManager::RemoveFSMP(G4FastSimulationManagerProcess* fp)
{
fFSMPVector.remove(fp);
}
void G4GlobalFastSimulationManager::CloseFastSimulation()
{
static int count(0);
if (count++ < 5)
G4cout << "G4GlobalFastSimulationManager::CloseFastSimulation() : DEPRECATING, will be dropped @ next major release" << G4endl;
_deprecated->CloseFastSimulation();
}
G4VFlavoredParallelWorld*
G4GlobalFastSimulationManager::
GetFlavoredWorldForThis(G4ParticleDefinition* definition)
{
static int count(0);
if (count++ < 5)
G4cout << "G4GlobalFastSimulationManager::GetFlavoredWorldForThis(...): DEPRECATING, will be dropped @ next major release" << G4endl;
return _deprecated->GetFlavoredWorldForThis(definition);
}
void
G4GlobalFastSimulationManager::
ActivateFastSimulationModel(const G4String& aName)
void G4GlobalFastSimulationManager::ActivateFastSimulationModel(const G4String& aName)
{
G4bool result = false;
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
@@ -157,9 +138,7 @@ ActivateFastSimulationModel(const G4String& aName)
G4cout << G4endl;
}
void
G4GlobalFastSimulationManager::
InActivateFastSimulationModel(const G4String& aName)
void G4GlobalFastSimulationManager::InActivateFastSimulationModel(const G4String& aName)
{
G4bool result = false;
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
@@ -172,8 +151,11 @@ InActivateFastSimulationModel(const G4String& aName)
G4cout << G4endl;
}
void
G4GlobalFastSimulationManager::ShowSetup()
// ---------------------------------
// -- display fast simulation setup:
// ---------------------------------
void G4GlobalFastSimulationManager::ShowSetup()
{
std::vector<G4VPhysicalVolume*> worldDone;
G4VPhysicalVolume* world;
@@ -224,9 +206,7 @@ G4GlobalFastSimulationManager::ShowSetup()
}
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 += " ";
@@ -272,10 +252,12 @@ DisplayRegion(G4Region* region, G4int depth, std::vector<G4ParticleDefinition*>&
}
// ----------------------------
// -- management methods : list
// ----------------------------
void
G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName,
listType theType)
void G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName,
listType theType)
{
if (theType == ISAPPLICABLE)
{
@@ -311,26 +293,15 @@ G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName,
}
}
void
G4GlobalFastSimulationManager::ListEnvelopes(const G4ParticleDefinition* aPD)
void G4GlobalFastSimulationManager::ListEnvelopes(const G4ParticleDefinition* aPD)
{
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
ManagedManagers[ifsm]->ListModels(aPD);
}
G4bool
G4GlobalFastSimulationManager::Notify(G4ApplicationState requestedState)
{
static int count(0);
if (count++ < 5)
G4cout << "G4GlobalFastSimulationManager::Notify() : DEPRECATING, will be dropped @ next major release" << G4endl;
return _deprecated->Notify(requestedState);
}
G4VFastSimulationModel*
G4GlobalFastSimulationManager::
GetFastSimulationModel(const G4String& modelName,
const G4VFastSimulationModel* previousFound) const
G4VFastSimulationModel* G4GlobalFastSimulationManager::GetFastSimulationModel(const G4String& modelName,
const G4VFastSimulationModel* previousFound) const
{
G4VFastSimulationModel* model = 0;
// -- flag used to navigate accross the various managers;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VFastSimulationModel.cc,v 1.6 2006/06/29 21:09:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VFastSimulationModel.cc,v 1.7 2007/05/11 13:50:20 mverderi Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//---------------------------------------------------------------
//
@@ -43,26 +43,24 @@
#include "G4VFastSimulationModel.hh"
#include "G4FastSimulationManager.hh"
//
// Simple constructor.
//
G4VFastSimulationModel::
G4VFastSimulationModel(const G4String& aName) : theModelName(aName) {}
// ----------------------
// -- Simple constructor:
// ----------------------
G4VFastSimulationModel::G4VFastSimulationModel(const G4String& aName)
: theModelName(aName) {}
//
// Constructor for beginners. We do all the job, no matters...
//
G4VFastSimulationModel::
G4VFastSimulationModel(const G4String& aName,
G4Envelope* anEnvelope,
G4bool IsUnique) : theModelName(aName)
// ----------------------------------------------------------------------------------------------
// -- Constructor with automatic G4FastSimulationManager constructed if needed fo given envelope:
// ----------------------------------------------------------------------------------------------
G4VFastSimulationModel::G4VFastSimulationModel(const G4String& aName,
G4Envelope* anEnvelope,
G4bool IsUnique)
: theModelName(aName)
{
// Retrieves the Fast Simulation Manager ou creates one
// if needed.
// 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()) == 0)
theFastSimulationManager = new G4FastSimulationManager(anEnvelope,IsUnique);
// adds this model to the Fast Simulation Manager.
theFastSimulationManager->AddFastSimulationModel(this);
}