Import Geant4 11.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2024-06-28 13:08:51 +02:00
parent f7b23877ed
commit e58e650b32
5232 changed files with 239416 additions and 244360 deletions
@@ -26,33 +26,34 @@
// User Classes
#include "Par04ParallelFastWorld.hh"
#include "Par04ParallelFullWorld.hh"
#include "Par04ParallelFastSensitiveDetector.hh"
#include "Par04ParallelFullWorld.hh"
// G4 Classes
#include "G4NistManager.hh"
#include "G4AutoDelete.hh"
#include "G4Colour.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4ThreeVector.hh"
#include "G4NistManager.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Tubs.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4AutoDelete.hh"
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4UnitsTable.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VisAttributes.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Par04ParallelFastWorld::Par04ParallelFastWorld(G4String aWorldName,
const Par04DetectorConstruction* aMassDetector,
const Par04ParallelFullWorld* aParallelFull)
:G4VUserParallelWorld(aWorldName), fMassDetector(aMassDetector), fParallelFull(aParallelFull) {
: G4VUserParallelWorld(aWorldName), fMassDetector(aMassDetector), fParallelFull(aParallelFull)
{
fNbOfLayers = fMassDetector->GetNbOfLayers();
}
@@ -65,15 +66,15 @@ Par04ParallelFastWorld::~Par04ParallelFastWorld() = default;
void Par04ParallelFastWorld::Construct()
{
// In parallel world material does not matter
G4Material* dummy = nullptr;
G4Material* dummy = nullptr;
// Build parallel geometry:
auto parallelLogicalVolume = GetWorld()->GetLogicalVolume();
G4double detectorInnerRadius = fMassDetector->GetInnerRadius();
G4double detectorLength = fMassDetector->GetLength();
G4double fullLayerThickness = fMassDetector->GetAbsorberThickness(0)
+ fMassDetector->GetAbsorberThickness(1);
G4double fullLayerThickness =
fMassDetector->GetAbsorberThickness(0) + fMassDetector->GetAbsorberThickness(1);
fLayerThickness = fullLayerThickness;
// Get an updated value
fNbOfLayers = fMassDetector->GetNbOfLayers();
@@ -82,105 +83,68 @@ void Par04ParallelFastWorld::Construct()
G4double detectorRadius = fNbOfLayers * fullLayerThickness;
G4double detectorOuterRadius = detectorInnerRadius + detectorRadius;
G4double rowThickness = detectorLength / fNbOfRows;
G4double full2Pi = 2.* CLHEP::pi * rad;
G4double full2Pi = 2. * CLHEP::pi * rad;
Print();
// Insert cells to create a readout structure that contains both passive and active materials
// Mostly a copy from the detector construction
auto solidDetector = new G4Tubs("Detector", // name
detectorInnerRadius, // inner radius
detectorOuterRadius, // outer radius
detectorLength / 2., // half-width in Z
0, // start angle
full2Pi); // delta angle
auto logicDetector = new G4LogicalVolume(solidDetector, // solid
dummy, // material
"Detector"); // name
new G4PVPlacement(0, // no rotation
G4ThreeVector(0, 0, 0), // detector centre at (0,0,0)
logicDetector, // logical volume
"Detector", // name
parallelLogicalVolume, // mother volume
false, // not used
9999, // copy number
true); // check overlaps
auto solidDetector = new G4Tubs("Detector", // name
detectorInnerRadius, // inner radius
detectorOuterRadius, // outer radius
detectorLength / 2., // half-width in Z
0, // start angle
full2Pi); // delta angle
auto logicDetector = new G4LogicalVolume(solidDetector, // solid
dummy, // material
"Detector"); // name
new G4PVPlacement(0, // no rotation
G4ThreeVector(0, 0, 0), // detector centre at (0,0,0)
logicDetector, // logical volume
"Detector", // name
parallelLogicalVolume, // mother volume
false, // not used
9999, // copy number
true); // check overlaps
//--------- Detector cylinder (division along z axis) ---------
auto solidRow = new G4Tubs("Row", detectorInnerRadius, detectorOuterRadius, rowThickness / 2.,
0, full2Pi);
auto solidRow =
new G4Tubs("Row", detectorInnerRadius, detectorOuterRadius, rowThickness / 2., 0, full2Pi);
auto logicRow = new G4LogicalVolume(solidRow, dummy, "Row");
if (fNbOfRows > 1)
new G4PVReplica("Row",
logicRow,
logicDetector,
kZAxis,
fNbOfRows,
rowThickness);
new G4PVReplica("Row", logicRow, logicDetector, kZAxis, fNbOfRows, rowThickness);
else
new G4PVPlacement(0,
G4ThreeVector(),
logicRow,
"Row",
logicDetector,
false,
0);
new G4PVPlacement(0, G4ThreeVector(), logicRow, "Row", logicDetector, false, 0);
//--------- Detector slices (division in azimuthal angle) ---------
G4double cellPhi = full2Pi / fNbOfSlices;
auto solidSlice = new G4Tubs("Slice", detectorInnerRadius, detectorOuterRadius, rowThickness/2,
0, cellPhi);
auto logicSlice = new G4LogicalVolume(solidSlice,
dummy,
"Slice");
if(fNbOfSlices>1) {
new G4PVReplica("Slice",
logicSlice,
logicRow,
kPhi,
fNbOfSlices,
cellPhi,
-cellPhi);
} else {
new G4PVPlacement(0,
G4ThreeVector(),
logicSlice,
"Slice",
logicRow,
false,
0);
auto solidSlice =
new G4Tubs("Slice", detectorInnerRadius, detectorOuterRadius, rowThickness / 2, 0, cellPhi);
auto logicSlice = new G4LogicalVolume(solidSlice, dummy, "Slice");
if (fNbOfSlices > 1) {
new G4PVReplica("Slice", logicSlice, logicRow, kPhi, fNbOfSlices, cellPhi, -cellPhi);
}
else {
new G4PVPlacement(0, G4ThreeVector(), logicSlice, "Slice", logicRow, false, 0);
}
//--------- Detector cells (division along radial axis) ---------
G4VisAttributes attribs;
attribs.SetColour(G4Colour(0, 1, 0, 0.1));
attribs.SetForceSolid(true);
if(fNbOfLayers>1) {
auto solidCell = new G4Tubs("Cell", detectorInnerRadius,
detectorInnerRadius + fLayerThickness,
rowThickness/2, 0, cellPhi);
if (fNbOfLayers > 1) {
auto solidCell = new G4Tubs("Cell", detectorInnerRadius, detectorInnerRadius + fLayerThickness,
rowThickness / 2, 0, cellPhi);
fLogicalCell.push_back(new G4LogicalVolume(solidCell, dummy, "Cell_0"));
new G4PVReplica("Cell",
fLogicalCell.back(),
logicSlice,
kRho,
fNbOfLayers,
fLayerThickness,
new G4PVReplica("Cell", fLogicalCell.back(), logicSlice, kRho, fNbOfLayers, fLayerThickness,
detectorInnerRadius);
} else {
auto solidCell = new G4Tubs("Cell", detectorInnerRadius,
detectorInnerRadius + fLayerThickness,
rowThickness/2, 0, cellPhi);
fLogicalCell.push_back(new G4LogicalVolume(solidCell, dummy, "Cell"));
fLogicalCell.back()->SetVisAttributes(attribs);
new G4PVPlacement(0,
G4ThreeVector(),
fLogicalCell.back(),
"Cell",
logicSlice,
false,
0);
}
else {
auto solidCell = new G4Tubs("Cell", detectorInnerRadius, detectorInnerRadius + fLayerThickness,
rowThickness / 2, 0, cellPhi);
fLogicalCell.push_back(new G4LogicalVolume(solidCell, dummy, "Cell"));
fLogicalCell.back()->SetVisAttributes(attribs);
new G4PVPlacement(0, G4ThreeVector(), fLogicalCell.back(), "Cell", logicSlice, false, 0);
}
Print();
}
@@ -194,13 +158,14 @@ void Par04ParallelFastWorld::ConstructSD()
Par04ParallelFastSensitiveDetector* caloSD =
new Par04ParallelFastSensitiveDetector("parallelFastSD", fNbOfLayers, fNbOfSlices);
SDman->AddNewDetector(caloSD);
for(const auto& logicalCell: fLogicalCell)
logicalCell->SetSensitiveDetector(caloSD);
for (const auto& logicalCell : fLogicalCell)
logicalCell->SetSensitiveDetector(caloSD);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Par04ParallelFastWorld::Print() {
void Par04ParallelFastWorld::Print()
{
G4cout << "\n------------------------------------------------------"
<< "\n Readout geometry with physics layout is set in parallel geometry:\t"
<< "\n Cylindrical detector is divided along radius (layers), phi (slices), and z (rows)."
@@ -208,6 +173,7 @@ void Par04ParallelFastWorld::Print() {
<< "\n- Number of layers: " << fNbOfLayers << "\n------- Number of slices: " << fNbOfSlices
<< "\n- Number of rows: " << fNbOfRows;
G4cout << "\n Readout will collect energy from fast simulation.\n------- Thickness is "
<< "a sum of all absorbers" << " = " << G4BestUnit(fLayerThickness, "Length")
<< "a sum of all absorbers"
<< " = " << G4BestUnit(fLayerThickness, "Length")
<< "\n-----------------------------------------------------" << G4endl;
}