Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
/// \file B4DetectorConstruction.cc
|
||||
/// \brief Implementation of the B4DetectorConstruction class
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -68,16 +68,16 @@ B4DetectorConstruction::B4DetectorConstruction()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4DetectorConstruction::~B4DetectorConstruction()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* B4DetectorConstruction::Construct()
|
||||
{
|
||||
// Define materials
|
||||
// Define materials
|
||||
DefineMaterials();
|
||||
|
||||
|
||||
// Define volumes
|
||||
return DefineVolumes();
|
||||
}
|
||||
@@ -85,15 +85,15 @@ G4VPhysicalVolume* B4DetectorConstruction::Construct()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
{
|
||||
// Lead material defined using NIST Manager
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
nistManager->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
|
||||
// Liquid argon material
|
||||
G4double a; // mass of a mole;
|
||||
G4double z; // z=mean number of protons;
|
||||
G4double density;
|
||||
G4double z; // z=mean number of protons;
|
||||
G4double density;
|
||||
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
|
||||
// The argon by NIST Manager is a gas with a different density
|
||||
|
||||
@@ -118,74 +118,74 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
|
||||
auto layerThickness = absoThickness + gapThickness;
|
||||
auto calorThickness = nofLayers * layerThickness;
|
||||
auto worldSizeXY = 1.2 * calorSizeXY;
|
||||
auto worldSizeZ = 1.2 * calorThickness;
|
||||
|
||||
auto worldSizeZ = 1.2 * calorThickness;
|
||||
|
||||
// Get materials
|
||||
auto defaultMaterial = G4Material::GetMaterial("Galactic");
|
||||
auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
|
||||
auto gapMaterial = G4Material::GetMaterial("liquidArgon");
|
||||
|
||||
|
||||
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Cannot retrieve materials already defined.";
|
||||
msg << "Cannot retrieve materials already defined.";
|
||||
G4Exception("B4DetectorConstruction::DefineVolumes()",
|
||||
"MyCode0001", FatalException, msg);
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
auto worldS
|
||||
auto worldS
|
||||
= new G4Box("World", // its name
|
||||
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
|
||||
|
||||
|
||||
auto worldLV
|
||||
= new G4LogicalVolume(
|
||||
worldS, // its solid
|
||||
defaultMaterial, // its material
|
||||
"World"); // its name
|
||||
|
||||
|
||||
auto worldPV
|
||||
= new G4PVPlacement(
|
||||
0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
worldLV, // its logical volume
|
||||
worldLV, // its logical volume
|
||||
"World", // its name
|
||||
0, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// Calorimeter
|
||||
//
|
||||
//
|
||||
auto calorimeterS
|
||||
= new G4Box("Calorimeter", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
|
||||
|
||||
|
||||
auto calorLV
|
||||
= new G4LogicalVolume(
|
||||
calorimeterS, // its solid
|
||||
defaultMaterial, // its material
|
||||
"Calorimeter"); // its name
|
||||
|
||||
|
||||
new G4PVPlacement(
|
||||
0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
calorLV, // its logical volume
|
||||
calorLV, // its logical volume
|
||||
"Calorimeter", // its name
|
||||
worldLV, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// Layer
|
||||
//
|
||||
auto layerS
|
||||
auto layerS
|
||||
= new G4Box("Layer", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
|
||||
|
||||
|
||||
auto layerLV
|
||||
= new G4LogicalVolume(
|
||||
layerS, // its solid
|
||||
@@ -199,68 +199,68 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
|
||||
kZAxis, // axis of replication
|
||||
nofLayers, // number of replica
|
||||
layerThickness); // witdth of replica
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Absorber
|
||||
//
|
||||
auto absorberS
|
||||
auto absorberS
|
||||
= new G4Box("Abso", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
|
||||
|
||||
|
||||
auto absorberLV
|
||||
= new G4LogicalVolume(
|
||||
absorberS, // its solid
|
||||
absorberMaterial, // its material
|
||||
"Abso"); // its name
|
||||
|
||||
|
||||
fAbsorberPV
|
||||
= new G4PVPlacement(
|
||||
0, // no rotation
|
||||
G4ThreeVector(0., 0., -gapThickness/2), // its position
|
||||
absorberLV, // its logical volume
|
||||
absorberLV, // its logical volume
|
||||
"Abso", // its name
|
||||
layerLV, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
//
|
||||
// Gap
|
||||
//
|
||||
auto gapS
|
||||
auto gapS
|
||||
= new G4Box("Gap", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
|
||||
|
||||
|
||||
auto gapLV
|
||||
= new G4LogicalVolume(
|
||||
gapS, // its solid
|
||||
gapMaterial, // its material
|
||||
"Gap"); // its name
|
||||
|
||||
|
||||
fGapPV
|
||||
= new G4PVPlacement(
|
||||
0, // no rotation
|
||||
G4ThreeVector(0., 0., absoThickness/2), // its position
|
||||
gapLV, // its logical volume
|
||||
gapLV, // its logical volume
|
||||
"Gap", // its name
|
||||
layerLV, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// print parameters
|
||||
//
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< G4endl
|
||||
<< "------------------------------------------------------------" << G4endl
|
||||
<< "---> The calorimeter is " << nofLayers << " layers of: [ "
|
||||
<< absoThickness/mm << "mm of " << absorberMaterial->GetName()
|
||||
<< absoThickness/mm << "mm of " << absorberMaterial->GetName()
|
||||
<< " + "
|
||||
<< gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
|
||||
<< "------------------------------------------------------------" << G4endl;
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
worldLV->SetVisAttributes (G4VisAttributes::GetInvisible());
|
||||
@@ -278,14 +278,14 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
{
|
||||
// Create global magnetic field messenger.
|
||||
// Uniform magnetic field is then created automatically if
|
||||
// the field value is not zero.
|
||||
G4ThreeVector fieldValue;
|
||||
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
|
||||
fMagFieldMessenger->SetVerboseLevel(1);
|
||||
|
||||
|
||||
// Register the field messenger for deleting
|
||||
G4AutoDelete::Register(fMagFieldMessenger);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
/// \file B4PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B4PrimaryGeneratorAction class
|
||||
|
||||
@@ -51,7 +51,7 @@ B4PrimaryGeneratorAction::B4PrimaryGeneratorAction()
|
||||
|
||||
// default particle kinematic
|
||||
//
|
||||
auto particleDefinition
|
||||
auto particleDefinition
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
|
||||
fParticleGun->SetParticleDefinition(particleDefinition);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
@@ -72,7 +72,7 @@ void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
// This function is called at the begining of event
|
||||
|
||||
// In order to avoid dependence of PrimaryGeneratorAction
|
||||
// on DetectorConstruction class we get world volume
|
||||
// on DetectorConstruction class we get world volume
|
||||
// from G4LogicalVolumeStore
|
||||
//
|
||||
G4double worldZHalfLength = 0.;
|
||||
@@ -85,7 +85,7 @@ void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
}
|
||||
|
||||
if ( worldBox ) {
|
||||
worldZHalfLength = worldBox->GetZHalfLength();
|
||||
worldZHalfLength = worldBox->GetZHalfLength();
|
||||
}
|
||||
else {
|
||||
G4ExceptionDescription msg;
|
||||
@@ -94,8 +94,8 @@ void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
msg << "The gun will be place in the center.";
|
||||
G4Exception("B4PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
"MyCode0002", JustWarning, msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set gun position
|
||||
fParticleGun
|
||||
->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
B4RunAction::B4RunAction()
|
||||
: G4UserRunAction()
|
||||
{
|
||||
{
|
||||
// set printing event number per each event
|
||||
G4RunManager::GetRunManager()->SetPrintProgress(1);
|
||||
G4RunManager::GetRunManager()->SetPrintProgress(1);
|
||||
|
||||
// Create analysis manager
|
||||
// The choice of analysis technology is done via selectin of a namespace
|
||||
@@ -49,7 +49,7 @@ B4RunAction::B4RunAction()
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
|
||||
// Create directories
|
||||
// Create directories
|
||||
//analysisManager->SetHistoDirectoryName("histograms");
|
||||
//analysisManager->SetNtupleDirectoryName("ntuple");
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
@@ -58,7 +58,7 @@ B4RunAction::B4RunAction()
|
||||
|
||||
// Book histograms, ntuple
|
||||
//
|
||||
|
||||
|
||||
// Creating histograms
|
||||
analysisManager->CreateH1("Eabs","Edep in absorber", 100, 0., 800*MeV);
|
||||
analysisManager->CreateH1("Egap","Edep in gap", 100, 0., 100*MeV);
|
||||
@@ -79,16 +79,16 @@ B4RunAction::B4RunAction()
|
||||
|
||||
B4RunAction::~B4RunAction()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
{
|
||||
//inform the runManager to save random number seed
|
||||
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
|
||||
|
||||
// Get analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
@@ -108,30 +108,30 @@ void B4RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
if ( analysisManager->GetH1(1) ) {
|
||||
G4cout << G4endl << " ----> print histograms statistic ";
|
||||
if(isMaster) {
|
||||
G4cout << "for the entire run " << G4endl << G4endl;
|
||||
G4cout << "for the entire run " << G4endl << G4endl;
|
||||
}
|
||||
else {
|
||||
G4cout << "for the local thread " << G4endl << G4endl;
|
||||
G4cout << "for the local thread " << G4endl << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " EAbs : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(0)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
|
||||
G4cout << " EAbs : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(0)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(0)->rms(), "Energy") << G4endl;
|
||||
|
||||
G4cout << " EGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(1)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
|
||||
G4cout << " EGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(1)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
|
||||
|
||||
G4cout << " LAbs : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Length")
|
||||
<< " rms = "
|
||||
|
||||
G4cout << " LAbs : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Length")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Length") << G4endl;
|
||||
|
||||
G4cout << " LGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(3)->mean(), "Length")
|
||||
<< " rms = "
|
||||
G4cout << " LGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(3)->mean(), "Length")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,6 @@ void B4aActionInitialization::Build() const
|
||||
auto eventAction = new B4aEventAction;
|
||||
SetUserAction(eventAction);
|
||||
SetUserAction(new B4aSteppingAction(fDetConstruction,eventAction));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
/// \file B4aEventAction.cc
|
||||
/// \brief Implementation of the B4aEventAction class
|
||||
|
||||
@@ -56,7 +56,7 @@ B4aEventAction::~B4aEventAction()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4aEventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
{
|
||||
{
|
||||
// initialisation per event
|
||||
fEnergyAbs = 0.;
|
||||
fEnergyGap = 0.;
|
||||
@@ -79,20 +79,20 @@ void B4aEventAction::EndOfEventAction(const G4Event* event)
|
||||
analysisManager->FillH1(1, fEnergyGap);
|
||||
analysisManager->FillH1(2, fTrackLAbs);
|
||||
analysisManager->FillH1(3, fTrackLGap);
|
||||
|
||||
|
||||
// fill ntuple
|
||||
analysisManager->FillNtupleDColumn(0, fEnergyAbs);
|
||||
analysisManager->FillNtupleDColumn(1, fEnergyGap);
|
||||
analysisManager->FillNtupleDColumn(2, fTrackLAbs);
|
||||
analysisManager->FillNtupleDColumn(3, fTrackLGap);
|
||||
analysisManager->AddNtupleRow();
|
||||
|
||||
analysisManager->AddNtupleRow();
|
||||
|
||||
// Print per event (modulo n)
|
||||
//
|
||||
auto eventID = event->GetEventID();
|
||||
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
|
||||
if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
|
||||
G4cout << "---> End of event: " << eventID << G4endl;
|
||||
G4cout << "---> End of event: " << eventID << G4endl;
|
||||
|
||||
G4cout
|
||||
<< " Absorber: total energy: " << std::setw(7)
|
||||
@@ -106,6 +106,6 @@ void B4aEventAction::EndOfEventAction(const G4Event* event)
|
||||
<< G4BestUnit(fTrackLGap,"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
/// \file B4aSteppingAction.cc
|
||||
/// \brief Implementation of the B4aSteppingAction class
|
||||
|
||||
@@ -57,20 +57,20 @@ void B4aSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
|
||||
// get volume of the current step
|
||||
auto volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
|
||||
|
||||
|
||||
// energy deposit
|
||||
auto edep = step->GetTotalEnergyDeposit();
|
||||
|
||||
|
||||
// step length
|
||||
G4double stepLength = 0.;
|
||||
if ( step->GetTrack()->GetDefinition()->GetPDGCharge() != 0. ) {
|
||||
stepLength = step->GetStepLength();
|
||||
}
|
||||
|
||||
|
||||
if ( volume == fDetConstruction->GetAbsorberPV() ) {
|
||||
fEventAction->AddAbs(edep,stepLength);
|
||||
}
|
||||
|
||||
|
||||
if ( volume == fDetConstruction->GetGapPV() ) {
|
||||
fEventAction->AddGap(edep,stepLength);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user