Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -27,41 +27,40 @@
|
||||
/// \file exampleB1.cc
|
||||
/// \brief Main program of the B1 example
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "QBBC.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "QBBC.hh"
|
||||
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
// #include "Randomize.hh"
|
||||
|
||||
using namespace B1;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// Optionally: choose a different Random engine...
|
||||
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
|
||||
|
||||
//use G4SteppingVerboseWithUnits
|
||||
// use G4SteppingVerboseWithUnits
|
||||
G4int precision = 4;
|
||||
G4SteppingVerbose::UseBestUnit(precision);
|
||||
|
||||
// Construct the default run manager
|
||||
//
|
||||
auto runManager =
|
||||
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
@@ -90,11 +89,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
|
||||
|
||||
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
|
||||
|
||||
|
||||
**************************************************************
|
||||
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
|
||||
@@ -43,14 +43,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...
|
||||
|
||||
@@ -233,7 +240,7 @@ eBrem: for e+ XStype:4 SubType=3
|
||||
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
|
||||
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
|
||||
|
||||
annihil: for e+ XStype:2 SubType=5 BuildTable=0
|
||||
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eplus2gg : Emin= 0 eV Emax= 100 TeV
|
||||
|
||||
@@ -794,7 +801,7 @@ Min energy per nucleon for multifragmentation 200 GeV
|
||||
Limit excitation energy for Fermi BreakUp 20 MeV
|
||||
Level density (1/MeV) 0.075
|
||||
Use simple level density model 1
|
||||
Use discrete excitation energy of the residual 1
|
||||
Use discrete excitation energy of the residual 0
|
||||
Time limit for long lived isomeres 1 ns
|
||||
Isomer production flag 1
|
||||
Internal e- conversion flag 1
|
||||
@@ -818,7 +825,7 @@ See commands in /vis/modeling/trajectories/ for other options.
|
||||
|
||||
--------------------End of Global Run-----------------------
|
||||
The run consists of 1000 gamma of 6 MeV
|
||||
Cumulated dose per run, in scoring volume : 42.4413 picoGy rms = 3.88774 picoGy
|
||||
Cumulated dose per run, in scoring volume : 45.5475 picoGy rms = 3.92567 picoGy
|
||||
------------------------------------------------------------
|
||||
|
||||
### Run 1 starts.
|
||||
@@ -835,7 +842,7 @@ See commands in /vis/modeling/trajectories/ for other options.
|
||||
|
||||
--------------------End of Global Run-----------------------
|
||||
The run consists of 1000 proton of 210 MeV
|
||||
Cumulated dose per run, in scoring volume : 5.05669 nanoGy rms = 147.009 picoGy
|
||||
Cumulated dose per run, in scoring volume : 4.70767 nanoGy rms = 144.639 picoGy
|
||||
------------------------------------------------------------
|
||||
|
||||
Graphics systems deleted.
|
||||
|
||||
@@ -47,7 +47,7 @@ class ActionInitialization : public G4VUserActionInitialization
|
||||
void Build() const override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#define B1DetectorConstruction_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
@@ -55,7 +54,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
G4LogicalVolume* fScoringVolume = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Event;
|
||||
|
||||
namespace B1
|
||||
{
|
||||
|
||||
@@ -53,13 +55,11 @@ class EventAction : public G4UserEventAction
|
||||
|
||||
private:
|
||||
RunAction* fRunAction = nullptr;
|
||||
G4double fEdep = 0.;
|
||||
G4double fEdep = 0.;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#define B1PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
@@ -59,11 +57,11 @@ class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
const G4ParticleGun* GetParticleGun() const { return fParticleGun; }
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class
|
||||
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class
|
||||
G4Box* fEnvelopeBox = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define B1RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
#include "G4Accumulable.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
@@ -52,16 +53,15 @@ class RunAction : public G4UserRunAction
|
||||
~RunAction() override = default;
|
||||
|
||||
void BeginOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
|
||||
void AddEdep (G4double edep);
|
||||
void AddEdep(G4double edep);
|
||||
|
||||
private:
|
||||
G4Accumulable<G4double> fEdep = 0.;
|
||||
G4Accumulable<G4double> fEdep2 = 0.;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
#define B1SteppingAction_h 1
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4LogicalVolume;
|
||||
class G4Step;
|
||||
|
||||
namespace B1
|
||||
{
|
||||
@@ -56,7 +56,7 @@ class SteppingAction : public G4UserSteppingAction
|
||||
G4LogicalVolume* fScoringVolume = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -28,9 +28,10 @@
|
||||
/// \brief Implementation of the B1::ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
|
||||
#include "EventAction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
|
||||
namespace B1
|
||||
@@ -61,4 +62,4 @@ void ActionInitialization::Build() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
@@ -29,16 +29,13 @@
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Orb.hh"
|
||||
#include "G4Sphere.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Trd.hh"
|
||||
|
||||
namespace B1
|
||||
{
|
||||
@@ -52,7 +49,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
|
||||
// Envelope parameters
|
||||
//
|
||||
G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
|
||||
G4double env_sizeXY = 20 * cm, env_sizeZ = 30 * cm;
|
||||
G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
|
||||
|
||||
// Option to switch on/off checking of volumes overlaps
|
||||
@@ -62,109 +59,111 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4double world_sizeXY = 1.2*env_sizeXY;
|
||||
G4double world_sizeZ = 1.2*env_sizeZ;
|
||||
G4double world_sizeXY = 1.2 * env_sizeXY;
|
||||
G4double world_sizeZ = 1.2 * env_sizeZ;
|
||||
G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
auto solidWorld = new G4Box("World", // its name
|
||||
0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
|
||||
auto solidWorld =
|
||||
new G4Box("World", // its name
|
||||
0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
|
||||
|
||||
auto logicWorld = new G4LogicalVolume(solidWorld, // its solid
|
||||
world_mat, // its material
|
||||
"World"); // its name
|
||||
world_mat, // its material
|
||||
"World"); // its name
|
||||
|
||||
auto physWorld = new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
nullptr, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
checkOverlaps); // overlaps checking
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
nullptr, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
checkOverlaps); // overlaps checking
|
||||
|
||||
//
|
||||
// Envelope
|
||||
//
|
||||
auto solidEnv = new G4Box("Envelope", // its name
|
||||
0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ); // its size
|
||||
auto solidEnv = new G4Box("Envelope", // its name
|
||||
0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ); // its size
|
||||
|
||||
auto logicEnv = new G4LogicalVolume(solidEnv, // its solid
|
||||
env_mat, // its material
|
||||
"Envelope"); // its name
|
||||
env_mat, // its material
|
||||
"Envelope"); // its name
|
||||
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicEnv, // its logical volume
|
||||
"Envelope", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
checkOverlaps); // overlaps checking
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicEnv, // its logical volume
|
||||
"Envelope", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
checkOverlaps); // overlaps checking
|
||||
|
||||
//
|
||||
// Shape 1
|
||||
//
|
||||
G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE");
|
||||
G4ThreeVector pos1 = G4ThreeVector(0, 2*cm, -7*cm);
|
||||
G4ThreeVector pos1 = G4ThreeVector(0, 2 * cm, -7 * cm);
|
||||
|
||||
// Conical section shape
|
||||
G4double shape1_rmina = 0.*cm, shape1_rmaxa = 2.*cm;
|
||||
G4double shape1_rminb = 0.*cm, shape1_rmaxb = 4.*cm;
|
||||
G4double shape1_hz = 3.*cm;
|
||||
G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
|
||||
G4double shape1_rmina = 0. * cm, shape1_rmaxa = 2. * cm;
|
||||
G4double shape1_rminb = 0. * cm, shape1_rmaxb = 4. * cm;
|
||||
G4double shape1_hz = 3. * cm;
|
||||
G4double shape1_phimin = 0. * deg, shape1_phimax = 360. * deg;
|
||||
auto solidShape1 = new G4Cons("Shape1", shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb,
|
||||
shape1_hz, shape1_phimin, shape1_phimax);
|
||||
shape1_hz, shape1_phimin, shape1_phimax);
|
||||
|
||||
auto logicShape1 = new G4LogicalVolume(solidShape1, // its solid
|
||||
shape1_mat, // its material
|
||||
"Shape1"); // its name
|
||||
shape1_mat, // its material
|
||||
"Shape1"); // its name
|
||||
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
pos1, // at position
|
||||
logicShape1, // its logical volume
|
||||
"Shape1", // its name
|
||||
logicEnv, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
checkOverlaps); // overlaps checking
|
||||
pos1, // at position
|
||||
logicShape1, // its logical volume
|
||||
"Shape1", // its name
|
||||
logicEnv, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
checkOverlaps); // overlaps checking
|
||||
|
||||
//
|
||||
// Shape 2
|
||||
//
|
||||
G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
|
||||
G4ThreeVector pos2 = G4ThreeVector(0, -1*cm, 7*cm);
|
||||
G4ThreeVector pos2 = G4ThreeVector(0, -1 * cm, 7 * cm);
|
||||
|
||||
// Trapezoid shape
|
||||
G4double shape2_dxa = 12*cm, shape2_dxb = 12*cm;
|
||||
G4double shape2_dya = 10*cm, shape2_dyb = 16*cm;
|
||||
G4double shape2_dz = 6*cm;
|
||||
auto solidShape2 = new G4Trd("Shape2", // its name
|
||||
0.5 * shape2_dxa, 0.5 * shape2_dxb, 0.5 * shape2_dya, 0.5 * shape2_dyb,
|
||||
0.5 * shape2_dz); // its size
|
||||
G4double shape2_dxa = 12 * cm, shape2_dxb = 12 * cm;
|
||||
G4double shape2_dya = 10 * cm, shape2_dyb = 16 * cm;
|
||||
G4double shape2_dz = 6 * cm;
|
||||
auto solidShape2 =
|
||||
new G4Trd("Shape2", // its name
|
||||
0.5 * shape2_dxa, 0.5 * shape2_dxb, 0.5 * shape2_dya, 0.5 * shape2_dyb,
|
||||
0.5 * shape2_dz); // its size
|
||||
|
||||
auto logicShape2 = new G4LogicalVolume(solidShape2, // its solid
|
||||
shape2_mat, // its material
|
||||
"Shape2"); // its name
|
||||
shape2_mat, // its material
|
||||
"Shape2"); // its name
|
||||
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
pos2, // at position
|
||||
logicShape2, // its logical volume
|
||||
"Shape2", // its name
|
||||
logicEnv, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
checkOverlaps); // overlaps checking
|
||||
pos2, // at position
|
||||
logicShape2, // its logical volume
|
||||
"Shape2", // its name
|
||||
logicEnv, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
checkOverlaps); // overlaps checking
|
||||
|
||||
// Set Shape2 as scoring volume
|
||||
//
|
||||
fScoringVolume = logicShape2;
|
||||
|
||||
//
|
||||
//always return the physical World
|
||||
// always return the physical World
|
||||
//
|
||||
return physWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
@@ -28,19 +28,15 @@
|
||||
/// \brief Implementation of the B1::EventAction class
|
||||
|
||||
#include "EventAction.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
namespace B1
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction(RunAction* runAction)
|
||||
: fRunAction(runAction)
|
||||
{}
|
||||
EventAction::EventAction(RunAction* runAction) : fRunAction(runAction) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -59,4 +55,4 @@ void EventAction::EndOfEventAction(const G4Event*)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
@@ -29,13 +29,11 @@
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
@@ -47,16 +45,15 @@ namespace B1
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="gamma");
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "gamma");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
fParticleGun->SetParticleEnergy(6.*MeV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
|
||||
fParticleGun->SetParticleEnergy(6. * MeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -68,9 +65,9 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
|
||||
{
|
||||
//this function is called at the begining of ecah event
|
||||
// this function is called at the begining of ecah event
|
||||
//
|
||||
|
||||
// In order to avoid dependence of PrimaryGeneratorAction
|
||||
@@ -80,38 +77,33 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
G4double envSizeXY = 0;
|
||||
G4double envSizeZ = 0;
|
||||
|
||||
if (!fEnvelopeBox)
|
||||
{
|
||||
G4LogicalVolume* envLV
|
||||
= G4LogicalVolumeStore::GetInstance()->GetVolume("Envelope");
|
||||
if ( envLV ) fEnvelopeBox = dynamic_cast<G4Box*>(envLV->GetSolid());
|
||||
if (!fEnvelopeBox) {
|
||||
G4LogicalVolume* envLV = G4LogicalVolumeStore::GetInstance()->GetVolume("Envelope");
|
||||
if (envLV) fEnvelopeBox = dynamic_cast<G4Box*>(envLV->GetSolid());
|
||||
}
|
||||
|
||||
if ( fEnvelopeBox ) {
|
||||
envSizeXY = fEnvelopeBox->GetXHalfLength()*2.;
|
||||
envSizeZ = fEnvelopeBox->GetZHalfLength()*2.;
|
||||
if (fEnvelopeBox) {
|
||||
envSizeXY = fEnvelopeBox->GetXHalfLength() * 2.;
|
||||
envSizeZ = fEnvelopeBox->GetZHalfLength() * 2.;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Envelope volume of box shape not found.\n";
|
||||
msg << "Perhaps you have changed geometry.\n";
|
||||
msg << "The gun will be place at the center.";
|
||||
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
"MyCode0002",JustWarning,msg);
|
||||
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()", "MyCode0002", JustWarning, msg);
|
||||
}
|
||||
|
||||
G4double size = 0.8;
|
||||
G4double x0 = size * envSizeXY * (G4UniformRand()-0.5);
|
||||
G4double y0 = size * envSizeXY * (G4UniformRand()-0.5);
|
||||
G4double x0 = size * envSizeXY * (G4UniformRand() - 0.5);
|
||||
G4double y0 = size * envSizeXY * (G4UniformRand() - 0.5);
|
||||
G4double z0 = -0.5 * envSizeZ;
|
||||
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0));
|
||||
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
fParticleGun->GeneratePrimaryVertex(event);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace B1
|
||||
|
||||
@@ -28,17 +28,18 @@
|
||||
/// \brief Implementation of the B1::RunAction class
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
// #include "Run.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4AccumulableManager.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
namespace B1
|
||||
{
|
||||
@@ -49,15 +50,15 @@ RunAction::RunAction()
|
||||
{
|
||||
// add new units for dose
|
||||
//
|
||||
const G4double milligray = 1.e-3*gray;
|
||||
const G4double microgray = 1.e-6*gray;
|
||||
const G4double nanogray = 1.e-9*gray;
|
||||
const G4double picogray = 1.e-12*gray;
|
||||
const G4double milligray = 1.e-3 * gray;
|
||||
const G4double microgray = 1.e-6 * gray;
|
||||
const G4double nanogray = 1.e-9 * gray;
|
||||
const G4double picogray = 1.e-12 * gray;
|
||||
|
||||
new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
|
||||
new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
|
||||
new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
|
||||
new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
|
||||
new G4UnitDefinition("milligray", "milliGy", "Dose", milligray);
|
||||
new G4UnitDefinition("microgray", "microGy", "Dose", microgray);
|
||||
new G4UnitDefinition("nanogray", "nanoGy", "Dose", nanogray);
|
||||
new G4UnitDefinition("picogray", "picoGy", "Dose", picogray);
|
||||
|
||||
// Register accumulable to the accumulable manager
|
||||
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
|
||||
@@ -75,7 +76,6 @@ void RunAction::BeginOfRunAction(const G4Run*)
|
||||
// reset accumulables to their initial values
|
||||
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
|
||||
accumulableManager->Reset();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -91,17 +91,20 @@ void RunAction::EndOfRunAction(const G4Run* run)
|
||||
|
||||
// Compute dose = total energy deposit in a run and its variance
|
||||
//
|
||||
G4double edep = fEdep.GetValue();
|
||||
G4double edep = fEdep.GetValue();
|
||||
G4double edep2 = fEdep2.GetValue();
|
||||
|
||||
G4double rms = edep2 - edep*edep/nofEvents;
|
||||
if (rms > 0.) rms = std::sqrt(rms); else rms = 0.;
|
||||
G4double rms = edep2 - edep * edep / nofEvents;
|
||||
if (rms > 0.)
|
||||
rms = std::sqrt(rms);
|
||||
else
|
||||
rms = 0.;
|
||||
|
||||
const auto detConstruction = static_cast<const DetectorConstruction*>(
|
||||
G4RunManager::GetRunManager()->GetUserDetectorConstruction());
|
||||
G4double mass = detConstruction->GetScoringVolume()->GetMass();
|
||||
G4double dose = edep/mass;
|
||||
G4double rmsDose = rms/mass;
|
||||
G4double dose = edep / mass;
|
||||
G4double rmsDose = rms / mass;
|
||||
|
||||
// Run conditions
|
||||
// note: There is no primary generator action object for "master"
|
||||
@@ -109,48 +112,37 @@ void RunAction::EndOfRunAction(const G4Run* run)
|
||||
const auto generatorAction = static_cast<const PrimaryGeneratorAction*>(
|
||||
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
|
||||
G4String runCondition;
|
||||
if (generatorAction)
|
||||
{
|
||||
if (generatorAction) {
|
||||
const G4ParticleGun* particleGun = generatorAction->GetParticleGun();
|
||||
runCondition += particleGun->GetParticleDefinition()->GetParticleName();
|
||||
runCondition += " of ";
|
||||
G4double particleEnergy = particleGun->GetParticleEnergy();
|
||||
runCondition += G4BestUnit(particleEnergy,"Energy");
|
||||
runCondition += G4BestUnit(particleEnergy, "Energy");
|
||||
}
|
||||
|
||||
// Print
|
||||
//
|
||||
if (IsMaster()) {
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "--------------------End of Global Run-----------------------";
|
||||
G4cout << G4endl << "--------------------End of Global Run-----------------------";
|
||||
}
|
||||
else {
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "--------------------End of Local Run------------------------";
|
||||
G4cout << G4endl << "--------------------End of Local Run------------------------";
|
||||
}
|
||||
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< " The run consists of " << nofEvents << " "<< runCondition
|
||||
<< G4endl
|
||||
<< " Cumulated dose per run, in scoring volume : "
|
||||
<< G4BestUnit(dose,"Dose") << " rms = " << G4BestUnit(rmsDose,"Dose")
|
||||
<< G4endl
|
||||
<< "------------------------------------------------------------"
|
||||
<< G4endl
|
||||
<< G4endl;
|
||||
G4cout << G4endl << " The run consists of " << nofEvents << " " << runCondition << G4endl
|
||||
<< " Cumulated dose per run, in scoring volume : " << G4BestUnit(dose, "Dose")
|
||||
<< " rms = " << G4BestUnit(rmsDose, "Dose") << G4endl
|
||||
<< "------------------------------------------------------------" << G4endl << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::AddEdep(G4double edep)
|
||||
{
|
||||
fEdep += edep;
|
||||
fEdep2 += edep*edep;
|
||||
fEdep += edep;
|
||||
fEdep2 += edep * edep;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
@@ -28,22 +28,21 @@
|
||||
/// \brief Implementation of the B1::SteppingAction class
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Step.hh"
|
||||
|
||||
namespace B1
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::SteppingAction(EventAction* eventAction)
|
||||
: fEventAction(eventAction)
|
||||
{}
|
||||
SteppingAction::SteppingAction(EventAction* eventAction) : fEventAction(eventAction) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -56,9 +55,8 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
}
|
||||
|
||||
// get volume of the current step
|
||||
G4LogicalVolume* volume
|
||||
= step->GetPreStepPoint()->GetTouchableHandle()
|
||||
->GetVolume()->GetLogicalVolume();
|
||||
G4LogicalVolume* volume =
|
||||
step->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume();
|
||||
|
||||
// check if we are in scoring volume
|
||||
if (volume != fScoringVolume) return;
|
||||
@@ -70,4 +68,4 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
} // namespace B1
|
||||
|
||||
Reference in New Issue
Block a user