Import Geant4 11.3.0.beta source tree
This commit is contained in:
+6
-9
@@ -26,7 +26,7 @@
|
||||
/// \file DetectorConstruction.hh
|
||||
/// \brief Definition of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -41,21 +41,18 @@
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
|
||||
DetectorConstruction();
|
||||
~DetectorConstruction() override = default;
|
||||
|
||||
~DetectorConstruction() override = default;
|
||||
|
||||
G4VPhysicalVolume* Construct() override;
|
||||
|
||||
G4double GetWorldSizeXY() {return fWorldSizeXY;};
|
||||
G4double GetWorldSizeZ() {return fWorldSizeZ;};
|
||||
|
||||
G4double GetWorldSizeXY() { return fWorldSizeXY; };
|
||||
G4double GetWorldSizeZ() { return fWorldSizeZ; };
|
||||
|
||||
private:
|
||||
|
||||
G4double fWorldSizeXY = 0., fWorldSizeZ = 0.;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file PhysicsList.hh
|
||||
/// \brief Definition of the PhysicsList class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -38,22 +38,19 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class PhysicsList: public G4VUserPhysicsList
|
||||
class PhysicsList : public G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
PhysicsList() = default;
|
||||
~PhysicsList() override = default;
|
||||
~PhysicsList() override = default;
|
||||
|
||||
protected:
|
||||
// Construct particle and physics
|
||||
void ConstructParticle() override;
|
||||
void ConstructProcess() override;
|
||||
void SetCuts() override;
|
||||
void ConstructProcess() override;
|
||||
void SetCuts() override;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file PrimaryGenerator.hh
|
||||
/// \brief Definition of the PrimaryGenerator class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -42,8 +42,8 @@ class G4Event;
|
||||
class PrimaryGenerator : public G4VPrimaryGenerator
|
||||
{
|
||||
public:
|
||||
PrimaryGenerator() = default;
|
||||
~PrimaryGenerator() override = default;
|
||||
PrimaryGenerator() = default;
|
||||
~PrimaryGenerator() override = default;
|
||||
|
||||
public:
|
||||
void GeneratePrimaryVertex(G4Event*) override;
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@
|
||||
/// \file PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -43,8 +43,8 @@ class PrimaryGenerator;
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorAction();
|
||||
~PrimaryGeneratorAction() override;
|
||||
PrimaryGeneratorAction();
|
||||
~PrimaryGeneratorAction() override;
|
||||
|
||||
public:
|
||||
void GeneratePrimaries(G4Event*) override;
|
||||
|
||||
@@ -26,15 +26,15 @@
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
{
|
||||
fWorldSizeXY = 2*cm;
|
||||
fWorldSizeZ = 2*cm;
|
||||
fWorldSizeXY = 2 * cm;
|
||||
fWorldSizeZ = 2 * cm;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -52,33 +52,29 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
//
|
||||
// define a material
|
||||
//
|
||||
G4Material* Air =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
//
|
||||
//
|
||||
G4Material* Air = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4Box*
|
||||
solidWorld = new G4Box("World", //its name
|
||||
fWorldSizeXY/2,fWorldSizeXY/2,fWorldSizeZ/2); //its size
|
||||
|
||||
G4LogicalVolume*
|
||||
logicWorld = new G4LogicalVolume(solidWorld, //its solid
|
||||
Air, //its material
|
||||
"World"); //its name
|
||||
G4VPhysicalVolume*
|
||||
physiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
logicWorld, //its logical volume
|
||||
"World", //its name
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
G4Box* solidWorld = new G4Box("World", // its name
|
||||
fWorldSizeXY / 2, fWorldSizeXY / 2, fWorldSizeZ / 2); // its size
|
||||
|
||||
G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, // its solid
|
||||
Air, // its material
|
||||
"World"); // its name
|
||||
G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
0, // its mother volume
|
||||
false, // no boolean operation
|
||||
0); // copy number
|
||||
|
||||
//
|
||||
// always return the physical World
|
||||
//
|
||||
//always return the physical World
|
||||
//
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,12 @@
|
||||
/// \file PhysicsList.cc
|
||||
/// \brief Implementation of the PhysicsList class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PhysicsList.hh"
|
||||
|
||||
#include "G4ParticleTypes.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -51,7 +52,7 @@ void PhysicsList::ConstructProcess()
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
SetCutsWithDefault();
|
||||
SetCutsWithDefault();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -26,18 +26,18 @@
|
||||
/// \file PrimaryGenerator.cc
|
||||
/// \brief Implementation of the PrimaryGenerator1 class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PrimaryGenerator.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
#include "G4PrimaryVertex.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
@@ -45,58 +45,58 @@
|
||||
|
||||
void PrimaryGenerator::GeneratePrimaryVertex(G4Event* event)
|
||||
{
|
||||
//vertex A uniform on a cylinder
|
||||
// vertex A uniform on a cylinder
|
||||
//
|
||||
const G4double r = 2*mm;
|
||||
const G4double zmax = 8*mm;
|
||||
const G4double r = 2 * mm;
|
||||
const G4double zmax = 8 * mm;
|
||||
//
|
||||
G4double alpha = twopi*G4UniformRand(); //alpha uniform in (0, 2*pi)
|
||||
G4double alpha = twopi * G4UniformRand(); // alpha uniform in (0, 2*pi)
|
||||
G4double ux = std::cos(alpha);
|
||||
G4double uy = std::sin(alpha);
|
||||
G4double z = zmax*(2*G4UniformRand() - 1); //z uniform in (-zmax, +zmax)
|
||||
G4ThreeVector positionA(r*ux,r*uy,z);
|
||||
G4double timeA = 0*s;
|
||||
//
|
||||
G4PrimaryVertex* vertexA = new G4PrimaryVertex(positionA, timeA);
|
||||
|
||||
//particle 1 at vertex A
|
||||
G4double z = zmax * (2 * G4UniformRand() - 1); // z uniform in (-zmax, +zmax)
|
||||
G4ThreeVector positionA(r * ux, r * uy, z);
|
||||
G4double timeA = 0 * s;
|
||||
//
|
||||
G4ParticleDefinition* particleDefinition
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("geantino");
|
||||
G4PrimaryVertex* vertexA = new G4PrimaryVertex(positionA, timeA);
|
||||
|
||||
// particle 1 at vertex A
|
||||
//
|
||||
G4ParticleDefinition* particleDefinition =
|
||||
G4ParticleTable::GetParticleTable()->FindParticle("geantino");
|
||||
G4PrimaryParticle* particle1 = new G4PrimaryParticle(particleDefinition);
|
||||
particle1->SetMomentumDirection(G4ThreeVector(ux,uy,0));
|
||||
particle1->SetKineticEnergy(1*MeV);
|
||||
particle1->SetMomentumDirection(G4ThreeVector(ux, uy, 0));
|
||||
particle1->SetKineticEnergy(1 * MeV);
|
||||
//
|
||||
vertexA->SetPrimary(particle1);
|
||||
event->AddPrimaryVertex(vertexA);
|
||||
|
||||
//vertex (B) symetric to vertex A
|
||||
// vertex (B) symetric to vertex A
|
||||
//
|
||||
alpha += pi;
|
||||
ux = std::cos(alpha);
|
||||
uy = std::sin(alpha);
|
||||
G4ThreeVector positionB(r*ux,r*uy,z);
|
||||
G4double timeB = 1*s;
|
||||
//
|
||||
G4PrimaryVertex* vertexB = new G4PrimaryVertex(positionB, timeB);
|
||||
|
||||
//particles 2 and 3 at vertex B
|
||||
G4ThreeVector positionB(r * ux, r * uy, z);
|
||||
G4double timeB = 1 * s;
|
||||
//
|
||||
const G4double dalpha = 10*deg;
|
||||
G4PrimaryVertex* vertexB = new G4PrimaryVertex(positionB, timeB);
|
||||
|
||||
// particles 2 and 3 at vertex B
|
||||
//
|
||||
const G4double dalpha = 10 * deg;
|
||||
ux = std::cos(alpha + dalpha);
|
||||
uy = std::sin(alpha + dalpha);
|
||||
uy = std::sin(alpha + dalpha);
|
||||
G4PrimaryParticle* particle2 = new G4PrimaryParticle(particleDefinition);
|
||||
particle2->SetMomentumDirection(G4ThreeVector(ux,uy,0));
|
||||
particle2->SetKineticEnergy(1*keV);
|
||||
particle2->SetMomentumDirection(G4ThreeVector(ux, uy, 0));
|
||||
particle2->SetKineticEnergy(1 * keV);
|
||||
//
|
||||
ux = std::cos(alpha - dalpha);
|
||||
uy = std::sin(alpha - dalpha);
|
||||
uy = std::sin(alpha - dalpha);
|
||||
G4PrimaryParticle* particle3 = new G4PrimaryParticle(particleDefinition);
|
||||
particle3->SetMomentumDirection(G4ThreeVector(ux,uy,0));
|
||||
particle3->SetKineticEnergy(1*GeV);
|
||||
particle3->SetMomentumDirection(G4ThreeVector(ux, uy, 0));
|
||||
particle3->SetKineticEnergy(1 * GeV);
|
||||
//
|
||||
vertexB->SetPrimary(particle2);
|
||||
vertexB->SetPrimary(particle3);
|
||||
vertexB->SetPrimary(particle3);
|
||||
event->AddPrimaryVertex(vertexB);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,25 +26,26 @@
|
||||
/// \file PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "PrimaryGenerator.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
{
|
||||
fPrimaryGenerator = new PrimaryGenerator();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fPrimaryGenerator;
|
||||
{
|
||||
delete fPrimaryGenerator;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,72 +27,70 @@
|
||||
/// \brief Main program of the eventgenerator/userPrimaryGenerator example
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsList.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
int main(int argc,char** argv) {
|
||||
|
||||
//detect interactive mode (if no arguments) and define UI session
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// detect interactive mode (if no arguments) and define UI session
|
||||
G4UIExecutive* ui = 0;
|
||||
if (argc == 1) ui = new G4UIExecutive(argc,argv);
|
||||
if (argc == 1) ui = new G4UIExecutive(argc, argv);
|
||||
|
||||
//choose the Random engine
|
||||
// choose the Random engine
|
||||
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
|
||||
|
||||
//use G4SteppingVerboseWithUnits
|
||||
|
||||
// use G4SteppingVerboseWithUnits
|
||||
G4int precision = 4;
|
||||
G4SteppingVerbose::UseBestUnit(precision);
|
||||
|
||||
//construct the default run manager
|
||||
// construct the default run manager
|
||||
G4RunManager* runManager = new G4RunManager;
|
||||
|
||||
//set mandatory initialization classes
|
||||
// set mandatory initialization classes
|
||||
//
|
||||
runManager->SetUserInitialization(new DetectorConstruction);
|
||||
runManager->SetUserInitialization(new PhysicsList);
|
||||
|
||||
runManager->SetUserAction(new PrimaryGeneratorAction);
|
||||
|
||||
//initialize visualization
|
||||
// initialize visualization
|
||||
G4VisManager* visManager = nullptr;
|
||||
|
||||
//get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
// get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
if (ui) {
|
||||
//interactive mode
|
||||
visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
if (ui) {
|
||||
// interactive mode
|
||||
visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
else {
|
||||
//batch mode
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
else {
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command + fileName);
|
||||
}
|
||||
|
||||
//job termination
|
||||
// job termination
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -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
|
||||
@@ -50,7 +50,7 @@ Index : 0 used in the geometry : Yes
|
||||
Run terminated.
|
||||
Run Summary
|
||||
Number of events processed : 100000
|
||||
User=0.450000s Real=0.463143s Sys=0.000000s
|
||||
User=0.350000s Real=0.349235s Sys=0.000000s
|
||||
================== Deleting memory pools ===================
|
||||
Number of memory pools allocated: 9 of which, static: 0
|
||||
Dynamic pools deleted: 9 / Total memory freed: 0.013 MB
|
||||
|
||||
Reference in New Issue
Block a user