Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file DetectorConstruction0.cc
|
||||
/// \brief Implementation of the DetectorConstruction0 class
|
||||
/// \file common/src/DetectorConstruction0.cc
|
||||
/// \brief Implementation of the Common::DetectorConstruction0 class
|
||||
|
||||
#include "DetectorConstruction0.hh"
|
||||
|
||||
@@ -36,16 +36,16 @@
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction0::DetectorConstruction0(
|
||||
const G4String& materialName,
|
||||
G4double hx, G4double hy, G4double hz)
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(nullptr),
|
||||
fMaterialName(materialName),
|
||||
fDimensions(hx, hy, hz),
|
||||
fWorldVolume(nullptr)
|
||||
: fMaterialName(materialName),
|
||||
fDimensions(hx, hy, hz)
|
||||
{
|
||||
DefineCommands();
|
||||
}
|
||||
@@ -66,21 +66,21 @@ G4VPhysicalVolume* DetectorConstruction0::Construct()
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
|
||||
auto material = nistManager->FindOrBuildMaterial(fMaterialName);
|
||||
|
||||
|
||||
// World
|
||||
//
|
||||
auto sWorld
|
||||
auto sWorld
|
||||
= new G4Box("World", //name
|
||||
fDimensions.x(), //dimensions (half-lentghs)
|
||||
fDimensions.y(),
|
||||
fDimensions.y(),
|
||||
fDimensions.z());
|
||||
|
||||
fWorldVolume
|
||||
fWorldVolume
|
||||
= new G4LogicalVolume(sWorld, //shape
|
||||
material, //material
|
||||
"World"); //name
|
||||
|
||||
auto pWorld
|
||||
auto pWorld
|
||||
= new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fWorldVolume, //logical volume
|
||||
@@ -95,7 +95,7 @@ G4VPhysicalVolume* DetectorConstruction0::Construct()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
void DetectorConstruction0::SetMaterial(const G4String& materialName)
|
||||
{
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
@@ -105,35 +105,35 @@ void DetectorConstruction0::SetMaterial(const G4String& materialName)
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( fWorldVolume ) fWorldVolume->SetMaterial(newMaterial);
|
||||
G4cout << "Material of box changed to " << materialName << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
void DetectorConstruction0::SetDimensions(G4ThreeVector dimensions)
|
||||
{
|
||||
/// Set world dimension (in half lengths).
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
|
||||
fDimensions = dimensions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction0::DefineCommands()
|
||||
{
|
||||
// Define /B5/detector command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/detector/",
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/detector/",
|
||||
"Detector control");
|
||||
|
||||
// setMaterial command
|
||||
auto& setMaterialCmd
|
||||
= fMessenger->DeclareMethod("setMaterial",
|
||||
&DetectorConstruction0::SetMaterial,
|
||||
&DetectorConstruction0::SetMaterial,
|
||||
"Set world material name.");
|
||||
setMaterialCmd.SetParameterName("materialName", false);
|
||||
setMaterialCmd.SetDefaultValue("G4_AIR");
|
||||
@@ -142,10 +142,12 @@ void DetectorConstruction0::DefineCommands()
|
||||
// setDimensions command
|
||||
auto& setDimensionsCmd
|
||||
= fMessenger->DeclareMethodWithUnit("setDimensions", "mm",
|
||||
&DetectorConstruction0::SetDimensions,
|
||||
&DetectorConstruction0::SetDimensions,
|
||||
"Set world dimensions (in half lentgh).");
|
||||
setDimensionsCmd.SetParameterName("dimensions", false);
|
||||
setDimensionsCmd.SetStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user