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 @@
F02ActionInitialization::F02ActionInitialization
(F02DetectorConstruction* detConstruction)
: G4VUserActionInitialization(),
fDetConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02ActionInitialization::~F02ActionInitialization()
: fDetConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,22 +34,7 @@
#include "F02CalorHit.hh"
G4ThreadLocal G4Allocator<F02CalorHit>* F02CalorHitAllocator=0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02CalorHit::F02CalorHit()
: G4VHit(),
fEdepAbs(0.),
fTrackLengthAbs(0.),
fEdepGap(0.),
fTrackLengthGap(0.)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02CalorHit::~F02CalorHit()
{;}
G4ThreadLocal G4Allocator<F02CalorHit>* F02CalorHitAllocator=nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -80,6 +65,6 @@ G4bool F02CalorHit::operator==(const F02CalorHit& right) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F02CalorHit::Print()
{;}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -48,7 +48,6 @@
F02CalorimeterSD::F02CalorimeterSD(G4String name,
F02DetectorConstruction* det)
: G4VSensitiveDetector(name),
fCalCollection(0),
fDetector(det),
fHitID(new G4int[500])
{
@@ -67,7 +66,7 @@ F02CalorimeterSD::~F02CalorimeterSD()
void F02CalorimeterSD::Initialize(G4HCofThisEvent*)
{
fCalCollection = new F02CalorHitsCollection
(SensitiveDetectorName,collectionName[0]);
(SensitiveDetectorName,collectionName[0]);
for (G4int j=0;j<1; j++) {fHitID[j] = -1;};
}
@@ -82,7 +81,7 @@ G4bool F02CalorimeterSD::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 F02CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
G4int number = 0;
if (fHitID[number]==-1)
{
F02CalorHit* calHit = new F02CalorHit();
auto calHit = new F02CalorHit();
if (physVol == fDetector->GetAbsorber()) calHit->AddAbs(edep,stepl);
fHitID[number] = fCalCollection->insert(calHit) - 1;
if (verboseLevel>0)
@@ -57,24 +57,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02DetectorConstruction::F02DetectorConstruction()
: G4VUserDetectorConstruction(),
fDetectorMessenger(0),
fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
fSolidAbsorber(0),fLogicAbsorber(0), fPhysiAbsorber(0),
fAbsorberMaterial(0), fAbsorberThickness(0.), fAbsorberRadius(0.),
fWorldChanged(false), fZAbsorber(0.), fZStartAbs(0.), fZEndAbs(0.),
fWorldMaterial(0), fWorldSizeR(0.), fWorldSizeZ(0.)
{
// default parameter values of the calorimeter
fWorldSizeZ = 80.*cm;
fWorldSizeR = 20.*cm;
fAbsorberThickness = 40.0*mm;
fAbsorberRadius = 10.*cm;
fZAbsorber = 36.*cm;
// create commands for interactive definition of the calorimeter
fDetectorMessenger = new F02DetectorMessenger(this);
@@ -104,7 +87,7 @@ G4VPhysicalVolume* F02DetectorConstruction::Construct()
void F02DetectorConstruction::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 F02DetectorConstruction::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 F02DetectorConstruction::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 F02DetectorConstruction::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
@@ -173,7 +156,7 @@ void F02DetectorConstruction::DefineMaterials()
temperature = STP_Temperature;
pressure = 1.0e-0*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 );
@@ -183,26 +166,26 @@ void F02DetectorConstruction::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 );
@@ -216,7 +199,7 @@ void F02DetectorConstruction::DefineMaterials()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* F02DetectorConstruction::ConstructCalorimeter()
{
// Cleanup old geometry
@@ -233,7 +216,7 @@ G4VPhysicalVolume* F02DetectorConstruction::ConstructCalorimeter()
ComputeCalorParameters();
PrintCalorParameters();
// World
fSolidWorld = new G4Tubs("World", // its name
@@ -243,11 +226,11 @@ G4VPhysicalVolume* F02DetectorConstruction::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
@@ -261,7 +244,7 @@ G4VPhysicalVolume* F02DetectorConstruction::ConstructCalorimeter()
fAbsorberMaterial,
"Absorber");
fPhysiAbsorber = new G4PVPlacement(0,
fPhysiAbsorber = new G4PVPlacement(nullptr,
G4ThreeVector(0.,0.,fZAbsorber),
"Absorber",
fLogicAbsorber,
@@ -385,19 +368,19 @@ void F02DetectorConstruction::ConstructSDandField()
// Sensitive Detectors: Absorber
if (!fCalorimeterSD.Get()) {
F02CalorimeterSD* calorimeterSD = new F02CalorimeterSD("CalorSD",this);
auto calorimeterSD = new F02CalorimeterSD("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()) {
F02ElectricFieldSetup* fieldSetup = new F02ElectricFieldSetup();
if (!fEmFieldSetup.Get()) {
auto fieldSetup = new F02ElectricFieldSetup();
G4AutoDelete::Register(fieldSetup); //Kernel will delete the messenger
fEmFieldSetup.Put(fieldSetup);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -42,20 +42,11 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02DetectorMessenger::F02DetectorMessenger(F02DetectorConstruction* 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("F02 detector control.");
fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("choice",true);
@@ -133,19 +124,19 @@ void F02DetectorMessenger::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));}
}
@@ -68,16 +68,6 @@
// Constructors:
F02ElectricFieldSetup::F02ElectricFieldSetup()
: fMinStep(0.010*mm), // minimal step of 10 microns
fFieldManager(0),
fChordFinder(0),
fEquation(0),
fEMfield(0),
fElFieldValue(),
fStepper(0),
fIntgrDriver(0),
fStepperType(4), // ClassicalRK4 -- the default stepper
fFieldMessenger(nullptr)
{
fEMfield = new G4UniformElectricField(
G4ThreeVector(0.0,100000.0*kilovolt/cm,0.0));
@@ -92,23 +82,13 @@ F02ElectricFieldSetup::F02ElectricFieldSetup()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02ElectricFieldSetup::F02ElectricFieldSetup(G4ThreeVector fieldVector)
: fMinStep(0.010*mm), // minimal step of 10 microns
fFieldManager(0),
fChordFinder(0),
fEquation(0),
fEMfield(0),
fElFieldValue(),
fStepper(0),
fIntgrDriver(0),
fStepperType(4), // ClassicalRK4 -- the default stepper
fFieldMessenger(nullptr)
{
fEMfield = new G4UniformElectricField(fieldVector);
fEquation = new G4EqMagElectricField(fEMfield);
fFieldManager = GetGlobalFieldManager();
UpdateIntegrator();
fFieldMessenger = new F02FieldMessenger(this);
}
@@ -120,7 +100,7 @@ F02ElectricFieldSetup::~F02ElectricFieldSetup()
delete fFieldMessenger; fFieldMessenger= nullptr;
// Delete the messenger first, to avoid messages to deleted classes!
delete fChordFinder; fChordFinder= nullptr;
delete fStepper; fStepper = nullptr;
delete fEquation; fEquation = nullptr;
@@ -147,7 +127,7 @@ void F02ElectricFieldSetup::UpdateIntegrator()
// The chord-finder's destructor deletes the driver
fIntgrDriver= nullptr;
}
// Currently driver does not 'own' stepper ( 17.05.2017 J.A. )
// -- so this stepper is still a valid object after this
@@ -155,7 +135,7 @@ void F02ElectricFieldSetup::UpdateIntegrator()
delete fStepper;
fStepper = nullptr;
}
// Create the new objects, in turn for all relevant classes
// -- Careful to call this after all old objects are destroyed, and
// pointers nullified.
@@ -168,7 +148,7 @@ void F02ElectricFieldSetup::UpdateIntegrator()
fIntgrDriver = new G4MagInt_Driver(fMinStep,
fStepper,
fStepper->GetNumberOfVariables());
if( fIntgrDriver ){
if( fIntgrDriver ){
fChordFinder = new G4ChordFinder(fIntgrDriver);
}
}
@@ -215,20 +195,20 @@ void F02ElectricFieldSetup::CreateStepper()
G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
break;
case 6:
fStepper = 0; // new G4RKG3_Stepper( fEquation, nvar );
fStepper = nullptr; // new G4RKG3_Stepper( fEquation, nvar );
G4cout<<"G4RKG3_Stepper is not currently working for Electric Field"
<<G4endl;
break;
case 7:
fStepper = 0; // new G4HelixExplicitEuler( fEquation );
fStepper = nullptr; // new G4HelixExplicitEuler( fEquation );
G4cout<<"G4HelixExplicitEuler is not valid for Electric Field"<<G4endl;
break;
case 8:
fStepper = 0; // new G4HelixImplicitEuler( fEquation );
fStepper = nullptr; // new G4HelixImplicitEuler( fEquation );
G4cout<<"G4HelixImplicitEuler is not valid for Electric Field"<<G4endl;
break;
case 9:
fStepper = 0; // new G4HelixSimpleRunge( fEquation );
fStepper = nullptr; // new G4HelixSimpleRunge( fEquation );
G4cout<<"G4HelixSimpleRunge is not valid for Electric Field"<<G4endl;
break;
default: /* fStepper = 0; // Older code */
@@ -262,7 +242,7 @@ void F02ElectricFieldSetup::SetFieldZValue(G4double fieldValue)
void F02ElectricFieldSetup::SetFieldValue(G4ThreeVector fieldVector)
{
if (fEMfield) delete fEMfield;
delete fEMfield;
// Set the value of the Global Field value to fieldVector
@@ -277,7 +257,7 @@ void F02ElectricFieldSetup::SetFieldValue(G4ThreeVector fieldVector)
{
// If the new field's value is Zero, then it is best to
// insure that it is not used for propagation.
fEMfield = 0;
fEMfield = nullptr;
}
fieldMgr->SetDetectorField(fEMfield);
fEquation->SetFieldObj(fEMfield); // must now point to the new field
@@ -43,14 +43,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02FieldMessenger::F02FieldMessenger(F02ElectricFieldSetup* fieldSetup)
: G4UImessenger(),
fElFieldSetup(fieldSetup),
fFieldDir(0),
fStepperCmd(0),
fElFieldZCmd(0),
fElFieldCmd(0),
fMinStepCmd(0),
fUpdateCmd(0)
: fElFieldSetup(fieldSetup)
{
fFieldDir = new G4UIdirectory("/field/");
fFieldDir->SetGuidance("F02 field tracking control.");
@@ -74,14 +67,14 @@ F02FieldMessenger::F02FieldMessenger(F02ElectricFieldSetup* fieldSetup)
fElFieldZCmd->SetParameterName("Ez",false,false);
fElFieldZCmd->SetDefaultUnit("megavolt/m");
fElFieldZCmd->AvailableForStates(G4State_Idle);
fElFieldCmd = new G4UIcmdWith3VectorAndUnit("/field/setField",this);
fElFieldCmd->SetGuidance("Define uniform Electric field.");
fElFieldCmd->SetGuidance("Value of Electric field has to be given in volt/m");
fElFieldCmd->SetParameterName("Ex","Ey","Ez",false,false);
fElFieldCmd->SetDefaultUnit("megavolt/m");
fElFieldCmd->AvailableForStates(G4State_Idle);
fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
fMinStepCmd->SetGuidance("Define minimal step");
fMinStepCmd->SetParameterName("min step",false,false);
@@ -47,22 +47,14 @@
#include "G4PhysicalConstants.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParticleDefinition* F02PrimaryGeneratorAction::fgPrimaryParticle = 0;
G4ParticleDefinition* F02PrimaryGeneratorAction::fgPrimaryParticle = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02PrimaryGeneratorAction::F02PrimaryGeneratorAction(
F02DetectorConstruction* 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 @@
F02PrimaryGeneratorMessenger::F02PrimaryGeneratorMessenger(
F02PrimaryGeneratorAction* 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 @@ F02PrimaryGeneratorMessenger::F02PrimaryGeneratorMessenger(
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);
@@ -39,17 +39,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02SteppingVerbose::F02SteppingVerbose()
: G4SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F02SteppingVerbose::~F02SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F02SteppingVerbose::StepInfo()
{
CopyState();
@@ -81,14 +70,14 @@ void F02SteppingVerbose::StepInfo()
<< std::setw( 6)<<G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if( fTrack->GetNextVolume() != 0 ) {
if( fTrack->GetNextVolume() != nullptr ) {
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
G4cout << std::setw(10)
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr){
G4cout << std::setw(10)
<< fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {