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
+29 -28
View File
@@ -27,37 +27,37 @@
/// \file exampleB4a.cc
/// \brief Main program of the B4a example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UIExecutive.hh"
#include "G4UIcommand.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "FTFP_BERT.hh"
#include "Randomize.hh"
// #include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace {
void PrintUsage() {
G4cerr << " Usage: " << G4endl;
G4cerr << " exampleB4a [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
<< G4endl;
G4cerr << " note: -t option is available only for multi-threaded mode."
<< G4endl;
}
namespace
{
void PrintUsage()
{
G4cerr << " Usage: " << G4endl;
G4cerr << " exampleB4a [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]" << G4endl;
G4cerr << " note: -t option is available only for multi-threaded mode." << G4endl;
}
} // namespace
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Evaluate arguments
//
if ( argc > 7 ) {
if (argc > 7) {
PrintUsage();
return 1;
}
@@ -68,15 +68,17 @@ int main(int argc,char** argv)
#ifdef G4MULTITHREADED
G4int nThreads = 0;
#endif
for ( G4int i=1; i<argc; i=i+2 ) {
if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
else if ( G4String(argv[i]) == "-u" ) session = argv[i+1];
for (G4int i = 1; i < argc; i = i + 2) {
if (G4String(argv[i]) == "-m")
macro = argv[i + 1];
else if (G4String(argv[i]) == "-u")
session = argv[i + 1];
#ifdef G4MULTITHREADED
else if ( G4String(argv[i]) == "-t" ) {
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
else if (G4String(argv[i]) == "-t") {
nThreads = G4UIcommand::ConvertToInt(argv[i + 1]);
}
#endif
else if ( G4String(argv[i]) == "-vDefault" ) {
else if (G4String(argv[i]) == "-vDefault") {
verboseBestUnits = false;
--i; // this option is not followed with a parameter
}
@@ -89,7 +91,7 @@ int main(int argc,char** argv)
// Detect interactive mode (if no macro provided) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( ! macro.size() ) {
if (!macro.size()) {
ui = new G4UIExecutive(argc, argv, session);
}
@@ -97,17 +99,16 @@ int main(int argc,char** argv)
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
// Use G4SteppingVerboseWithUnits
if ( verboseBestUnits ) {
if (verboseBestUnits) {
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
}
// Construct the default run manager
//
auto runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
#ifdef G4MULTITHREADED
if ( nThreads > 0 ) {
if (nThreads > 0) {
runManager->SetNumberOfThreads(nThreads);
}
#endif
@@ -135,12 +136,12 @@ int main(int argc,char** argv)
// Process macro or start UI session
//
if ( macro.size() ) {
if (macro.size()) {
// batch mode
G4String command = "/control/execute ";
UImanager->ApplyCommand(command+macro);
UImanager->ApplyCommand(command + macro);
}
else {
else {
// interactive mode : define UI session
UImanager->ApplyCommand("/control/execute init_vis.mac");
if (ui->IsGUI()) {
+31 -24
View File
@@ -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
@@ -44,14 +44,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...
@@ -276,7 +283,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
@@ -831,7 +838,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
@@ -857,17 +864,17 @@ Setting was ignored.
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 265.781 MeV total track length: 19.326 cm
Gap: total energy: 21.0561 MeV total track length: 10.6454 cm
Absorber: total energy: 279.218 MeV total track length: 20.3807 cm
Gap: total energy: 19.7181 MeV total track length: 9.43835 cm
--> End of event 0
----> print histograms statistic for the entire run
EAbs : mean = 265.781 MeV rms = 0 eV
EGap : mean = 21.0561 MeV rms = 0 eV
LAbs : mean = 19.326 cm rms = 0 fm
LGap : mean = 10.6454 cm rms = 0 fm
EAbs : mean = 279.218 MeV rms = 0 eV
EGap : mean = 19.7181 MeV rms = 0 eV
LAbs : mean = 20.3807 cm rms = 0 fm
LGap : mean = 9.43835 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -937,17 +944,17 @@ hFritiofCaptureAtRest,hBertiniCaptureAtRest,muMinusCaptureAtRest, dInela
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 273.124 MeV total track length: 20.1646 cm
Gap: total energy: 16.2656 MeV total track length: 7.73372 cm
Absorber: total energy: 253.71 MeV total track length: 18.3379 cm
Gap: total energy: 18.1797 MeV total track length: 8.925 cm
--> End of event 0
----> print histograms statistic for the entire run
EAbs : mean = 273.124 MeV rms = 0 eV
EGap : mean = 16.2656 MeV rms = 0 eV
LAbs : mean = 20.1646 cm rms = 0 fm
LGap : mean = 7.73372 cm rms = 0 fm
EAbs : mean = 253.71 MeV rms = 0 eV
EGap : mean = 18.1797 MeV rms = 0 eV
LAbs : mean = 18.3379 cm rms = 0 fm
LGap : mean = 8.925 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -963,17 +970,17 @@ There are histograms that can be viewed with visualization:
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 465.716 MeV total track length: 34.0047 cm
Gap: total energy: 15.1463 MeV total track length: 7.88173 cm
Absorber: total energy: 437.115 MeV total track length: 31.5725 cm
Gap: total energy: 19.1128 MeV total track length: 8.67887 cm
--> End of event 0
----> print histograms statistic for the entire run
EAbs : mean = 0 eV rms = 0 eV
EGap : mean = 15.1463 MeV rms = 0 eV
LAbs : mean = 34.0047 cm rms = 0 fm
LGap : mean = 7.88173 cm rms = 0 fm
EGap : mean = 19.1128 MeV rms = 0 eV
LAbs : mean = 31.5725 cm rms = 0 fm
LGap : mean = 8.67887 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -32,10 +32,9 @@
#include "G4VUserActionInitialization.hh"
namespace B4
{
class DetectorConstruction;
class DetectorConstruction;
}
namespace B4a
@@ -56,8 +55,6 @@ class ActionInitialization : public G4VUserActionInitialization
B4::DetectorConstruction* fDetConstruction = nullptr;
};
}
} // namespace B4a
#endif
@@ -31,6 +31,8 @@
#define B4DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4Threading.hh"
#include "globals.hh"
class G4VPhysicalVolume;
@@ -76,28 +78,29 @@ class DetectorConstruction : public G4VUserDetectorConstruction
// data members
//
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4VPhysicalVolume* fAbsorberPV = nullptr; // the absorber physical volume
G4VPhysicalVolume* fGapPV = nullptr; // the gap physical volume
G4VPhysicalVolume* fAbsorberPV = nullptr; // the absorber physical volume
G4VPhysicalVolume* fGapPV = nullptr; // the gap physical volume
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
};
// inline functions
inline const G4VPhysicalVolume* DetectorConstruction::GetAbsorberPV() const {
inline const G4VPhysicalVolume* DetectorConstruction::GetAbsorberPV() const
{
return fAbsorberPV;
}
inline const G4VPhysicalVolume* DetectorConstruction::GetGapPV() const {
inline const G4VPhysicalVolume* DetectorConstruction::GetGapPV() const
{
return fGapPV;
}
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
+13 -11
View File
@@ -33,6 +33,8 @@
#include "G4UserEventAction.hh"
#include "globals.hh"
class G4Event;
namespace B4a
{
@@ -50,34 +52,34 @@ class EventAction : public G4UserEventAction
EventAction() = default;
~EventAction() override = default;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
void AddAbs(G4double de, G4double dl);
void AddGap(G4double de, G4double dl);
private:
G4double fEnergyAbs = 0.;
G4double fEnergyGap = 0.;
G4double fTrackLAbs = 0.;
G4double fTrackLGap = 0.;
G4double fEnergyAbs = 0.;
G4double fEnergyGap = 0.;
G4double fTrackLAbs = 0.;
G4double fTrackLGap = 0.;
};
// inline functions
inline void EventAction::AddAbs(G4double de, G4double dl) {
inline void EventAction::AddAbs(G4double de, G4double dl)
{
fEnergyAbs += de;
fTrackLAbs += dl;
}
inline void EventAction::AddGap(G4double de, G4double dl) {
inline void EventAction::AddGap(G4double de, G4double dl)
{
fEnergyGap += de;
fTrackLGap += dl;
}
}
} // namespace B4a
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -31,7 +31,6 @@
#define B4PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
@@ -48,17 +47,17 @@ namespace B4
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event* event) override;
void GeneratePrimaries(G4Event* event) override;
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
};
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+2 -4
View File
@@ -31,7 +31,6 @@
#define B4RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
@@ -63,12 +62,11 @@ class RunAction : public G4UserRunAction
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
};
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
+11 -10
View File
@@ -32,9 +32,11 @@
#include "G4UserSteppingAction.hh"
class G4Step;
namespace B4
{
class DetectorConstruction;
class DetectorConstruction;
}
namespace B4a
@@ -50,19 +52,18 @@ class EventAction;
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(const B4::DetectorConstruction* detConstruction,
EventAction* eventAction);
~SteppingAction() override = default;
public:
SteppingAction(const B4::DetectorConstruction* detConstruction, EventAction* eventAction);
~SteppingAction() override = default;
void UserSteppingAction(const G4Step* step) override;
void UserSteppingAction(const G4Step* step) override;
private:
const B4::DetectorConstruction* fDetConstruction = nullptr;
EventAction* fEventAction = nullptr;
private:
const B4::DetectorConstruction* fDetConstruction = nullptr;
EventAction* fEventAction = nullptr;
};
}
} // namespace B4a
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,11 +28,11 @@
/// \brief Implementation of the B4a::ActionInitialization class
#include "ActionInitialization.hh"
#include "EventAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "DetectorConstruction.hh"
using namespace B4;
@@ -42,7 +42,7 @@ namespace B4a
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization(DetectorConstruction* detConstruction)
: fDetConstruction(detConstruction)
: fDetConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -60,9 +60,9 @@ void ActionInitialization::Build() const
SetUserAction(new RunAction);
auto eventAction = new EventAction;
SetUserAction(eventAction);
SetUserAction(new SteppingAction(fDetConstruction,eventAction));
SetUserAction(new SteppingAction(fDetConstruction, eventAction));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4a
+84 -114
View File
@@ -29,34 +29,25 @@
#include "DetectorConstruction.hh"
#include "G4AutoDelete.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4AutoDelete.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
namespace B4
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
G4ThreadLocal G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -81,12 +72,12 @@ void DetectorConstruction::DefineMaterials()
G4double a; // mass of a mole;
G4double z; // z=mean number of protons;
G4double density;
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
// The argon by NIST Manager is a gas with a different density
new G4Material("liquidArgon", z = 18., a = 39.95 * g / mole, density = 1.390 * g / cm3);
// The argon by NIST Manager is a gas with a different density
// Vacuum
new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
kStateGas, 2.73*kelvin, 3.e-18*pascal);
new G4Material("Galactic", z = 1., a = 1.01 * g / mole, density = universe_mean_density,
kStateGas, 2.73 * kelvin, 3.e-18 * pascal);
// Print materials
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
@@ -98,147 +89,127 @@ G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
{
// Geometry parameters
G4int nofLayers = 10;
G4double absoThickness = 10.*mm;
G4double gapThickness = 5.*mm;
G4double calorSizeXY = 10.*cm;
G4double absoThickness = 10. * mm;
G4double gapThickness = 5. * mm;
G4double calorSizeXY = 10. * cm;
auto layerThickness = absoThickness + gapThickness;
auto calorThickness = nofLayers * layerThickness;
auto worldSizeXY = 1.2 * calorSizeXY;
auto worldSizeZ = 1.2 * calorThickness;
auto worldSizeZ = 1.2 * calorThickness;
// Get materials
auto defaultMaterial = G4Material::GetMaterial("Galactic");
auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
auto gapMaterial = G4Material::GetMaterial("liquidArgon");
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
if (!defaultMaterial || !absorberMaterial || !gapMaterial) {
G4ExceptionDescription msg;
msg << "Cannot retrieve materials already defined.";
G4Exception("DetectorConstruction::DefineVolumes()",
"MyCode0001", FatalException, msg);
G4Exception("DetectorConstruction::DefineVolumes()", "MyCode0001", FatalException, msg);
}
//
// World
//
auto worldS
= new G4Box("World", // its name
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
auto worldS = new G4Box("World", // its name
worldSizeXY / 2, worldSizeXY / 2, worldSizeZ / 2); // its size
auto worldLV
= new G4LogicalVolume(
worldS, // its solid
defaultMaterial, // its material
"World"); // its name
auto worldLV = new G4LogicalVolume(worldS, // its solid
defaultMaterial, // its material
"World"); // its name
auto worldPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Calorimeter
//
auto calorimeterS
= new G4Box("Calorimeter", // its name
calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
auto calorimeterS = new G4Box("Calorimeter", // its name
calorSizeXY / 2, calorSizeXY / 2, calorThickness / 2); // its size
auto calorLV
= new G4LogicalVolume(
calorimeterS, // its solid
defaultMaterial, // its material
"Calorimeter"); // its name
auto calorLV = new G4LogicalVolume(calorimeterS, // its solid
defaultMaterial, // its material
"Calorimeter"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
calorLV, // its logical volume
"Calorimeter", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4ThreeVector(), // at (0,0,0)
calorLV, // its logical volume
"Calorimeter", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Layer
//
auto layerS
= new G4Box("Layer", // its name
calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
auto layerS = new G4Box("Layer", // its name
calorSizeXY / 2, calorSizeXY / 2, layerThickness / 2); // its size
auto layerLV
= new G4LogicalVolume(
layerS, // its solid
defaultMaterial, // its material
"Layer"); // its name
auto layerLV = new G4LogicalVolume(layerS, // its solid
defaultMaterial, // its material
"Layer"); // its name
new G4PVReplica(
"Layer", // its name
layerLV, // its logical volume
calorLV, // its mother
kZAxis, // axis of replication
nofLayers, // number of replica
layerThickness); // witdth of replica
new G4PVReplica("Layer", // its name
layerLV, // its logical volume
calorLV, // its mother
kZAxis, // axis of replication
nofLayers, // number of replica
layerThickness); // witdth of replica
//
// Absorber
//
auto absorberS
= new G4Box("Abso", // its name
calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
auto absorberS = new G4Box("Abso", // its name
calorSizeXY / 2, calorSizeXY / 2, absoThickness / 2); // its size
auto absorberLV
= new G4LogicalVolume(
absorberS, // its solid
absorberMaterial, // its material
"Abso"); // its name
auto absorberLV = new G4LogicalVolume(absorberS, // its solid
absorberMaterial, // its material
"Abso"); // its name
fAbsorberPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., -gapThickness / 2), // its position
absorberLV, // its logical volume
"Abso", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
fAbsorberPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., -gapThickness / 2), // its position
absorberLV, // its logical volume
"Abso", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Gap
//
auto gapS
= new G4Box("Gap", // its name
calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
auto gapS = new G4Box("Gap", // its name
calorSizeXY / 2, calorSizeXY / 2, gapThickness / 2); // its size
auto gapLV
= new G4LogicalVolume(
gapS, // its solid
gapMaterial, // its material
"Gap"); // its name
auto gapLV = new G4LogicalVolume(gapS, // its solid
gapMaterial, // its material
"Gap"); // its name
fGapPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., absoThickness / 2), // its position
gapLV, // its logical volume
"Gap", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
fGapPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., absoThickness / 2), // its position
gapLV, // its logical volume
"Gap", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// print parameters
//
G4cout
<< G4endl
<< "------------------------------------------------------------" << G4endl
<< "---> The calorimeter is " << nofLayers << " layers of: [ "
<< absoThickness/mm << "mm of " << absorberMaterial->GetName()
<< " + "
<< gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
<< "------------------------------------------------------------" << G4endl;
G4cout << G4endl << "------------------------------------------------------------" << G4endl
<< "---> The calorimeter is " << nofLayers << " layers of: [ " << absoThickness / mm
<< "mm of " << absorberMaterial->GetName() << " + " << gapThickness / mm << "mm of "
<< gapMaterial->GetName() << " ] " << G4endl
<< "------------------------------------------------------------" << G4endl;
//
// Visualization attributes
@@ -269,5 +240,4 @@ void DetectorConstruction::ConstructSDandField()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4
+10 -18
View File
@@ -28,14 +28,12 @@
/// \brief Implementation of the B4a::EventAction class
#include "EventAction.hh"
#include "RunAction.hh"
#include "G4AnalysisManager.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include <iomanip>
namespace B4a
@@ -76,23 +74,17 @@ void EventAction::EndOfEventAction(const G4Event* event)
//
auto eventID = event->GetEventID();
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
G4cout
<< " Absorber: total energy: " << std::setw(7)
<< G4BestUnit(fEnergyAbs,"Energy")
<< " total track length: " << std::setw(7)
<< G4BestUnit(fTrackLAbs,"Length")
<< G4endl
<< " Gap: total energy: " << std::setw(7)
<< G4BestUnit(fEnergyGap,"Energy")
<< " total track length: " << std::setw(7)
<< G4BestUnit(fTrackLGap,"Length")
<< G4endl;
G4cout << "--> End of event " << eventID << "\n" << G4endl;
if ((printModulo > 0) && (eventID % printModulo == 0)) {
G4cout << " Absorber: total energy: " << std::setw(7) << G4BestUnit(fEnergyAbs, "Energy")
<< " total track length: " << std::setw(7) << G4BestUnit(fTrackLAbs, "Length")
<< G4endl << " Gap: total energy: " << std::setw(7)
<< G4BestUnit(fEnergyGap, "Energy") << " total track length: " << std::setw(7)
<< G4BestUnit(fTrackLGap, "Length") << G4endl;
G4cout << "--> End of event " << eventID << "\n" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
}
} // namespace B4a
@@ -29,16 +29,13 @@
#include "PrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Event.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "globals.hh"
namespace B4
{
@@ -52,11 +49,10 @@ PrimaryGeneratorAction::PrimaryGeneratorAction()
// default particle kinematic
//
auto particleDefinition
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
auto particleDefinition = G4ParticleTable::GetParticleTable()->FindParticle("e-");
fParticleGun->SetParticleDefinition(particleDefinition);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleEnergy(300.*MeV);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
fParticleGun->SetParticleEnergy(300. * MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -68,7 +64,7 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
{
// This function is called at the begining of event
@@ -81,29 +77,27 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
// Check that the world volume has box shape
G4Box* worldBox = nullptr;
if ( worldLV ) {
if (worldLV) {
worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
}
if ( worldBox ) {
if (worldBox) {
worldZHalfLength = worldBox->GetZHalfLength();
}
else {
else {
G4ExceptionDescription msg;
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("PrimaryGeneratorAction::GeneratePrimaries()",
"MyCode0002", JustWarning, msg);
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()", "MyCode0002", JustWarning, msg);
}
// Set gun position
fParticleGun
->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
fParticleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(event);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4
+23 -31
View File
@@ -30,10 +30,10 @@
#include "RunAction.hh"
#include "G4AnalysisManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "globals.hh"
namespace B4
{
@@ -51,21 +51,21 @@ RunAction::RunAction()
auto analysisManager = G4AnalysisManager::Instance();
// Create directories
//analysisManager->SetHistoDirectoryName("histograms");
//analysisManager->SetNtupleDirectoryName("ntuple");
// analysisManager->SetHistoDirectoryName("histograms");
// analysisManager->SetNtupleDirectoryName("ntuple");
analysisManager->SetVerboseLevel(1);
analysisManager->SetNtupleMerging(true);
// Note: merging ntuples is available only with Root output
// Note: merging ntuples is available only with Root output
// Book histograms, ntuple
//
// Creating histograms
analysisManager->CreateH1("Eabs" ,"Edep in absorber", 110, 0., 330*MeV);
analysisManager->CreateH1("Egap" ,"Edep in gap", 100, 0., 30*MeV);
analysisManager->CreateH1("Labs" ,"trackL in absorber", 100, 0., 50*cm);
analysisManager->CreateH1("Lgap" ,"trackL in gap", 100, 0., 50*cm);
analysisManager->CreateH1("Eabs", "Edep in absorber", 110, 0., 330 * MeV);
analysisManager->CreateH1("Egap", "Edep in gap", 100, 0., 30 * MeV);
analysisManager->CreateH1("Labs", "trackL in absorber", 100, 0., 50 * cm);
analysisManager->CreateH1("Lgap", "trackL in gap", 100, 0., 50 * cm);
// Creating ntuple
//
analysisManager->CreateNtuple("B4", "Edep and TrackL");
@@ -80,8 +80,8 @@ RunAction::RunAction()
void RunAction::BeginOfRunAction(const G4Run* /*run*/)
{
//inform the runManager to save random number seed
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// inform the runManager to save random number seed
// G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// Get analysis manager
auto analysisManager = G4AnalysisManager::Instance();
@@ -104,34 +104,26 @@ void RunAction::EndOfRunAction(const G4Run* /*run*/)
// print histogram statistics
//
auto analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->GetH1(1) ) {
if (analysisManager->GetH1(1)) {
G4cout << G4endl << " ----> print histograms statistic ";
if(isMaster) {
if (isMaster) {
G4cout << "for the entire run " << G4endl << G4endl;
}
else {
G4cout << "for the local thread " << G4endl << G4endl;
}
G4cout << " EAbs : mean = "
<< G4BestUnit(analysisManager->GetH1(0)->mean(), "Energy")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(0)->rms(), "Energy") << G4endl;
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(1)->mean(), "Energy")
<< " rms = " << G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
G4cout << " LAbs : mean = "
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Length")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Length") << 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(3)->mean(), "Length")
<< " rms = " << G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
}
// save histograms & ntuple
@@ -142,4 +134,4 @@ void RunAction::EndOfRunAction(const G4Run* /*run*/)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4
+11 -11
View File
@@ -28,11 +28,12 @@
/// \brief Implementation of the B4a::SteppingAction class
#include "SteppingAction.hh"
#include "EventAction.hh"
#include "DetectorConstruction.hh"
#include "EventAction.hh"
#include "G4Step.hh"
#include "G4RunManager.hh"
#include "globals.hh"
using namespace B4;
@@ -43,15 +44,14 @@ namespace B4a
SteppingAction::SteppingAction(const DetectorConstruction* detConstruction,
EventAction* eventAction)
: fDetConstruction(detConstruction),
fEventAction(eventAction)
: fDetConstruction(detConstruction), fEventAction(eventAction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* step)
{
// Collect energy and track length step by step
// Collect energy and track length step by step
// get volume of the current step
auto volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
@@ -61,19 +61,19 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
// step length
G4double stepLength = 0.;
if ( step->GetTrack()->GetDefinition()->GetPDGCharge() != 0. ) {
if (step->GetTrack()->GetDefinition()->GetPDGCharge() != 0.) {
stepLength = step->GetStepLength();
}
if ( volume == fDetConstruction->GetAbsorberPV() ) {
fEventAction->AddAbs(edep,stepLength);
if (volume == fDetConstruction->GetAbsorberPV()) {
fEventAction->AddAbs(edep, stepLength);
}
if ( volume == fDetConstruction->GetGapPV() ) {
fEventAction->AddGap(edep,stepLength);
if (volume == fDetConstruction->GetGapPV()) {
fEventAction->AddGap(edep, stepLength);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4a
+29 -28
View File
@@ -27,37 +27,37 @@
/// \file exampleB4b.cc
/// \brief Main program of the B4b example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UIExecutive.hh"
#include "G4UIcommand.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "FTFP_BERT.hh"
#include "Randomize.hh"
// #include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace {
void PrintUsage() {
G4cerr << " Usage: " << G4endl;
G4cerr << " exampleB4b [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
<< G4endl;
G4cerr << " note: -t option is available only for multi-threaded mode."
<< G4endl;
}
namespace
{
void PrintUsage()
{
G4cerr << " Usage: " << G4endl;
G4cerr << " exampleB4b [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]" << G4endl;
G4cerr << " note: -t option is available only for multi-threaded mode." << G4endl;
}
} // namespace
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Evaluate arguments
//
if ( argc > 7 ) {
if (argc > 7) {
PrintUsage();
return 1;
}
@@ -68,15 +68,17 @@ int main(int argc,char** argv)
#ifdef G4MULTITHREADED
G4int nThreads = 0;
#endif
for ( G4int i=1; i<argc; i=i+2 ) {
if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
else if ( G4String(argv[i]) == "-u" ) session = argv[i+1];
for (G4int i = 1; i < argc; i = i + 2) {
if (G4String(argv[i]) == "-m")
macro = argv[i + 1];
else if (G4String(argv[i]) == "-u")
session = argv[i + 1];
#ifdef G4MULTITHREADED
else if ( G4String(argv[i]) == "-t" ) {
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
else if (G4String(argv[i]) == "-t") {
nThreads = G4UIcommand::ConvertToInt(argv[i + 1]);
}
#endif
else if ( G4String(argv[i]) == "-vDefault" ) {
else if (G4String(argv[i]) == "-vDefault") {
verboseBestUnits = false;
--i; // this option is not followed with a parameter
}
@@ -89,7 +91,7 @@ int main(int argc,char** argv)
// Detect interactive mode (if no macro provided) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( ! macro.size() ) {
if (!macro.size()) {
ui = new G4UIExecutive(argc, argv, session);
}
@@ -97,17 +99,16 @@ int main(int argc,char** argv)
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
// Use G4SteppingVerboseWithUnits
if ( verboseBestUnits ) {
if (verboseBestUnits) {
G4int precision = 8;
G4SteppingVerbose::UseBestUnit(precision);
}
// Construct the default run manager
//
auto runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
#ifdef G4MULTITHREADED
if ( nThreads > 0 ) {
if (nThreads > 0) {
runManager->SetNumberOfThreads(nThreads);
}
#endif
@@ -134,12 +135,12 @@ int main(int argc,char** argv)
// Process macro or start UI session
//
if ( macro.size() ) {
if (macro.size()) {
// batch mode
G4String command = "/control/execute ";
UImanager->ApplyCommand(command+macro);
UImanager->ApplyCommand(command + macro);
}
else {
else {
// interactive mode : define UI session
UImanager->ApplyCommand("/control/execute init_vis.mac");
if (ui->IsGUI()) {
+31 -24
View File
@@ -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
@@ -44,14 +44,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...
@@ -276,7 +283,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
@@ -831,7 +838,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
@@ -858,17 +865,17 @@ Setting was ignored.
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 265.781 MeV total track length: 19.326 cm
Gap: total energy: 21.0561 MeV total track length: 10.6454 cm
Absorber: total energy: 279.218 MeV total track length: 20.3807 cm
Gap: total energy: 19.7181 MeV total track length: 9.43835 cm
--> End of event 0
----> print histograms statistic for the entire run
EAbs : mean = 265.781 MeV rms = 0 eV
EGap : mean = 21.0561 MeV rms = 0 eV
LAbs : mean = 19.326 cm rms = 0 fm
LGap : mean = 10.6454 cm rms = 0 fm
EAbs : mean = 279.218 MeV rms = 0 eV
EGap : mean = 19.7181 MeV rms = 0 eV
LAbs : mean = 20.3807 cm rms = 0 fm
LGap : mean = 9.43835 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -939,17 +946,17 @@ hFritiofCaptureAtRest,hBertiniCaptureAtRest,muMinusCaptureAtRest, dInela
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 273.124 MeV total track length: 20.1646 cm
Gap: total energy: 16.2656 MeV total track length: 7.73372 cm
Absorber: total energy: 253.71 MeV total track length: 18.3379 cm
Gap: total energy: 18.1797 MeV total track length: 8.925 cm
--> End of event 0
----> print histograms statistic for the entire run
EAbs : mean = 273.124 MeV rms = 0 eV
EGap : mean = 16.2656 MeV rms = 0 eV
LAbs : mean = 20.1646 cm rms = 0 fm
LGap : mean = 7.73372 cm rms = 0 fm
EAbs : mean = 253.71 MeV rms = 0 eV
EGap : mean = 18.1797 MeV rms = 0 eV
LAbs : mean = 18.3379 cm rms = 0 fm
LGap : mean = 8.925 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -966,17 +973,17 @@ There are histograms that can be viewed with visualization:
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 465.716 MeV total track length: 34.0047 cm
Gap: total energy: 15.1463 MeV total track length: 7.88173 cm
Absorber: total energy: 437.115 MeV total track length: 31.5725 cm
Gap: total energy: 19.1128 MeV total track length: 8.67887 cm
--> End of event 0
----> print histograms statistic for the entire run
EAbs : mean = 0 eV rms = 0 eV
EGap : mean = 15.1463 MeV rms = 0 eV
LAbs : mean = 34.0047 cm rms = 0 fm
LGap : mean = 7.88173 cm rms = 0 fm
EGap : mean = 19.1128 MeV rms = 0 eV
LAbs : mean = 31.5725 cm rms = 0 fm
LGap : mean = 8.67887 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -32,10 +32,9 @@
#include "G4VUserActionInitialization.hh"
namespace B4
{
class DetectorConstruction;
class DetectorConstruction;
}
namespace B4b
@@ -56,8 +55,6 @@ class ActionInitialization : public G4VUserActionInitialization
B4::DetectorConstruction* fDetConstruction = nullptr;
};
}
} // namespace B4b
#endif
@@ -25,12 +25,14 @@
//
//
/// \file B4/B4b/include/DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
/// \brief Definition of the B4::DetectorConstruction class
#ifndef B4DetectorConstruction_h
#define B4DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4Threading.hh"
#include "globals.hh"
class G4VPhysicalVolume;
@@ -76,28 +78,29 @@ class DetectorConstruction : public G4VUserDetectorConstruction
// data members
//
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4VPhysicalVolume* fAbsorberPV = nullptr; // the absorber physical volume
G4VPhysicalVolume* fGapPV = nullptr; // the gap physical volume
G4VPhysicalVolume* fAbsorberPV = nullptr; // the absorber physical volume
G4VPhysicalVolume* fGapPV = nullptr; // the gap physical volume
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
};
// inline functions
inline const G4VPhysicalVolume* DetectorConstruction::GetAbsorberPV() const {
inline const G4VPhysicalVolume* DetectorConstruction::GetAbsorberPV() const
{
return fAbsorberPV;
}
inline const G4VPhysicalVolume* DetectorConstruction::GetGapPV() const {
inline const G4VPhysicalVolume* DetectorConstruction::GetGapPV() const
{
return fGapPV;
}
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
+7 -7
View File
@@ -33,6 +33,8 @@
#include "G4UserEventAction.hh"
#include "globals.hh"
class G4Event;
namespace B4b
{
@@ -48,19 +50,17 @@ class EventAction : public G4UserEventAction
EventAction() = default;
~EventAction() override = default;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
private:
// methods
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const;
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep,
G4double gapTrackLength) const;
};
}
} // namespace B4b
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -25,13 +25,12 @@
//
//
/// \file B4/B4b/include/PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
/// \brief Definition of the B4::PrimaryGeneratorAction class
#ifndef B4PrimaryGeneratorAction_h
#define B4PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
@@ -48,17 +47,17 @@ namespace B4
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event* event) override;
void GeneratePrimaries(G4Event* event) override;
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
};
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+2 -4
View File
@@ -31,7 +31,6 @@
#define B4bRunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
@@ -65,12 +64,11 @@ class RunAction : public G4UserRunAction
G4Run* GenerateRun() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
};
}
} // namespace B4b
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
+23 -20
View File
@@ -59,48 +59,51 @@ const G4int kDim = 2;
class RunData : public G4Run
{
public:
RunData() = default;
~RunData() override = default;
public:
RunData() = default;
~RunData() override = default;
void Add(G4int id, G4double de, G4double dl);
void FillPerEvent();
void Add(G4int id, G4double de, G4double dl);
void FillPerEvent();
void Reset();
void Reset();
// Get methods
G4String GetVolumeName(G4int id) const;
G4double GetEdep(G4int id) const;
G4double GetTrackLength(G4int id) const;
// Get methods
G4String GetVolumeName(G4int id) const;
G4double GetEdep(G4int id) const;
G4double GetTrackLength(G4int id) const;
private:
std::array<G4String, kDim> fVolumeNames = { "Absorber", "Gap" };
std::array<G4double, kDim> fEdep = { 0., 0. };
std::array<G4double, kDim> fTrackLength = { 0., 0. };
private:
std::array<G4String, kDim> fVolumeNames = {"Absorber", "Gap"};
std::array<G4double, kDim> fEdep = {0., 0.};
std::array<G4double, kDim> fTrackLength = {0., 0.};
};
// inline functions
inline void RunData::Add(G4int id, G4double de, G4double dl) {
inline void RunData::Add(G4int id, G4double de, G4double dl)
{
fEdep[id] += de;
fTrackLength[id] += dl;
}
inline G4String RunData::GetVolumeName(G4int id) const {
inline G4String RunData::GetVolumeName(G4int id) const
{
return fVolumeNames[id];
}
inline G4double RunData::GetEdep(G4int id) const {
inline G4double RunData::GetEdep(G4int id) const
{
return fEdep[id];
}
inline G4double RunData::GetTrackLength(G4int id) const {
inline G4double RunData::GetTrackLength(G4int id) const
{
return fTrackLength[id];
}
}
} // namespace B4b
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -32,6 +32,8 @@
#include "G4UserSteppingAction.hh"
class G4Step;
namespace B4
{
class DetectorConstruction;
@@ -48,17 +50,17 @@ namespace B4b
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(const B4::DetectorConstruction* detConstruction);
~SteppingAction() override = default;
public:
SteppingAction(const B4::DetectorConstruction* detConstruction);
~SteppingAction() override = default;
void UserSteppingAction(const G4Step* step) override;
void UserSteppingAction(const G4Step* step) override;
private:
const B4::DetectorConstruction* fDetConstruction = nullptr;
private:
const B4::DetectorConstruction* fDetConstruction = nullptr;
};
}
} // namespace B4b
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,12 +28,11 @@
/// \brief Implementation of the B4b::ActionInitialization class
#include "ActionInitialization.hh"
#include "EventAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "G4MTRunManager.hh"
#include "DetectorConstruction.hh"
using namespace B4;
@@ -43,7 +42,7 @@ namespace B4b
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization(DetectorConstruction* detConstruction)
: fDetConstruction(detConstruction)
: fDetConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -65,4 +64,4 @@ void ActionInitialization::Build() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4b
+85 -115
View File
@@ -25,38 +25,29 @@
//
//
/// \file B4/B4b/src/DetectorConstruction.cc
/// \brief Implementation of the B4:DetectorConstruction class
/// \brief Implementation of the B4::DetectorConstruction class
#include "DetectorConstruction.hh"
#include "G4AutoDelete.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4AutoDelete.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
namespace B4
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
G4ThreadLocal G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -81,12 +72,12 @@ void DetectorConstruction::DefineMaterials()
G4double a; // mass of a mole;
G4double z; // z=mean number of protons;
G4double density;
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
// The argon by NIST Manager is a gas with a different density
new G4Material("liquidArgon", z = 18., a = 39.95 * g / mole, density = 1.390 * g / cm3);
// The argon by NIST Manager is a gas with a different density
// Vacuum
new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
kStateGas, 2.73*kelvin, 3.e-18*pascal);
new G4Material("Galactic", z = 1., a = 1.01 * g / mole, density = universe_mean_density,
kStateGas, 2.73 * kelvin, 3.e-18 * pascal);
// Print materials
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
@@ -98,147 +89,127 @@ G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
{
// Geometry parameters
G4int nofLayers = 10;
G4double absoThickness = 10.*mm;
G4double gapThickness = 5.*mm;
G4double calorSizeXY = 10.*cm;
G4double absoThickness = 10. * mm;
G4double gapThickness = 5. * mm;
G4double calorSizeXY = 10. * cm;
auto layerThickness = absoThickness + gapThickness;
auto calorThickness = nofLayers * layerThickness;
auto worldSizeXY = 1.2 * calorSizeXY;
auto worldSizeZ = 1.2 * calorThickness;
auto worldSizeZ = 1.2 * calorThickness;
// Get materials
auto defaultMaterial = G4Material::GetMaterial("Galactic");
auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
auto gapMaterial = G4Material::GetMaterial("liquidArgon");
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
if (!defaultMaterial || !absorberMaterial || !gapMaterial) {
G4ExceptionDescription msg;
msg << "Cannot retrieve materials already defined.";
G4Exception("DetectorConstruction::DefineVolumes()",
"MyCode0001", FatalException, msg);
G4Exception("DetectorConstruction::DefineVolumes()", "MyCode0001", FatalException, msg);
}
//
// World
//
auto worldS
= new G4Box("World", // its name
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
auto worldS = new G4Box("World", // its name
worldSizeXY / 2, worldSizeXY / 2, worldSizeZ / 2); // its size
auto worldLV
= new G4LogicalVolume(
worldS, // its solid
defaultMaterial, // its material
"World"); // its name
auto worldLV = new G4LogicalVolume(worldS, // its solid
defaultMaterial, // its material
"World"); // its name
auto worldPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Calorimeter
//
auto calorimeterS
= new G4Box("Calorimeter", // its name
calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
auto calorimeterS = new G4Box("Calorimeter", // its name
calorSizeXY / 2, calorSizeXY / 2, calorThickness / 2); // its size
auto calorLV
= new G4LogicalVolume(
calorimeterS, // its solid
defaultMaterial, // its material
"Calorimeter"); // its name
auto calorLV = new G4LogicalVolume(calorimeterS, // its solid
defaultMaterial, // its material
"Calorimeter"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
calorLV, // its logical volume
"Calorimeter", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4ThreeVector(), // at (0,0,0)
calorLV, // its logical volume
"Calorimeter", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Layer
//
auto layerS
= new G4Box("Layer", // its name
calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
auto layerS = new G4Box("Layer", // its name
calorSizeXY / 2, calorSizeXY / 2, layerThickness / 2); // its size
auto layerLV
= new G4LogicalVolume(
layerS, // its solid
defaultMaterial, // its material
"Layer"); // its name
auto layerLV = new G4LogicalVolume(layerS, // its solid
defaultMaterial, // its material
"Layer"); // its name
new G4PVReplica(
"Layer", // its name
layerLV, // its logical volume
calorLV, // its mother
kZAxis, // axis of replication
nofLayers, // number of replica
layerThickness); // witdth of replica
new G4PVReplica("Layer", // its name
layerLV, // its logical volume
calorLV, // its mother
kZAxis, // axis of replication
nofLayers, // number of replica
layerThickness); // witdth of replica
//
// Absorber
//
auto absorberS
= new G4Box("Abso", // its name
calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
auto absorberS = new G4Box("Abso", // its name
calorSizeXY / 2, calorSizeXY / 2, absoThickness / 2); // its size
auto absorberLV
= new G4LogicalVolume(
absorberS, // its solid
absorberMaterial, // its material
"Abso"); // its name
auto absorberLV = new G4LogicalVolume(absorberS, // its solid
absorberMaterial, // its material
"Abso"); // its name
fAbsorberPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., -gapThickness / 2), // its position
absorberLV, // its logical volume
"Abso", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
fAbsorberPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., -gapThickness / 2), // its position
absorberLV, // its logical volume
"Abso", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Gap
//
auto gapS
= new G4Box("Gap", // its name
calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
auto gapS = new G4Box("Gap", // its name
calorSizeXY / 2, calorSizeXY / 2, gapThickness / 2); // its size
auto gapLV
= new G4LogicalVolume(
gapS, // its solid
gapMaterial, // its material
"Gap"); // its name
auto gapLV = new G4LogicalVolume(gapS, // its solid
gapMaterial, // its material
"Gap"); // its name
fGapPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., absoThickness / 2), // its position
gapLV, // its logical volume
"Gap", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
fGapPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., absoThickness / 2), // its position
gapLV, // its logical volume
"Gap", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// print parameters
//
G4cout
<< G4endl
<< "------------------------------------------------------------" << G4endl
<< "---> The calorimeter is " << nofLayers << " layers of: [ "
<< absoThickness/mm << "mm of " << absorberMaterial->GetName()
<< " + "
<< gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
<< "------------------------------------------------------------" << G4endl;
G4cout << G4endl << "------------------------------------------------------------" << G4endl
<< "---> The calorimeter is " << nofLayers << " layers of: [ " << absoThickness / mm
<< "mm of " << absorberMaterial->GetName() << " + " << gapThickness / mm << "mm of "
<< gapMaterial->GetName() << " ] " << G4endl
<< "------------------------------------------------------------" << G4endl;
//
// Visualization attributes
@@ -269,5 +240,4 @@ void DetectorConstruction::ConstructSDandField()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4
+18 -32
View File
@@ -28,13 +28,13 @@
/// \brief Implementation of the B4b::EventAction class
#include "EventAction.hh"
#include "RunData.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include <iomanip>
namespace B4b
@@ -42,31 +42,22 @@ namespace B4b
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::PrintEventStatistics(
G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const
{
void EventAction::PrintEventStatistics(G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const
{
// print event statistics
G4cout
<< " Absorber: total energy: "
<< std::setw(7) << G4BestUnit(absoEdep, "Energy")
<< " total track length: "
<< std::setw(7) << G4BestUnit(absoTrackLength, "Length")
<< G4endl
<< " Gap: total energy: "
<< std::setw(7) << G4BestUnit(gapEdep, "Energy")
<< " total track length: "
<< std::setw(7) << G4BestUnit(gapTrackLength, "Length")
<< G4endl;
G4cout << " Absorber: total energy: " << std::setw(7) << G4BestUnit(absoEdep, "Energy")
<< " total track length: " << std::setw(7) << G4BestUnit(absoTrackLength, "Length")
<< G4endl << " Gap: total energy: " << std::setw(7) << G4BestUnit(gapEdep, "Energy")
<< " total track length: " << std::setw(7) << G4BestUnit(gapTrackLength, "Length")
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event* /*event*/)
{
auto runData
= static_cast<RunData*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
auto runData = static_cast<RunData*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
runData->Reset();
}
@@ -74,25 +65,20 @@ void EventAction::BeginOfEventAction(const G4Event* /*event*/)
void EventAction::EndOfEventAction(const G4Event* event)
{
auto runData
= static_cast<RunData*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
auto runData = static_cast<RunData*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
runData->FillPerEvent();
//print per event (modulo n)
// print per event (modulo n)
//
auto eventID = event->GetEventID();
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
PrintEventStatistics(
runData->GetEdep(kAbs),
runData->GetTrackLength(kAbs),
runData->GetEdep(kGap),
runData->GetTrackLength(kGap));
G4cout << "--> End of event " << eventID << "\n" << G4endl;
if ((printModulo > 0) && (eventID % printModulo == 0)) {
PrintEventStatistics(runData->GetEdep(kAbs), runData->GetTrackLength(kAbs),
runData->GetEdep(kGap), runData->GetTrackLength(kGap));
G4cout << "--> End of event " << eventID << "\n" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4b
@@ -29,16 +29,13 @@
#include "PrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Event.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "globals.hh"
namespace B4
{
@@ -52,11 +49,10 @@ PrimaryGeneratorAction::PrimaryGeneratorAction()
// default particle kinematic
//
auto particleDefinition
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
auto particleDefinition = G4ParticleTable::GetParticleTable()->FindParticle("e-");
fParticleGun->SetParticleDefinition(particleDefinition);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleEnergy(300.*MeV);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
fParticleGun->SetParticleEnergy(300. * MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -68,7 +64,7 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
{
// This function is called at the begining of event
@@ -81,29 +77,27 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
// Check that the world volume has box shape
G4Box* worldBox = nullptr;
if ( worldLV ) {
if (worldLV) {
worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
}
if ( worldBox ) {
if (worldBox) {
worldZHalfLength = worldBox->GetZHalfLength();
}
else {
else {
G4ExceptionDescription msg;
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("PrimaryGeneratorAction::GeneratePrimaries()",
"MyCode0002", JustWarning, msg);
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()", "MyCode0002", JustWarning, msg);
}
// Set gun position
fParticleGun
->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
fParticleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(event);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4
+25 -32
View File
@@ -28,13 +28,15 @@
/// \brief Implementation of the B4b::RunAction class
#include "RunAction.hh"
#include "RunData.hh"
#include "G4AnalysisManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "globals.hh"
namespace B4b
{
@@ -52,21 +54,21 @@ RunAction::RunAction()
auto analysisManager = G4AnalysisManager::Instance();
// Create directories
//analysisManager->SetHistoDirectoryName("histograms");
//analysisManager->SetNtupleDirectoryName("ntuple");
// analysisManager->SetHistoDirectoryName("histograms");
// analysisManager->SetNtupleDirectoryName("ntuple");
analysisManager->SetVerboseLevel(1);
analysisManager->SetNtupleMerging(true);
// Note: merging ntuples is available only with Root output
// Note: merging ntuples is available only with Root output
// Book histograms, ntuple
//
// Creating histograms
analysisManager->CreateH1("Eabs" ,"Edep in absorber", 110, 0., 330*MeV);
analysisManager->CreateH1("Egap" ,"Edep in gap", 100, 0., 30*MeV);
analysisManager->CreateH1("Labs" ,"trackL in absorber", 100, 0., 50*cm);
analysisManager->CreateH1("Lgap" ,"trackL in gap", 100, 0., 50*cm);
analysisManager->CreateH1("Eabs", "Edep in absorber", 110, 0., 330 * MeV);
analysisManager->CreateH1("Egap", "Edep in gap", 100, 0., 30 * MeV);
analysisManager->CreateH1("Labs", "trackL in absorber", 100, 0., 50 * cm);
analysisManager->CreateH1("Lgap", "trackL in gap", 100, 0., 50 * cm);
// Creating ntuple
//
analysisManager->CreateNtuple("B4", "Edep and TrackL");
@@ -90,8 +92,8 @@ void RunAction::BeginOfRunAction(const G4Run* run)
{
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
//inform the runManager to save random number seed
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// inform the runManager to save random number seed
// G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// Get analysis manager
auto analysisManager = G4AnalysisManager::Instance();
@@ -109,48 +111,39 @@ void RunAction::BeginOfRunAction(const G4Run* run)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run* /*aRun*/)
void RunAction::EndOfRunAction(const G4Run* /*run*/)
{
// print histogram statistics
//
auto analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->GetH1(1) ) {
if (analysisManager->GetH1(1)) {
G4cout << G4endl << " ----> print histograms statistic ";
if(isMaster) {
if (isMaster) {
G4cout << "for the entire run " << G4endl << G4endl;
}
else {
G4cout << "for the local thread " << G4endl << G4endl;
}
G4cout << " EAbs : mean = "
<< G4BestUnit(analysisManager->GetH1(0)->mean(), "Energy")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(0)->rms(), "Energy") << G4endl;
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(1)->mean(), "Energy")
<< " rms = " << G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
G4cout << " LAbs : mean = "
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Length")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Length") << 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(3)->mean(), "Length")
<< " rms = " << G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
}
// save histograms & ntuple
//
analysisManager->Write();
analysisManager->CloseFile();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4b
+6 -8
View File
@@ -30,8 +30,6 @@
#include "RunData.hh"
#include "G4AnalysisManager.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
namespace B4b
{
@@ -46,15 +44,15 @@ void RunData::FillPerEvent()
// accumulate statistic
// in the order of the histograms, ntuple columns declarations
G4int counter = 0;
for ( auto edep : fEdep ) {
for (auto edep : fEdep) {
analysisManager->FillH1(counter, edep);
analysisManager->FillNtupleDColumn(counter++, edep);
}
for ( auto trackLength : fTrackLength ) {
for (auto trackLength : fTrackLength) {
analysisManager->FillH1(counter, trackLength);
analysisManager->FillNtupleDColumn(counter++, trackLength);
}
analysisManager->AddNtupleRow();
}
@@ -62,14 +60,14 @@ void RunData::FillPerEvent()
void RunData::Reset()
{
for ( auto& edep : fEdep ) {
for (auto& edep : fEdep) {
edep = 0.;
}
for ( auto& trackLength : fTrackLength ) {
for (auto& trackLength : fTrackLength) {
trackLength = 0.;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4b
+11 -12
View File
@@ -28,11 +28,12 @@
/// \brief Implementation of the B4b::SteppingAction class
#include "SteppingAction.hh"
#include "RunData.hh"
#include "DetectorConstruction.hh"
#include "G4Step.hh"
#include "DetectorConstruction.hh"
#include "RunData.hh"
#include "G4RunManager.hh"
#include "G4Step.hh"
using namespace B4;
@@ -43,14 +44,13 @@ namespace B4b
SteppingAction::SteppingAction(const DetectorConstruction* detConstruction)
: fDetConstruction(detConstruction)
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* step)
{
// Collect energy and track length step by step
// Collect energy and track length step by step
// get volume of the current step
auto volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
@@ -60,22 +60,21 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
// step length
G4double stepLength = 0.;
if ( step->GetTrack()->GetDefinition()->GetPDGCharge() != 0. ) {
if (step->GetTrack()->GetDefinition()->GetPDGCharge() != 0.) {
stepLength = step->GetStepLength();
}
auto runData = static_cast<RunData*>
(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
auto runData = static_cast<RunData*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
if ( volume == fDetConstruction->GetAbsorberPV() ) {
if (volume == fDetConstruction->GetAbsorberPV()) {
runData->Add(kAbs, edep, stepLength);
}
if ( volume == fDetConstruction->GetGapPV() ) {
if (volume == fDetConstruction->GetGapPV()) {
runData->Add(kGap, edep, stepLength);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4b
+29 -28
View File
@@ -27,37 +27,37 @@
/// \file exampleB4c.cc
/// \brief Main program of the B4c example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UIExecutive.hh"
#include "G4UIcommand.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "FTFP_BERT.hh"
#include "Randomize.hh"
// #include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace {
void PrintUsage() {
G4cerr << " Usage: " << G4endl;
G4cerr << " exampleB4c [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
<< G4endl;
G4cerr << " note: -t option is available only for multi-threaded mode."
<< G4endl;
}
namespace
{
void PrintUsage()
{
G4cerr << " Usage: " << G4endl;
G4cerr << " exampleB4c [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]" << G4endl;
G4cerr << " note: -t option is available only for multi-threaded mode." << G4endl;
}
} // namespace
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Evaluate arguments
//
if ( argc > 7 ) {
if (argc > 7) {
PrintUsage();
return 1;
}
@@ -68,15 +68,17 @@ int main(int argc,char** argv)
#ifdef G4MULTITHREADED
G4int nThreads = 0;
#endif
for ( G4int i=1; i<argc; i=i+2 ) {
if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
else if ( G4String(argv[i]) == "-u" ) session = argv[i+1];
for (G4int i = 1; i < argc; i = i + 2) {
if (G4String(argv[i]) == "-m")
macro = argv[i + 1];
else if (G4String(argv[i]) == "-u")
session = argv[i + 1];
#ifdef G4MULTITHREADED
else if ( G4String(argv[i]) == "-t" ) {
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
else if (G4String(argv[i]) == "-t") {
nThreads = G4UIcommand::ConvertToInt(argv[i + 1]);
}
#endif
else if ( G4String(argv[i]) == "-vDefault" ) {
else if (G4String(argv[i]) == "-vDefault") {
verboseBestUnits = false;
--i; // this option is not followed with a parameter
}
@@ -89,7 +91,7 @@ int main(int argc,char** argv)
// Detect interactive mode (if no macro provided) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( ! macro.size() ) {
if (!macro.size()) {
ui = new G4UIExecutive(argc, argv, session);
}
@@ -97,17 +99,16 @@ int main(int argc,char** argv)
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
// Use G4SteppingVerboseWithUnits
if ( verboseBestUnits ) {
if (verboseBestUnits) {
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
}
// Construct the default run manager
//
auto runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
#ifdef G4MULTITHREADED
if ( nThreads > 0 ) {
if (nThreads > 0) {
runManager->SetNumberOfThreads(nThreads);
}
#endif
@@ -134,12 +135,12 @@ int main(int argc,char** argv)
// Process macro or start UI session
//
if ( macro.size() ) {
if (macro.size()) {
// batch mode
G4String command = "/control/execute ";
UImanager->ApplyCommand(command+macro);
UImanager->ApplyCommand(command + macro);
}
else {
else {
// interactive mode : define UI session
UImanager->ApplyCommand("/control/execute init_vis.mac");
if (ui->IsGUI()) {
+31 -24
View File
@@ -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
@@ -44,14 +44,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...
@@ -276,7 +283,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
@@ -831,7 +838,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
@@ -857,17 +864,17 @@ Setting was ignored.
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 265.781 MeV total track length: 19.326 cm
Gap: total energy: 21.0561 MeV total track length: 10.6454 cm
Absorber: total energy: 279.218 MeV total track length: 20.3807 cm
Gap: total energy: 19.7181 MeV total track length: 9.43835 cm
--> End of event: 0
----> print histograms statistic for the entire run
EAbs : mean = 265.781 MeV rms = 0 eV
EGap : mean = 21.0561 MeV rms = 0 eV
LAbs : mean = 19.326 cm rms = 0 fm
LGap : mean = 10.6454 cm rms = 0 fm
EAbs : mean = 279.218 MeV rms = 0 eV
EGap : mean = 19.7181 MeV rms = 0 eV
LAbs : mean = 20.3807 cm rms = 0 fm
LGap : mean = 9.43835 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -937,17 +944,17 @@ hFritiofCaptureAtRest,hBertiniCaptureAtRest,muMinusCaptureAtRest, dInela
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 273.124 MeV total track length: 20.1646 cm
Gap: total energy: 16.2656 MeV total track length: 7.73372 cm
Absorber: total energy: 253.71 MeV total track length: 18.3379 cm
Gap: total energy: 18.1797 MeV total track length: 8.925 cm
--> End of event: 0
----> print histograms statistic for the entire run
EAbs : mean = 273.124 MeV rms = 0 eV
EGap : mean = 16.2656 MeV rms = 0 eV
LAbs : mean = 20.1646 cm rms = 0 fm
LGap : mean = 7.73372 cm rms = 0 fm
EAbs : mean = 253.71 MeV rms = 0 eV
EGap : mean = 18.1797 MeV rms = 0 eV
LAbs : mean = 18.3379 cm rms = 0 fm
LGap : mean = 8.925 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -963,17 +970,17 @@ There are histograms that can be viewed with visualization:
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 465.716 MeV total track length: 34.0047 cm
Gap: total energy: 15.1463 MeV total track length: 7.88173 cm
Absorber: total energy: 437.115 MeV total track length: 31.5725 cm
Gap: total energy: 19.1128 MeV total track length: 8.67887 cm
--> End of event: 0
----> print histograms statistic for the entire run
EAbs : mean = 0 eV rms = 0 eV
EGap : mean = 15.1463 MeV rms = 0 eV
LAbs : mean = 34.0047 cm rms = 0 fm
LGap : mean = 7.88173 cm rms = 0 fm
EGap : mean = 19.1128 MeV rms = 0 eV
LAbs : mean = 31.5725 cm rms = 0 fm
LGap : mean = 8.67887 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -47,8 +47,6 @@ class ActionInitialization : public G4VUserActionInitialization
void Build() const override;
};
}
} // namespace B4c
#endif
+19 -15
View File
@@ -30,11 +30,12 @@
#ifndef B4cCalorHit_h
#define B4cCalorHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4THitsCollection.hh"
#include "G4Threading.hh"
#include "G4ThreeVector.hh"
#include "G4VHit.hh"
#include "globals.hh"
namespace B4c
{
@@ -57,10 +58,10 @@ class CalorHit : public G4VHit
G4bool operator==(const CalorHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
inline void operator delete(void*);
// methods from base class
void Draw() override{}
void Draw() override {}
void Print() override;
// methods to handle data
@@ -71,8 +72,8 @@ class CalorHit : public G4VHit
G4double GetTrackLength() const;
private:
G4double fEdep = 0.; ///< Energy deposit in the sensitive volume
G4double fTrackLength = 0.; ///< Track length in the sensitive volume
G4double fEdep = 0.; ///< Energy deposit in the sensitive volume
G4double fTrackLength = 0.; ///< Track length in the sensitive volume
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -88,33 +89,36 @@ inline void* CalorHit::operator new(size_t)
if (!CalorHitAllocator) {
CalorHitAllocator = new G4Allocator<CalorHit>;
}
void *hit;
hit = (void *) CalorHitAllocator->MallocSingle();
void* hit;
hit = (void*)CalorHitAllocator->MallocSingle();
return hit;
}
inline void CalorHit::operator delete(void *hit)
inline void CalorHit::operator delete(void* hit)
{
if (!CalorHitAllocator) {
CalorHitAllocator = new G4Allocator<CalorHit>;
}
CalorHitAllocator->FreeSingle((CalorHit*) hit);
CalorHitAllocator->FreeSingle((CalorHit*)hit);
}
inline void CalorHit::Add(G4double de, G4double dl) {
inline void CalorHit::Add(G4double de, G4double dl)
{
fEdep += de;
fTrackLength += dl;
}
inline G4double CalorHit::GetEdep() const {
inline G4double CalorHit::GetEdep() const
{
return fEdep;
}
inline G4double CalorHit::GetTrackLength() const {
inline G4double CalorHit::GetTrackLength() const
{
return fTrackLength;
}
}
} // namespace B4c
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+7 -10
View File
@@ -30,14 +30,14 @@
#ifndef B4cCalorimeterSD_h
#define B4cCalorimeterSD_h 1
#include "G4VSensitiveDetector.hh"
#include "CalorHit.hh"
#include <vector>
#include "G4VSensitiveDetector.hh"
#include "globals.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
namespace B4c
{
@@ -53,24 +53,21 @@ namespace B4c
class CalorimeterSD : public G4VSensitiveDetector
{
public:
CalorimeterSD(const G4String& name,
const G4String& hitsCollectionName,
G4int nofCells);
CalorimeterSD(const G4String& name, const G4String& hitsCollectionName, G4int nofCells);
~CalorimeterSD() override = default;
// methods from base class
void Initialize(G4HCofThisEvent* hitCollection) override;
void Initialize(G4HCofThisEvent* hitCollection) override;
G4bool ProcessHits(G4Step* step, G4TouchableHistory* history) override;
void EndOfEvent(G4HCofThisEvent* hitCollection) override;
void EndOfEvent(G4HCofThisEvent* hitCollection) override;
private:
CalorHitsCollection* fHitsCollection = nullptr;
G4int fNofCells = 0;
};
}
} // namespace B4c
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -31,6 +31,8 @@
#define B4cDetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4Threading.hh"
#include "globals.hh"
class G4VPhysicalVolume;
@@ -73,16 +75,15 @@ class DetectorConstruction : public G4VUserDetectorConstruction
// data members
//
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
G4int fNofLayers = -1; // number of layers
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
G4int fNofLayers = -1; // number of layers
};
}
} // namespace B4c
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
+16 -17
View File
@@ -36,6 +36,8 @@
#include "globals.hh"
class G4Event;
namespace B4c
{
@@ -47,29 +49,26 @@ namespace B4c
class EventAction : public G4UserEventAction
{
public:
EventAction() = default;
~EventAction() override = default;
public:
EventAction() = default;
~EventAction() override = default;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
private:
// methods
CalorHitsCollection* GetHitsCollection(G4int hcID,
const G4Event* event) const;
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const;
private:
// methods
CalorHitsCollection* GetHitsCollection(G4int hcID, const G4Event* event) const;
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep,
G4double gapTrackLength) const;
// data members
G4int fAbsHCID = -1;
G4int fGapHCID = -1;
// data members
G4int fAbsHCID = -1;
G4int fGapHCID = -1;
};
}
} // namespace B4c
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -25,13 +25,12 @@
//
//
/// \file B4/B4c/include/PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
/// \brief Definition of the B4::PrimaryGeneratorAction class
#ifndef B4PrimaryGeneratorAction_h
#define B4PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
@@ -48,17 +47,17 @@ namespace B4
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event* event) override;
void GeneratePrimaries(G4Event* event) override;
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
};
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+2 -4
View File
@@ -31,7 +31,6 @@
#define B4RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
@@ -63,12 +62,11 @@ class RunAction : public G4UserRunAction
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
};
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -28,9 +28,10 @@
/// \brief Implementation of the B4c::ActionInitialization class
#include "ActionInitialization.hh"
#include "EventAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
using namespace B4;
@@ -55,4 +56,4 @@ void ActionInitialization::Build() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4c
+5 -12
View File
@@ -28,11 +28,8 @@
/// \brief Implementation of the B4c::CalorHit class
#include "CalorHit.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include <iomanip>
@@ -45,21 +42,17 @@ G4ThreadLocal G4Allocator<CalorHit>* CalorHitAllocator = nullptr;
G4bool CalorHit::operator==(const CalorHit& right) const
{
return ( this == &right ) ? true : false;
return (this == &right) ? true : false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void CalorHit::Print()
{
G4cout
<< "Edep: "
<< std::setw(7) << G4BestUnit(fEdep,"Energy")
<< " track length: "
<< std::setw(7) << G4BestUnit( fTrackLength,"Length")
<< G4endl;
G4cout << "Edep: " << std::setw(7) << G4BestUnit(fEdep, "Energy")
<< " track length: " << std::setw(7) << G4BestUnit(fTrackLength, "Length") << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4c
+21 -30
View File
@@ -28,22 +28,19 @@
/// \brief Implementation of the B4c::CalorimeterSD class
#include "CalorimeterSD.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
#include "G4Step.hh"
namespace B4c
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
CalorimeterSD::CalorimeterSD(const G4String& name,
const G4String& hitsCollectionName,
CalorimeterSD::CalorimeterSD(const G4String& name, const G4String& hitsCollectionName,
G4int nofCells)
: G4VSensitiveDetector(name),
fNofCells(nofCells)
: G4VSensitiveDetector(name), fNofCells(nofCells)
{
collectionName.insert(hitsCollectionName);
}
@@ -53,36 +50,33 @@ CalorimeterSD::CalorimeterSD(const G4String& name,
void CalorimeterSD::Initialize(G4HCofThisEvent* hce)
{
// Create hits collection
fHitsCollection
= new CalorHitsCollection(SensitiveDetectorName, collectionName[0]);
fHitsCollection = new CalorHitsCollection(SensitiveDetectorName, collectionName[0]);
// Add this collection in hce
auto hcID
= G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
hce->AddHitsCollection( hcID, fHitsCollection );
auto hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
hce->AddHitsCollection(hcID, fHitsCollection);
// Create hits
// fNofCells for cells + one more for total sums
for (G4int i=0; i<fNofCells+1; i++ ) {
for (G4int i = 0; i < fNofCells + 1; i++) {
fHitsCollection->insert(new CalorHit());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool CalorimeterSD::ProcessHits(G4Step* step,
G4TouchableHistory*)
G4bool CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
// energy deposit
auto edep = step->GetTotalEnergyDeposit();
// step length
G4double stepLength = 0.;
if ( step->GetTrack()->GetDefinition()->GetPDGCharge() != 0. ) {
if (step->GetTrack()->GetDefinition()->GetPDGCharge() != 0.) {
stepLength = step->GetStepLength();
}
if ( edep==0. && stepLength == 0. ) return false;
if (edep == 0. && stepLength == 0.) return false;
auto touchable = (step->GetPreStepPoint()->GetTouchable());
@@ -91,16 +85,14 @@ G4bool CalorimeterSD::ProcessHits(G4Step* step,
// Get hit accounting data for this cell
auto hit = (*fHitsCollection)[layerNumber];
if ( ! hit ) {
if (!hit) {
G4ExceptionDescription msg;
msg << "Cannot access hit " << layerNumber;
G4Exception("CalorimeterSD::ProcessHits()",
"MyCode0004", FatalException, msg);
G4Exception("CalorimeterSD::ProcessHits()", "MyCode0004", FatalException, msg);
}
// Get hit for total accounting
auto hitTotal
= (*fHitsCollection)[fHitsCollection->entries()-1];
auto hitTotal = (*fHitsCollection)[fHitsCollection->entries() - 1];
// Add values
hit->Add(edep, stepLength);
@@ -113,16 +105,15 @@ G4bool CalorimeterSD::ProcessHits(G4Step* step,
void CalorimeterSD::EndOfEvent(G4HCofThisEvent*)
{
if ( verboseLevel>1 ) {
auto nofHits = fHitsCollection->entries();
G4cout
<< G4endl
<< "-------->Hits Collection: in this event they are " << nofHits
<< " hits in the tracker chambers: " << G4endl;
for ( std::size_t i=0; i<nofHits; ++i ) (*fHitsCollection)[i]->Print();
if (verboseLevel > 1) {
auto nofHits = fHitsCollection->entries();
G4cout << G4endl << "-------->Hits Collection: in this event they are " << nofHits
<< " hits in the tracker chambers: " << G4endl;
for (std::size_t i = 0; i < nofHits; ++i)
(*fHitsCollection)[i]->Print();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4c
+91 -116
View File
@@ -28,32 +28,29 @@
/// \brief Implementation of the B4c::DetectorConstruction class
#include "DetectorConstruction.hh"
#include "CalorimeterSD.hh"
#include "G4AutoDelete.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4AutoDelete.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4PhysicalConstants.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
namespace B4c
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
G4ThreadLocal G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -78,12 +75,12 @@ void DetectorConstruction::DefineMaterials()
G4double a; // mass of a mole;
G4double z; // z=mean number of protons;
G4double density;
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
// The argon by NIST Manager is a gas with a different density
new G4Material("liquidArgon", z = 18., a = 39.95 * g / mole, density = 1.390 * g / cm3);
// The argon by NIST Manager is a gas with a different density
// Vacuum
new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
kStateGas, 2.73*kelvin, 3.e-18*pascal);
new G4Material("Galactic", z = 1., a = 1.01 * g / mole, density = universe_mean_density,
kStateGas, 2.73 * kelvin, 3.e-18 * pascal);
// Print materials
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
@@ -95,147 +92,127 @@ G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
{
// Geometry parameters
fNofLayers = 10;
G4double absoThickness = 10.*mm;
G4double gapThickness = 5.*mm;
G4double calorSizeXY = 10.*cm;
G4double absoThickness = 10. * mm;
G4double gapThickness = 5. * mm;
G4double calorSizeXY = 10. * cm;
auto layerThickness = absoThickness + gapThickness;
auto calorThickness = fNofLayers * layerThickness;
auto worldSizeXY = 1.2 * calorSizeXY;
auto worldSizeZ = 1.2 * calorThickness;
auto worldSizeZ = 1.2 * calorThickness;
// Get materials
auto defaultMaterial = G4Material::GetMaterial("Galactic");
auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
auto gapMaterial = G4Material::GetMaterial("liquidArgon");
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
if (!defaultMaterial || !absorberMaterial || !gapMaterial) {
G4ExceptionDescription msg;
msg << "Cannot retrieve materials already defined.";
G4Exception("DetectorConstruction::DefineVolumes()",
"MyCode0001", FatalException, msg);
G4Exception("DetectorConstruction::DefineVolumes()", "MyCode0001", FatalException, msg);
}
//
// World
//
auto worldS
= new G4Box("World", // its name
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
auto worldS = new G4Box("World", // its name
worldSizeXY / 2, worldSizeXY / 2, worldSizeZ / 2); // its size
auto worldLV
= new G4LogicalVolume(
worldS, // its solid
defaultMaterial, // its material
"World"); // its name
auto worldLV = new G4LogicalVolume(worldS, // its solid
defaultMaterial, // its material
"World"); // its name
auto worldPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Calorimeter
//
auto calorimeterS
= new G4Box("Calorimeter", // its name
calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
auto calorimeterS = new G4Box("Calorimeter", // its name
calorSizeXY / 2, calorSizeXY / 2, calorThickness / 2); // its size
auto calorLV
= new G4LogicalVolume(
calorimeterS, // its solid
defaultMaterial, // its material
"Calorimeter"); // its name
auto calorLV = new G4LogicalVolume(calorimeterS, // its solid
defaultMaterial, // its material
"Calorimeter"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
calorLV, // its logical volume
"Calorimeter", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4ThreeVector(), // at (0,0,0)
calorLV, // its logical volume
"Calorimeter", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Layer
//
auto layerS
= new G4Box("Layer", // its name
calorSizeXY/2, calorSizeXY/2, layerThickness/2); //its size
auto layerS = new G4Box("Layer", // its name
calorSizeXY / 2, calorSizeXY / 2, layerThickness / 2); // its size
auto layerLV
= new G4LogicalVolume(
layerS, // its solid
defaultMaterial, // its material
"Layer"); // its name
auto layerLV = new G4LogicalVolume(layerS, // its solid
defaultMaterial, // its material
"Layer"); // its name
new G4PVReplica(
"Layer", // its name
layerLV, // its logical volume
calorLV, // its mother
kZAxis, // axis of replication
fNofLayers, // number of replica
layerThickness); // witdth of replica
new G4PVReplica("Layer", // its name
layerLV, // its logical volume
calorLV, // its mother
kZAxis, // axis of replication
fNofLayers, // number of replica
layerThickness); // witdth of replica
//
// Absorber
//
auto absorberS
= new G4Box("Abso", // its name
calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
auto absorberS = new G4Box("Abso", // its name
calorSizeXY / 2, calorSizeXY / 2, absoThickness / 2); // its size
auto absorberLV
= new G4LogicalVolume(
absorberS, // its solid
absorberMaterial, // its material
"AbsoLV"); // its name
auto absorberLV = new G4LogicalVolume(absorberS, // its solid
absorberMaterial, // its material
"AbsoLV"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., -gapThickness / 2), // its position
absorberLV, // its logical volume
"Abso", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., -gapThickness / 2), // its position
absorberLV, // its logical volume
"Abso", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Gap
//
auto gapS
= new G4Box("Gap", // its name
calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
auto gapS = new G4Box("Gap", // its name
calorSizeXY / 2, calorSizeXY / 2, gapThickness / 2); // its size
auto gapLV
= new G4LogicalVolume(
gapS, // its solid
gapMaterial, // its material
"GapLV"); // its name
auto gapLV = new G4LogicalVolume(gapS, // its solid
gapMaterial, // its material
"GapLV"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., absoThickness / 2), // its position
gapLV, // its logical volume
"Gap", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., absoThickness / 2), // its position
gapLV, // its logical volume
"Gap", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// print parameters
//
G4cout
<< G4endl
<< "------------------------------------------------------------" << G4endl
<< "---> The calorimeter is " << fNofLayers << " layers of: [ "
<< absoThickness/mm << "mm of " << absorberMaterial->GetName()
<< " + "
<< gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
<< "------------------------------------------------------------" << G4endl;
G4cout << G4endl << "------------------------------------------------------------" << G4endl
<< "---> The calorimeter is " << fNofLayers << " layers of: [ " << absoThickness / mm
<< "mm of " << absorberMaterial->GetName() << " + " << gapThickness / mm << "mm of "
<< gapMaterial->GetName() << " ] " << G4endl
<< "------------------------------------------------------------" << G4endl;
//
// Visualization attributes
@@ -258,15 +235,13 @@ void DetectorConstruction::ConstructSDandField()
//
// Sensitive detectors
//
auto absoSD
= new CalorimeterSD("AbsorberSD", "AbsorberHitsCollection", fNofLayers);
auto absoSD = new CalorimeterSD("AbsorberSD", "AbsorberHitsCollection", fNofLayers);
G4SDManager::GetSDMpointer()->AddNewDetector(absoSD);
SetSensitiveDetector("AbsoLV",absoSD);
SetSensitiveDetector("AbsoLV", absoSD);
auto gapSD
= new CalorimeterSD("GapSD", "GapHitsCollection", fNofLayers);
auto gapSD = new CalorimeterSD("GapSD", "GapHitsCollection", fNofLayers);
G4SDManager::GetSDMpointer()->AddNewDetector(gapSD);
SetSensitiveDetector("GapLV",gapSD);
SetSensitiveDetector("GapLV", gapSD);
//
// Magnetic field
@@ -284,4 +259,4 @@ void DetectorConstruction::ConstructSDandField()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4c
+25 -42
View File
@@ -28,17 +28,16 @@
/// \brief Implementation of the B4c::EventAction class
#include "EventAction.hh"
#include "CalorimeterSD.hh"
#include "CalorHit.hh"
#include "G4AnalysisManager.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4SDManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include <iomanip>
namespace B4c
@@ -46,19 +45,14 @@ namespace B4c
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
CalorHitsCollection*
EventAction::GetHitsCollection(G4int hcID,
const G4Event* event) const
CalorHitsCollection* EventAction::GetHitsCollection(G4int hcID, const G4Event* event) const
{
auto hitsCollection
= static_cast<CalorHitsCollection*>(
event->GetHCofThisEvent()->GetHC(hcID));
auto hitsCollection = static_cast<CalorHitsCollection*>(event->GetHCofThisEvent()->GetHC(hcID));
if ( ! hitsCollection ) {
if (!hitsCollection) {
G4ExceptionDescription msg;
msg << "Cannot access hitsCollection ID " << hcID;
G4Exception("EventAction::GetHitsCollection()",
"MyCode0003", FatalException, msg);
G4Exception("EventAction::GetHitsCollection()", "MyCode0003", FatalException, msg);
}
return hitsCollection;
@@ -66,39 +60,29 @@ EventAction::GetHitsCollection(G4int hcID,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::PrintEventStatistics(
G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const
void EventAction::PrintEventStatistics(G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const
{
// print event statistics
G4cout
<< " Absorber: total energy: "
<< std::setw(7) << G4BestUnit(absoEdep, "Energy")
<< " total track length: "
<< std::setw(7) << G4BestUnit(absoTrackLength, "Length")
<< G4endl
<< " Gap: total energy: "
<< std::setw(7) << G4BestUnit(gapEdep, "Energy")
<< " total track length: "
<< std::setw(7) << G4BestUnit(gapTrackLength, "Length")
<< G4endl;
G4cout << " Absorber: total energy: " << std::setw(7) << G4BestUnit(absoEdep, "Energy")
<< " total track length: " << std::setw(7) << G4BestUnit(absoTrackLength, "Length")
<< G4endl << " Gap: total energy: " << std::setw(7) << G4BestUnit(gapEdep, "Energy")
<< " total track length: " << std::setw(7) << G4BestUnit(gapTrackLength, "Length")
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event* /*event*/)
{}
void EventAction::BeginOfEventAction(const G4Event* /*event*/) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event* event)
{
// Get hits collections IDs (only once)
if ( fAbsHCID == -1 ) {
fAbsHCID
= G4SDManager::GetSDMpointer()->GetCollectionID("AbsorberHitsCollection");
fGapHCID
= G4SDManager::GetSDMpointer()->GetCollectionID("GapHitsCollection");
if (fAbsHCID == -1) {
fAbsHCID = G4SDManager::GetSDMpointer()->GetCollectionID("AbsorberHitsCollection");
fGapHCID = G4SDManager::GetSDMpointer()->GetCollectionID("GapHitsCollection");
}
// Get hits collections
@@ -106,18 +90,17 @@ void EventAction::EndOfEventAction(const G4Event* event)
auto gapHC = GetHitsCollection(fGapHCID, event);
// Get hit with total values
auto absoHit = (*absoHC)[absoHC->entries()-1];
auto gapHit = (*gapHC)[gapHC->entries()-1];
auto absoHit = (*absoHC)[absoHC->entries() - 1];
auto gapHit = (*gapHC)[gapHC->entries() - 1];
// Print per event (modulo n)
//
auto eventID = event->GetEventID();
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
PrintEventStatistics(
absoHit->GetEdep(), absoHit->GetTrackLength(),
gapHit->GetEdep(), gapHit->GetTrackLength());
G4cout << "--> End of event: " << eventID << "\n" << G4endl;
if ((printModulo > 0) && (eventID % printModulo == 0)) {
PrintEventStatistics(absoHit->GetEdep(), absoHit->GetTrackLength(), gapHit->GetEdep(),
gapHit->GetTrackLength());
G4cout << "--> End of event: " << eventID << "\n" << G4endl;
}
// Fill histograms, ntuple
@@ -142,4 +125,4 @@ void EventAction::EndOfEventAction(const G4Event* event)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4c
@@ -29,16 +29,13 @@
#include "PrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Event.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "globals.hh"
namespace B4
{
@@ -52,11 +49,10 @@ PrimaryGeneratorAction::PrimaryGeneratorAction()
// default particle kinematic
//
auto particleDefinition
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
auto particleDefinition = G4ParticleTable::GetParticleTable()->FindParticle("e-");
fParticleGun->SetParticleDefinition(particleDefinition);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleEnergy(300.*MeV);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
fParticleGun->SetParticleEnergy(300. * MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -68,7 +64,7 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
{
// This function is called at the begining of event
@@ -81,29 +77,27 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
// Check that the world volume has box shape
G4Box* worldBox = nullptr;
if ( worldLV ) {
if (worldLV) {
worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
}
if ( worldBox ) {
if (worldBox) {
worldZHalfLength = worldBox->GetZHalfLength();
}
else {
else {
G4ExceptionDescription msg;
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("PrimaryGeneratorAction::GeneratePrimaries()",
"MyCode0002", JustWarning, msg);
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()", "MyCode0002", JustWarning, msg);
}
// Set gun position
fParticleGun
->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
fParticleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(event);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4
+22 -30
View File
@@ -30,10 +30,10 @@
#include "RunAction.hh"
#include "G4AnalysisManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "globals.hh"
namespace B4
{
@@ -51,20 +51,20 @@ RunAction::RunAction()
auto analysisManager = G4AnalysisManager::Instance();
// Create directories
//analysisManager->SetHistoDirectoryName("histograms");
//analysisManager->SetNtupleDirectoryName("ntuple");
// analysisManager->SetHistoDirectoryName("histograms");
// analysisManager->SetNtupleDirectoryName("ntuple");
analysisManager->SetVerboseLevel(1);
analysisManager->SetNtupleMerging(true);
// Note: merging ntuples is available only with Root output
// Note: merging ntuples is available only with Root output
// Book histograms, ntuple
//
// Creating histograms
analysisManager->CreateH1("Eabs","Edep in absorber", 110, 0., 330*MeV);
analysisManager->CreateH1("Egap","Edep in gap", 100, 0., 30*MeV);
analysisManager->CreateH1("Labs","trackL in absorber", 100, 0., 50*cm);
analysisManager->CreateH1("Lgap","trackL in gap", 100, 0., 50*cm);
analysisManager->CreateH1("Eabs", "Edep in absorber", 110, 0., 330 * MeV);
analysisManager->CreateH1("Egap", "Edep in gap", 100, 0., 30 * MeV);
analysisManager->CreateH1("Labs", "trackL in absorber", 100, 0., 50 * cm);
analysisManager->CreateH1("Lgap", "trackL in gap", 100, 0., 50 * cm);
// Creating ntuple
//
@@ -80,8 +80,8 @@ RunAction::RunAction()
void RunAction::BeginOfRunAction(const G4Run* /*run*/)
{
//inform the runManager to save random number seed
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// inform the runManager to save random number seed
// G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// Get analysis manager
auto analysisManager = G4AnalysisManager::Instance();
@@ -104,34 +104,26 @@ void RunAction::EndOfRunAction(const G4Run* /*run*/)
// print histogram statistics
//
auto analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->GetH1(1) ) {
if (analysisManager->GetH1(1)) {
G4cout << G4endl << " ----> print histograms statistic ";
if(isMaster) {
if (isMaster) {
G4cout << "for the entire run " << G4endl << G4endl;
}
else {
G4cout << "for the local thread " << G4endl << G4endl;
}
G4cout << " EAbs : mean = "
<< G4BestUnit(analysisManager->GetH1(0)->mean(), "Energy")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(0)->rms(), "Energy") << G4endl;
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(1)->mean(), "Energy")
<< " rms = " << G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
G4cout << " LAbs : mean = "
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Length")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Length") << 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(3)->mean(), "Length")
<< " rms = " << G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
}
// save histograms & ntuple
@@ -142,4 +134,4 @@ void RunAction::EndOfRunAction(const G4Run* /*run*/)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4
+31 -30
View File
@@ -27,39 +27,39 @@
/// \file exampleB4d.cc
/// \brief Main program of the B4d example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4AnalysisManager.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4TScoreNtupleWriter.hh"
#include "G4UIExecutive.hh"
#include "G4UIcommand.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "FTFP_BERT.hh"
#include "Randomize.hh"
// #include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace {
void PrintUsage() {
G4cerr << " Usage: " << G4endl;
G4cerr << " exampleB4d [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
<< G4endl;
G4cerr << " note: -t option is available only for multi-threaded mode."
<< G4endl;
}
namespace
{
void PrintUsage()
{
G4cerr << " Usage: " << G4endl;
G4cerr << " exampleB4d [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]" << G4endl;
G4cerr << " note: -t option is available only for multi-threaded mode." << G4endl;
}
} // namespace
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Evaluate arguments
//
if ( argc > 7 ) {
if (argc > 7) {
PrintUsage();
return 1;
}
@@ -70,15 +70,17 @@ int main(int argc,char** argv)
#ifdef G4MULTITHREADED
G4int nThreads = 0;
#endif
for ( G4int i=1; i<argc; i=i+2 ) {
if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
else if ( G4String(argv[i]) == "-u" ) session = argv[i+1];
for (G4int i = 1; i < argc; i = i + 2) {
if (G4String(argv[i]) == "-m")
macro = argv[i + 1];
else if (G4String(argv[i]) == "-u")
session = argv[i + 1];
#ifdef G4MULTITHREADED
else if ( G4String(argv[i]) == "-t" ) {
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
else if (G4String(argv[i]) == "-t") {
nThreads = G4UIcommand::ConvertToInt(argv[i + 1]);
}
#endif
else if ( G4String(argv[i]) == "-vDefault" ) {
else if (G4String(argv[i]) == "-vDefault") {
verboseBestUnits = false;
--i; // this option is not followed with a parameter
}
@@ -91,7 +93,7 @@ int main(int argc,char** argv)
// Detect interactive mode (if no macro provided) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( ! macro.size() ) {
if (!macro.size()) {
ui = new G4UIExecutive(argc, argv, session);
}
@@ -99,17 +101,16 @@ int main(int argc,char** argv)
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
// Use G4SteppingVerboseWithUnits
if ( verboseBestUnits ) {
if (verboseBestUnits) {
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
}
// Construct the default run manager
//
auto runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
#ifdef G4MULTITHREADED
if ( nThreads > 0 ) {
if (nThreads > 0) {
runManager->SetNumberOfThreads(nThreads);
}
#endif
@@ -142,17 +143,17 @@ int main(int argc,char** argv)
G4TScoreNtupleWriter<G4AnalysisManager> scoreNtupleWriter;
scoreNtupleWriter.SetVerboseLevel(1);
scoreNtupleWriter.SetNtupleMerging(true);
// Note: merging ntuples is available only with Root output
// (the default in G4TScoreNtupleWriter)
// Note: merging ntuples is available only with Root output
// (the default in G4TScoreNtupleWriter)
// Process macro or start UI session
//
if ( macro.size() ) {
if (macro.size()) {
// batch mode
G4String command = "/control/execute ";
UImanager->ApplyCommand(command+macro);
UImanager->ApplyCommand(command + macro);
}
else {
else {
// interactive mode : define UI session
UImanager->ApplyCommand("/control/execute init_vis.mac");
if (ui->IsGUI()) {
+32 -25
View File
@@ -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
@@ -44,14 +44,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...
@@ -280,7 +287,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
@@ -835,7 +842,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
@@ -861,17 +868,17 @@ Setting was ignored.
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 265.781 MeV total track length: 19.326 cm
Gap: total energy: 21.0561 MeV total track length: 10.6454 cm
Absorber: total energy: 279.218 MeV total track length: 20.3807 cm
Gap: total energy: 19.7181 MeV total track length: 9.43835 cm
--> End of event: 0
----> print histograms statistic for the entire run
EAbs : mean = 265.781 MeV rms = 0 eV
EGap : mean = 21.0561 MeV rms = 0 eV
LAbs : mean = 19.326 cm rms = 0 fm
LGap : mean = 10.6454 cm rms = 0 fm
EAbs : mean = 279.218 MeV rms = 0 eV
EGap : mean = 19.7181 MeV rms = 0 eV
LAbs : mean = 20.3807 cm rms = 0 fm
LGap : mean = 9.43835 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -941,17 +948,17 @@ hFritiofCaptureAtRest,hBertiniCaptureAtRest,muMinusCaptureAtRest, dInela
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 273.124 MeV total track length: 20.1646 cm
Gap: total energy: 16.2656 MeV total track length: 7.73372 cm
Absorber: total energy: 253.71 MeV total track length: 18.3379 cm
Gap: total energy: 18.1797 MeV total track length: 8.925 cm
--> End of event: 0
----> print histograms statistic for the entire run
EAbs : mean = 273.124 MeV rms = 0 eV
EGap : mean = 16.2656 MeV rms = 0 eV
LAbs : mean = 20.1646 cm rms = 0 fm
LGap : mean = 7.73372 cm rms = 0 fm
EAbs : mean = 253.71 MeV rms = 0 eV
EGap : mean = 18.1797 MeV rms = 0 eV
LAbs : mean = 18.3379 cm rms = 0 fm
LGap : mean = 8.925 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -967,17 +974,17 @@ There are histograms that can be viewed with visualization:
... open analysis file : B4.root - done
Using
--> Event 0 starts.
Absorber: total energy: 465.716 MeV total track length: 34.0047 cm
Gap: total energy: 15.1463 MeV total track length: 7.88173 cm
Absorber: total energy: 437.115 MeV total track length: 31.5725 cm
Gap: total energy: 19.1128 MeV total track length: 8.67887 cm
--> End of event: 0
----> print histograms statistic for the entire run
EAbs : mean = 0 eV rms = 0 eV
EGap : mean = 15.1463 MeV rms = 0 eV
LAbs : mean = 34.0047 cm rms = 0 fm
LGap : mean = 7.88173 cm rms = 0 fm
EGap : mean = 19.1128 MeV rms = 0 eV
LAbs : mean = 31.5725 cm rms = 0 fm
LGap : mean = 8.67887 cm rms = 0 fm
... write file : B4.root - done
... close file : B4.root - done
There are histograms that can be viewed with visualization:
@@ -989,4 +996,4 @@ There are histograms that can be viewed with visualization:
EndOfRunAction and Reset() in your BeginOfRunAction.
Graphics systems deleted.
Visualization Manager deleting...
### deleting chargedFilter 0x1f5cf00
### deleting chargedFilter 0xb7fb80
@@ -47,8 +47,6 @@ class ActionInitialization : public G4VUserActionInitialization
void Build() const override;
};
}
} // namespace B4d
#endif
@@ -73,13 +73,13 @@ class DetectorConstruction : public G4VUserDetectorConstruction
// data members
//
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
};
}
} // namespace B4d
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+20 -20
View File
@@ -31,10 +31,11 @@
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "G4THitsMap.hh"
#include "globals.hh"
class G4Event;
template <typename T> class G4THitsMap;
namespace B4d
{
@@ -46,29 +47,28 @@ namespace B4d
class EventAction : public G4UserEventAction
{
public:
EventAction() = default;
~EventAction() override = default;
public:
EventAction() = default;
~EventAction() override = default;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
private:
// methods
G4THitsMap<G4double>* GetHitsCollection(G4int hcID,
const G4Event* event) const;
G4double GetSum(G4THitsMap<G4double>* hitsMap) const;
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const;
private:
// methods
G4THitsMap<G4double>* GetHitsCollection(G4int hcID, const G4Event* event) const;
G4double GetSum(G4THitsMap<G4double>* hitsMap) const;
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep,
G4double gapTrackLength) const;
// data members
G4int fAbsoEdepHCID = -1;
G4int fGapEdepHCID = -1;
G4int fAbsoTrackLengthHCID = -1;
G4int fGapTrackLengthHCID = -1;
// data members
G4int fAbsoEdepHCID = -1;
G4int fGapEdepHCID = -1;
G4int fAbsoTrackLengthHCID = -1;
G4int fGapTrackLengthHCID = -1;
};
}
} // namespace B4d
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -25,13 +25,12 @@
//
//
/// \file B4/B4d/include/PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
/// \brief Definition of the B4::PrimaryGeneratorAction class
#ifndef B4PrimaryGeneratorAction_h
#define B4PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
@@ -48,17 +47,17 @@ namespace B4
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event* event) override;
void GeneratePrimaries(G4Event* event) override;
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
};
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+2 -3
View File
@@ -31,7 +31,6 @@
#define B4RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
@@ -63,10 +62,10 @@ class RunAction : public G4UserRunAction
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
};
}
} // namespace B4
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,9 +28,10 @@
/// \brief Implementation of the B4d::ActionInitialization class
#include "ActionInitialization.hh"
#include "EventAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
using namespace B4;
@@ -55,4 +56,4 @@ void ActionInitialization::Build() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4d
+98 -123
View File
@@ -29,36 +29,31 @@
#include "DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4AutoDelete.hh"
#include "G4SDManager.hh"
#include "G4SDChargedFilter.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4NistManager.hh"
#include "G4PSEnergyDeposit.hh"
#include "G4PSTrackLength.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4PhysicalConstants.hh"
#include "G4SDChargedFilter.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4VisAttributes.hh"
namespace B4d
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
G4ThreadLocal G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -83,12 +78,12 @@ void DetectorConstruction::DefineMaterials()
G4double a; // mass of a mole;
G4double z; // z=mean number of protons;
G4double density;
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
// The argon by NIST Manager is a gas with a different density
new G4Material("liquidArgon", z = 18., a = 39.95 * g / mole, density = 1.390 * g / cm3);
// The argon by NIST Manager is a gas with a different density
// Vacuum
new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
kStateGas, 2.73*kelvin, 3.e-18*pascal);
new G4Material("Galactic", z = 1., a = 1.01 * g / mole, density = universe_mean_density,
kStateGas, 2.73 * kelvin, 3.e-18 * pascal);
// Print materials
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
@@ -99,148 +94,128 @@ void DetectorConstruction::DefineMaterials()
G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
{
// Geometry parameters
G4int nofLayers = 10;
G4double absoThickness = 10.*mm;
G4double gapThickness = 5.*mm;
G4double calorSizeXY = 10.*cm;
G4int nofLayers = 10;
G4double absoThickness = 10. * mm;
G4double gapThickness = 5. * mm;
G4double calorSizeXY = 10. * cm;
auto layerThickness = absoThickness + gapThickness;
auto calorThickness = nofLayers * layerThickness;
auto worldSizeXY = 1.2 * calorSizeXY;
auto worldSizeZ = 1.2 * calorThickness;
auto layerThickness = absoThickness + gapThickness;
auto calorThickness = nofLayers * layerThickness;
auto worldSizeXY = 1.2 * calorSizeXY;
auto worldSizeZ = 1.2 * calorThickness;
// Get materials
auto defaultMaterial = G4Material::GetMaterial("Galactic");
auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
auto gapMaterial = G4Material::GetMaterial("liquidArgon");
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
if (!defaultMaterial || !absorberMaterial || !gapMaterial) {
G4ExceptionDescription msg;
msg << "Cannot retrieve materials already defined.";
G4Exception("DetectorConstruction::DefineVolumes()",
"MyCode0001", FatalException, msg);
G4Exception("DetectorConstruction::DefineVolumes()", "MyCode0001", FatalException, msg);
}
//
// World
//
auto worldS
= new G4Box("World", // its name
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
auto worldS = new G4Box("World", // its name
worldSizeXY / 2, worldSizeXY / 2, worldSizeZ / 2); // its size
auto worldLV
= new G4LogicalVolume(
worldS, // its solid
defaultMaterial, // its material
"World"); // its name
auto worldLV = new G4LogicalVolume(worldS, // its solid
defaultMaterial, // its material
"World"); // its name
auto worldPV = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Calorimeter
//
auto calorimeterS
= new G4Box("Calorimeter", // its name
calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
auto calorimeterS = new G4Box("Calorimeter", // its name
calorSizeXY / 2, calorSizeXY / 2, calorThickness / 2); // its size
auto calorLV
= new G4LogicalVolume(
calorimeterS, // its solid
defaultMaterial, // its material
"Calorimeter"); // its name
auto calorLV = new G4LogicalVolume(calorimeterS, // its solid
defaultMaterial, // its material
"Calorimeter"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
calorLV, // its logical volume
"Calorimeter", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4ThreeVector(), // at (0,0,0)
calorLV, // its logical volume
"Calorimeter", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Layer
//
auto layerS
= new G4Box("Layer", // its name
calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
auto layerS = new G4Box("Layer", // its name
calorSizeXY / 2, calorSizeXY / 2, layerThickness / 2); // its size
auto layerLV
= new G4LogicalVolume(
layerS, // its solid
defaultMaterial, // its material
"Layer"); // its name
auto layerLV = new G4LogicalVolume(layerS, // its solid
defaultMaterial, // its material
"Layer"); // its name
new G4PVReplica(
"Layer", // its name
layerLV, // its logical volume
calorLV, // its mother
kZAxis, // axis of replication
nofLayers, // number of replica
layerThickness); // witdth of replica
new G4PVReplica("Layer", // its name
layerLV, // its logical volume
calorLV, // its mother
kZAxis, // axis of replication
nofLayers, // number of replica
layerThickness); // witdth of replica
//
// Absorber
//
auto absorberS
= new G4Box("Abso", // its name
calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
auto absorberS = new G4Box("Abso", // its name
calorSizeXY / 2, calorSizeXY / 2, absoThickness / 2); // its size
auto absorberLV
= new G4LogicalVolume(
absorberS, // its solid
absorberMaterial, // its material
"AbsoLV"); // its name
auto absorberLV = new G4LogicalVolume(absorberS, // its solid
absorberMaterial, // its material
"AbsoLV"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., -gapThickness / 2), // its position
absorberLV, // its logical volume
"Abso", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., -gapThickness / 2), // its position
absorberLV, // its logical volume
"Abso", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Gap
//
auto gapS
= new G4Box("Gap", // its name
calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
auto gapS = new G4Box("Gap", // its name
calorSizeXY / 2, calorSizeXY / 2, gapThickness / 2); // its size
auto gapLV
= new G4LogicalVolume(
gapS, // its solid
gapMaterial, // its material
"GapLV"); // its name
auto gapLV = new G4LogicalVolume(gapS, // its solid
gapMaterial, // its material
"GapLV"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., absoThickness / 2), // its position
gapLV, // its logical volume
"Gap", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(0., 0., absoThickness / 2), // its position
gapLV, // its logical volume
"Gap", // its name
layerLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// print parameters
//
G4cout
<< G4endl
<< "------------------------------------------------------------" << G4endl
<< "---> The calorimeter is " << nofLayers << " layers of: [ "
<< absoThickness/mm << "mm of " << absorberMaterial->GetName()
<< " + "
<< gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
<< "------------------------------------------------------------" << G4endl;
G4cout << G4endl << "------------------------------------------------------------" << G4endl
<< "---> The calorimeter is " << nofLayers << " layers of: [ " << absoThickness / mm
<< "mm of " << absorberMaterial->GetName() << " + " << gapThickness / mm << "mm of "
<< gapMaterial->GetName() << " ] " << G4endl
<< "------------------------------------------------------------" << G4endl;
//
// Visualization attributes
@@ -274,10 +249,10 @@ void DetectorConstruction::ConstructSDandField()
primitive = new G4PSTrackLength("TrackLength");
auto charged = new G4SDChargedFilter("chargedFilter");
primitive ->SetFilter(charged);
primitive->SetFilter(charged);
absDetector->RegisterPrimitive(primitive);
SetSensitiveDetector("AbsoLV",absDetector);
SetSensitiveDetector("AbsoLV", absDetector);
// declare Gap as a MultiFunctionalDetector scorer
//
@@ -288,10 +263,10 @@ void DetectorConstruction::ConstructSDandField()
gapDetector->RegisterPrimitive(primitive);
primitive = new G4PSTrackLength("TrackLength");
primitive ->SetFilter(charged);
primitive->SetFilter(charged);
gapDetector->RegisterPrimitive(primitive);
SetSensitiveDetector("GapLV",gapDetector);
SetSensitiveDetector("GapLV", gapDetector);
//
// Magnetic field
@@ -309,4 +284,4 @@ void DetectorConstruction::ConstructSDandField()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4d
+28 -47
View File
@@ -30,13 +30,13 @@
#include "EventAction.hh"
#include "G4AnalysisManager.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4SDManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4THitsMap.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include <iomanip>
namespace B4d
@@ -44,19 +44,14 @@ namespace B4d
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4THitsMap<G4double>*
EventAction::GetHitsCollection(G4int hcID,
const G4Event* event) const
G4THitsMap<G4double>* EventAction::GetHitsCollection(G4int hcID, const G4Event* event) const
{
auto hitsCollection
= static_cast<G4THitsMap<G4double>*>(
event->GetHCofThisEvent()->GetHC(hcID));
auto hitsCollection = static_cast<G4THitsMap<G4double>*>(event->GetHCofThisEvent()->GetHC(hcID));
if ( ! hitsCollection ) {
if (!hitsCollection) {
G4ExceptionDescription msg;
msg << "Cannot access hitsCollection ID " << hcID;
G4Exception("EventAction::GetHitsCollection()",
"MyCode0003", FatalException, msg);
G4Exception("EventAction::GetHitsCollection()", "MyCode0003", FatalException, msg);
}
return hitsCollection;
@@ -67,7 +62,7 @@ EventAction::GetHitsCollection(G4int hcID,
G4double EventAction::GetSum(G4THitsMap<G4double>* hitsMap) const
{
G4double sumValue = 0.;
for ( auto it : *hitsMap->GetMap() ) {
for (auto it : *hitsMap->GetMap()) {
// hitsMap->GetMap() returns the map of std::map<G4int, G4double*>
sumValue += *(it.second);
}
@@ -76,44 +71,32 @@ G4double EventAction::GetSum(G4THitsMap<G4double>* hitsMap) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::PrintEventStatistics(
G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const
void EventAction::PrintEventStatistics(G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const
{
// Print event statistics
//
G4cout
<< " Absorber: total energy: "
<< std::setw(7) << G4BestUnit(absoEdep, "Energy")
<< " total track length: "
<< std::setw(7) << G4BestUnit(absoTrackLength, "Length")
<< G4endl
<< " Gap: total energy: "
<< std::setw(7) << G4BestUnit(gapEdep, "Energy")
<< " total track length: "
<< std::setw(7) << G4BestUnit(gapTrackLength, "Length")
<< G4endl;
G4cout << " Absorber: total energy: " << std::setw(7) << G4BestUnit(absoEdep, "Energy")
<< " total track length: " << std::setw(7) << G4BestUnit(absoTrackLength, "Length")
<< G4endl << " Gap: total energy: " << std::setw(7) << G4BestUnit(gapEdep, "Energy")
<< " total track length: " << std::setw(7) << G4BestUnit(gapTrackLength, "Length")
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event* /*event*/)
{}
void EventAction::BeginOfEventAction(const G4Event* /*event*/) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event* event)
{
// Get hist collections IDs
if ( fAbsoEdepHCID == -1 ) {
fAbsoEdepHCID
= G4SDManager::GetSDMpointer()->GetCollectionID("Absorber/Edep");
fGapEdepHCID
= G4SDManager::GetSDMpointer()->GetCollectionID("Gap/Edep");
fAbsoTrackLengthHCID
= G4SDManager::GetSDMpointer()->GetCollectionID("Absorber/TrackLength");
fGapTrackLengthHCID
= G4SDManager::GetSDMpointer()->GetCollectionID("Gap/TrackLength");
// Get hist collections IDs
if (fAbsoEdepHCID == -1) {
fAbsoEdepHCID = G4SDManager::GetSDMpointer()->GetCollectionID("Absorber/Edep");
fGapEdepHCID = G4SDManager::GetSDMpointer()->GetCollectionID("Gap/Edep");
fAbsoTrackLengthHCID = G4SDManager::GetSDMpointer()->GetCollectionID("Absorber/TrackLength");
fGapTrackLengthHCID = G4SDManager::GetSDMpointer()->GetCollectionID("Gap/TrackLength");
}
// Get sum values from hits collections
@@ -121,10 +104,8 @@ void EventAction::EndOfEventAction(const G4Event* event)
auto absoEdep = GetSum(GetHitsCollection(fAbsoEdepHCID, event));
auto gapEdep = GetSum(GetHitsCollection(fGapEdepHCID, event));
auto absoTrackLength
= GetSum(GetHitsCollection(fAbsoTrackLengthHCID, event));
auto gapTrackLength
= GetSum(GetHitsCollection(fGapTrackLengthHCID, event));
auto absoTrackLength = GetSum(GetHitsCollection(fAbsoTrackLengthHCID, event));
auto gapTrackLength = GetSum(GetHitsCollection(fGapTrackLengthHCID, event));
// get analysis manager
auto analysisManager = G4AnalysisManager::Instance();
@@ -144,16 +125,16 @@ void EventAction::EndOfEventAction(const G4Event* event)
analysisManager->FillNtupleDColumn(3, gapTrackLength);
analysisManager->AddNtupleRow();
//print per event (modulo n)
// print per event (modulo n)
//
auto eventID = event->GetEventID();
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
if ((printModulo > 0) && (eventID % printModulo == 0)) {
PrintEventStatistics(absoEdep, absoTrackLength, gapEdep, gapTrackLength);
G4cout << "--> End of event: " << eventID << "\n" << G4endl;
G4cout << "--> End of event: " << eventID << "\n" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4d
@@ -29,16 +29,13 @@
#include "PrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Event.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "globals.hh"
namespace B4
{
@@ -52,11 +49,10 @@ PrimaryGeneratorAction::PrimaryGeneratorAction()
// default particle kinematic
//
auto particleDefinition
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
auto particleDefinition = G4ParticleTable::GetParticleTable()->FindParticle("e-");
fParticleGun->SetParticleDefinition(particleDefinition);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleEnergy(300.*MeV);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
fParticleGun->SetParticleEnergy(300. * MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -68,7 +64,7 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
{
// This function is called at the begining of event
@@ -81,29 +77,27 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
// Check that the world volume has box shape
G4Box* worldBox = nullptr;
if ( worldLV ) {
if (worldLV) {
worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
}
if ( worldBox ) {
if (worldBox) {
worldZHalfLength = worldBox->GetZHalfLength();
}
else {
else {
G4ExceptionDescription msg;
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("PrimaryGeneratorAction::GeneratePrimaries()",
"MyCode0002", JustWarning, msg);
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()", "MyCode0002", JustWarning, msg);
}
// Set gun position
fParticleGun
->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
fParticleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(event);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4
+22 -30
View File
@@ -30,10 +30,10 @@
#include "RunAction.hh"
#include "G4AnalysisManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "globals.hh"
namespace B4
{
@@ -51,20 +51,20 @@ RunAction::RunAction()
auto analysisManager = G4AnalysisManager::Instance();
// Create directories
//analysisManager->SetHistoDirectoryName("histograms");
//analysisManager->SetNtupleDirectoryName("ntuple");
// analysisManager->SetHistoDirectoryName("histograms");
// analysisManager->SetNtupleDirectoryName("ntuple");
analysisManager->SetVerboseLevel(1);
analysisManager->SetNtupleMerging(true);
// Note: merging ntuples is available only with Root output
// Note: merging ntuples is available only with Root output
// Book histograms, ntuple
//
// Creating histograms
analysisManager->CreateH1("Eabs","Edep in absorber", 110, 0., 330*MeV);
analysisManager->CreateH1("Egap","Edep in gap", 100, 0., 30*MeV);
analysisManager->CreateH1("Labs","trackL in absorber", 100, 0., 50*cm);
analysisManager->CreateH1("Lgap","trackL in gap", 100, 0., 50*cm);
analysisManager->CreateH1("Eabs", "Edep in absorber", 110, 0., 330 * MeV);
analysisManager->CreateH1("Egap", "Edep in gap", 100, 0., 30 * MeV);
analysisManager->CreateH1("Labs", "trackL in absorber", 100, 0., 50 * cm);
analysisManager->CreateH1("Lgap", "trackL in gap", 100, 0., 50 * cm);
// Creating ntuple
//
@@ -80,8 +80,8 @@ RunAction::RunAction()
void RunAction::BeginOfRunAction(const G4Run* /*run*/)
{
//inform the runManager to save random number seed
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// inform the runManager to save random number seed
// G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// Get analysis manager
auto analysisManager = G4AnalysisManager::Instance();
@@ -104,34 +104,26 @@ void RunAction::EndOfRunAction(const G4Run* /*run*/)
// print histogram statistics
//
auto analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->GetH1(1) ) {
if (analysisManager->GetH1(1)) {
G4cout << G4endl << " ----> print histograms statistic ";
if(isMaster) {
if (isMaster) {
G4cout << "for the entire run " << G4endl << G4endl;
}
else {
G4cout << "for the local thread " << G4endl << G4endl;
}
G4cout << " EAbs : mean = "
<< G4BestUnit(analysisManager->GetH1(0)->mean(), "Energy")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(0)->rms(), "Energy") << G4endl;
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(1)->mean(), "Energy")
<< " rms = " << G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
G4cout << " LAbs : mean = "
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Length")
<< " rms = "
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Length") << 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(3)->mean(), "Length")
<< " rms = " << G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
}
// save histograms & ntuple
@@ -142,4 +134,4 @@ void RunAction::EndOfRunAction(const G4Run* /*run*/)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B4