Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -27,13 +27,13 @@
/// \brief Implementation of the F01FieldSetup class
//
//
// $Id$
// $Id: F01FieldSetup.cc 77115 2013-11-21 15:06:37Z gcosmo $
//
// User Field setup class implementation.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01FieldSetup.hh"
#include "F01FieldMessenger.hh"
@@ -60,18 +60,15 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
// #include "G4SIunits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Constructors:
F01FieldSetup::F01FieldSetup(G4ThreeVector fieldVector)
: fFieldManager(0),
fChordFinder(0),
fEquation(0),
fEquation(0),
fMagneticField(new G4UniformMagField(fieldVector)),
// G4ThreeVector(3.3*tesla, 0.0, 0.0 ));
fStepper(0),
fStepperType(0),
fMinStep(0.),
@@ -82,71 +79,69 @@ F01FieldSetup::F01FieldSetup(G4ThreeVector fieldVector)
InitialiseAll();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldSetup::F01FieldSetup()
: fFieldManager(0),
fChordFinder(0),
fEquation(0),
fEquation(0),
fMagneticField(new G4UniformMagField(G4ThreeVector())),
// G4ThreeVector(0.0, 0.0, 0.0 ));
fStepper(0),
fStepperType(0),
fMinStep(0.),
fFieldMessenger(0)
{
G4cout << " F01FieldSetup: magnetic field set to Uniform( 0.0, 0, 0 ) "
G4cout << " F01FieldSetup: magnetic field set to Uniform( 0.0, 0, 0 ) "
<< G4endl;
InitialiseAll();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::InitialiseAll()
{
fFieldMessenger = new F01FieldMessenger(this) ;
fFieldMessenger = new F01FieldMessenger(this);
fEquation = new G4Mag_UsualEqRhs(fMagneticField);
fEquation = new G4Mag_UsualEqRhs(fMagneticField);
fMinStep = 1.0*mm ; // minimal step of 1 mm is default
fMinStep = 1.0*mm; // minimal step of 1 mm is default
fStepperType = 4 ; // ClassicalRK4 is default stepper
fStepperType = 4; // ClassicalRK4 is default stepper
fFieldManager = G4TransportationManager::GetTransportationManager()
->GetFieldManager();
CreateStepperAndChordFinder();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldSetup::~F01FieldSetup()
{
// GetGlobalFieldManager()->SetDetectorField(0);
if (fMagneticField) delete fMagneticField;
if (fChordFinder) delete fChordFinder;
if (fStepper) delete fStepper;
delete fMagneticField;
delete fChordFinder;
delete fStepper;
delete fFieldMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::CreateStepperAndChordFinder()
{
// Update field
// Update field
SetStepper();
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl ;
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl;
fFieldManager->SetDetectorField(fMagneticField );
if (fChordFinder) delete fChordFinder;
fChordFinder = new G4ChordFinder( fMagneticField, fMinStep,fStepper);
fChordFinder = new G4ChordFinder( fMagneticField, fMinStep,fStepper );
fFieldManager->SetChordFinder( fChordFinder );
return;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::SetStepper()
{
@@ -154,77 +149,75 @@ void F01FieldSetup::SetStepper()
if (fStepper) delete fStepper;
switch ( fStepperType )
switch ( fStepperType )
{
case 0:
fStepper = new G4ExplicitEuler( fEquation );
G4cout<<"G4ExplicitEuler is calledS"<<G4endl;
case 0:
fStepper = new G4ExplicitEuler( fEquation );
G4cout<<"G4ExplicitEuler is calledS"<<G4endl;
break;
case 1:
fStepper = new G4ImplicitEuler( fEquation );
G4cout<<"G4ImplicitEuler is called"<<G4endl;
case 1:
fStepper = new G4ImplicitEuler( fEquation );
G4cout<<"G4ImplicitEuler is called"<<G4endl;
break;
case 2:
fStepper = new G4SimpleRunge( fEquation );
G4cout<<"G4SimpleRunge is called"<<G4endl;
case 2:
fStepper = new G4SimpleRunge( fEquation );
G4cout<<"G4SimpleRunge is called"<<G4endl;
break;
case 3:
fStepper = new G4SimpleHeum( fEquation );
G4cout<<"G4SimpleHeum is called"<<G4endl;
case 3:
fStepper = new G4SimpleHeum( fEquation );
G4cout<<"G4SimpleHeum is called"<<G4endl;
break;
case 4:
fStepper = new G4ClassicalRK4( fEquation );
G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
case 4:
fStepper = new G4ClassicalRK4( fEquation );
G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
break;
case 5:
fStepper = new G4HelixExplicitEuler( fEquation );
G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
case 5:
fStepper = new G4HelixExplicitEuler( fEquation );
G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
break;
case 6:
fStepper = new G4HelixImplicitEuler( fEquation );
G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
case 6:
fStepper = new G4HelixImplicitEuler( fEquation );
G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
break;
case 7:
fStepper = new G4HelixSimpleRunge( fEquation );
G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
case 7:
fStepper = new G4HelixSimpleRunge( fEquation );
G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
break;
case 8:
fStepper = new G4CashKarpRKF45( fEquation );
G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
case 8:
fStepper = new G4CashKarpRKF45( fEquation );
G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
break;
case 9:
fStepper = new G4RKG3_Stepper( fEquation );
G4cout<<"G4RKG3_Stepper is called"<<G4endl;
case 9:
fStepper = new G4RKG3_Stepper( fEquation );
G4cout<<"G4RKG3_Stepper is called"<<G4endl;
break;
default: fStepper = 0;
}
return;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::SetFieldValue(G4double fieldStrength)
{
// Set the value of the Global Field to fieldValue along Z
// Set the value of the Global Field to fieldValue along Z
#ifdef G4VERBOSE
G4cout << "Setting Field strength to "
G4cout << "Setting Field strength to "
<< fieldStrength / gauss << " Gauss."; // << G4endl;
#endif
G4ThreeVector fieldSetVec(0.0, 0.0, fieldStrength);
this->SetFieldValue( fieldSetVec );
// *************
this->SetFieldValue( fieldSetVec );
#ifdef G4VERBOSE
G4double fieldValue[6], position[4];
position[0] = position[1] = position[2] = position[3] = 0.0;
G4double fieldValue[6], position[4];
position[0] = position[1] = position[2] = position[3] = 0.0;
if ( fieldStrength != 0.0 ) {
fMagneticField->GetFieldValue( position, fieldValue);
G4ThreeVector fieldVec(fieldValue[0], fieldValue[1], fieldValue[2]);
// G4cout << " fMagneticField is now " << fMagneticField
G4cout << " Magnetic field vector is "
<< fieldVec / gauss << " G " << G4endl;
G4ThreeVector fieldVec(fieldValue[0], fieldValue[1], fieldValue[2]);
// G4cout << " fMagneticField is now " << fMagneticField
G4cout << " Magnetic field vector is "
<< fieldVec / gauss << " G " << G4endl;
} else {
if ( fMagneticField == 0 )
G4cout << " Magnetic field pointer is null." << G4endl;
@@ -232,48 +225,46 @@ void F01FieldSetup::SetFieldValue(G4double fieldStrength)
G4Exception("F01FieldSetup::SetFieldValue(double)",
"IncorrectForZeroField",
FatalException,
"fMagneticField ptr should be set to 0 for no field.");
"fMagneticField ptr should be set to 0 for no field.");
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::SetFieldValue(G4ThreeVector fieldVector)
{
// Set the value of the Global Field
// Set the value of the Global Field
if (fMagneticField) delete fMagneticField;
if (fieldVector != G4ThreeVector(0.,0.,0.))
{
{
fMagneticField = new G4UniformMagField(fieldVector);
// CreateStepperAndChordFinder();
}
else
else
{
// If the new field's value is Zero, signal it as below
// so that it is not used for propagation.
// so that it is not used for propagation.
fMagneticField = 0;
}
// Set this as the field of the global Field Manager
// Set this as the field of the global Field Manager
GetGlobalFieldManager()->SetDetectorField(fMagneticField);
// Now notify equation of new field
fEquation->SetFieldObj( fMagneticField );
fEquation->SetFieldObj( fMagneticField );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4FieldManager* F01FieldSetup::GetGlobalFieldManager()
{
// Utility method
// Utility method
return G4TransportationManager::GetTransportationManager()
->GetFieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......