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
+19 -11
View File
@@ -10,7 +10,7 @@
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -41,14 +41,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
Default graphics system is: TSG_OFFSCREEN (based on batch session).
Default window size hint is: 600x600-0+0 (based on G4VisManager initialisation).
Note: Parameters specified on the command line will override these defaults.
Use "vis/open" without parameters to get these defaults.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -120,15 +127,16 @@ See commands in /vis/modeling/trajectories/ for other options.
Run terminated.
Run Summary
Number of events processed : 10
User=0.000000s Real=0.000295s Sys=0.000000s
User=0.000000s Real=0.000293s Sys=0.000000s
Graphics systems deleted.
Visualization Manager deleting...
G4 kernel has come to Quit state.
UserDetectorConstruction deleted.
UserPhysicsList deleted.
UserActionInitialization deleted.
UserWorkerInitialization deleted.
UserWorkerThreadInitialization deleted.
Deleting G4Run (id:0)
UserDetectorConstruction deleted 0x1d75580
UserPhysicsList deleted 0x1fc51f0
UserActionInitialization deleted 0
UserWorkerInitialization deleted 0
UserWorkerThreadInitialization deleted 0
UserRunAction deleted.
UserPrimaryGenerator deleted.
RunManager is deleting RunManagerKernel.
+7 -5
View File
@@ -32,18 +32,20 @@
#include "GpsPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
using namespace Common;
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
// Construct the default run manager
G4RunManager* runManager = new G4RunManager;
@@ -67,11 +69,11 @@ int main(int argc,char** argv)
// Process macro or start UI session
//
if ( ! ui ) {
if (!ui) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command + fileName);
}
else {
// interactive mode
@@ -32,17 +32,19 @@
#include "GpsPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
using namespace Common;
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
// Construct the default run manager
G4RunManager* runManager = new G4RunManager;
@@ -59,11 +61,11 @@ int main(int argc,char** argv)
// Process macro or start UI session
//
if ( ! ui ) {
if (!ui) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command + fileName);
}
else {
// interactive mode
@@ -30,10 +30,11 @@
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4ThreeVector.hh"
#include "CLHEP/Units/SystemOfUnits.h"
#include "G4ThreeVector.hh"
#include "G4VUserDetectorConstruction.hh"
class G4LogicalVolume;
class G4Material;
class G4GenericMessenger;
@@ -46,13 +47,11 @@ namespace Common
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction(
const G4String& boxMaterialName = "G4_AIR",
G4double boxHx = 40*CLHEP::cm,
G4double boxHy = 40*CLHEP::cm,
G4double boxHz = 40*CLHEP::cm,
const G4String& worldMaterialName = "G4_AIR",
G4double worldSizeFactor = 1.25);
DetectorConstruction(const G4String& boxMaterialName = "G4_AIR",
G4double boxHx = 40 * CLHEP::cm, G4double boxHy = 40 * CLHEP::cm,
G4double boxHz = 40 * CLHEP::cm,
const G4String& worldMaterialName = "G4_AIR",
G4double worldSizeFactor = 1.25);
~DetectorConstruction() override;
public:
@@ -60,26 +59,25 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4VPhysicalVolume* Construct() override;
// set methods
void SetBoxMaterial(const G4String& materialName);
void SetWorldMaterial(const G4String& materialName);
void SetBoxDimensions(G4ThreeVector dimensions);
void SetWorldSizeFactor(G4double factor);
void SetBoxMaterial(const G4String& materialName);
void SetWorldMaterial(const G4String& materialName);
void SetBoxDimensions(G4ThreeVector dimensions);
void SetWorldSizeFactor(G4double factor);
private:
void DefineCommands();
G4GenericMessenger* fMessenger = nullptr;
G4String fBoxMaterialName;
G4String fWorldMaterialName;
G4ThreeVector fBoxDimensions;
G4double fWorldSizeFactor = 0.;
G4LogicalVolume* fBoxVolume = nullptr;
G4LogicalVolume* fWorldVolume = nullptr;
G4GenericMessenger* fMessenger = nullptr;
G4String fBoxMaterialName;
G4String fWorldMaterialName;
G4ThreeVector fBoxDimensions;
G4double fWorldSizeFactor = 0.;
G4LogicalVolume* fBoxVolume = nullptr;
G4LogicalVolume* fWorldVolume = nullptr;
};
}
} // namespace Common
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -30,10 +30,11 @@
#ifndef DetectorConstruction0_h
#define DetectorConstruction0_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4ThreeVector.hh"
#include "CLHEP/Units/SystemOfUnits.h"
#include "G4ThreeVector.hh"
#include "G4VUserDetectorConstruction.hh"
class G4LogicalVolume;
class G4Material;
class G4GenericMessenger;
@@ -46,11 +47,8 @@ namespace Common
class DetectorConstruction0 : public G4VUserDetectorConstruction
{
public:
DetectorConstruction0(
const G4String& materialName = "G4_AIR",
G4double hx = 50*CLHEP::cm,
G4double hy = 50*CLHEP::cm,
G4double hz = 50*CLHEP::cm);
DetectorConstruction0(const G4String& materialName = "G4_AIR", G4double hx = 50 * CLHEP::cm,
G4double hy = 50 * CLHEP::cm, G4double hz = 50 * CLHEP::cm);
~DetectorConstruction0() override;
public:
@@ -58,21 +56,20 @@ class DetectorConstruction0 : public G4VUserDetectorConstruction
G4VPhysicalVolume* Construct() override;
// set methods
void SetMaterial(const G4String& materialName);
void SetDimensions(G4ThreeVector dimensions);
void SetMaterial(const G4String& materialName);
void SetDimensions(G4ThreeVector dimensions);
private:
void DefineCommands();
G4GenericMessenger* fMessenger = nullptr;
G4String fMaterialName;
G4ThreeVector fDimensions;
G4LogicalVolume* fWorldVolume = nullptr;
G4GenericMessenger* fMessenger = nullptr;
G4String fMaterialName;
G4ThreeVector fDimensions;
G4LogicalVolume* fWorldVolume = nullptr;
};
}
} // namespace Common
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -37,7 +37,7 @@ namespace Common
/// Physics list with geantino and charged geantino only
class GeantinoPhysicsList: public G4VUserPhysicsList
class GeantinoPhysicsList : public G4VUserPhysicsList
{
public:
GeantinoPhysicsList();
@@ -49,7 +49,6 @@ class GeantinoPhysicsList: public G4VUserPhysicsList
void ConstructProcess() override;
};
}
} // namespace Common
#endif
@@ -44,7 +44,7 @@ namespace Common
///
/// \author I. Hrivnacova; IPN Orsay
class GpsPrimaryGeneratorAction: public G4VUserPrimaryGeneratorAction
class GpsPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
GpsPrimaryGeneratorAction();
@@ -55,10 +55,9 @@ class GpsPrimaryGeneratorAction: public G4VUserPrimaryGeneratorAction
private:
// data members
G4GeneralParticleSource* fGeneralParticleSource = nullptr;
G4GeneralParticleSource* fGeneralParticleSource = nullptr;
};
}
} // namespace Common
#endif
@@ -30,12 +30,12 @@
#ifndef GunPrimaryGeneratorAction_h
#define GunPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include "CLHEP/Units/SystemOfUnits.h"
#include "G4ThreeVector.hh"
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
@@ -49,11 +49,10 @@ namespace Common
class GunPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
GunPrimaryGeneratorAction(
const G4String& particleName = "geantino",
G4double energy = 1.*CLHEP::MeV,
G4ThreeVector position= G4ThreeVector(0,0,0),
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));
GunPrimaryGeneratorAction(const G4String& particleName = "geantino",
G4double energy = 1. * CLHEP::MeV,
G4ThreeVector position = G4ThreeVector(0, 0, 0),
G4ThreeVector momentumDirection = G4ThreeVector(0, 0, 1));
~GunPrimaryGeneratorAction() override;
// methods
@@ -61,9 +60,9 @@ class GunPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
private:
// data members
G4ParticleGun* fParticleGun = nullptr;
G4ParticleGun* fParticleGun = nullptr;
};
}
} // namespace Common
#endif
@@ -29,27 +29,26 @@
#include "DetectorConstruction.hh"
#include "G4Box.hh"
#include "G4GenericMessenger.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GenericMessenger.hh"
namespace Common
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction(
const G4String& boxMaterialName,
G4double boxHx, G4double boxHy, G4double boxHz,
const G4String& worldMaterialName,
G4double worldSizeFactor)
: fBoxMaterialName(boxMaterialName),
fWorldMaterialName(worldMaterialName),
fBoxDimensions(boxHx*2, boxHy*2, boxHz*2),
fWorldSizeFactor(worldSizeFactor)
DetectorConstruction::DetectorConstruction(const G4String& boxMaterialName, G4double boxHx,
G4double boxHy, G4double boxHz,
const G4String& worldMaterialName,
G4double worldSizeFactor)
: fBoxMaterialName(boxMaterialName),
fWorldMaterialName(worldMaterialName),
fBoxDimensions(boxHx * 2, boxHy * 2, boxHz * 2),
fWorldSizeFactor(worldSizeFactor)
{
DefineCommands();
}
@@ -78,48 +77,41 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// World
//
auto sWorld
= new G4Box("World", //name
worldDimensions.x(), //dimensions (half-lentghs)
worldDimensions.y(),
worldDimensions.z());
auto sWorld = new G4Box("World", // name
worldDimensions.x(), // dimensions (half-lentghs)
worldDimensions.y(), worldDimensions.z());
fWorldVolume
= new G4LogicalVolume(sWorld, //shape
worldMaterial, //material
"World"); //name
fWorldVolume = new G4LogicalVolume(sWorld, // shape
worldMaterial, // material
"World"); // name
auto pWorld
= new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fWorldVolume, //logical volume
"World", //name
0, //mother volume
false, //no boolean operation
0); //copy number
auto pWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
fWorldVolume, // logical volume
"World", // name
0, // mother volume
false, // no boolean operation
0); // copy number
// Box
//
auto sBox
= new G4Box("Box", //its name
fBoxDimensions.x(), //dimensions (half-lengths)
fBoxDimensions.y(),
fBoxDimensions.z());
auto sBox = new G4Box("Box", // its name
fBoxDimensions.x(), // dimensions (half-lengths)
fBoxDimensions.y(), fBoxDimensions.z());
fBoxVolume
= new G4LogicalVolume(sBox, //its shape
boxMaterial, //its material
"Box"); //its name
fBoxVolume = new G4LogicalVolume(sBox, // its shape
boxMaterial, // its material
"Box"); // its name
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fBoxVolume, //its logical volume
"Box", //its name
fWorldVolume, //its mother volume
false, //no boolean operation
0); //copy number
new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
fBoxVolume, // its logical volume
"Box", // its name
fWorldVolume, // its mother volume
false, // no boolean operation
0); // copy number
//always return the root volume
// always return the root volume
//
return pWorld;
}
@@ -131,13 +123,13 @@ void DetectorConstruction::SetBoxMaterial(const G4String& materialName)
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
if (!newMaterial) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
return;
}
if ( fBoxVolume ) fBoxVolume->SetMaterial(newMaterial);
if (fBoxVolume) fBoxVolume->SetMaterial(newMaterial);
G4cout << "Material of box changed to " << materialName << G4endl;
}
@@ -148,13 +140,13 @@ void DetectorConstruction::SetWorldMaterial(const G4String& materialName)
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
if (!newMaterial) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
return;
}
if ( fWorldVolume ) fWorldVolume->SetMaterial(newMaterial);
if (fWorldVolume) fWorldVolume->SetMaterial(newMaterial);
G4cout << "Material of box changed to " << materialName << G4endl;
}
@@ -162,8 +154,8 @@ void DetectorConstruction::SetWorldMaterial(const G4String& materialName)
void DetectorConstruction::SetBoxDimensions(G4ThreeVector dimensions)
{
/// Set box dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
/// Set box dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
fBoxDimensions = dimensions;
}
@@ -172,8 +164,8 @@ void DetectorConstruction::SetBoxDimensions(G4ThreeVector dimensions)
void DetectorConstruction::SetWorldSizeFactor(G4double factor)
{
/// Set the multiplication factor from box dimensions to world dimensions.
/// This setting has effect only if called in PreInit> phase
/// Set the multiplication factor from box dimensions to world dimensions.
/// This setting has effect only if called in PreInit> phase
fWorldSizeFactor = factor;
}
@@ -183,39 +175,31 @@ void DetectorConstruction::SetWorldSizeFactor(G4double factor)
void DetectorConstruction::DefineCommands()
{
// Define /B5/detector command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/detector/",
"Detector control");
fMessenger = new G4GenericMessenger(this, "/detector/", "Detector control");
// setBoxMaterial command
auto& setBoxMaterialCmd
= fMessenger->DeclareMethod("setBoxMaterial",
&DetectorConstruction::SetBoxMaterial,
"Set box material name.");
auto& setBoxMaterialCmd = fMessenger->DeclareMethod(
"setBoxMaterial", &DetectorConstruction::SetBoxMaterial, "Set box material name.");
setBoxMaterialCmd.SetParameterName("boxMaterialName", false);
setBoxMaterialCmd.SetDefaultValue("G4_AIR");
// setWorldMaterial command
auto& setWorldMaterialCmd
= fMessenger->DeclareMethod("setWorldMaterial",
&DetectorConstruction::SetWorldMaterial,
"Set world material name.");
auto& setWorldMaterialCmd = fMessenger->DeclareMethod(
"setWorldMaterial", &DetectorConstruction::SetWorldMaterial, "Set world material name.");
setWorldMaterialCmd.SetParameterName("worldMaterialName", false);
setWorldMaterialCmd.SetDefaultValue("G4_AIR");
// setBoxDimensions command
auto& setBoxDimensionsCmd
= fMessenger->DeclareMethodWithUnit("setBoxDimensions", "mm",
&DetectorConstruction::SetBoxDimensions,
"Set box dimensions (in half lentgh).");
auto& setBoxDimensionsCmd = fMessenger->DeclareMethodWithUnit(
"setBoxDimensions", "mm", &DetectorConstruction::SetBoxDimensions,
"Set box dimensions (in half lentgh).");
setBoxDimensionsCmd.SetParameterName("boxDimensions", false);
setBoxDimensionsCmd.SetStates(G4State_PreInit);
// setWorldSizeFactor command
auto& setWorldSizeFactorCmd
= fMessenger->DeclareMethod("setWorldSizeFactor",
&DetectorConstruction::SetWorldSizeFactor,
"Set the multiplication factor from box dimensions to world dimensions.");
auto& setWorldSizeFactorCmd = fMessenger->DeclareMethod(
"setWorldSizeFactor", &DetectorConstruction::SetWorldSizeFactor,
"Set the multiplication factor from box dimensions to world dimensions.");
setWorldSizeFactorCmd.SetParameterName("worldSizeFactor", false);
setWorldSizeFactorCmd.SetRange("WorldSizeFactor >= 1");
setWorldSizeFactorCmd.SetStates(G4State_PreInit);
@@ -223,4 +207,4 @@ void DetectorConstruction::DefineCommands()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace Common
@@ -29,23 +29,21 @@
#include "DetectorConstruction0.hh"
#include "G4Box.hh"
#include "G4GenericMessenger.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GenericMessenger.hh"
namespace Common
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction0::DetectorConstruction0(
const G4String& materialName,
G4double hx, G4double hy, G4double hz)
: fMaterialName(materialName),
fDimensions(hx, hy, hz)
DetectorConstruction0::DetectorConstruction0(const G4String& materialName, G4double hx, G4double hy,
G4double hz)
: fMaterialName(materialName), fDimensions(hx, hy, hz)
{
DefineCommands();
}
@@ -69,27 +67,23 @@ G4VPhysicalVolume* DetectorConstruction0::Construct()
// World
//
auto sWorld
= new G4Box("World", //name
fDimensions.x(), //dimensions (half-lentghs)
fDimensions.y(),
fDimensions.z());
auto sWorld = new G4Box("World", // name
fDimensions.x(), // dimensions (half-lentghs)
fDimensions.y(), fDimensions.z());
fWorldVolume
= new G4LogicalVolume(sWorld, //shape
material, //material
"World"); //name
fWorldVolume = new G4LogicalVolume(sWorld, // shape
material, // material
"World"); // name
auto pWorld
= new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fWorldVolume, //logical volume
"World", //name
0, //mother volume
false, //no boolean operation
0); //copy number
auto pWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
fWorldVolume, // logical volume
"World", // name
0, // mother volume
false, // no boolean operation
0); // copy number
//always return the root volume
// always return the root volume
//
return pWorld;
}
@@ -101,13 +95,13 @@ void DetectorConstruction0::SetMaterial(const G4String& materialName)
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
if (!newMaterial) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
return;
}
if ( fWorldVolume ) fWorldVolume->SetMaterial(newMaterial);
if (fWorldVolume) fWorldVolume->SetMaterial(newMaterial);
G4cout << "Material of box changed to " << materialName << G4endl;
}
@@ -115,8 +109,8 @@ void DetectorConstruction0::SetMaterial(const G4String& materialName)
void DetectorConstruction0::SetDimensions(G4ThreeVector dimensions)
{
/// Set world dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
/// Set world dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
fDimensions = dimensions;
}
@@ -126,28 +120,23 @@ void DetectorConstruction0::SetDimensions(G4ThreeVector dimensions)
void DetectorConstruction0::DefineCommands()
{
// Define /B5/detector command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/detector/",
"Detector control");
fMessenger = new G4GenericMessenger(this, "/detector/", "Detector control");
// setMaterial command
auto& setMaterialCmd
= fMessenger->DeclareMethod("setMaterial",
&DetectorConstruction0::SetMaterial,
"Set world material name.");
auto& setMaterialCmd = fMessenger->DeclareMethod(
"setMaterial", &DetectorConstruction0::SetMaterial, "Set world material name.");
setMaterialCmd.SetParameterName("materialName", false);
setMaterialCmd.SetDefaultValue("G4_AIR");
setMaterialCmd.SetStates(G4State_PreInit);
// setDimensions command
auto& setDimensionsCmd
= fMessenger->DeclareMethodWithUnit("setDimensions", "mm",
&DetectorConstruction0::SetDimensions,
"Set world dimensions (in half lentgh).");
auto& setDimensionsCmd =
fMessenger->DeclareMethodWithUnit("setDimensions", "mm", &DetectorConstruction0::SetDimensions,
"Set world dimensions (in half lentgh).");
setDimensionsCmd.SetParameterName("dimensions", false);
setDimensionsCmd.SetStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace Common
@@ -28,8 +28,9 @@
/// \brief Implementation of the Common::GeantinoPhysicsList class
#include "GeantinoPhysicsList.hh"
#include "G4Geantino.hh"
#include "G4ChargedGeantino.hh"
#include "G4Geantino.hh"
namespace Common
{
@@ -66,4 +67,4 @@ void GeantinoPhysicsList::ConstructProcess()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace Common
@@ -40,7 +40,7 @@ namespace Common
GpsPrimaryGeneratorAction::GpsPrimaryGeneratorAction()
{
fGeneralParticleSource = new G4GeneralParticleSource();
fGeneralParticleSource = new G4GeneralParticleSource();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -61,5 +61,4 @@ void GpsPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace Common
@@ -30,28 +30,25 @@
#include "GunPrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
namespace Common
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GunPrimaryGeneratorAction::GunPrimaryGeneratorAction(
const G4String& particleName,
G4double energy,
G4ThreeVector position,
G4ThreeVector momentumDirection)
GunPrimaryGeneratorAction::GunPrimaryGeneratorAction(const G4String& particleName, G4double energy,
G4ThreeVector position,
G4ThreeVector momentumDirection)
{
G4int nofParticles = 1;
fParticleGun = new G4ParticleGun(nofParticles);
fParticleGun = new G4ParticleGun(nofParticles);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName);
G4ParticleDefinition* particle = particleTable->FindParticle(particleName);
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleEnergy(energy);
fParticleGun->SetParticlePosition(position);
@@ -76,5 +73,4 @@ void GunPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace Common
+4 -4
View File
@@ -24,24 +24,24 @@
// ********************************************************************
//
//
//
//
/// \file common/testCommon.cc
/// \brief Test program for the common classes
#include "DetectorConstruction.hh"
#include "DetectorConstruction0.hh"
#include "FTFP_BERT.hh"
#include "GeantinoPhysicsList.hh"
#include "GpsPrimaryGeneratorAction.hh"
#include "GunPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "FTFP_BERT.hh"
using namespace Common;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Test program which only instantiates classes defined in
// Test program which only instantiates classes defined in
// examples/common
int main()
@@ -58,7 +58,7 @@ int main()
// Instantiate all physics list classes
auto geantinoPhysicsList = new GeantinoPhysicsList();
// Instantiate all primary generator actions classes
auto gpsPrimaryGeneratorAction = new GpsPrimaryGeneratorAction();
auto gunPrimaryGeneratorAction = new GunPrimaryGeneratorAction();