Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B4DetectorConstruction.cc 87359 2014-12-01 16:04:27Z gcosmo $
// $Id: B4DetectorConstruction.cc 101905 2016-12-07 11:34:39Z gunter $
//
/// \file B4DetectorConstruction.cc
/// \brief Implementation of the B4DetectorConstruction class
@@ -54,14 +54,14 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = 0;
G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4DetectorConstruction::B4DetectorConstruction()
: G4VUserDetectorConstruction(),
fAbsorberPV(0),
fGapPV(0),
fAbsorberPV(nullptr),
fGapPV(nullptr),
fCheckOverlaps(true)
{
}
@@ -88,7 +88,7 @@ G4VPhysicalVolume* B4DetectorConstruction::Construct()
void B4DetectorConstruction::DefineMaterials()
{
// Lead material defined using NIST Manager
G4NistManager* nistManager = G4NistManager::Instance();
auto nistManager = G4NistManager::Instance();
nistManager->FindOrBuildMaterial("G4_Pb");
// Liquid argon material
@@ -116,15 +116,15 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
G4double gapThickness = 5.*mm;
G4double calorSizeXY = 10.*cm;
G4double layerThickness = absoThickness + gapThickness;
G4double calorThickness = nofLayers * layerThickness;
G4double worldSizeXY = 1.2 * calorSizeXY;
G4double worldSizeZ = 1.2 * calorThickness;
auto layerThickness = absoThickness + gapThickness;
auto calorThickness = nofLayers * layerThickness;
auto worldSizeXY = 1.2 * calorSizeXY;
auto worldSizeZ = 1.2 * calorThickness;
// Get materials
G4Material* defaultMaterial = G4Material::GetMaterial("Galactic");
G4Material* absorberMaterial = G4Material::GetMaterial("G4_Pb");
G4Material* gapMaterial = G4Material::GetMaterial("liquidArgon");
auto defaultMaterial = G4Material::GetMaterial("Galactic");
auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
auto gapMaterial = G4Material::GetMaterial("liquidArgon");
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
G4ExceptionDescription msg;
@@ -136,17 +136,17 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
//
// World
//
G4VSolid* worldS
auto worldS
= new G4Box("World", // its name
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
G4LogicalVolume* worldLV
auto worldLV
= new G4LogicalVolume(
worldS, // its solid
defaultMaterial, // its material
"World"); // its name
G4VPhysicalVolume* worldPV
auto worldPV
= new G4PVPlacement(
0, // no rotation
G4ThreeVector(), // at (0,0,0)
@@ -160,11 +160,11 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
//
// Calorimeter
//
G4VSolid* calorimeterS
auto calorimeterS
= new G4Box("Calorimeter", // its name
calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
G4LogicalVolume* calorLV
auto calorLV
= new G4LogicalVolume(
calorimeterS, // its solid
defaultMaterial, // its material
@@ -183,11 +183,11 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
//
// Layer
//
G4VSolid* layerS
auto layerS
= new G4Box("Layer", // its name
calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
G4LogicalVolume* layerLV
auto layerLV
= new G4LogicalVolume(
layerS, // its solid
defaultMaterial, // its material
@@ -204,11 +204,11 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
//
// Absorber
//
G4VSolid* absorberS
auto absorberS
= new G4Box("Abso", // its name
calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
G4LogicalVolume* absorberLV
auto absorberLV
= new G4LogicalVolume(
absorberS, // its solid
absorberMaterial, // its material
@@ -228,11 +228,11 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
//
// Gap
//
G4VSolid* gapS
auto gapS
= new G4Box("Gap", // its name
calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
G4LogicalVolume* gapLV
auto gapLV
= new G4LogicalVolume(
gapS, // its solid
gapMaterial, // its material
@@ -264,9 +264,9 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
//
// Visualization attributes
//
worldLV->SetVisAttributes (G4VisAttributes::Invisible);
worldLV->SetVisAttributes (G4VisAttributes::GetInvisible());
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxVisAtt->SetVisibility(true);
calorLV->SetVisAttributes(simpleBoxVisAtt);
@@ -283,7 +283,7 @@ void B4DetectorConstruction::ConstructSDandField()
// Create global magnetic field messenger.
// Uniform magnetic field is then created automatically if
// the field value is not zero.
G4ThreeVector fieldValue = G4ThreeVector();
G4ThreeVector fieldValue;
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
fMagFieldMessenger->SetVerboseLevel(1);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B4PrimaryGeneratorAction.cc 75215 2013-10-29 16:07:06Z gcosmo $
// $Id: B4PrimaryGeneratorAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
//
/// \file B4PrimaryGeneratorAction.cc
/// \brief Implementation of the B4PrimaryGeneratorAction class
@@ -45,14 +45,14 @@
B4PrimaryGeneratorAction::B4PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0)
fParticleGun(nullptr)
{
G4int nofParticles = 1;
fParticleGun = new G4ParticleGun(nofParticles);
// default particle kinematic
//
G4ParticleDefinition* particleDefinition
auto particleDefinition
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
fParticleGun->SetParticleDefinition(particleDefinition);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
@@ -73,20 +73,24 @@ 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;
G4LogicalVolume* worlLV
= G4LogicalVolumeStore::GetInstance()->GetVolume("World");
G4Box* worldBox = 0;
if ( worlLV) worldBox = dynamic_cast< G4Box*>(worlLV->GetSolid());
G4double worldZHalfLength = 0.;
auto worldLV = G4LogicalVolumeStore::GetInstance()->GetVolume("World");
// Check that the world volume has box shape
G4Box* worldBox = nullptr;
if ( worldLV ) {
worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
}
if ( worldBox ) {
worldZHalfLength = worldBox->GetZHalfLength();
}
else {
G4ExceptionDescription msg;
msg << "World volume of box not found." << G4endl;
msg << "World volume of box shape not found." << G4endl;
msg << "Perhaps you have changed geometry." << G4endl;
msg << "The gun will be place in the center.";
G4Exception("B4PrimaryGeneratorAction::GeneratePrimaries()",
+20 -20
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B4RunAction.cc 87359 2014-12-01 16:04:27Z gcosmo $
// $Id: B4RunAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
//
/// \file B4RunAction.cc
/// \brief Implementation of the B4RunAction class
@@ -47,23 +47,24 @@ B4RunAction::B4RunAction()
// Create analysis manager
// The choice of analysis technology is done via selectin of a namespace
// in B4Analysis.hh
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
auto analysisManager = G4AnalysisManager::Instance();
G4cout << "Using " << analysisManager->GetType() << G4endl;
// Create directories
//analysisManager->SetHistoDirectoryName("histograms");
//analysisManager->SetNtupleDirectoryName("ntuple");
analysisManager->SetVerboseLevel(1);
analysisManager->SetFirstHistoId(1);
analysisManager->SetNtupleMerging(true);
// Note: merging ntuples is available only with Root output
// Book histograms, ntuple
//
// Creating histograms
analysisManager->CreateH1("1","Edep in absorber", 100, 0., 800*MeV);
analysisManager->CreateH1("2","Edep in gap", 100, 0., 100*MeV);
analysisManager->CreateH1("3","trackL in absorber", 100, 0., 1*m);
analysisManager->CreateH1("4","trackL in gap", 100, 0., 50*cm);
analysisManager->CreateH1("Eabs","Edep in absorber", 100, 0., 800*MeV);
analysisManager->CreateH1("Egap","Edep in gap", 100, 0., 100*MeV);
analysisManager->CreateH1("Labs","trackL in absorber", 100, 0., 1*m);
analysisManager->CreateH1("Lgap","trackL in gap", 100, 0., 50*cm);
// Creating ntuple
//
@@ -90,7 +91,7 @@ void B4RunAction::BeginOfRunAction(const G4Run* /*run*/)
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// Get analysis manager
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
auto analysisManager = G4AnalysisManager::Instance();
// Open an output file
//
@@ -104,7 +105,7 @@ void B4RunAction::EndOfRunAction(const G4Run* /*run*/)
{
// print histogram statistics
//
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
auto analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->GetH1(1) ) {
G4cout << G4endl << " ----> print histograms statistic ";
if(isMaster) {
@@ -115,31 +116,30 @@ void B4RunAction::EndOfRunAction(const G4Run* /*run*/)
}
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 = "
<< G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
G4cout << " EGap : mean = "
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Energy")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Energy") << G4endl;
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 = "
<< G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
G4cout << " LGap : mean = "
<< G4BestUnit(analysisManager->GetH1(4)->mean(), "Length")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(4)->rms(), "Length") << G4endl;
}
// save histograms & ntuple
//
analysisManager->Write();
analysisManager->CloseFile();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -61,7 +61,7 @@ void B4aActionInitialization::Build() const
{
SetUserAction(new B4PrimaryGeneratorAction);
SetUserAction(new B4RunAction);
B4aEventAction* eventAction = new B4aEventAction;
auto eventAction = new B4aEventAction;
SetUserAction(eventAction);
SetUserAction(new B4aSteppingAction(fDetConstruction,eventAction));
}
+8 -8
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B4aEventAction.cc 75604 2013-11-04 13:17:26Z gcosmo $
// $Id: B4aEventAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
//
/// \file B4aEventAction.cc
/// \brief Implementation of the B4aEventAction class
@@ -73,13 +73,13 @@ void B4aEventAction::EndOfEventAction(const G4Event* event)
//
// get analysis manager
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
auto analysisManager = G4AnalysisManager::Instance();
// fill histograms
analysisManager->FillH1(1, fEnergyAbs);
analysisManager->FillH1(2, fEnergyGap);
analysisManager->FillH1(3, fTrackLAbs);
analysisManager->FillH1(4, fTrackLGap);
analysisManager->FillH1(0, fEnergyAbs);
analysisManager->FillH1(1, fEnergyGap);
analysisManager->FillH1(2, fTrackLAbs);
analysisManager->FillH1(3, fTrackLGap);
// fill ntuple
analysisManager->FillNtupleDColumn(0, fEnergyAbs);
@@ -90,8 +90,8 @@ void B4aEventAction::EndOfEventAction(const G4Event* event)
// Print per event (modulo n)
//
G4int eventID = event->GetEventID();
G4int printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
auto eventID = event->GetEventID();
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
G4cout << "---> End of event: " << eventID << G4endl;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B4aSteppingAction.cc 68058 2013-03-13 14:47:43Z gcosmo $
// $Id: B4aSteppingAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
//
/// \file B4aSteppingAction.cc
/// \brief Implementation of the B4aSteppingAction class
@@ -43,14 +43,12 @@ B4aSteppingAction::B4aSteppingAction(
: G4UserSteppingAction(),
fDetConstruction(detectorConstruction),
fEventAction(eventAction)
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4aSteppingAction::~B4aSteppingAction()
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -59,11 +57,10 @@ void B4aSteppingAction::UserSteppingAction(const G4Step* step)
// Collect energy and track length step by step
// get volume of the current step
G4VPhysicalVolume* volume
= step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
auto volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
// energy deposit
G4double edep = step->GetTotalEnergyDeposit();
auto edep = step->GetTotalEnergyDeposit();
// step length
G4double stepLength = 0.;