Import Geant4 8.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FastSimulationManager.cc,v 1.8 2002/11/15 11:41:56 stesting Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4FastSimulationManager.cc,v 1.10 2005/11/26 00:35:02 mverderi Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
@@ -50,9 +50,9 @@ G4FastSimulationManager(G4Envelope *anEnvelope,
|
||||
fFastTrack(anEnvelope,IsUnique),fTriggedFastSimulationModel(0),
|
||||
fLastCrossedParticle(0)
|
||||
{
|
||||
// Communicates to the Logical Volume that it becomes a
|
||||
// Communicates to the region that it becomes a
|
||||
// envelope and with this fast simulation manager.
|
||||
anEnvelope->BecomeEnvelopeForFastSimulation(this);
|
||||
anEnvelope->SetFastSimulationManager(this);
|
||||
|
||||
// Add itself to the GlobalFastSimulationManager
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->
|
||||
@@ -69,7 +69,7 @@ G4FastSimulationManager::~G4FastSimulationManager()
|
||||
// resets the Logical Volume IsEnvelope flag to avoid clash.
|
||||
//
|
||||
if(fFastTrack.GetEnvelope()->GetFastSimulationManager()==this)
|
||||
fFastTrack.GetEnvelope()->ClearEnvelopeForFastSimulation();
|
||||
fFastTrack.GetEnvelope()->ClearFastSimulationManager();
|
||||
// Remove itself from the GlobalFastSimulationManager
|
||||
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->
|
||||
RemoveFastSimulationManager(this);
|
||||
@@ -151,6 +151,7 @@ G4FastSimulationManager::GetFastSimulationModel(const G4String& modelName,
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
// Methods to add/remove GhostPlacements
|
||||
//----------------------------------------
|
||||
@@ -185,6 +186,44 @@ G4FastSimulationManager::RemoveGhostPlacement(const G4Transform3D *trans3d)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//-------------------------------------
|
||||
// Interface trigger method for the
|
||||
@@ -323,34 +362,6 @@ G4VParticleChange* G4FastSimulationManager::InvokeAtRestDoIt()
|
||||
return &fFastStep;
|
||||
}
|
||||
|
||||
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++)
|
||||
GhostPhysical=new
|
||||
G4PVPlacement(*(GhostPlacements[ighost]),
|
||||
fFastTrack.GetEnvelope()->GetName(),
|
||||
fFastTrack.GetEnvelope(),
|
||||
theClone,
|
||||
false,0);
|
||||
// And answer true
|
||||
return true;
|
||||
}
|
||||
//otherwise answer false
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
G4FastSimulationManager::ListTitle() const
|
||||
{
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FastSimulationManagerProcess.cc,v 1.9 2004/11/25 23:34:13 mverderi Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4FastSimulationManagerProcess.cc,v 1.12 2005/11/26 00:47:54 mverderi Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -525,7 +525,7 @@ G4VParticleChange* G4FastSimulationManagerProcess::AtRestDoIt(
|
||||
return fFastSimulationManager->InvokeAtRestDoIt();
|
||||
}
|
||||
|
||||
void G4FastSimulationManagerProcess::StartTracking()
|
||||
void G4FastSimulationManagerProcess::StartTracking(G4Track*)
|
||||
{
|
||||
fStartTracking = true;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FastSimulationMessenger.cc,v 1.5 2002/12/04 21:29:50 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
|
||||
#include "G4FastSimulationMessenger.hh"
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FastStep.cc,v 1.14 2004/12/07 08:22:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4FastStep.cc,v 1.15 2005/11/02 09:22:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
@@ -92,7 +92,7 @@ void G4FastStep::KillPrimaryTrack()
|
||||
void
|
||||
G4FastStep::
|
||||
ProposePrimaryTrackFinalPosition(const G4ThreeVector &position,
|
||||
G4bool localCoordinates)
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
// Compute the position coordinate in global
|
||||
// reference system if needed ...
|
||||
@@ -107,7 +107,7 @@ ProposePrimaryTrackFinalPosition(const G4ThreeVector &position,
|
||||
void
|
||||
G4FastStep::
|
||||
SetPrimaryTrackFinalPosition(const G4ThreeVector &position,
|
||||
G4bool localCoordinates)
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
ProposePrimaryTrackFinalPosition(position, localCoordinates);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ SetPrimaryTrackFinalPosition(const G4ThreeVector &position,
|
||||
void
|
||||
G4FastStep::
|
||||
ProposePrimaryTrackFinalMomentumDirection(const G4ThreeVector &momentum,
|
||||
G4bool localCoordinates)
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
// Compute the momentum in global reference
|
||||
// system if needed ...
|
||||
@@ -133,7 +133,7 @@ ProposePrimaryTrackFinalMomentumDirection(const G4ThreeVector &momentum,
|
||||
void
|
||||
G4FastStep::
|
||||
SetPrimaryTrackFinalMomentum(const G4ThreeVector &momentum,
|
||||
G4bool localCoordinates)
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
ProposePrimaryTrackFinalMomentumDirection(momentum, localCoordinates);
|
||||
}
|
||||
@@ -144,8 +144,8 @@ SetPrimaryTrackFinalMomentum(const G4ThreeVector &momentum,
|
||||
void
|
||||
G4FastStep::
|
||||
ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
const G4ThreeVector &direction,
|
||||
G4bool localCoordinates)
|
||||
const G4ThreeVector &direction,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
// Compute global direction if needed...
|
||||
G4ThreeVector globalDirection = direction;
|
||||
@@ -160,8 +160,8 @@ ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
void
|
||||
G4FastStep::
|
||||
SetPrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
const G4ThreeVector &direction,
|
||||
G4bool localCoordinates)
|
||||
const G4ThreeVector &direction,
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
ProposePrimaryTrackFinalKineticEnergyAndDirection(kineticEnergy, direction, localCoordinates);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ SetPrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
|
||||
void
|
||||
G4FastStep::
|
||||
ProposePrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
|
||||
G4bool localCoordinates)
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
// Compute polarization in global system if needed:
|
||||
G4ThreeVector globalPolarization(polarization);
|
||||
@@ -186,7 +186,7 @@ ProposePrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
|
||||
void
|
||||
G4FastStep::
|
||||
SetPrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
|
||||
G4bool localCoordinates)
|
||||
G4bool localCoordinates)
|
||||
{
|
||||
ProposePrimaryTrackFinalPolarization(polarization, localCoordinates);
|
||||
}
|
||||
@@ -196,10 +196,10 @@ SetPrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
|
||||
//--------------------
|
||||
G4Track* G4FastStep::
|
||||
CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
G4ThreeVector polarization,
|
||||
G4ThreeVector position,
|
||||
G4double time,
|
||||
G4bool localCoordinates )
|
||||
G4ThreeVector polarization,
|
||||
G4ThreeVector position,
|
||||
G4double time,
|
||||
G4bool localCoordinates )
|
||||
{
|
||||
G4DynamicParticle dummyDynamics(dynamics);
|
||||
|
||||
@@ -207,8 +207,8 @@ CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
// Add the polarization to the dummyDynamics:
|
||||
// ------------------------------------------
|
||||
dummyDynamics.SetPolarization(polarization.x(),
|
||||
polarization.y(),
|
||||
polarization.z());
|
||||
polarization.y(),
|
||||
polarization.z());
|
||||
|
||||
return CreateSecondaryTrack(dummyDynamics, position, time, localCoordinates);
|
||||
}
|
||||
@@ -218,9 +218,9 @@ CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
//--------------------
|
||||
G4Track* G4FastStep::
|
||||
CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
G4ThreeVector position,
|
||||
G4double time,
|
||||
G4bool localCoordinates )
|
||||
G4ThreeVector position,
|
||||
G4double time,
|
||||
G4bool localCoordinates )
|
||||
{
|
||||
// ----------------------------------------
|
||||
// Quantities in global coordinates system.
|
||||
@@ -239,32 +239,32 @@ CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
{
|
||||
// -- Momentum Direction:
|
||||
globalDynamics->SetMomentumDirection(fFastTrack->
|
||||
GetInverseAffineTransformation()->
|
||||
TransformAxis(globalDynamics->
|
||||
GetMomentumDirection()));
|
||||
GetInverseAffineTransformation()->
|
||||
TransformAxis(globalDynamics->
|
||||
GetMomentumDirection()));
|
||||
// -- Polarization:
|
||||
G4ThreeVector globalPolarization;
|
||||
globalPolarization = fFastTrack->GetInverseAffineTransformation()->
|
||||
TransformAxis(globalDynamics->GetPolarization());
|
||||
TransformAxis(globalDynamics->GetPolarization());
|
||||
globalDynamics->SetPolarization(
|
||||
globalPolarization.x(),
|
||||
globalPolarization.y(),
|
||||
globalPolarization.z()
|
||||
);
|
||||
globalPolarization.x(),
|
||||
globalPolarization.y(),
|
||||
globalPolarization.z()
|
||||
);
|
||||
|
||||
// -- Position:
|
||||
globalPosition = fFastTrack->GetInverseAffineTransformation()->
|
||||
TransformPoint(globalPosition);
|
||||
TransformPoint(globalPosition);
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
// Create the G4Track of the secondary:
|
||||
//-------------------------------------
|
||||
G4Track* secondary = new G4Track(
|
||||
globalDynamics,
|
||||
time,
|
||||
globalPosition
|
||||
);
|
||||
globalDynamics,
|
||||
time,
|
||||
globalPosition
|
||||
);
|
||||
|
||||
//-------------------------------
|
||||
// and feed the changes:
|
||||
@@ -281,7 +281,8 @@ CreateSecondaryTrack(const G4DynamicParticle& dynamics,
|
||||
// but we must define it to avoid warnings.
|
||||
void G4FastStep::Initialize(const G4Track&)
|
||||
{
|
||||
G4Exception("G4FastStep::Initialize(const G4Track&) should never be called,\nyou must use instead the G4FastStep::Initialize(const G4FastTrack&)\nmethod!");
|
||||
G4Exception("G4FastStep::Initialize()", "InvalidCondition", FatalException,
|
||||
"G4FastStep can be initialised only through G4FastTrack!");
|
||||
}
|
||||
|
||||
G4FastStep::G4FastStep()
|
||||
@@ -373,7 +374,7 @@ G4Step* G4FastStep::UpdateStepForPostStep(G4Step* pStep)
|
||||
pPostStepPoint->SetPosition( thePositionChange );
|
||||
pPostStepPoint->SetGlobalTime( theTimeChange );
|
||||
pPostStepPoint->AddLocalTime( theTimeChange
|
||||
- aTrack->GetGlobalTime());
|
||||
- aTrack->GetGlobalTime());
|
||||
pPostStepPoint->SetProperTime( theProperTimeChange );
|
||||
|
||||
// update weight
|
||||
@@ -406,7 +407,7 @@ G4Step* G4FastStep::UpdateStepForAtRest(G4Step* pStep)
|
||||
pPostStepPoint->SetPosition( thePositionChange );
|
||||
pPostStepPoint->SetGlobalTime( theTimeChange );
|
||||
pPostStepPoint->AddLocalTime( theTimeChange
|
||||
- aTrack->GetGlobalTime());
|
||||
- aTrack->GetGlobalTime());
|
||||
pPostStepPoint->SetProperTime( theProperTimeChange );
|
||||
|
||||
// update weight
|
||||
@@ -493,49 +494,53 @@ G4bool G4FastStep::CheckIt(const G4Track& aTrack)
|
||||
// Energy should not be larger than the initial value
|
||||
accuracy = ( theEnergyChange - aTrack.GetKineticEnergy())/MeV;
|
||||
if (accuracy > GetAccuracyForWarning()) {
|
||||
G4cout << " G4FastStep::CheckIt : ";
|
||||
G4cout << "the energy becomes larger than the initial value !!" << G4endl;
|
||||
G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl;
|
||||
G4cout << "ERROR - G4FastStep::CheckIt()" << G4endl
|
||||
<< " The energy becomes larger than the initial value !!"
|
||||
<< G4endl
|
||||
<< " Difference: " << accuracy << "[MeV] " << G4endl;
|
||||
itsOK = false;
|
||||
if (accuracy > GetAccuracyForException()) exitWithError = true;
|
||||
if (accuracy > GetAccuracyForException()) {exitWithError = true;}
|
||||
}
|
||||
|
||||
G4bool itsOKforMomentum = true;
|
||||
if ( theEnergyChange >0.) {
|
||||
accuracy = std::abs(theMomentumChange.mag2()-1.0);
|
||||
if (accuracy > GetAccuracyForWarning()) {
|
||||
G4cout << " G4FastStep::CheckIt : ";
|
||||
G4cout << "the Momentum Change is not unit vector !!"
|
||||
<< " Difference: " << accuracy << G4endl;
|
||||
G4cout << "ERROR - G4FastStep::CheckIt()" << G4endl
|
||||
<< " The Momentum Change is not unit vector !!" << G4endl
|
||||
<< " Difference: " << accuracy << G4endl;
|
||||
itsOK = itsOKforMomentum = false;
|
||||
if (accuracy > GetAccuracyForException()) exitWithError = true;
|
||||
if (accuracy > GetAccuracyForException()) {exitWithError = true;}
|
||||
}
|
||||
}
|
||||
|
||||
accuracy = (aTrack.GetGlobalTime()- theTimeChange)/ns;
|
||||
if (accuracy > GetAccuracyForWarning()) {
|
||||
G4cout << " G4FastStep::CheckIt : ";
|
||||
G4cout << "the global time goes back !!"
|
||||
<< " Difference: " << accuracy << "[ns] " <<G4endl;
|
||||
G4cout << "ERROR - G4FastStep::CheckIt()" << G4endl
|
||||
<< " The global time goes back !!" << G4endl
|
||||
<< " Difference: " << accuracy << "[ns] " << G4endl;
|
||||
itsOK = false;
|
||||
}
|
||||
|
||||
accuracy = (aTrack.GetProperTime() - theProperTimeChange )/ns;
|
||||
if (accuracy) {
|
||||
G4cout << " G4FastStep::CheckIt : ";
|
||||
G4cout << "the proper time goes back !!"
|
||||
<< " Difference: " << accuracy << "[ns] " <<G4endl;
|
||||
G4cout << "ERROR - G4FastStep::CheckIt()" << G4endl
|
||||
<< " The proper time goes back !!" << G4endl
|
||||
<< " Difference: " << accuracy << "[ns] " << G4endl;
|
||||
itsOK = false;
|
||||
}
|
||||
|
||||
if (!itsOK) {
|
||||
G4cout << " G4FastStep::CheckIt " <<G4endl;
|
||||
G4cout << " pointer : " << this <<G4endl ;
|
||||
G4cout << "ERROR - G4FastStep::CheckIt() " << G4endl;
|
||||
G4cout << " Pointer : " << this << G4endl ;
|
||||
DumpInfo();
|
||||
}
|
||||
|
||||
// Exit with error
|
||||
if (exitWithError) G4Exception("G4ParticleChange::CheckIt");
|
||||
if (exitWithError) {
|
||||
G4Exception("G4FastStep::CheckIt()", "FatalError",
|
||||
FatalException, "Error condition in G4ParticleChange.");
|
||||
}
|
||||
|
||||
//correction for Momentum only.
|
||||
if (!itsOKforMomentum) {
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FastTrack.cc,v 1.7 2003/11/10 08:57:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4FastTrack.cc,v 1.9 2005/11/02 09:21:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
@@ -47,9 +47,10 @@
|
||||
// -----------
|
||||
//
|
||||
G4FastTrack::G4FastTrack(G4Envelope *anEnvelope,
|
||||
G4bool IsUnique) :
|
||||
G4bool IsUnique) :
|
||||
fAffineTransformationDefined(false), fEnvelope(anEnvelope),
|
||||
fIsUnique(IsUnique), fEnvelopeSolid(fEnvelope->GetSolid())
|
||||
fIsUnique(IsUnique), fEnvelopeLogicalVolume(0), fEnvelopePhysicalVolume(0),
|
||||
fEnvelopeSolid(0)
|
||||
{}
|
||||
|
||||
// -----------
|
||||
@@ -63,7 +64,7 @@ G4FastTrack::~G4FastTrack()
|
||||
// method to setup the current G4FastTrack object
|
||||
//------------------------------------------------------------
|
||||
void G4FastTrack::SetCurrentTrack(const G4Track& track,
|
||||
const G4Navigator* theNavigator)
|
||||
const G4Navigator* theNavigator)
|
||||
{
|
||||
|
||||
// -- Register track pointer (used everywhere):
|
||||
@@ -130,12 +131,17 @@ G4FastTrack::FRecordsAffineTransformation(const G4Navigator* theNavigator)
|
||||
// Run accross the hierarchy to find the physical volume
|
||||
// associated with the envelope
|
||||
//-----------------------------------------------------
|
||||
int depth = history->GetHistory()->GetDepth();
|
||||
int idepth, Done = 0;
|
||||
for (idepth = 0; idepth <= depth; idepth++) {
|
||||
if (history->GetHistory()->GetVolume(idepth)->GetLogicalVolume() ==
|
||||
fEnvelope) {
|
||||
fEnvelopePhysicalVolume=history->GetHistory()->GetVolume(idepth);
|
||||
G4int depth = history->GetHistory()->GetDepth();
|
||||
G4int idepth, Done = 0;
|
||||
for (idepth = 0; idepth <= depth; idepth++)
|
||||
{
|
||||
G4VPhysicalVolume* currPV = history->GetHistory()->GetVolume(idepth);
|
||||
G4LogicalVolume* currLV = currPV->GetLogicalVolume();
|
||||
if ( (currLV->GetRegion() == fEnvelope) && (currLV->IsRootRegion()) )
|
||||
{
|
||||
fEnvelopePhysicalVolume = currPV;
|
||||
fEnvelopeLogicalVolume = currLV;
|
||||
fEnvelopeSolid = currLV->GetSolid();
|
||||
Done = 1;
|
||||
break;
|
||||
}
|
||||
@@ -145,8 +151,13 @@ G4FastTrack::FRecordsAffineTransformation(const G4Navigator* theNavigator)
|
||||
//---------------------------------------------
|
||||
if ( !Done )
|
||||
{
|
||||
G4cout << "\n\nERROR !!! can't find Transform for " <<
|
||||
fEnvelopePhysicalVolume->GetName() << "\n\n" << G4endl;
|
||||
G4cout << "WARNING - G4FastTrack::FRecordsAffineTransformation()"
|
||||
<< G4endl
|
||||
<< " Can't find transformation for "
|
||||
<< fEnvelopePhysicalVolume->GetName() << G4endl;
|
||||
G4Exception("G4FastTrack::FRecordsAffineTransformation()",
|
||||
"InvalidSetup", JustWarning,
|
||||
"Transformation for envelope volume not found!");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GlobalFastSimulationManager.cc,v 1.12 2002/12/04 21:29:50 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4GlobalFastSimulationManager.cc,v 1.15 2005/11/26 00:35:02 mverderi Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -103,7 +103,7 @@ RemoveFastSimulationManager(G4FastSimulationManager* fsmanager)
|
||||
void G4GlobalFastSimulationManager::CloseFastSimulation()
|
||||
{
|
||||
if(fClosed) return;
|
||||
|
||||
|
||||
G4ParticleTable* theParticleTable;
|
||||
|
||||
// Reset the NeededFlavoredWorlds List
|
||||
@@ -113,26 +113,29 @@ void G4GlobalFastSimulationManager::CloseFastSimulation()
|
||||
theParticleTable=G4ParticleTable::GetParticleTable();
|
||||
|
||||
// Creates the first world volume clone.
|
||||
G4VPhysicalVolume* aClone=GiveMeAWorldVolumeClone();
|
||||
G4VPhysicalVolume* aClone = GiveMeAWorldVolumeClone();
|
||||
|
||||
G4cout << "Closing FastSimulation\n";
|
||||
for (G4int iParticle=0; iParticle<theParticleTable->entries(); iParticle++) {
|
||||
G4cout << "Closing Fast-Simulation ..." << G4endl;
|
||||
|
||||
for (G4int iParticle=0;
|
||||
iParticle<theParticleTable->entries(); iParticle++) {
|
||||
G4bool Needed = false;
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
Needed = Needed || ManagedManagers[ifsm]->
|
||||
InsertGhostHereIfNecessary(aClone,
|
||||
*(theParticleTable->
|
||||
GetParticle(iParticle)));
|
||||
InsertGhostHereIfNecessary(aClone,
|
||||
*(theParticleTable->
|
||||
GetParticle(iParticle)));
|
||||
// if some FSM inserted a ghost, keep this clone.
|
||||
if(Needed) {
|
||||
NeededFlavoredWorlds.push_back(new
|
||||
G4FlavoredParallelWorld(theParticleTable->
|
||||
GetParticle(iParticle),
|
||||
aClone));
|
||||
// and prepare a new one.
|
||||
aClone=GiveMeAWorldVolumeClone();
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -147,11 +150,13 @@ GetFlavoredWorldForThis(G4ParticleDefinition* particle)
|
||||
}
|
||||
|
||||
void
|
||||
G4GlobalFastSimulationManager::ActivateFastSimulationModel(const G4String& aName)
|
||||
G4GlobalFastSimulationManager::
|
||||
ActivateFastSimulationModel(const G4String& aName)
|
||||
{
|
||||
G4bool result = false;
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
result = result || ManagedManagers[ifsm]->ActivateFastSimulationModel(aName);
|
||||
result = result || ManagedManagers[ifsm]->
|
||||
ActivateFastSimulationModel(aName);
|
||||
if(result)
|
||||
G4cout << "Model " << aName << " activated.";
|
||||
else
|
||||
@@ -160,11 +165,13 @@ G4GlobalFastSimulationManager::ActivateFastSimulationModel(const G4String& aName
|
||||
}
|
||||
|
||||
void
|
||||
G4GlobalFastSimulationManager::InActivateFastSimulationModel(const G4String& aName)
|
||||
G4GlobalFastSimulationManager::
|
||||
InActivateFastSimulationModel(const G4String& aName)
|
||||
{
|
||||
G4bool result = false;
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
result = result || ManagedManagers[ifsm]->InActivateFastSimulationModel(aName);
|
||||
result = result || ManagedManagers[ifsm]->
|
||||
InActivateFastSimulationModel(aName);
|
||||
if(result)
|
||||
G4cout << "Model " << aName << " inactivated.";
|
||||
else
|
||||
@@ -174,7 +181,7 @@ G4GlobalFastSimulationManager::InActivateFastSimulationModel(const G4String& aNa
|
||||
|
||||
void
|
||||
G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName,
|
||||
listType theType)
|
||||
listType theType)
|
||||
{
|
||||
if(theType == ISAPPLICABLE) {
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
@@ -186,11 +193,11 @@ G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName,
|
||||
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;
|
||||
if(!(titled++))
|
||||
G4cout << "Current Envelopes for Fast Simulation:\n";
|
||||
G4cout << " ";
|
||||
ManagedManagers[ifsm]->ListTitle();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
else ManagedManagers[ifsm]->ListModels();
|
||||
}
|
||||
@@ -198,9 +205,9 @@ G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName,
|
||||
else {
|
||||
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
|
||||
if(aName == ManagedManagers[ifsm]->
|
||||
GetEnvelope()->GetName()){
|
||||
ManagedManagers[ifsm]->ListModels();
|
||||
break;
|
||||
GetEnvelope()->GetName()){
|
||||
ManagedManagers[ifsm]->ListModels();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,14 +237,14 @@ G4GlobalFastSimulationManager::GiveMeAWorldVolumeClone()
|
||||
|
||||
G4LogicalVolume *parallelWorldLog =
|
||||
new G4LogicalVolume(parallelWorldSolid,
|
||||
parallelWorldMaterial,
|
||||
"ParallelWorldLogical",
|
||||
0, 0, 0);
|
||||
parallelWorldMaterial,
|
||||
"ParallelWorldLogical",
|
||||
0, 0, 0);
|
||||
|
||||
theParallelWorldPhysical= new G4PVPlacement(0,G4ThreeVector(),
|
||||
"ParallelWorldPhysical",
|
||||
parallelWorldLog,
|
||||
0,false,0);
|
||||
"ParallelWorldPhysical",
|
||||
parallelWorldLog,
|
||||
0,false,0);
|
||||
|
||||
return theParallelWorldPhysical;
|
||||
}
|
||||
@@ -247,22 +254,35 @@ G4GlobalFastSimulationManager::Notify(G4ApplicationState requestedState)
|
||||
{
|
||||
G4StateManager * stateManager = G4StateManager::GetStateManager();
|
||||
if((stateManager->GetPreviousState()==G4State_Idle) &&
|
||||
(requestedState==G4State_GeomClosed) &&
|
||||
(!fClosed))
|
||||
G4Exception("G4GlobalFastSimulationManager fatal error : \n1) you are using ghost volumes;\n2) In this case the G4GlobalFastSimulationManager MUST be closed BEFORE\n closing the geometry;\n3) To do this put in your code the call \n G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->\n CloseFastSimulation();\n just before closing the geometry.");
|
||||
(requestedState==G4State_GeomClosed) && (!fClosed) )
|
||||
{
|
||||
G4cerr
|
||||
<< "ERROR - G4GlobalFastSimulationManager::Notify()" << G4endl
|
||||
<< " 1) you are using ghost volumes;" << G4endl
|
||||
<< " 2) In this case the G4GlobalFastSimulationManager" << 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("G4GlobalFastSimulationManager::Notify()", "InvalidState",
|
||||
FatalException, "Fast simulation must be closed.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
G4VFastSimulationModel*
|
||||
G4GlobalFastSimulationManager::GetFastSimulationModel(const G4String& modelName,
|
||||
const G4VFastSimulationModel* previousFound) const
|
||||
G4GlobalFastSimulationManager::
|
||||
GetFastSimulationModel(const G4String& modelName,
|
||||
const G4VFastSimulationModel* previousFound) const
|
||||
{
|
||||
G4VFastSimulationModel* model = 0;
|
||||
// -- 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);
|
||||
model = ManagedManagers[ifsm]->
|
||||
GetFastSimulationModel(modelName, previousFound, foundPrevious);
|
||||
if (model) break;
|
||||
}
|
||||
return model;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VFastSimulationModel.cc,v 1.5 2001/07/11 10:08:25 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user