Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldManager.cc 93661 2015-10-28 09:47:47Z gcosmo $
// $Id: G4FieldManager.cc 104525 2017-06-02 07:22:58Z gcosmo $
//
// -------------------------------------------------------------------
@@ -146,15 +146,63 @@ G4FieldManager::CreateChordFinder(G4MagneticField *detectorMagField)
fAllocatedChordFinder= true;
}
G4bool G4FieldManager::SetDetectorField(G4Field *pDetectorField)
void G4FieldManager::InitialiseFieldChangesEnergy()
{
fDetectorField= pDetectorField;
if ( pDetectorField )
fFieldChangesEnergy= pDetectorField->DoesFieldChangeEnergy();
if ( fDetectorField )
fFieldChangesEnergy= fDetectorField->DoesFieldChangeEnergy();
else
fFieldChangesEnergy= false; // No field
return false;
fFieldChangesEnergy= false; // No field , no change!
}
G4bool G4FieldManager::SetDetectorField(G4Field *pDetectorField, int failMode )
{
G4MagInt_Driver* driver= 0;
G4MagIntegratorStepper* stepper=0;
G4EquationOfMotion* equation=0;
// G4bool compatibleField= false;
G4bool ableToSet= false;
fDetectorField= pDetectorField;
InitialiseFieldChangesEnergy();
// Must 'propagate' the field to the dependent classes
//
if( fChordFinder )
{
failMode= std::max( failMode, 1) ; // If a chord finder exists, warn in case of error!
driver= fChordFinder->GetIntegrationDriver();
if( driver ){
stepper= driver->GetStepper();
if( stepper ){
equation= stepper->GetEquationOfMotion();
// Should check the compatibility between the field and the equation HERE
if( equation ) {
equation->SetFieldObj(pDetectorField);
ableToSet = true;
}
}
}
}
if( !ableToSet && (failMode > 0) )
{
// If this fails, report the issue !
G4ExceptionDescription msg;
msg << "Unable to set the field in the dependent objects of G4FieldManager" << G4endl;
msg << "All the dependent classes must be fully initialised, before it is possible to call this method." << G4endl;
msg << "The problem encountered was the following: " << G4endl;
if( !fChordFinder ) { msg << " No ChordFinder. " ; }
else if( !driver) { msg << " No Integration Driver set. ";}
else if( !stepper ) { msg << " No Stepper found. " ; }
else if( !equation) { msg << " No Equation found. " ; }
// else if( !compatibleField ) { msg << " Field not compatible. ";}
else { msg << " Can NOT find reason for failure. ";}
msg << G4endl;
G4ExceptionSeverity severity= (failMode != 1) ? FatalException : JustWarning ;
G4Exception("G4FieldManager::SetDetectorField", "Geometry001",
severity, msg);
}
return ableToSet;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FieldManagerStore.cc 69589 2013-05-08 14:35:28Z gcosmo $
// $Id: G4FieldManagerStore.cc 103228 2017-03-22 14:52:32Z gcosmo $
//
// G4FieldManagerStore
//
@@ -63,7 +63,7 @@ G4FieldManagerStore::G4FieldManagerStore()
G4FieldManagerStore::~G4FieldManagerStore()
{
Clean();
if (fgInstance) { delete fgInstance; fgInstance=0; }
fgInstance = 0;
}
// ***************************************************************************
@@ -138,6 +138,15 @@ G4FieldManagerStore* G4FieldManagerStore::GetInstance()
return fgInstance;
}
// ***************************************************************************
// Return ptr to Store
// ***************************************************************************
//
G4FieldManagerStore* G4FieldManagerStore::GetInstanceIfExist()
{
return fgInstance;
}
// ***************************************************************************
// Globally reset the state
// ***************************************************************************