Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -37,13 +37,7 @@
F01ActionInitialization::F01ActionInitialization
(F01DetectorConstruction* detConstruction)
: G4VUserActionInitialization(),
fDetConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01ActionInitialization::~F01ActionInitialization()
: fDetConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,22 +34,7 @@
#include "F01CalorHit.hh"
G4ThreadLocal G4Allocator<F01CalorHit>* F01CalorHitAllocator=0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01CalorHit::F01CalorHit()
: G4VHit(),
fEdepAbs(0.),
fTrackLengthAbs(0.),
fEdepGap(0.),
fTrackLengthGap(0.)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01CalorHit::~F01CalorHit()
{;}
G4ThreadLocal G4Allocator<F01CalorHit>* F01CalorHitAllocator=nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -80,6 +65,6 @@ G4bool F01CalorHit::operator==(const F01CalorHit& right) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01CalorHit::Print()
{;}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -48,7 +48,6 @@
F01CalorimeterSD::F01CalorimeterSD(G4String name,
F01DetectorConstruction* det)
: G4VSensitiveDetector(name),
fCalCollection(0),
fDetector(det),
fHitID(new G4int[500])
{
@@ -82,7 +81,7 @@ G4bool F01CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
if ((edep == 0.) && (stepl == 0.) ) return false;
G4TouchableHistory* theTouchable
auto theTouchable
= (G4TouchableHistory*)(step->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
@@ -90,7 +89,7 @@ G4bool F01CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
G4int number = 0;
if (fHitID[number]==-1)
{
F01CalorHit* calHit = new F01CalorHit();
auto calHit = new F01CalorHit();
if (physVol == fDetector->GetAbsorber()) calHit->AddAbs(edep,stepl);
fHitID[number] = fCalCollection->insert(calHit) - 1;
if (verboseLevel>0)
@@ -101,7 +100,7 @@ G4bool F01CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
if (physVol == fDetector->GetAbsorber())
(*fCalCollection)[fHitID[number]]->AddAbs(edep,stepl);
if (verboseLevel>0)
G4cout << " Energy added to F01: " << number << G4endl;
G4cout << " Energy added to F01: " << number << G4endl;
}
return true;
}
@@ -57,24 +57,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01DetectorConstruction::F01DetectorConstruction()
: G4VUserDetectorConstruction(),
fDetectorMessenger(0),
fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
fSolidAbsorber(0), fLogicAbsorber(0), fPhysiAbsorber(0),
fAbsorberMaterial(0), fAbsorberThickness(0.), fAbsorberRadius(0.),
fZAbsorber(0.), fZStartAbs(0.), fZEndAbs(0.),
fWorldMaterial(0), fWorldSizeR(0.), fWorldSizeZ(0.)
{
// default parameter values of the calorimeter
fWorldSizeZ = 44000.*mm;
fWorldSizeR = 22000.*mm;
fAbsorberThickness = 1.0*mm;
fAbsorberRadius = 20000.*mm;
fZAbsorber = 21990.0*mm;
// create commands for interactive definition of the calorimeter
fDetectorMessenger = new F01DetectorMessenger(this);
@@ -104,7 +87,7 @@ G4VPhysicalVolume* F01DetectorConstruction::Construct()
void F01DetectorConstruction::DefineMaterials()
{
//This function illustrates the possible ways to define materials
G4String name, symbol; // a=mass of a mole;
G4double a, z, density; // z=mean number of protons;
G4int nel;
@@ -116,19 +99,19 @@ void F01DetectorConstruction::DefineMaterials()
//
a = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
auto elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
a = 12.01*g/mole;
G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a);
auto elC = new G4Element(name="Carbon", symbol="C", z=6., a);
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
auto elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
auto elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
a = 39.948*g/mole;
G4Element* elAr = new G4Element(name="Argon", symbol="Ar", z=18., a);
auto elAr = new G4Element(name="Argon", symbol="Ar", z=18., a);
//
// define simple materials
@@ -137,14 +120,14 @@ void F01DetectorConstruction::DefineMaterials()
// Mylar
density = 1.39*g/cm3;
G4Material* mylar = new G4Material(name="Mylar", density, nel=3);
auto mylar = new G4Material(name="Mylar", density, nel=3);
mylar->AddElement(elO,2);
mylar->AddElement(elC,5);
mylar->AddElement(elH,4);
// Polypropelene
G4Material* CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2);
auto CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2);
CH2->AddElement(elH,2);
CH2->AddElement(elC,1);
@@ -152,20 +135,20 @@ void F01DetectorConstruction::DefineMaterials()
density = 3.700*mg/cm3;
a = 83.80*g/mole;
G4Material* Kr = new G4Material(name="Kr",z=36., a, density );
auto Kr = new G4Material(name="Kr",z=36., a, density );
// Dry air (average composition)
density = 1.7836*mg/cm3; // STP
G4Material* argon = new G4Material(name="Argon" , density, ncomponents=1);
auto argon = new G4Material(name="Argon" , density, ncomponents=1);
argon->AddElement(elAr, 1);
density = 1.25053*mg/cm3; // STP
G4Material* nitrogen = new G4Material(name="N2" , density, ncomponents=1);
auto nitrogen = new G4Material(name="N2" , density, ncomponents=1);
nitrogen->AddElement(elN, 2);
density = 1.4289*mg/cm3; // STP
G4Material* oxygen = new G4Material(name="O2" , density, ncomponents=1);
auto oxygen = new G4Material(name="O2" , density, ncomponents=1);
oxygen->AddElement(elO, 2);
density = 1.2928*mg/cm3; // STP
@@ -174,7 +157,7 @@ void F01DetectorConstruction::DefineMaterials()
temperature = STP_Temperature;
pressure = 1.0e-8*STP_Pressure;
G4Material* air = new G4Material(name="Air" , density, ncomponents=3,
auto air = new G4Material(name="Air" , density, ncomponents=3,
kStateGas,temperature,pressure);
air->AddMaterial( nitrogen, fractionmass = 0.7557 );
air->AddMaterial( oxygen, fractionmass = 0.2315 );
@@ -185,26 +168,26 @@ void F01DetectorConstruction::DefineMaterials()
density = 5.858*mg/cm3;
a = 131.29*g/mole;
G4Material* Xe = new G4Material(name="Xenon",z=54., a, density );
auto Xe = new G4Material(name="Xenon",z=54., a, density );
// Carbon dioxide, STP
density = 1.842*mg/cm3;
G4Material* CarbonDioxide = new G4Material(name="CO2", density, nel=2);
auto CarbonDioxide = new G4Material(name="CO2", density, nel=2);
CarbonDioxide->AddElement(elC,1);
CarbonDioxide->AddElement(elO,2);
// 80% Xe + 20% CO2, STP
density = 5.0818*mg/cm3;
G4Material* Xe20CO2 = new G4Material(name="Xe20CO2", density, ncomponents=2);
auto Xe20CO2 = new G4Material(name="Xe20CO2", density, ncomponents=2);
Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 );
Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 );
// 80% Kr + 20% CO2, STP
density = 3.601*mg/cm3;
G4Material* Kr20CO2 = new G4Material(name="Kr20CO2", density, ncomponents=2);
auto Kr20CO2 = new G4Material(name="Kr20CO2", density, ncomponents=2);
Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 );
Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 );
@@ -212,9 +195,9 @@ void F01DetectorConstruction::DefineMaterials()
// G4cout << *(G4Material::GetMaterialTable()) << G4endl;
G4cout << "F01DetectorConstruction: not printing material table - to see it edit the source."
<< G4endl;
// default materials of the calorimeter
fAbsorberMaterial = air; // Kr20CO2; // XeCO2CF4;
fWorldMaterial = air;
@@ -238,7 +221,7 @@ G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter()
ComputeCalorParameters();
PrintCalorParameters();
// World
fSolidWorld = new G4Tubs("World", // its name
@@ -248,11 +231,11 @@ G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter()
fWorldMaterial, // its material
"World"); // its name
fPhysiWorld = new G4PVPlacement(0, // no rotation
fPhysiWorld = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
"World", // its name
fLogicWorld, // its logical volume
0, // its mother volume
nullptr, // its mother volume
false, // no boolean op.
0); // copy number
// Absorber
@@ -266,7 +249,7 @@ G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter()
fAbsorberMaterial,
"Absorber");
fPhysiAbsorber = new G4PVPlacement(0,
fPhysiAbsorber = new G4PVPlacement(nullptr,
G4ThreeVector(0.,0.,fZAbsorber),
"Absorber",
fLogicAbsorber,
@@ -389,15 +372,15 @@ void F01DetectorConstruction::ConstructSDandField()
// Sensitive Detectors: Absorber
if (!fCalorimeterSD.Get()) {
F01CalorimeterSD* calorimeterSD = new F01CalorimeterSD("CalorSD",this);
auto calorimeterSD = new F01CalorimeterSD("CalorSD",this);
fCalorimeterSD.Put(calorimeterSD);
}
G4SDManager::GetSDMpointer()->AddNewDetector(fCalorimeterSD.Get());
SetSensitiveDetector(fLogicAbsorber, fCalorimeterSD.Get());
// Construct the field creator - this will register the field it creates
if (!fEmFieldSetup.Get()) {
F01FieldSetup* fieldSetup
auto fieldSetup
= new F01FieldSetup(G4ThreeVector( 0.0, 0.0, 3.3*tesla ),
fUseFSALstepper );
G4AutoDelete::Register(fieldSetup); // Kernel will delete the F01FieldSetup
@@ -42,20 +42,11 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01DetectorMessenger::F01DetectorMessenger(F01DetectorConstruction* det)
: G4UImessenger(),
fDetector(det),
fDetDir(0),
fAbsMaterCmd(0),
fAbsThickCmd(0),
fAbsRadCmd(0),
fAbsZposCmd(0),
fWorldMaterCmd(0),
fWorldZCmd(0),
fWorldRCmd(0)
: fDetector(det)
{
fDetDir = new G4UIdirectory("/calor/");
fDetDir->SetGuidance("F01 detector control.");
fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("choice",true);
@@ -133,19 +124,19 @@ void F01DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
if( command == fWorldMaterCmd )
{ fDetector->SetWorldMaterial(newValue);}
if( command == fAbsThickCmd )
{fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));}
if( command == fAbsRadCmd )
{ fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));}
if( command == fAbsZposCmd )
{ fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));}
if( command == fWorldZCmd )
{ fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
if( command == fWorldRCmd )
{ fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
}
@@ -46,14 +46,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
: G4UImessenger(),
fEMfieldSetup(fieldSetup),
fFieldDir(0),
fStepperCmd(0),
fMagFieldZCmd(0),
fMagFieldCmd(0),
fMinStepCmd(0),
fUpdateCmd(0)
: fEMfieldSetup(fieldSetup)
{
fFieldDir = new G4UIdirectory("/field/");
fFieldDir->SetGuidance("F01 field tracking control.");
@@ -76,13 +69,13 @@ F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
fMagFieldZCmd->SetParameterName("Bz",false,false);
fMagFieldZCmd->SetDefaultUnit("tesla");
fMagFieldZCmd->AvailableForStates(G4State_Idle);
fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field/setField",this);
fMagFieldCmd->SetGuidance("Define magnetic field.");
fMagFieldCmd->SetParameterName("Bx", "By", "Bz" ,false,false);
fMagFieldCmd->SetDefaultUnit("tesla");
fMagFieldCmd->AvailableForStates(G4State_Idle);
fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
fMinStepCmd->SetGuidance("Define minimal step");
fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
@@ -90,7 +83,7 @@ F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
fMinStepCmd->SetDefaultUnit("mm");
fMinStepCmd->AvailableForStates(G4State_Idle);
// Commands for integration accuracy
// Commands for integration accuracy
// 1. Delta One Step = length of potential error in each integration substep
// Recall that there can be up to 300 substeps in a physics step !!
fDeltaOneStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this);
@@ -103,15 +96,21 @@ F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
// A choice: Allow the user to reset the Eps Min/Max values to our default
G4bool omitable= true, currentAsDefault= false;
fEpsMinCmd = new G4UIcmdWithADouble("/field/setEpsilonMin",this);
fEpsMinCmd->SetGuidance("Define minimum value of the relative integration error (EpsilonMin) - a dimensionless number");
fEpsMinCmd->SetGuidance("Limit to ensure that large steps do NOT result in a very low value (ie high accuracy) that integration needs many steps and CPU cycles.");
fEpsMinCmd->SetGuidance(
"Define minimum value of the relative integration error (EpsilonMin)"
" - a dimensionless number\n"
"Limit to ensure that large steps do NOT result in a very low value"
"(ie high accuracy) that integration needs many steps and CPU cycles.");
fEpsMinCmd->SetParameterName("minEpsilon",omitable,currentAsDefault);
fEpsMinCmd->SetDefaultValue(1.0e-4); // A default eps_min
fEpsMinCmd->AvailableForStates(G4State_Idle);
fEpsMaxCmd = new G4UIcmdWithADouble("/field/setEpsilonMax",this);
fEpsMaxCmd->SetGuidance("Define minimum value of the relative integration error (EpsilonMax) - a dimensionless number");
fEpsMaxCmd->SetGuidance("Limit to ensure a very small step does NOT result in a large relative error (ie low accuracy) with unreliable results.");
fEpsMaxCmd->SetGuidance(
"Define minimum value of the relative integration error (EpsilonMax)"
" - a dimensionless number\n"
"Limit to ensure a very small step does NOT result in a large relative"
" error (ie low accuracy) with unreliable results.");
fEpsMaxCmd->SetParameterName("maxEpsilon",omitable,currentAsDefault);
fEpsMinCmd->SetDefaultValue(1.0e-5); // A default eps_max
fEpsMaxCmd->AvailableForStates(G4State_Idle);
@@ -128,7 +127,7 @@ F01FieldMessenger::~F01FieldMessenger()
delete fMagFieldZCmd;
delete fMagFieldCmd;
delete fMinStepCmd;
delete fDeltaOneStepCmd;
delete fDeltaOneStepCmd;
delete fEpsMinCmd;
delete fEpsMaxCmd;
delete fFieldDir;
@@ -150,7 +149,7 @@ void F01FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
if( command == fMinStepCmd )
fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
if( command == fDeltaOneStepCmd )
fEMfieldSetup->SetDeltaOneStep(fDeltaOneStepCmd->GetNewDoubleValue(newValue));
fEMfieldSetup->SetDeltaOneStep(fDeltaOneStepCmd->GetNewDoubleValue(newValue));
if( command == fEpsMinCmd )
fEMfieldSetup->SetEpsilonMin(fEpsMinCmd->GetNewDoubleValue(newValue));
if( command == fEpsMaxCmd )
@@ -127,14 +127,16 @@ F01FieldSetup::F01FieldSetup()
void F01FieldSetup::InitialiseAll()
{
fFieldMessenger = new F01FieldMessenger(this);
fEquation = new G4Mag_UsualEqRhs(fMagneticField);
fMinStep = 3.0e-3*mm; // minimal step of 1 um is default ==> accept any error for smaller steps!
fDeltaOneStep = 1.0e-5*mm; // Errors of this size in an integration sub-step are acceptable
// except limited by the relative integration error limits (epsilon_min/max)
// Notes: - their initial values are set in the header.
// - both this and the eps min/max can be changed using Set methods.
fMinStep = 3.0e-3*mm;
// minimal step of 1 um is default ==> accept any error for smallersteps!
fDeltaOneStep = 1.0e-5*mm;
// Errors of this size in an integration sub-step are acceptable
// except limited by the relative integration error limits (epsilon_min/max)
// Notes: - their initial values are set in the header.
// - both this and the eps min/max can be changed using Set methods.
fFieldManager = G4TransportationManager::GetTransportationManager()
->GetFieldManager();
@@ -144,16 +146,17 @@ void F01FieldSetup::InitialiseAll()
else
{
CreateStepperAndChordFinder();
// To try the symplectic method (Boris Scheme/Driver) replace the line above with the one below:
// To try the symplectic method (Boris Scheme/Driver) replace the line above
// with the one below:
// CreateAndSetupBorisDriver();
}
G4cout << " 4/5. Updating eps_min and eps_max in Field Manager." << G4endl;
fFieldManager->SetChordFinder( fChordFinder );
fFieldManager->SetDetectorField(fMagneticField );
// For controling the accurancy
fFieldManager -> SetMinimumEpsilonStep( fDesiredEpsilonMin ) ;
// For controling the accurancy
fFieldManager -> SetMinimumEpsilonStep( fDesiredEpsilonMin ) ;
//
// const G4double increaseFactor = 3.0 ; // typical rangle 1.0 - 10.0
// maxEpsilon must not exceed a ceiling, ideally 0.001 -- above this integration is unreliable
@@ -184,14 +187,14 @@ void F01FieldSetup::InitialiseAll()
}
}
// To demonstrate that it is now possible to change the maximum accepted epsilon
// Note: The values of both epsilon parameters must be between
// fMaxAcceptedEpsilon = 0.001
// to ensure robustness of integration (adequate accuracy of intermediate results)
// and (much bigger than)
// fMinAcceptedEpsilon ~= 2.2e-13 ( 1000.0 * std::numeric_limits<G4double>::epsilon() )
// which even the best integration methods would struggle greatly to achieve.
G4cout << " Changed FieldManager epsilon values to epsilon_min= "
<< fFieldManager -> GetMinimumEpsilonStep()
<< " and epsilon_max= "
@@ -214,7 +217,7 @@ void F01FieldSetup::CreateStepperAndChordFinder()
{
delete fChordFinder;
fChordFinder= nullptr;
// Update field
G4cout << " F01FieldSetup::CreateStepperAndChordFinder() called. " << G4endl
<< " 1. Creating Stepper." << G4endl;
@@ -236,18 +239,18 @@ void F01FieldSetup::SetStepper()
{
// Set stepper according to the stepper type
if (fStepper) delete fStepper;
delete fStepper;
switch ( fStepperType )
{
// The new default in G4 and here ( since G4 10.4 Dec 2017 )
case 17:
case 17:
case 457:
case 745:
fStepper = new G4DormandPrince745( fEquation );
G4cout<<"G4DormandPrince745 Stepper is chosen"<<G4endl;
break;
case 0:
fStepper = new G4ExplicitEuler( fEquation );
G4cout<<"G4ExplicitEuler is chosen."<<G4endl;
@@ -288,16 +291,16 @@ void F01FieldSetup::SetStepper()
fStepper = new G4RKG3_Stepper( fEquation );
G4cout<<"G4RKG3_Stepper is chosen"<<G4endl;
break;
case 10:
fStepper = new G4ExactHelixStepper( fEquation );
case 10:
fStepper = new G4ExactHelixStepper( fEquation );
G4cout<<"G4ExactHelixStepper is chosen"<<G4endl;
break;
case 11:
fStepper = new G4HelixMixedStepper( fEquation );
case 11:
fStepper = new G4HelixMixedStepper( fEquation );
G4cout<<"G4HelixMixedStepper is chosen"<<G4endl;
break;
case 12:
fStepper = new G4ConstRK4( fEquation );
case 12:
fStepper = new G4ConstRK4( fEquation );
G4cout<<"G4ConstRK4 Stepper is chosen"<<G4endl;
break;
case 13:
@@ -305,7 +308,7 @@ void F01FieldSetup::SetStepper()
fStepper = new G4NystromRK4( fEquation );
G4cout<<" G4NystromRK4 Stepper is chosen"<<G4endl;
break;
case 14:
case 14:
case 23:
fStepper = new G4BogackiShampine23( fEquation );
G4cout<<"G4BogackiShampine23 Stepper is chosen"<<G4endl;
@@ -313,16 +316,16 @@ void F01FieldSetup::SetStepper()
// Other optimised 4/5th order embedded steppers
case 15:
case 45:
case 45:
fStepper = new G4BogackiShampine45( fEquation );
G4cout<<"G4BogackiShampine45 Stepper is chosen"<<G4endl;
break;
// case 145:
case kTsitouras45:
case kTsitouras45:
fStepper = new G4TsitourasRK45( fEquation );
G4cout<<"G4TsitourasRK45 Stepper is chosen"<<G4endl;
break;
break;
// Higher order embedded steppers - for very smooth fields
case 56:
@@ -339,7 +342,7 @@ void F01FieldSetup::SetStepper()
// G4cout<<"G4ClassicalRK4 Stepper (default) is chosen"<<G4endl;
fStepper = new G4DormandPrince745( fEquation );
G4cout<<"G4DormandPrince745 (default) Stepper is chosen"<<G4endl;
break;
break;
}
}
@@ -356,10 +359,10 @@ F01FieldSetup::CreateFSALStepperAndDriver()
{
// using FsalStepperType = G4RK547FEq1;
const char *methodName= "F01FieldSetup::CreateFSALStepperAndDriver()";
if (fStepper) delete fStepper;
delete fStepper;
fStepper = nullptr;
G4cout << " F01FieldSetup::CreateFSALStepperAndDriver() called. " << G4endl;
G4cout << " F01FieldSetup::CreateFSALStepperAndDriver() called. " << G4endl;
G4cout << " 1. Creating Stepper." << G4endl;
// auto fsalStepper = new FsalStepperType( fEquation );
G4RK547FEq1* stepper1 = nullptr;
@@ -379,7 +382,7 @@ F01FieldSetup::CreateFSALStepperAndDriver()
fStepper = stepper1;
stepper1 = nullptr;
break;
case 2:
case 102:
stepper2= new G4RK547FEq2( fEquation );
@@ -389,13 +392,13 @@ F01FieldSetup::CreateFSALStepperAndDriver()
fStepper = stepper2;
stepper2 = nullptr;
break;
case 3:
case 103:
stepper3 = new G4RK547FEq3( fEquation );
stepper3 = new G4RK547FEq3( fEquation );
fsalDriver = new G4FSALIntegrationDriver<G4RK547FEq3>( fMinStep, stepper3 );
G4cout << " Stepper type '3' is G4RK547FEq3 stepper (in FSAL mode) with FSAL driver. "
<< G4endl;
<< G4endl;
fStepper = stepper3;
stepper3 = nullptr;
break;
@@ -405,7 +408,7 @@ F01FieldSetup::CreateFSALStepperAndDriver()
<< fStepperType << " ) is unknown. " << G4endl
<< " Using value '1' instead - i.e. G4RK547FEq1 stepper. "
<< G4endl;
stepper1 = new G4RK547FEq1( fEquation );
stepper1 = new G4RK547FEq1( fEquation );
fsalDriver = new G4FSALIntegrationDriver<G4RK547FEq1>( fMinStep, stepper1 );
fStepper = stepper1;
stepper1 = nullptr;
@@ -413,21 +416,21 @@ F01FieldSetup::CreateFSALStepperAndDriver()
}
delete stepper1; stepper1 = nullptr;
delete stepper2; stepper2 = nullptr;
delete stepper2; stepper2 = nullptr;
delete stepper3; stepper3 = nullptr;
if( fsalDriver )
fStepper = fsalDriver->GetStepper();
return fsalDriver;
}
void F01FieldSetup::CreateFSALStepperAndChordFinder()
{
// using FsalStepperType = G4DormandPrince745; // eventually ?
// using FsalStepperType = G4DormandPrince745; // eventually ?
delete fChordFinder;
fChordFinder= nullptr;
G4cout << " F01FieldSetup::CreateFSALStepperAndChordFinder() called. " << G4endl;
auto FSALdriver= CreateFSALStepperAndDriver();
@@ -454,8 +457,8 @@ void F01FieldSetup::SetFieldValue(G4ThreeVector fieldVector)
{
// Set the value of the Global Field
if (fMagneticField) delete fMagneticField;
delete fMagneticField;
#ifdef G4VERBOSE
G4cout << "Setting Field strength to "
<< fieldVector / gauss << " Gauss." << G4endl;
@@ -472,7 +475,7 @@ void F01FieldSetup::SetFieldValue(G4ThreeVector fieldVector)
#endif
// If the new field's value is Zero, signal it as below
// so that it is not used for propagation.
fMagneticField = 0;
fMagneticField = nullptr;
}
// Set this as the field of the global Field Manager
@@ -501,8 +504,8 @@ G4FieldManager* F01FieldSetup::GetGlobalFieldManager()
void
F01FieldSetup::CreateAndSetupBorisDriver()
{
G4cout << " F01FieldSetup::CreateAndSetupBorisDriver() called. " << G4endl;
G4cout << " F01FieldSetup::CreateAndSetupBorisDriver() called. " << G4endl;
G4cout << " 1. Creating Scheme (Stepper)." << G4endl;
auto borisStepr = new G4BorisScheme(fEquation);
G4cout << " 2. Creating Driver." << G4endl;
@@ -47,22 +47,14 @@
#include "G4PhysicalConstants.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParticleDefinition* F01PrimaryGeneratorAction::fgPrimaryParticle = 0;
G4ParticleDefinition* F01PrimaryGeneratorAction::fgPrimaryParticle = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PrimaryGeneratorAction::F01PrimaryGeneratorAction(
F01DetectorConstruction* det)
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0),
fDetector(det),
fGunMessenger(0),
fRndmFlag("off"),
fXVertex(0.),
fYVertex(0.),
fZVertex(0.),
fVertexDefined(false)
: fDetector(det)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
@@ -43,12 +43,7 @@
F01PrimaryGeneratorMessenger::F01PrimaryGeneratorMessenger(
F01PrimaryGeneratorAction* action)
: G4UImessenger(),
fAction(action),
fRndmCmd(0),
fSetXVertexCmd(0),
fSetYVertexCmd(0),
fSetZVertexCmd(0)
: fAction(action)
{
fRndmCmd = new G4UIcmdWithAString("/gun/random",this);
fRndmCmd->SetGuidance("Shoot randomly the incident particle.");
@@ -57,7 +52,7 @@ F01PrimaryGeneratorMessenger::F01PrimaryGeneratorMessenger(
fRndmCmd->SetDefaultValue("off");
fRndmCmd->SetCandidates("on off");
fRndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetXVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
fSetXVertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
fSetXVertexCmd->SetParameterName("xv",true);
@@ -34,19 +34,7 @@
#include "G4Transportation.hh"
#include "G4CoupledTransportation.hh"
F01RunAction::F01RunAction() {
fWarningEnergy = 1.0 * CLHEP::kiloelectronvolt; // Arbitrary
fImportantEnergy = 10.0 * CLHEP::kiloelectronvolt; // Arbitrary
fNumberOfTrials = 15; // Arbitrary
// Applications should determine these thresholds according to
// - physics requirements, and
// - the computing cost of continuing integration for looping tracks
}
F01RunAction::~F01RunAction() {}
//------------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01RunAction::BeginOfRunAction( const G4Run* aRun ) {
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
@@ -55,7 +43,7 @@ void F01RunAction::BeginOfRunAction( const G4Run* aRun ) {
ChangeLooperParameters( G4Electron::Definition() );
}
//------------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01RunAction::
ChangeLooperParameters(const G4ParticleDefinition* particleDef )
@@ -79,7 +67,7 @@ ChangeLooperParameters(const G4ParticleDefinition* particleDef )
G4cout << " UNKNOWN -- it is neither G4Transportation nor G4CoupledTransportation";
}
G4cout << G4endl;
if( transport != nullptr ) {
if( fWarningEnergy >= 0.0 ){
transport->SetThresholdWarningEnergy( fWarningEnergy );
@@ -88,18 +76,18 @@ ChangeLooperParameters(const G4ParticleDefinition* particleDef )
}
if( fImportantEnergy >= 0.0 ) {
transport->SetThresholdImportantEnergy( fImportantEnergy );
G4cout << "-- Changed Threshold Important Energy (for loopers) = "
<< fImportantEnergy / CLHEP::MeV << " MeV " << G4endl;
}
if( fNumberOfTrials > 0 ) {
transport->SetThresholdTrials( fNumberOfTrials );
G4cout << "-- Changed number of Trials (for loopers) = " << fNumberOfTrials << G4endl;
}
}
if( transport == nullptr ) {
if( fWarningEnergy >= 0.0 )
G4cerr << " Unknown transport process> Cannot change Warning Energy. " << G4endl;
@@ -110,7 +98,7 @@ ChangeLooperParameters(const G4ParticleDefinition* particleDef )
}
}
//------------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01RunAction::EndOfRunAction( const G4Run* ) {
if( fVerboseLevel > 1 )
@@ -126,14 +114,14 @@ void F01RunAction::EndOfRunAction( const G4Run* ) {
}
}
//------------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Transportation*
F01RunAction::FindTransportation( const G4ParticleDefinition* particleDef,
bool reportError )
{
const auto *partPM= particleDef->GetProcessManager();
G4VProcess* partTransport = partPM->GetProcess("Transportation");
auto transport= dynamic_cast<G4Transportation*>(partTransport);
@@ -152,7 +140,7 @@ F01RunAction::FindTransportation( const G4ParticleDefinition* particleDef,
}
}
}
if( reportError && !transport )
{
G4cerr << "Unable to find Transportation process for particle type "
@@ -160,6 +148,6 @@ F01RunAction::FindTransportation( const G4ParticleDefinition* particleDef,
<< " ( PDG code = " << particleDef->GetPDGEncoding() << " ) "
<< G4endl;
}
return transport;
}
@@ -38,17 +38,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01SteppingVerbose::F01SteppingVerbose()
: G4SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01SteppingVerbose::~F01SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01SteppingVerbose::StepInfo()
{
CopyState();
@@ -88,13 +77,13 @@ void F01SteppingVerbose::StepInfo()
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length") << " "
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length") << " ";
if( fTrack->GetNextVolume() != 0 ) {
if( fTrack->GetNextVolume() != nullptr ) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr){
G4cout << " "
<< std::setw(10)
<< fStep->GetPostStepPoint()->GetProcessDefinedStep()