Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
+9 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.9 2007/06/05 13:37:36 gcosmo Exp $
$Id: History,v 1.13 2007/11/14 17:03:06 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14 November 2007 - G.Cosmo (error_propagation-V09-00-02)
- G4ErrorPropagator: removed call to exit() and some cleanup.
24 September 2007 - P.Arce (error_propagation-V09-00-01)
- G4ErrorFreeTrajState: corrected bug in one of the transformation matrix
terms. Addresses problem report #971.
- G4ErrorFreeTrajParam: corrected normalization of Y and Z coordinates.
5 June 2007 - G.Cosmo (error_propagation-V08-03-09)
- Added missing definition of GLOBLIBS in GNUmakefile to allow for
building DLLs on Windows.
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorFreeTrajParam.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// Class Description:
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorFreeTrajState.hh,v 1.4 2007/05/31 20:27:06 arce Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// Class Description:
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorGeomVolumeTarget.hh,v 1.3 2007/05/31 15:28:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// Class Description:
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorMagFieldLimitProcess.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// Class description:
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorMatrix.hh,v 1.2 2007/06/01 12:43:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// Class Description:
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorMatrix.icc,v 1.2 2007/06/01 12:43:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class inline implementation
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorMessenger.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// Class Description:
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorPhysicsList.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class Description:
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorPropagator.hh,v 1.3 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class Description:
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorPropagatorManager.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// Class Description:
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorRunManagerHelper.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class Description:
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorStepLengthLimitProcess.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class Description:
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorSurfaceTrajParam.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class Description:
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorSurfaceTrajState.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class description:
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorSymMatrix.hh,v 1.2 2007/06/01 12:43:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// Class Description:
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorSymMatrix.icc,v 1.2 2007/06/01 12:43:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class inline implementation
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorTrackLengthTarget.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class Description:
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorTrajErr.hh,v 1.3 2007/05/31 20:27:07 arce Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class Description:
@@ -25,7 +25,7 @@
//
//
// $Id: G4ErrorTrajState.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class Description:
@@ -25,7 +25,7 @@
//
//
// $Id: G4VErrorLimitProcess.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// Class description:
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ErrorFreeTrajParam.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4ErrorFreeTrajParam.cc,v 1.3 2007/09/24 16:24:45 arce Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -53,11 +53,13 @@ void G4ErrorFreeTrajParam::SetParameters( const G4Point3D& pos,
fLambda = 90.*deg - mom.theta();
fPhi = mom.phi();
G4Vector3D vxPerp(0.,0.,0.);
if( mom.mag() > 0.) {
vxPerp = mom/mom.mag();
}
if( mom.mag() > 0.) {
vxPerp = mom/mom.mag();
}
G4Vector3D vyPerp = G4Vector3D( -vxPerp.y(), vxPerp.x(), 0.);
vyPerp /= vyPerp.mag();
G4Vector3D vzPerp = vxPerp.cross( vyPerp );
vzPerp /= vzPerp.mag();
// check if right handed
// fXPerp = pos.proj( mom );
G4ThreeVector posv(pos);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ErrorFreeTrajState.cc,v 1.6 2007/06/21 15:04:04 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4ErrorFreeTrajState.cc,v 1.7 2007/09/24 16:25:57 arce Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -440,7 +440,7 @@ G4int G4ErrorFreeTrajState::PropagateError( const G4Track* aTrack )
ANV*( -sinThetaAver*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y() ) +
OMcosThetaAver*(vUPre.x()*AN2.x()+vUPre.y()*AN2.y() ) -
TMSINT*gamma*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y() ) );
transf[1][2] = sinpPre*transf[1][3];
transf[1][2] = sinpPre*transf[1][2];
transf[1][3] = -QAver*ANV*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y() );
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorGeomVolumeTarget.cc,v 1.3 2007/05/31 15:28:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorMagFieldLimitProcess.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorMatrix.cc,v 1.3 2007/06/21 15:04:06 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorMessenger.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorPhysicsList.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
+329 -160
View File
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ErrorPropagator.cc,v 1.6 2007/06/04 14:59:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4ErrorPropagator.cc,v 1.7 2007/11/14 17:01:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -58,42 +58,54 @@ G4ErrorPropagator::G4ErrorPropagator()
{
verbose = G4ErrorPropagatorData::verbose();
#ifdef G4EVERBOSE
if(verbose >= 5) G4cout << "G4ErrorPropagator " << this << G4endl;
if(verbose >= 5) { G4cout << "G4ErrorPropagator " << this << G4endl; }
#endif
//t theTrackingGeometry = 0; //by default set it to 0, and when propagation it will be set to the world
theG4Track = 0;
fpSteppingManager = G4EventManager::GetEventManager()->GetTrackingManager()->GetSteppingManager();
fpSteppingManager = G4EventManager::GetEventManager()
->GetTrackingManager()->GetSteppingManager();
thePropIsInitialized = false;
}
//-----------------------------------------------------------------------
G4int G4ErrorPropagator::Propagate( G4ErrorTrajState* currentTS, const G4ErrorTarget* target, G4ErrorMode mode )
G4int G4ErrorPropagator::Propagate( G4ErrorTrajState* currentTS,
const G4ErrorTarget* target, G4ErrorMode mode )
{
// to start ierror is set to 1 (= OK)
//
G4int ierr = 1;
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
G4ErrorPropagatorData* g4edata =
G4ErrorPropagatorData::GetErrorPropagatorData();
//--- Do not propagate zero or too low energy particles
if( currentTS->GetMomentum().mag() < 1.E-9*MeV ) {
G4cerr << " !! G4ErrorPropagator::Propagate: energy too low to be propagated " << G4BestUnit(currentTS->GetMomentum().mag(),"Energy") << G4endl;
//----- Do not propagate zero or too low energy particles
//
if( currentTS->GetMomentum().mag() < 1.E-9*MeV )
{
G4cerr << "ERROR - G4ErrorPropagator::Propagate()" << G4endl
<< " Energy too low to be propagated: "
<< G4BestUnit(currentTS->GetMomentum().mag(),"Energy") << G4endl;
return -3;
}
g4edata->SetMode( mode );
#ifdef G4EVERBOSE
if( verbose >= 1 ) G4cout << " =====> starting GEANT4E tracking for " << currentTS->GetParticleType() << " Forwards= " << g4edata->GetMode() << G4endl;
if(verbose >= 1 ) G4cout << G4endl << "@@@@@@@@@@@@@@@@@@@@@@@@@ NEW STEP " << G4endl;
if( verbose >= 1 )
{
G4cout << " =====> starting GEANT4E tracking for "
<< currentTS->GetParticleType()
<< " Forwards= " << g4edata->GetMode() << G4endl;
}
if(verbose >= 1 )
{
G4cout << G4endl << "@@@@@@@@@@@@@@@@@@@@@@@@@ NEW STEP " << G4endl;
}
if( verbose >= 3 ){
if( verbose >= 3 )
{
G4cout << " G4ErrorPropagator::Propagate initialTS ";
// initialTS.Dump();
G4cout << *currentTS << G4endl;
target->Dump(G4String(" to target "));
}
@@ -102,39 +114,60 @@ G4int G4ErrorPropagator::Propagate( G4ErrorTrajState* currentTS, const G4ErrorTa
g4edata->SetTarget( target );
//----- Create a track
if( theG4Track != 0 ) delete theG4Track;
//
if( theG4Track != 0 ) { delete theG4Track; }
theG4Track = InitG4Track( *currentTS );
//----- Create a G4ErrorFreeTrajState
//
G4ErrorFreeTrajState* currentTS_FREE = InitFreeTrajState( currentTS );
//----- Track the particle
//
ierr = MakeSteps( currentTS_FREE );
//------ Tracking ended, check if target has been reached
// if target not found
if( g4edata->GetState() != G4ErrorState_StoppedAtTarget ){
if( theG4Track->GetKineticEnergy() > 0. ) {
// if target not found
//
if( g4edata->GetState() != G4ErrorState_StoppedAtTarget )
{
if( theG4Track->GetKineticEnergy() > 0. )
{
ierr = -ierr - 10;
} else {
}
else
{
ierr = -ierr - 20;
}
*currentTS = *currentTS_FREE;
if(verbose >= 0 ) G4cerr << " !!ERROR G4ErrorPropagator: particle does not reach target " << *currentTS << G4endl;
} else {
if(verbose >= 0 )
{
G4cerr << "ERROR - G4ErrorPropagator::Propagate()" << G4endl
<< " Particle does not reach target: " << *currentTS
<< G4endl;
}
}
else
{
GetFinalTrajState( currentTS, currentTS_FREE, target );
}
#ifdef G4EVERBOSE
if( verbose >= 1 ) G4cout << " G4ErrorPropagator: propagation ended " << G4endl;
if( verbose >= 2 ) G4cout << " Current TrajState " << currentTS << G4endl;
if( verbose >= 1 )
{
G4cout << " G4ErrorPropagator: propagation ended " << G4endl;
}
if( verbose >= 2 )
{
G4cout << " Current TrajState " << currentTS << G4endl;
}
#endif
// Inform end of tracking to physics processes
// Inform end of tracking to physics processes
//
theG4Track->GetDefinition()->GetProcessManager()->EndTracking();
InvokePostUserTrackingAction( theG4Track );
InvokePostUserTrackingAction( theG4Track );
return ierr;
}
@@ -143,45 +176,67 @@ G4int G4ErrorPropagator::Propagate( G4ErrorTrajState* currentTS, const G4ErrorTa
//-----------------------------------------------------------------------
G4int G4ErrorPropagator::PropagateOneStep( G4ErrorTrajState* currentTS )
{
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
G4ErrorPropagatorData* g4edata =
G4ErrorPropagatorData::GetErrorPropagatorData();
if( g4edata->GetState() == G4ErrorState_PreInit || G4StateManager::GetStateManager()->GetCurrentState() != G4State_GeomClosed) {
//G4cout << g4edata << " G4ErrorState " << g4edata->GetState() << " <> " << G4ErrorState_Propagating
// << " G4State " << G4StateManager::GetStateManager()->GetCurrentState()<< " <> " << G4State_GeomClosed << G4endl;
G4Exception("!!! G4ErrorPropagator::PropagateOneStep called before initialization is done for this track, please call G4ErrorPropagatorManager::InitGeant4e() " );
if ( (g4edata->GetState() == G4ErrorState_PreInit)
|| (G4StateManager::GetStateManager()->GetCurrentState()
!= G4State_GeomClosed) )
{
G4cout << "ERROR - G4ErrorPropagator::PropagateOneStep()" << G4endl
<< " Called before initialization is done for this track."
<< G4endl
<< " Please call G4ErrorPropagatorManager::InitGeant4e()."
<< G4endl;
G4Exception("G4ErrorPropagator::PropagateOneStep()",
"InvalidCall", FatalException,
"Called before initialization is done for this track!");
}
// to start ierror is set to 0 (= OK)
//
G4int ierr = 0;
//--- Do not propagate zero or too low energy particles
if( currentTS->GetMomentum().mag() < 1.E-9*MeV ) {
G4cerr << " !! G4ErrorPropagator::PropagateOneStep: energy too low to be propagated " << G4BestUnit(currentTS->GetMomentum().mag(),"Energy") << G4endl;
//
if( currentTS->GetMomentum().mag() < 1.E-9*MeV )
{
G4cerr << "ERROR - G4ErrorPropagator::PropagateOneStep()" << G4endl
<< " Energy too low to be propagated: "
<< G4BestUnit(currentTS->GetMomentum().mag(),"Energy") << G4endl;
return -3;
}
#ifdef G4EVERBOSE
if( verbose >= 1 ) G4cout << " =====> starting GEANT4E tracking for " << currentTS->GetParticleType() << " Forwards= " << g4edata->GetMode() << G4endl;
if( verbose >= 3 ){
if( verbose >= 1 )
{
G4cout << " =====> starting GEANT4E tracking for "
<< currentTS->GetParticleType()
<< " Forwards= " << g4edata->GetMode() << G4endl;
}
if( verbose >= 3 )
{
G4cout << " G4ErrorPropagator::Propagate initialTS ";
G4cout << *currentTS << G4endl;
}
#endif
// SetTargetToNavigator( (G4ErrorTarget*)0 );
//----- If it is the first step, create a track
if( theStepN == 0 ) theG4Track = InitG4Track( *currentTS ); // set to 0 by the initialization in G4ErrorPropagatorManager
//
if( theStepN == 0 ) { theG4Track = InitG4Track( *currentTS ); }
// set to 0 by the initialization in G4ErrorPropagatorManager
theStepN++;
//----- Create a G4ErrorFreeTrajState
//
G4ErrorFreeTrajState* currentTS_FREE = InitFreeTrajState( currentTS );
//----- Track the particle one step
//
ierr = MakeOneStep( currentTS_FREE );
//----- Get the state on target
//
GetFinalTrajState( currentTS, currentTS_FREE, g4edata->GetTarget() );
return ierr;
@@ -191,63 +246,73 @@ G4int G4ErrorPropagator::PropagateOneStep( G4ErrorTrajState* currentTS )
//---------------------------------------------------------------------------
G4Track* G4ErrorPropagator::InitG4Track( G4ErrorTrajState& initialTS )
{
if( verbose >= 5 ) G4cout << "InitG4Track " << G4endl;
//----- Close geometry
//- G4bool geometryToBeOptimized = true;
// if(verboseLevel>1)
//- G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
//- geomManager->OpenGeometry();
//- geomManager->CloseGeometry(geometryToBeOptimized);
if( verbose >= 5 ) { G4cout << "InitG4Track " << G4endl; }
//----- Create Particle
//
const G4String partType = initialTS.GetParticleType();
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* particle = particleTable->FindParticle(partType);
if( particle == 0) {
G4Exception( "!!! G4ErrorPropagator::InitG4Track: particle type not defined " + partType );
} else {
if( particle == 0)
{
G4cerr << "ERROR - G4ErrorPropagator::InitG4Track()" << G4endl
<< " Particle type not defined " + partType << G4endl;
G4Exception( "G4ErrorPropagator::InitG4Track()", "InvalidSetup",
FatalException, "Particle type not defined !" );
}
G4DynamicParticle* DP =
new G4DynamicParticle(particle,initialTS.GetMomentum());
new G4DynamicParticle(particle,initialTS.GetMomentum());
DP->SetPolarization(0.,0.,0.);
// Set Charge
// if (abs(primaryParticle->GetCharge()-DP->GetPDGCharge())>eplus) {
// DP->SetCharge(primaryParticle->GetCharge());
if( particle->GetPDGCharge() < 0 ) {
//
if( particle->GetPDGCharge() < 0 )
{
DP->SetCharge(-eplus);
} else {
}
else
{
DP->SetCharge(eplus);
}
// Set decay products to the DynamicParticle
//?? SetDecayProducts( primaryParticle, DP );
//----- Create Track
//
theG4Track = new G4Track(DP, 0., initialTS.GetPosition() );
theG4Track->SetParentID(0);
#ifdef G4EVERBOSE
if(verbose >= 3) G4cout << " G4ErrorPropagator new track of energy: " << theG4Track->GetKineticEnergy() << G4endl;
if(verbose >= 3)
{
G4cout << " G4ErrorPropagator new track of energy: "
<< theG4Track->GetKineticEnergy() << G4endl;
}
#endif
//---- Reproduce G4TrackingManager::ProcessOneTrack initialization
InvokePreUserTrackingAction( theG4Track );
if( fpSteppingManager == 0 ) {
// G4cerr << " event manager " << G4EventManager::GetEventManager() << G4endl;
G4Exception( "G4ErrorPropagator::InitG4Track. GEANT4e error: G4SteppingManager not initialized yet " );
} else {
if( fpSteppingManager == 0 )
{
G4Exception("G4ErrorPropagator::InitG4Track()", "InvalidSetup",
FatalException, "G4SteppingManager not initialized yet!");
}
else
{
fpSteppingManager->SetInitialStep(theG4Track);
}
// Give SteppingManger the maximum number of processes
// Give SteppingManger the maximum number of processes
//
fpSteppingManager->GetProcessNumber();
// Give track the pointer to the Step
//
theG4Track->SetStep(fpSteppingManager->GetStep());
// Inform beginning of tracking to physics processes
// Inform beginning of tracking to physics processes
//
theG4Track->GetDefinition()->GetProcessManager()->StartTracking(theG4Track);
initialTS.SetG4Track( theG4Track );
@@ -260,88 +325,113 @@ G4Track* G4ErrorPropagator::InitG4Track( G4ErrorTrajState& initialTS )
G4int G4ErrorPropagator::MakeSteps( G4ErrorFreeTrajState* currentTS_FREE )
{
G4int ierr = 0;
//----- Track the particle Step-by-Step while it is alive
//
theStepLength = 0.;
while( (theG4Track->GetTrackStatus() == fAlive) ||
(theG4Track->GetTrackStatus() == fStopButAlive) ){
(theG4Track->GetTrackStatus() == fStopButAlive) )
{
ierr = MakeOneStep( currentTS_FREE );
if( ierr != 0 ) break;
//----- Check if last step for GEANT4e
if( CheckIfLastStep( theG4Track ) ) {
if( verbose >= 5 ) G4cout << "!!!! Last Step reached " << G4endl;
if( ierr != 0 ) { break; }
//----- Check if last step for error propagation
//
if( CheckIfLastStep( theG4Track ) )
{
break;
}
}
return ierr;
}
//-----------------------------------------------------------------------
G4int G4ErrorPropagator::MakeOneStep( G4ErrorFreeTrajState* currentTS_FREE )
{
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
G4ErrorPropagatorData* g4edata =
G4ErrorPropagatorData::GetErrorPropagatorData();
G4int ierr = 0;
//---------- Track one step
#ifdef G4EVERBOSE
if(verbose >= 2 ) G4cout << G4endl << "@@@@@@@@@@@@@@@@@@@@@@@@@ NEW STEP " << G4endl;
if(verbose >= 2 )
{
G4cout << G4endl
<< "@@@@@@@@@@@@@@@@@@@@@@@@@ NEW STEP " << G4endl;
}
#endif
theG4Track->IncrementCurrentStepNumber();
//- G4StepStatus stepStatus =
fpSteppingManager->Stepping(); //t
fpSteppingManager->Stepping();
//---------- Check if Target has been reached (and then set G4ErrorState)
#ifdef G4EVERBOSE
// if(verbose >= 5 ) G4cout << " process = " << theG4Track->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() << " g4estate " << g4edata->PrintG4ErrorState() << G4endl;
#endif
// G4ErrorPropagationNavigator limits the step if target is closer than boundary (but the winner process is always "Transportation": then geant4e will stop the track
if( theG4Track->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == "Transportation" ){
if( g4edata->GetState() == G4ErrorState(G4ErrorState_TargetCloserThanBoundary) ){ // target or step length reached
// G4ErrorPropagationNavigator limits the step if target is closer than
// boundary (but the winner process is always "Transportation": then
// error propagator will stop the track
if( theG4Track->GetStep()->GetPostStepPoint()
->GetProcessDefinedStep()->GetProcessName() == "Transportation" )
{
if( g4edata->GetState()
== G4ErrorState(G4ErrorState_TargetCloserThanBoundary) )
{ // target or step length reached
#ifdef G4EVERBOSE
if(verbose >= 5 ) G4cout << " transportation determined by geant4e " << G4endl;
#endif
if(verbose >= 5 )
{
G4cout << " transportation determined by geant4e " << G4endl;
}
#endif
g4edata->SetState( G4ErrorState_StoppedAtTarget );
} else if( g4edata->GetTarget()->GetType() == G4ErrorTarget_GeomVolume ) {
G4ErrorGeomVolumeTarget* target = (G4ErrorGeomVolumeTarget*)(g4edata->GetTarget());
if( static_cast<G4ErrorGeomVolumeTarget*>( target )->TargetReached( theG4Track->GetStep() ) ) {
}
else if( g4edata->GetTarget()->GetType() == G4ErrorTarget_GeomVolume )
{
G4ErrorGeomVolumeTarget* target =
(G4ErrorGeomVolumeTarget*)(g4edata->GetTarget());
if( static_cast<G4ErrorGeomVolumeTarget*>( target )
->TargetReached( theG4Track->GetStep() ) )
{
g4edata->SetState( G4ErrorState_StoppedAtTarget );
}
}
}else if( theG4Track->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == "G4ErrorTrackLengthTarget" ){
}
else if( theG4Track->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName() == "G4ErrorTrackLengthTarget" )
{
g4edata->SetState( G4ErrorState_StoppedAtTarget );
}
/*if( g4edata->GetState() == G4ErrorState_StoppedAtTarget ) {
G4cout << " Run termination " << g4edata->GetState() << G4endl;
g4emgr->RunTermination();
}*/
//---------- Propagate error
#ifdef G4EVERBOSE
if(verbose >= 2 ) G4cout << " propagating error " << *currentTS_FREE << G4endl;
if(verbose >= 2 )
{
G4cout << " propagating error " << *currentTS_FREE << G4endl;
}
#endif
const G4Track* cTrack = const_cast<G4Track*>(theG4Track);
ierr = currentTS_FREE->PropagateError( cTrack );
#ifdef G4EVERBOSE
if(verbose >= 3 ) G4cout << " PropagateError returns " << ierr << G4endl;
if(verbose >= 3 )
{
G4cout << " PropagateError returns " << ierr << G4endl;
}
#endif
currentTS_FREE->Update( cTrack );
theStepLength += theG4Track->GetStepLength();
if(ierr != 0 ) {
G4cerr << "!!! G4ErrorPropagator:MakeOneStep returns an error " << ierr << G4endl;
G4cerr << "!!! GEANT4 tracking will be stopped " << G4endl;
if(ierr != 0 )
{
G4cerr << "ERROR - G4ErrorPropagator:MakeOneStep()" << G4endl
<< " Error returned: " << ierr << G4endl
<< " Geant4 tracking will be stopped !" << G4endl;
}
return ierr;
@@ -349,47 +439,74 @@ G4int G4ErrorPropagator::MakeOneStep( G4ErrorFreeTrajState* currentTS_FREE )
//-----------------------------------------------------------------------
G4ErrorFreeTrajState* G4ErrorPropagator::InitFreeTrajState( G4ErrorTrajState* currentTS )
G4ErrorFreeTrajState*
G4ErrorPropagator::InitFreeTrajState( G4ErrorTrajState* currentTS )
{
G4ErrorFreeTrajState* currentTS_FREE = 0;
//----- Transform the TrajState to Free coordinates if it is OnSurface
if( currentTS->GetTSType() == G4eTS_OS ){
G4ErrorSurfaceTrajState* tssd = static_cast<G4ErrorSurfaceTrajState*>(currentTS);
//t if( theCurrentTS_FREE != 0 ) delete theCurrentTS_FREE;
currentTS_FREE = new G4ErrorFreeTrajState( *tssd );
}else if( currentTS->GetTSType() == G4eTS_FREE ){
currentTS_FREE = static_cast<G4ErrorFreeTrajState*>(currentTS);
} else {
G4Exception("G4ErrorPropagator::InitFreeTrajState WRONG TrajState " + currentTS->GetTSType());
}
//----- Transform the TrajState to Free coordinates if it is OnSurface
//
if( currentTS->GetTSType() == G4eTS_OS )
{
G4ErrorSurfaceTrajState* tssd =
static_cast<G4ErrorSurfaceTrajState*>(currentTS);
currentTS_FREE = new G4ErrorFreeTrajState( *tssd );
}
else if( currentTS->GetTSType() == G4eTS_FREE )
{
currentTS_FREE = static_cast<G4ErrorFreeTrajState*>(currentTS);
}
else
{
G4cerr << "ERROR - G4ErrorPropagator::InitFreeTrajState()" << G4endl
<< "WRONG TrajState " + currentTS->GetTSType() << G4endl;
G4Exception("G4ErrorPropagator::InitFreeTrajState()", "InvalidState",
FatalException, "WRONG trajectory state !");
}
return currentTS_FREE;
}
//-----------------------------------------------------------------------
void G4ErrorPropagator::GetFinalTrajState( G4ErrorTrajState* currentTS, G4ErrorFreeTrajState* currentTS_FREE, const G4ErrorTarget* target )
void G4ErrorPropagator::GetFinalTrajState( G4ErrorTrajState* currentTS,
G4ErrorFreeTrajState* currentTS_FREE,
const G4ErrorTarget* target )
{
G4ErrorPropagatorData* g4edata =
G4ErrorPropagatorData::GetErrorPropagatorData();
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
#ifdef G4EVERBOSE
if(verbose >= 1 ) G4cout << " G4ErrorPropagator::Propagate: final state " << int(g4edata->GetState()) << " TSType " << currentTS->GetTSType() << G4endl;
if(verbose >= 1 )
{
G4cout << " G4ErrorPropagator::Propagate: final state "
<< G4int(g4edata->GetState()) << " TSType "
<< currentTS->GetTSType() << G4endl;
}
#endif
if( (currentTS->GetTSType() == G4eTS_FREE) ||
(g4edata->GetState() != G4ErrorState_StoppedAtTarget) ){
(g4edata->GetState() != G4ErrorState_StoppedAtTarget) )
{
currentTS = currentTS_FREE;
} else if( currentTS->GetTSType() == G4eTS_OS ){
if( target->GetType() == G4ErrorTarget_TrkL ){
G4Exception("G4ErrorPropagator:GetFinalTrajState !! Using a G4ErrorSurfaceTrajState with a target of type G4ErrorTargetTrackLength ");
}
else if( currentTS->GetTSType() == G4eTS_OS )
{
if( target->GetType() == G4ErrorTarget_TrkL )
{
G4Exception("G4ErrorPropagator:GetFinalTrajState()",
"InvalidSetup", FatalException,
"Using a G4ErrorSurfaceTrajState with wrong target");
}
//- G4ErrorSurfaceTrajState* tssd = static_cast<G4ErrorSurfaceTrajState*>(currentTS);
// delete currentTS;
const G4ErrorTanPlaneTarget* targetWTP = static_cast<const G4ErrorTanPlaneTarget*>(target);
*currentTS = G4ErrorSurfaceTrajState( *(static_cast<G4ErrorFreeTrajState*>(currentTS_FREE)), targetWTP->GetTangentPlane( currentTS_FREE->GetPosition() ) );
const G4ErrorTanPlaneTarget* targetWTP =
static_cast<const G4ErrorTanPlaneTarget*>(target);
*currentTS = G4ErrorSurfaceTrajState(
*(static_cast<G4ErrorFreeTrajState*>(currentTS_FREE)),
targetWTP->GetTangentPlane( currentTS_FREE->GetPosition() ) );
#ifdef G4EVERBOSE
if(verbose >= 1 ) G4cout << currentTS << " returning tssd " << *currentTS << G4endl;
if(verbose >= 1 )
{
G4cout << currentTS << " returning tssd " << *currentTS << G4endl;
}
#endif
delete currentTS_FREE;
}
@@ -401,59 +518,111 @@ G4bool G4ErrorPropagator::CheckIfLastStep( G4Track* aTrack )
{
G4bool exception = 0;
G4bool lastG4eStep = false;
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
G4ErrorPropagatorData* g4edata =
G4ErrorPropagatorData::GetErrorPropagatorData();
if( verbose >= 4 ) G4cout << " G4ErrorPropagator::CheckIfLastStep G4ErrorState= " << int(g4edata->GetState()) << G4endl;
#ifdef G4EVERBOSE
if( verbose >= 4 )
{
G4cout << " G4ErrorPropagator::CheckIfLastStep G4ErrorState= "
<< G4int(g4edata->GetState()) << G4endl;
}
#endif
//----- Check if this is the last step: track has reached the target or the end of world
if(g4edata->GetState() == G4ErrorState(G4ErrorState_StoppedAtTarget) ) {
//----- Check if this is the last step: track has reached the target
// or the end of world
//
if(g4edata->GetState() == G4ErrorState(G4ErrorState_StoppedAtTarget) )
{
lastG4eStep = true;
#ifdef G4EVERBOSE
if(verbose >= 5 ) G4cout << " G4ErrorPropagator::CheckIfLastStep " << lastG4eStep << " " << int(g4edata->GetState()) << G4endl;
#endif
} else if( aTrack->GetNextVolume() == 0 ) {
//----- If particle is out of world, without finding the G4ErrorTarget, give a n error/warning
lastG4eStep = true;
if( exception ){
G4Exception(" !!!EXITING: G4ErrorPropagator::CheckIfLastStep: track extrapolated until end of World without finding the defined target ");
} else {
if( verbose >= 1 ) G4cerr << " !!!WARNING: G4ErrorPropagator::CheckIfLastStep: track extrapolated until end of World without finding the defined target " << G4endl;
if(verbose >= 5 )
{
G4cout << " G4ErrorPropagator::CheckIfLastStep " << lastG4eStep
<< " " << G4int(g4edata->GetState()) << G4endl;
}
//----- not last step from G4e, but track is stopped (energy exhausted)
} else if( aTrack->GetTrackStatus() == fStopAndKill ) {
if( exception ){
G4cerr << " !!!EXITING: G4ErrorPropagator::CheckIfLastStep: track extrapolated until energy is exhausted without finding the defined target " << G4endl;
exit(1);
} else {
if( verbose >= 1 ) G4cerr << " !!!WARNING: G4ErrorPropagator::CheckIfLastStep: track extrapolated until energy is exhausted without finding the defined target " << G4endl;
#endif
}
else if( aTrack->GetNextVolume() == 0 )
{
//----- If particle is out of world, without finding the G4ErrorTarget,
// give a n error/warning
//
lastG4eStep = true;
if( exception )
{
G4cerr << "ERROR - G4ErrorPropagator::CheckIfLastStep()" << G4endl
<< " Track extrapolated until end of World" << G4endl
<< " without finding the defined target " << G4endl;
G4Exception("G4ErrorPropagator::CheckIfLastStep()",
"InvalidSetup", FatalException,
"Track extrapolated without finding the defined target.");
}
else
{
if( verbose >= 1 )
{
G4cerr << "ERROR - G4ErrorPropagator::CheckIfLastStep()" << G4endl
<< " Track extrapolated until end of World" << G4endl
<< " without finding the defined target " << G4endl;
}
}
} //----- not last step from G4e, but track is stopped (energy exhausted)
else if( aTrack->GetTrackStatus() == fStopAndKill )
{
if( exception )
{
G4cerr << "ERROR - G4ErrorPropagator::CheckIfLastStep()" << G4endl
<< " Track extrapolated until energy is exhausted" << G4endl
<< " without finding the defined target !" << G4endl;
G4Exception("G4ErrorPropagator::CheckIfLastStep()",
"InvalidSetup", FatalException,
"Track extrapolated without finding the defined target.");
}
else
{
if( verbose >= 1 )
{
G4cerr << "ERROR - G4ErrorPropagator::CheckIfLastStep()" << G4endl
<< " Track extrapolated until energy is exhausted" << G4endl
<< " without finding the defined target !" << G4endl;
}
lastG4eStep = 1;
}
}
if( verbose >= 5 ) G4cout << " return CheckIfLastStep " << lastG4eStep << G4endl;
#ifdef G4EVERBOSE
if( verbose >= 5 )
{
G4cout << " return CheckIfLastStep " << lastG4eStep << G4endl;
}
#endif
return lastG4eStep;
}
//---------------------------------------------------------------------------
void G4ErrorPropagator::InvokePreUserTrackingAction( G4Track* fpTrack )
{
const G4UserTrackingAction* fpUserTrackingAction = G4EventManager::GetEventManager()->GetUserTrackingAction();
if( fpUserTrackingAction != NULL ) {
const_cast<G4UserTrackingAction*>(fpUserTrackingAction)->PreUserTrackingAction((fpTrack) );
const G4UserTrackingAction* fpUserTrackingAction =
G4EventManager::GetEventManager()->GetUserTrackingAction();
if( fpUserTrackingAction != 0 )
{
const_cast<G4UserTrackingAction*>(fpUserTrackingAction)
->PreUserTrackingAction((fpTrack) );
}
}
//---------------------------------------------------------------------------
void G4ErrorPropagator::InvokePostUserTrackingAction( G4Track* fpTrack )
{
const G4UserTrackingAction* fpUserTrackingAction = G4EventManager::GetEventManager()->GetUserTrackingAction();
if( fpUserTrackingAction != NULL ) {
const_cast<G4UserTrackingAction*>(fpUserTrackingAction)->PostUserTrackingAction((fpTrack) );
const G4UserTrackingAction* fpUserTrackingAction =
G4EventManager::GetEventManager()->GetUserTrackingAction();
if( fpUserTrackingAction != 0 )
{
const_cast<G4UserTrackingAction*>(fpUserTrackingAction)
->PostUserTrackingAction((fpTrack) );
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorPropagatorManager.cc,v 1.3 2007/05/31 15:28:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorRunManagerHelper.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorStepLengthLimitProcess.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorSurfaceTrajParam.cc,v 1.3 2007/05/31 20:22:45 arce Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorSurfaceTrajState.cc,v 1.6 2007/06/21 15:04:08 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorSymMatrix.cc,v 1.3 2007/06/21 15:04:10 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorTrackLengthTarget.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ErrorTrajState.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4VErrorLimitProcess.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file