Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -27,42 +27,41 @@
|
||||
/// \file exampleB3a.cc
|
||||
/// \brief Main program of the B3a example
|
||||
|
||||
#include "G4Types.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4TScoreNtupleWriter.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsList.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4TScoreNtupleWriter.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
// #include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Detect interactive mode (if no arguments) and define UI session
|
||||
//
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv);}
|
||||
if (argc == 1) {
|
||||
ui = new G4UIExecutive(argc, argv);
|
||||
}
|
||||
|
||||
// Optionally: choose a different Random engine...
|
||||
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
|
||||
|
||||
//use G4SteppingVerboseWithUnits
|
||||
// use G4SteppingVerboseWithUnits
|
||||
G4int precision = 4;
|
||||
G4SteppingVerbose::UseBestUnit(precision);
|
||||
|
||||
// Construct the default run manager
|
||||
//
|
||||
auto runManager =
|
||||
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
@@ -92,16 +91,16 @@ 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 ( ! ui ) {
|
||||
if (!ui) {
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
UImanager->ApplyCommand(command + fileName);
|
||||
}
|
||||
else {
|
||||
// interactive mode
|
||||
|
||||
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
|
||||
|
||||
|
||||
**************************************************************
|
||||
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
|
||||
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
|
||||
Copyright : Geant4 Collaboration
|
||||
References : NIM A 506 (2003), 250-303
|
||||
: IEEE-TNS 53 (2006), 270-278
|
||||
@@ -42,14 +42,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...
|
||||
|
||||
@@ -390,7 +397,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
|
||||
|
||||
@@ -466,7 +473,7 @@ Threshold for very long decay time at rest 1 y
|
||||
HADRONIC PROCESSES SUMMARY (verbose level 1)
|
||||
-------------------------------------------------------------------------
|
||||
Hadronic Processes for GenericIon
|
||||
Process: Radioactivation
|
||||
Process: RadioactiveDecay
|
||||
|
||||
msc: for alpha SubType= 10
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
@@ -733,8 +740,8 @@ Setting was ignored.
|
||||
--> Event 9000 starts.
|
||||
|
||||
--------------------End of Global Run-----------------------
|
||||
The run was 10000 events Nb of 'good' e+ annihilations: 1278
|
||||
Total dose in patient : 306.445 picoGy
|
||||
The run was 10000 events Nb of 'good' e+ annihilations: 1308
|
||||
Total dose in patient : 305.937 picoGy
|
||||
------------------------------------------------------------
|
||||
|
||||
... write file : scoring.root - done
|
||||
|
||||
@@ -47,10 +47,9 @@ class ActionInitialization : public G4VUserActionInitialization
|
||||
|
||||
void BuildForMaster() const override;
|
||||
void Build() const override;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3a
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
|
||||
namespace B3
|
||||
{
|
||||
@@ -60,9 +59,8 @@ class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
G4bool fCheckOverlaps = true;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ class EventAction : public G4UserEventAction
|
||||
EventAction(RunAction* runAction);
|
||||
~EventAction() override = default;
|
||||
|
||||
void BeginOfEventAction(const G4Event*) override;
|
||||
void EndOfEventAction(const G4Event*) override;
|
||||
void BeginOfEventAction(const G4Event*) override;
|
||||
void EndOfEventAction(const G4Event*) override;
|
||||
|
||||
private:
|
||||
RunAction* fRunAction = nullptr;
|
||||
@@ -59,10 +59,8 @@ class EventAction : public G4UserEventAction
|
||||
G4int fCollID_patient = -1;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3a
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -42,18 +42,17 @@ namespace B3
|
||||
/// - G4RadioactiveDecayPhysics
|
||||
/// - G4EmStandardPhysics
|
||||
|
||||
class PhysicsList: public G4VModularPhysicsList
|
||||
class PhysicsList : public G4VModularPhysicsList
|
||||
{
|
||||
public:
|
||||
PhysicsList();
|
||||
~PhysicsList() override = default;
|
||||
public:
|
||||
PhysicsList();
|
||||
~PhysicsList() override = default;
|
||||
|
||||
void SetCuts() override;
|
||||
void SetCuts() override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#define B3PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
@@ -60,7 +59,7 @@ class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
G4ParticleGun* fParticleGun = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -31,9 +31,12 @@
|
||||
#define B3aRunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
#include "G4Accumulable.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Run;
|
||||
|
||||
namespace B3a
|
||||
{
|
||||
|
||||
@@ -46,19 +49,18 @@ class RunAction : public G4UserRunAction
|
||||
~RunAction() override = default;
|
||||
|
||||
void BeginOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
|
||||
void CountEvent() { fGoodEvents += 1; };
|
||||
void CountEvent() { fGoodEvents += 1; };
|
||||
void SumDose(G4double dose) { fSumDose += dose; };
|
||||
|
||||
private:
|
||||
G4Accumulable<G4int> fGoodEvents = 0;
|
||||
private:
|
||||
G4Accumulable<G4int> fGoodEvents = 0;
|
||||
G4Accumulable<G4double> fSumDose = 0.;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3a
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,7 +31,10 @@
|
||||
#define B3StackingAction_h 1
|
||||
|
||||
#include "G4UserStackingAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4ClassificationOfNewTrack.hh"
|
||||
|
||||
class G4Track;
|
||||
|
||||
namespace B3
|
||||
{
|
||||
@@ -50,9 +53,8 @@ class StackingAction : public G4UserStackingAction
|
||||
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*) override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -28,9 +28,10 @@
|
||||
/// \brief Implementation of the B3a::ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "EventAction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "StackingAction.hh"
|
||||
|
||||
using namespace B3;
|
||||
@@ -59,5 +60,4 @@ void ActionInitialization::Build() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3a
|
||||
|
||||
@@ -29,21 +29,20 @@
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4MultiFunctionalDetector.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
#include "G4PSEnergyDeposit.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PSDoseDeposit.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4PSEnergyDeposit.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
namespace B3
|
||||
{
|
||||
@@ -63,14 +62,14 @@ void DetectorConstruction::DefineMaterials()
|
||||
|
||||
G4bool isotopes = false;
|
||||
|
||||
G4Element* O = man->FindOrBuildElement("O" , isotopes);
|
||||
G4Element* O = man->FindOrBuildElement("O", isotopes);
|
||||
G4Element* Si = man->FindOrBuildElement("Si", isotopes);
|
||||
G4Element* Lu = man->FindOrBuildElement("Lu", isotopes);
|
||||
|
||||
auto LSO = new G4Material("Lu2SiO5", 7.4 * g / cm3, 3);
|
||||
LSO->AddElement(Lu, 2);
|
||||
LSO->AddElement(Si, 1);
|
||||
LSO->AddElement(O , 5);
|
||||
LSO->AddElement(O, 5);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -79,44 +78,45 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Gamma detector Parameters
|
||||
//
|
||||
G4double cryst_dX = 6*cm, cryst_dY = 6*cm, cryst_dZ = 3*cm;
|
||||
G4double cryst_dX = 6 * cm, cryst_dY = 6 * cm, cryst_dZ = 3 * cm;
|
||||
G4int nb_cryst = 32;
|
||||
G4int nb_rings = 9;
|
||||
//
|
||||
G4double dPhi = twopi/nb_cryst, half_dPhi = 0.5*dPhi;
|
||||
G4double dPhi = twopi / nb_cryst, half_dPhi = 0.5 * dPhi;
|
||||
G4double cosdPhi = std::cos(half_dPhi);
|
||||
G4double tandPhi = std::tan(half_dPhi);
|
||||
//
|
||||
G4double ring_R1 = 0.5*cryst_dY/tandPhi;
|
||||
G4double ring_R2 = (ring_R1+cryst_dZ)/cosdPhi;
|
||||
G4double ring_R1 = 0.5 * cryst_dY / tandPhi;
|
||||
G4double ring_R2 = (ring_R1 + cryst_dZ) / cosdPhi;
|
||||
//
|
||||
G4double detector_dZ = nb_rings*cryst_dX;
|
||||
G4double detector_dZ = nb_rings * cryst_dX;
|
||||
//
|
||||
G4NistManager* nist = G4NistManager::Instance();
|
||||
G4Material* default_mat = nist->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* cryst_mat = nist->FindOrBuildMaterial("Lu2SiO5");
|
||||
G4Material* cryst_mat = nist->FindOrBuildMaterial("Lu2SiO5");
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4double world_sizeXY = 2.4*ring_R2;
|
||||
G4double world_sizeZ = 1.2*detector_dZ;
|
||||
G4double world_sizeXY = 2.4 * ring_R2;
|
||||
G4double world_sizeZ = 1.2 * detector_dZ;
|
||||
|
||||
auto solidWorld = new G4Box("World", // its name
|
||||
0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
|
||||
auto solidWorld =
|
||||
new G4Box("World", // its name
|
||||
0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
|
||||
|
||||
auto logicWorld = new G4LogicalVolume(solidWorld, // its solid
|
||||
default_mat, // its material
|
||||
"World"); // its name
|
||||
default_mat, // its material
|
||||
"World"); // its name
|
||||
|
||||
auto physWorld = new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
nullptr, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
nullptr, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// ring
|
||||
@@ -124,38 +124,38 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
auto solidRing = new G4Tubs("Ring", ring_R1, ring_R2, 0.5 * cryst_dX, 0., twopi);
|
||||
|
||||
auto logicRing = new G4LogicalVolume(solidRing, // its solid
|
||||
default_mat, // its material
|
||||
"Ring"); // its name
|
||||
default_mat, // its material
|
||||
"Ring"); // its name
|
||||
|
||||
//
|
||||
// define crystal
|
||||
//
|
||||
G4double gap = 0.5*mm; //a gap for wrapping
|
||||
G4double gap = 0.5 * mm; // a gap for wrapping
|
||||
G4double dX = cryst_dX - gap, dY = cryst_dY - gap;
|
||||
auto solidCryst = new G4Box("crystal", dX / 2, dY / 2, cryst_dZ / 2);
|
||||
|
||||
auto logicCryst = new G4LogicalVolume(solidCryst, // its solid
|
||||
cryst_mat, // its material
|
||||
"CrystalLV"); // its name
|
||||
cryst_mat, // its material
|
||||
"CrystalLV"); // its name
|
||||
|
||||
// place crystals within a ring
|
||||
//
|
||||
for (G4int icrys = 0; icrys < nb_cryst ; icrys++) {
|
||||
G4double phi = icrys*dPhi;
|
||||
G4RotationMatrix rotm = G4RotationMatrix();
|
||||
rotm.rotateY(90*deg);
|
||||
for (G4int icrys = 0; icrys < nb_cryst; icrys++) {
|
||||
G4double phi = icrys * dPhi;
|
||||
G4RotationMatrix rotm = G4RotationMatrix();
|
||||
rotm.rotateY(90 * deg);
|
||||
rotm.rotateZ(phi);
|
||||
G4ThreeVector uz = G4ThreeVector(std::cos(phi), std::sin(phi),0.);
|
||||
G4ThreeVector position = (ring_R1+0.5*cryst_dZ)*uz;
|
||||
G4Transform3D transform = G4Transform3D(rotm,position);
|
||||
G4ThreeVector uz = G4ThreeVector(std::cos(phi), std::sin(phi), 0.);
|
||||
G4ThreeVector position = (ring_R1 + 0.5 * cryst_dZ) * uz;
|
||||
G4Transform3D transform = G4Transform3D(rotm, position);
|
||||
|
||||
new G4PVPlacement(transform, //rotation,position
|
||||
logicCryst, //its logical volume
|
||||
"crystal", //its name
|
||||
logicRing, //its mother volume
|
||||
false, //no boolean operation
|
||||
icrys, //copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
new G4PVPlacement(transform, // rotation,position
|
||||
logicCryst, // its logical volume
|
||||
"crystal", // its name
|
||||
logicRing, // its mother volume
|
||||
false, // no boolean operation
|
||||
icrys, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
}
|
||||
|
||||
//
|
||||
@@ -164,71 +164,71 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
auto solidDetector = new G4Tubs("Detector", ring_R1, ring_R2, 0.5 * detector_dZ, 0., twopi);
|
||||
|
||||
auto logicDetector = new G4LogicalVolume(solidDetector, // its solid
|
||||
default_mat, // its material
|
||||
"Detector"); // its name
|
||||
default_mat, // its material
|
||||
"Detector"); // its name
|
||||
|
||||
//
|
||||
// place rings within detector
|
||||
//
|
||||
G4double OG = -0.5*(detector_dZ + cryst_dX);
|
||||
for (G4int iring = 0; iring < nb_rings ; iring++) {
|
||||
G4double OG = -0.5 * (detector_dZ + cryst_dX);
|
||||
for (G4int iring = 0; iring < nb_rings; iring++) {
|
||||
OG += cryst_dX;
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(0, 0, OG), // position
|
||||
logicRing, // its logical volume
|
||||
"ring", // its name
|
||||
logicDetector, // its mother volume
|
||||
false, // no boolean operation
|
||||
iring, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
G4ThreeVector(0, 0, OG), // position
|
||||
logicRing, // its logical volume
|
||||
"ring", // its name
|
||||
logicDetector, // its mother volume
|
||||
false, // no boolean operation
|
||||
iring, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
}
|
||||
|
||||
//
|
||||
// place detector in world
|
||||
//
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicDetector, // its logical volume
|
||||
"Detector", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicDetector, // its logical volume
|
||||
"Detector", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// patient
|
||||
//
|
||||
G4double patient_radius = 8*cm;
|
||||
G4double patient_dZ = 10*cm;
|
||||
G4double patient_radius = 8 * cm;
|
||||
G4double patient_dZ = 10 * cm;
|
||||
G4Material* patient_mat = nist->FindOrBuildMaterial("G4_BRAIN_ICRP");
|
||||
|
||||
auto solidPatient = new G4Tubs("Patient", 0., patient_radius, 0.5 * patient_dZ, 0., twopi);
|
||||
|
||||
auto logicPatient = new G4LogicalVolume(solidPatient, // its solid
|
||||
patient_mat, // its material
|
||||
"PatientLV"); // its name
|
||||
patient_mat, // its material
|
||||
"PatientLV"); // its name
|
||||
|
||||
//
|
||||
// place patient in world
|
||||
//
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicPatient, // its logical volume
|
||||
"Patient", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicPatient, // its logical volume
|
||||
"Patient", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
// Visualization attributes
|
||||
//
|
||||
logicRing->SetVisAttributes (G4VisAttributes::GetInvisible());
|
||||
logicDetector->SetVisAttributes (G4VisAttributes::GetInvisible());
|
||||
logicRing->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
logicDetector->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
|
||||
// Print materials
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//always return the physical World
|
||||
// always return the physical World
|
||||
//
|
||||
return physWorld;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ void DetectorConstruction::ConstructSDandField()
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(cryst);
|
||||
G4VPrimitiveScorer* primitiv1 = new G4PSEnergyDeposit("edep");
|
||||
cryst->RegisterPrimitive(primitiv1);
|
||||
SetSensitiveDetector("CrystalLV",cryst);
|
||||
SetSensitiveDetector("CrystalLV", cryst);
|
||||
|
||||
// declare patient as a MultiFunctionalDetector scorer
|
||||
//
|
||||
@@ -253,10 +253,9 @@ void DetectorConstruction::ConstructSDandField()
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(patient);
|
||||
G4VPrimitiveScorer* primitiv2 = new G4PSDoseDeposit("dose");
|
||||
patient->RegisterPrimitive(primitiv2);
|
||||
SetSensitiveDetector("PatientLV",patient);
|
||||
SetSensitiveDetector("PatientLV", patient);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3
|
||||
|
||||
@@ -28,77 +28,72 @@
|
||||
/// \brief Implementation of the B3a::EventAction class
|
||||
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
// #include "G4UnitsTable.hh"
|
||||
|
||||
namespace B3a
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction(RunAction* runAction)
|
||||
: fRunAction(runAction)
|
||||
{}
|
||||
EventAction::EventAction(RunAction* runAction) : fRunAction(runAction) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* /*evt*/)
|
||||
{ }
|
||||
void EventAction::BeginOfEventAction(const G4Event* /*evt*/) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::EndOfEventAction(const G4Event* evt )
|
||||
void EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
//Hits collections
|
||||
// Hits collections
|
||||
//
|
||||
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
||||
if(!HCE) return;
|
||||
if (!HCE) return;
|
||||
|
||||
// Get hits collections IDs
|
||||
// Get hits collections IDs
|
||||
if (fCollID_cryst < 0) {
|
||||
G4SDManager* SDMan = G4SDManager::GetSDMpointer();
|
||||
fCollID_cryst = SDMan->GetCollectionID("crystal/edep");
|
||||
fCollID_cryst = SDMan->GetCollectionID("crystal/edep");
|
||||
fCollID_patient = SDMan->GetCollectionID("patient/dose");
|
||||
}
|
||||
|
||||
//Energy in crystals : identify 'good events'
|
||||
// Energy in crystals : identify 'good events'
|
||||
//
|
||||
const G4double eThreshold = 500*keV;
|
||||
const G4double eThreshold = 500 * keV;
|
||||
G4int nbOfFired = 0;
|
||||
|
||||
auto evtMap = (G4THitsMap<G4double>*)(HCE->GetHC(fCollID_cryst));
|
||||
auto evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_cryst));
|
||||
|
||||
std::map<G4int,G4double*>::iterator itr;
|
||||
for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
|
||||
///G4int copyNb = (itr->first);
|
||||
G4double edep = *(itr->second);
|
||||
if (edep > eThreshold) nbOfFired++;
|
||||
///G4cout << "\n cryst" << copyNb << ": " << edep/keV << " keV ";
|
||||
for (auto& mapElement : (*evtMap->GetMap())) {
|
||||
auto edep = *(mapElement.second);
|
||||
if (edep > eThreshold) ++nbOfFired;
|
||||
// auto copyNb = mapElement.first;
|
||||
// G4cout << "\n cryst" << copyNb << ": " << edep/keV << " keV ";
|
||||
}
|
||||
if (nbOfFired == 2) fRunAction->CountEvent();
|
||||
|
||||
//Dose deposit in patient
|
||||
// Dose deposit in patient
|
||||
//
|
||||
G4double dose = 0.;
|
||||
|
||||
evtMap = (G4THitsMap<G4double>*)(HCE->GetHC(fCollID_patient));
|
||||
evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_patient));
|
||||
|
||||
for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
|
||||
///G4int copyNb = (itr->first);
|
||||
dose = *(itr->second);
|
||||
for (auto& mapElement : (*evtMap->GetMap())) {
|
||||
dose += *(mapElement.second);
|
||||
// auto copyNb = mapElement.first;
|
||||
// G4cout << "\n patient" << copyNb << ": " << G4BestUnit(dose,"Dose");
|
||||
}
|
||||
if (dose > 0.) fRunAction->SumDose(dose);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3a
|
||||
|
||||
@@ -61,4 +61,4 @@ void PhysicsList::SetCuts()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
@@ -29,13 +29,10 @@
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ChargedGeantino.hh"
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ChargedGeantino.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
@@ -47,17 +44,16 @@ namespace B3
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle("chargedgeantino");
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("chargedgeantino");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
|
||||
fParticleGun->SetParticleEnergy(1*eV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., 0.));
|
||||
fParticleGun->SetParticleEnergy(1 * eV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -69,39 +65,36 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
|
||||
{
|
||||
G4ParticleDefinition* particle = fParticleGun->GetParticleDefinition();
|
||||
if (particle == G4ChargedGeantino::ChargedGeantino()) {
|
||||
//fluorine
|
||||
// fluorine
|
||||
G4int Z = 9, A = 18;
|
||||
G4double ionCharge = 0.*eplus;
|
||||
G4double excitEnergy = 0.*keV;
|
||||
G4double ionCharge = 0. * eplus;
|
||||
G4double excitEnergy = 0. * keV;
|
||||
|
||||
G4ParticleDefinition* ion
|
||||
= G4IonTable::GetIonTable()->GetIon(Z,A,excitEnergy);
|
||||
G4ParticleDefinition* ion = G4IonTable::GetIonTable()->GetIon(Z, A, excitEnergy);
|
||||
fParticleGun->SetParticleDefinition(ion);
|
||||
fParticleGun->SetParticleCharge(ionCharge);
|
||||
}
|
||||
|
||||
// randomized position
|
||||
//
|
||||
///G4double x0 = 0*cm, y0 = 0*cm, z0 = 0*cm;
|
||||
///G4double dx0 = 0*cm, dy0 = 0*cm, dz0 = 0*cm;
|
||||
G4double x0 = 4*cm, y0 = 4*cm, z0 = 4*cm;
|
||||
G4double dx0 = 1*cm, dy0 = 1*cm, dz0 = 1*cm;
|
||||
x0 += dx0*(G4UniformRand()-0.5);
|
||||
y0 += dy0*(G4UniformRand()-0.5);
|
||||
z0 += dz0*(G4UniformRand()-0.5);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
|
||||
/// G4double x0 = 0*cm, y0 = 0*cm, z0 = 0*cm;
|
||||
/// G4double dx0 = 0*cm, dy0 = 0*cm, dz0 = 0*cm;
|
||||
G4double x0 = 4 * cm, y0 = 4 * cm, z0 = 4 * cm;
|
||||
G4double dx0 = 1 * cm, dy0 = 1 * cm, dz0 = 1 * cm;
|
||||
x0 += dx0 * (G4UniformRand() - 0.5);
|
||||
y0 += dy0 * (G4UniformRand() - 0.5);
|
||||
z0 += dz0 * (G4UniformRand() - 0.5);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0));
|
||||
|
||||
//create vertex
|
||||
// create vertex
|
||||
//
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
fParticleGun->GeneratePrimaryVertex(event);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace B3
|
||||
|
||||
@@ -28,13 +28,15 @@
|
||||
/// \brief Implementation of the B3a::RunAction class
|
||||
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4AccumulableManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
using namespace B3;
|
||||
|
||||
@@ -45,17 +47,17 @@ namespace B3a
|
||||
|
||||
RunAction::RunAction()
|
||||
{
|
||||
//add new units for dose
|
||||
// add new units for dose
|
||||
//
|
||||
const G4double milligray = 1.e-3*gray;
|
||||
const G4double microgray = 1.e-6*gray;
|
||||
const G4double nanogray = 1.e-9*gray;
|
||||
const G4double picogray = 1.e-12*gray;
|
||||
const G4double milligray = 1.e-3 * gray;
|
||||
const G4double microgray = 1.e-6 * gray;
|
||||
const G4double nanogray = 1.e-9 * gray;
|
||||
const G4double picogray = 1.e-12 * gray;
|
||||
|
||||
new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
|
||||
new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
|
||||
new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
|
||||
new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
|
||||
new G4UnitDefinition("milligray", "milliGy", "Dose", milligray);
|
||||
new G4UnitDefinition("microgray", "microGy", "Dose", microgray);
|
||||
new G4UnitDefinition("nanogray", "nanoGy", "Dose", nanogray);
|
||||
new G4UnitDefinition("picogray", "picoGy", "Dose", picogray);
|
||||
|
||||
// Register accumulable to the accumulable manager
|
||||
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
|
||||
@@ -73,7 +75,7 @@ void RunAction::BeginOfRunAction(const G4Run* run)
|
||||
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
|
||||
accumulableManager->Reset();
|
||||
|
||||
//inform the runManager to save random number seed
|
||||
// inform the runManager to save random number seed
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
|
||||
}
|
||||
|
||||
@@ -94,40 +96,26 @@ void RunAction::EndOfRunAction(const G4Run* run)
|
||||
const auto generatorAction = static_cast<const PrimaryGeneratorAction*>(
|
||||
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
|
||||
G4String partName;
|
||||
if (generatorAction)
|
||||
{
|
||||
G4ParticleDefinition* particle
|
||||
= generatorAction->GetParticleGun()->GetParticleDefinition();
|
||||
if (generatorAction) {
|
||||
G4ParticleDefinition* particle = generatorAction->GetParticleGun()->GetParticleDefinition();
|
||||
partName = particle->GetParticleName();
|
||||
}
|
||||
|
||||
// Print results
|
||||
//
|
||||
if (IsMaster())
|
||||
{
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "--------------------End of Global Run-----------------------"
|
||||
<< G4endl
|
||||
<< " The run was " << nofEvents << " events ";
|
||||
if (IsMaster()) {
|
||||
G4cout << G4endl << "--------------------End of Global Run-----------------------" << G4endl
|
||||
<< " The run was " << nofEvents << " events ";
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "--------------------End of Local Run------------------------"
|
||||
<< G4endl
|
||||
<< " The run was " << nofEvents << " "<< partName;
|
||||
else {
|
||||
G4cout << G4endl << "--------------------End of Local Run------------------------" << G4endl
|
||||
<< " The run was " << nofEvents << " " << partName;
|
||||
}
|
||||
G4cout
|
||||
<< "; Nb of 'good' e+ annihilations: " << fGoodEvents.GetValue() << G4endl
|
||||
<< " Total dose in patient : " << G4BestUnit(fSumDose.GetValue(),"Dose")
|
||||
<< G4endl
|
||||
<< "------------------------------------------------------------" << G4endl
|
||||
<< G4endl;
|
||||
G4cout << "; Nb of 'good' e+ annihilations: " << fGoodEvents.GetValue() << G4endl
|
||||
<< " Total dose in patient : " << G4BestUnit(fSumDose.GetValue(), "Dose") << G4endl
|
||||
<< "------------------------------------------------------------" << G4endl << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3a
|
||||
|
||||
@@ -29,26 +29,26 @@
|
||||
|
||||
#include "StackingAction.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4NeutrinoE.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
namespace B3
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
StackingAction::ClassifyNewTrack(const G4Track* track)
|
||||
G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track)
|
||||
{
|
||||
//keep primary particle
|
||||
// keep primary particle
|
||||
if (track->GetParentID() == 0) return fUrgent;
|
||||
|
||||
//kill secondary neutrino
|
||||
if (track->GetDefinition() == G4NeutrinoE::NeutrinoE()) return fKill;
|
||||
else return fUrgent;
|
||||
// kill secondary neutrino
|
||||
if (track->GetDefinition() == G4NeutrinoE::NeutrinoE())
|
||||
return fKill;
|
||||
else
|
||||
return fUrgent;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3
|
||||
|
||||
@@ -27,42 +27,41 @@
|
||||
/// \file exampleB3b.cc
|
||||
/// \brief Main program of the B3b example
|
||||
|
||||
#include "G4Types.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4TScoreNtupleWriter.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsList.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4TScoreNtupleWriter.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
// #include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Detect interactive mode (if no arguments) and define UI session
|
||||
//
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv);}
|
||||
if (argc == 1) {
|
||||
ui = new G4UIExecutive(argc, argv);
|
||||
}
|
||||
|
||||
// Optionally: choose a different Random engine...
|
||||
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
|
||||
|
||||
//use G4SteppingVerboseWithUnits
|
||||
// use G4SteppingVerboseWithUnits
|
||||
G4int precision = 4;
|
||||
G4SteppingVerbose::UseBestUnit(precision);
|
||||
|
||||
// Construct the default run manager
|
||||
//
|
||||
auto runManager =
|
||||
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
@@ -92,16 +91,16 @@ 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 ( ! ui ) {
|
||||
if (!ui) {
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
UImanager->ApplyCommand(command + fileName);
|
||||
}
|
||||
else {
|
||||
// interactive mode
|
||||
|
||||
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
|
||||
|
||||
|
||||
**************************************************************
|
||||
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
|
||||
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
|
||||
Copyright : Geant4 Collaboration
|
||||
References : NIM A 506 (2003), 250-303
|
||||
: IEEE-TNS 53 (2006), 270-278
|
||||
@@ -42,14 +42,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...
|
||||
|
||||
@@ -390,7 +397,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
|
||||
|
||||
@@ -466,7 +473,7 @@ Threshold for very long decay time at rest 1 y
|
||||
HADRONIC PROCESSES SUMMARY (verbose level 1)
|
||||
-------------------------------------------------------------------------
|
||||
Hadronic Processes for GenericIon
|
||||
Process: Radioactivation
|
||||
Process: RadioactiveDecay
|
||||
|
||||
msc: for alpha SubType= 10
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
@@ -735,9 +742,9 @@ Setting was ignored.
|
||||
--> Event 9000 starts.
|
||||
|
||||
--------------------End of Global Run-----------------------
|
||||
The run was 10000 events Nb of 'good' e+ annihilations: 1278
|
||||
Total dose in patient : 306.445 picoGy
|
||||
Total dose in patient : 3.06445e-10 [sigma: 1.73409e-14 | error: 0.00565873 | coeff: 0.00565873 | eff: 1 | fom: 31229.3 | r2int: 3.2018e-05 | r2eff: 0 | hits: 10000 ] Gy
|
||||
The run was 10000 events Nb of 'good' e+ annihilations: 1308
|
||||
Total dose in patient : 305.937 picoGy
|
||||
Total dose in patient : 3.05937e-10 [sigma: 1.73788e-14 | error: 0.0056805 | coeff: 0.0056805 | eff: 1 | fom: 30990.3 | r2int: 3.22649e-05 | r2eff: 0 | hits: 10000 ] Gy
|
||||
------------------------------------------------------------
|
||||
|
||||
... write file : scoring.root - done
|
||||
|
||||
@@ -47,13 +47,10 @@ class ActionInitialization : public G4VUserActionInitialization
|
||||
|
||||
void BuildForMaster() const override;
|
||||
void Build() const override;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3b
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
|
||||
namespace B3
|
||||
{
|
||||
@@ -60,9 +59,8 @@ class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
G4bool fCheckOverlaps = true;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -42,18 +42,17 @@ namespace B3
|
||||
/// - G4RadioactiveDecayPhysics
|
||||
/// - G4EmStandardPhysics
|
||||
|
||||
class PhysicsList: public G4VModularPhysicsList
|
||||
class PhysicsList : public G4VModularPhysicsList
|
||||
{
|
||||
public:
|
||||
PhysicsList();
|
||||
~PhysicsList() override = default;
|
||||
public:
|
||||
PhysicsList();
|
||||
~PhysicsList() override = default;
|
||||
|
||||
void SetCuts() override;
|
||||
void SetCuts() override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#define B3PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
@@ -60,7 +59,7 @@ class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
G4ParticleGun* fParticleGun = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -31,8 +31,9 @@
|
||||
#define B3bRun_h 1
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4StatAnalysis.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
namespace B3b
|
||||
{
|
||||
@@ -53,7 +54,7 @@ class Run : public G4Run
|
||||
|
||||
public:
|
||||
G4int GetNbGoodEvents() const { return fGoodEvents; }
|
||||
G4double GetSumDose() const { return fSumDose; }
|
||||
G4double GetSumDose() const { return fSumDose; }
|
||||
G4StatAnalysis GetStatDose() const { return fStatDose; }
|
||||
|
||||
private:
|
||||
@@ -65,10 +66,8 @@ class Run : public G4Run
|
||||
G4StatAnalysis fStatDose;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3b
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#define B3bRunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Run;
|
||||
|
||||
@@ -48,12 +47,11 @@ class RunAction : public G4UserRunAction
|
||||
|
||||
G4Run* GenerateRun() override;
|
||||
void BeginOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3b
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
#define B3StackingAction_h 1
|
||||
|
||||
#include "G4UserStackingAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4ClassificationOfNewTrack.hh"
|
||||
|
||||
namespace B3
|
||||
{
|
||||
@@ -50,9 +51,8 @@ class StackingAction : public G4UserStackingAction
|
||||
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*) override;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@
|
||||
/// \brief Implementation of the B3b::ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "StackingAction.hh"
|
||||
|
||||
using namespace B3;
|
||||
@@ -55,5 +56,4 @@ void ActionInitialization::Build() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3b
|
||||
|
||||
@@ -29,21 +29,20 @@
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4MultiFunctionalDetector.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
#include "G4PSEnergyDeposit.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PSDoseDeposit.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4PSEnergyDeposit.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
namespace B3
|
||||
{
|
||||
@@ -63,14 +62,14 @@ void DetectorConstruction::DefineMaterials()
|
||||
|
||||
G4bool isotopes = false;
|
||||
|
||||
G4Element* O = man->FindOrBuildElement("O" , isotopes);
|
||||
G4Element* O = man->FindOrBuildElement("O", isotopes);
|
||||
G4Element* Si = man->FindOrBuildElement("Si", isotopes);
|
||||
G4Element* Lu = man->FindOrBuildElement("Lu", isotopes);
|
||||
|
||||
auto LSO = new G4Material("Lu2SiO5", 7.4 * g / cm3, 3);
|
||||
LSO->AddElement(Lu, 2);
|
||||
LSO->AddElement(Si, 1);
|
||||
LSO->AddElement(O , 5);
|
||||
LSO->AddElement(O, 5);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -79,44 +78,45 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Gamma detector Parameters
|
||||
//
|
||||
G4double cryst_dX = 6*cm, cryst_dY = 6*cm, cryst_dZ = 3*cm;
|
||||
G4double cryst_dX = 6 * cm, cryst_dY = 6 * cm, cryst_dZ = 3 * cm;
|
||||
G4int nb_cryst = 32;
|
||||
G4int nb_rings = 9;
|
||||
//
|
||||
G4double dPhi = twopi/nb_cryst, half_dPhi = 0.5*dPhi;
|
||||
G4double dPhi = twopi / nb_cryst, half_dPhi = 0.5 * dPhi;
|
||||
G4double cosdPhi = std::cos(half_dPhi);
|
||||
G4double tandPhi = std::tan(half_dPhi);
|
||||
//
|
||||
G4double ring_R1 = 0.5*cryst_dY/tandPhi;
|
||||
G4double ring_R2 = (ring_R1+cryst_dZ)/cosdPhi;
|
||||
G4double ring_R1 = 0.5 * cryst_dY / tandPhi;
|
||||
G4double ring_R2 = (ring_R1 + cryst_dZ) / cosdPhi;
|
||||
//
|
||||
G4double detector_dZ = nb_rings*cryst_dX;
|
||||
G4double detector_dZ = nb_rings * cryst_dX;
|
||||
//
|
||||
G4NistManager* nist = G4NistManager::Instance();
|
||||
G4Material* default_mat = nist->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* cryst_mat = nist->FindOrBuildMaterial("Lu2SiO5");
|
||||
G4Material* cryst_mat = nist->FindOrBuildMaterial("Lu2SiO5");
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4double world_sizeXY = 2.4*ring_R2;
|
||||
G4double world_sizeZ = 1.2*detector_dZ;
|
||||
G4double world_sizeXY = 2.4 * ring_R2;
|
||||
G4double world_sizeZ = 1.2 * detector_dZ;
|
||||
|
||||
auto solidWorld = new G4Box("World", // its name
|
||||
0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
|
||||
auto solidWorld =
|
||||
new G4Box("World", // its name
|
||||
0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
|
||||
|
||||
auto logicWorld = new G4LogicalVolume(solidWorld, // its solid
|
||||
default_mat, // its material
|
||||
"World"); // its name
|
||||
default_mat, // its material
|
||||
"World"); // its name
|
||||
|
||||
auto physWorld = new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
nullptr, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
nullptr, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// ring
|
||||
@@ -124,38 +124,38 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
auto solidRing = new G4Tubs("Ring", ring_R1, ring_R2, 0.5 * cryst_dX, 0., twopi);
|
||||
|
||||
auto logicRing = new G4LogicalVolume(solidRing, // its solid
|
||||
default_mat, // its material
|
||||
"Ring"); // its name
|
||||
default_mat, // its material
|
||||
"Ring"); // its name
|
||||
|
||||
//
|
||||
// define crystal
|
||||
//
|
||||
G4double gap = 0.5*mm; //a gap for wrapping
|
||||
G4double gap = 0.5 * mm; // a gap for wrapping
|
||||
G4double dX = cryst_dX - gap, dY = cryst_dY - gap;
|
||||
auto solidCryst = new G4Box("crystal", dX / 2, dY / 2, cryst_dZ / 2);
|
||||
|
||||
auto logicCryst = new G4LogicalVolume(solidCryst, // its solid
|
||||
cryst_mat, // its material
|
||||
"CrystalLV"); // its name
|
||||
cryst_mat, // its material
|
||||
"CrystalLV"); // its name
|
||||
|
||||
// place crystals within a ring
|
||||
//
|
||||
for (G4int icrys = 0; icrys < nb_cryst ; icrys++) {
|
||||
G4double phi = icrys*dPhi;
|
||||
G4RotationMatrix rotm = G4RotationMatrix();
|
||||
rotm.rotateY(90*deg);
|
||||
for (G4int icrys = 0; icrys < nb_cryst; icrys++) {
|
||||
G4double phi = icrys * dPhi;
|
||||
G4RotationMatrix rotm = G4RotationMatrix();
|
||||
rotm.rotateY(90 * deg);
|
||||
rotm.rotateZ(phi);
|
||||
G4ThreeVector uz = G4ThreeVector(std::cos(phi), std::sin(phi),0.);
|
||||
G4ThreeVector position = (ring_R1+0.5*cryst_dZ)*uz;
|
||||
G4Transform3D transform = G4Transform3D(rotm,position);
|
||||
G4ThreeVector uz = G4ThreeVector(std::cos(phi), std::sin(phi), 0.);
|
||||
G4ThreeVector position = (ring_R1 + 0.5 * cryst_dZ) * uz;
|
||||
G4Transform3D transform = G4Transform3D(rotm, position);
|
||||
|
||||
new G4PVPlacement(transform, //rotation,position
|
||||
logicCryst, //its logical volume
|
||||
"crystal", //its name
|
||||
logicRing, //its mother volume
|
||||
false, //no boolean operation
|
||||
icrys, //copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
new G4PVPlacement(transform, // rotation,position
|
||||
logicCryst, // its logical volume
|
||||
"crystal", // its name
|
||||
logicRing, // its mother volume
|
||||
false, // no boolean operation
|
||||
icrys, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
}
|
||||
|
||||
//
|
||||
@@ -164,71 +164,71 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
auto solidDetector = new G4Tubs("Detector", ring_R1, ring_R2, 0.5 * detector_dZ, 0., twopi);
|
||||
|
||||
auto logicDetector = new G4LogicalVolume(solidDetector, // its solid
|
||||
default_mat, // its material
|
||||
"Detector"); // its name
|
||||
default_mat, // its material
|
||||
"Detector"); // its name
|
||||
|
||||
//
|
||||
// place rings within detector
|
||||
//
|
||||
G4double OG = -0.5*(detector_dZ + cryst_dX);
|
||||
for (G4int iring = 0; iring < nb_rings ; iring++) {
|
||||
G4double OG = -0.5 * (detector_dZ + cryst_dX);
|
||||
for (G4int iring = 0; iring < nb_rings; iring++) {
|
||||
OG += cryst_dX;
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(0, 0, OG), // position
|
||||
logicRing, // its logical volume
|
||||
"ring", // its name
|
||||
logicDetector, // its mother volume
|
||||
false, // no boolean operation
|
||||
iring, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
G4ThreeVector(0, 0, OG), // position
|
||||
logicRing, // its logical volume
|
||||
"ring", // its name
|
||||
logicDetector, // its mother volume
|
||||
false, // no boolean operation
|
||||
iring, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
}
|
||||
|
||||
//
|
||||
// place detector in world
|
||||
//
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicDetector, // its logical volume
|
||||
"Detector", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicDetector, // its logical volume
|
||||
"Detector", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// patient
|
||||
//
|
||||
G4double patient_radius = 8*cm;
|
||||
G4double patient_dZ = 10*cm;
|
||||
G4double patient_radius = 8 * cm;
|
||||
G4double patient_dZ = 10 * cm;
|
||||
G4Material* patient_mat = nist->FindOrBuildMaterial("G4_BRAIN_ICRP");
|
||||
|
||||
auto solidPatient = new G4Tubs("Patient", 0., patient_radius, 0.5 * patient_dZ, 0., twopi);
|
||||
|
||||
auto logicPatient = new G4LogicalVolume(solidPatient, // its solid
|
||||
patient_mat, // its material
|
||||
"PatientLV"); // its name
|
||||
patient_mat, // its material
|
||||
"PatientLV"); // its name
|
||||
|
||||
//
|
||||
// place patient in world
|
||||
//
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicPatient, // its logical volume
|
||||
"Patient", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicPatient, // its logical volume
|
||||
"Patient", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
// Visualization attributes
|
||||
//
|
||||
logicRing->SetVisAttributes (G4VisAttributes::GetInvisible());
|
||||
logicDetector->SetVisAttributes (G4VisAttributes::GetInvisible());
|
||||
logicRing->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
logicDetector->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
|
||||
// Print materials
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//always return the physical World
|
||||
// always return the physical World
|
||||
//
|
||||
return physWorld;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ void DetectorConstruction::ConstructSDandField()
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(cryst);
|
||||
G4VPrimitiveScorer* primitiv1 = new G4PSEnergyDeposit("edep");
|
||||
cryst->RegisterPrimitive(primitiv1);
|
||||
SetSensitiveDetector("CrystalLV",cryst);
|
||||
SetSensitiveDetector("CrystalLV", cryst);
|
||||
|
||||
// declare patient as a MultiFunctionalDetector scorer
|
||||
//
|
||||
@@ -253,10 +253,9 @@ void DetectorConstruction::ConstructSDandField()
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(patient);
|
||||
G4VPrimitiveScorer* primitiv2 = new G4PSDoseDeposit("dose");
|
||||
patient->RegisterPrimitive(primitiv2);
|
||||
SetSensitiveDetector("PatientLV",patient);
|
||||
SetSensitiveDetector("PatientLV", patient);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3
|
||||
|
||||
@@ -61,4 +61,4 @@ void PhysicsList::SetCuts()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
} // namespace B3
|
||||
|
||||
@@ -29,13 +29,10 @@
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ChargedGeantino.hh"
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ChargedGeantino.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
@@ -47,17 +44,16 @@ namespace B3
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle("chargedgeantino");
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("chargedgeantino");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
|
||||
fParticleGun->SetParticleEnergy(1*eV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., 0.));
|
||||
fParticleGun->SetParticleEnergy(1 * eV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -69,39 +65,36 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
|
||||
{
|
||||
G4ParticleDefinition* particle = fParticleGun->GetParticleDefinition();
|
||||
if (particle == G4ChargedGeantino::ChargedGeantino()) {
|
||||
//fluorine
|
||||
// fluorine
|
||||
G4int Z = 9, A = 18;
|
||||
G4double ionCharge = 0.*eplus;
|
||||
G4double excitEnergy = 0.*keV;
|
||||
G4double ionCharge = 0. * eplus;
|
||||
G4double excitEnergy = 0. * keV;
|
||||
|
||||
G4ParticleDefinition* ion
|
||||
= G4IonTable::GetIonTable()->GetIon(Z,A,excitEnergy);
|
||||
G4ParticleDefinition* ion = G4IonTable::GetIonTable()->GetIon(Z, A, excitEnergy);
|
||||
fParticleGun->SetParticleDefinition(ion);
|
||||
fParticleGun->SetParticleCharge(ionCharge);
|
||||
}
|
||||
|
||||
// randomized position
|
||||
//
|
||||
///G4double x0 = 0*cm, y0 = 0*cm, z0 = 0*cm;
|
||||
///G4double dx0 = 0*cm, dy0 = 0*cm, dz0 = 0*cm;
|
||||
G4double x0 = 4*cm, y0 = 4*cm, z0 = 4*cm;
|
||||
G4double dx0 = 1*cm, dy0 = 1*cm, dz0 = 1*cm;
|
||||
x0 += dx0*(G4UniformRand()-0.5);
|
||||
y0 += dy0*(G4UniformRand()-0.5);
|
||||
z0 += dz0*(G4UniformRand()-0.5);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
|
||||
/// G4double x0 = 0*cm, y0 = 0*cm, z0 = 0*cm;
|
||||
/// G4double dx0 = 0*cm, dy0 = 0*cm, dz0 = 0*cm;
|
||||
G4double x0 = 4 * cm, y0 = 4 * cm, z0 = 4 * cm;
|
||||
G4double dx0 = 1 * cm, dy0 = 1 * cm, dz0 = 1 * cm;
|
||||
x0 += dx0 * (G4UniformRand() - 0.5);
|
||||
y0 += dy0 * (G4UniformRand() - 0.5);
|
||||
z0 += dz0 * (G4UniformRand() - 0.5);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0));
|
||||
|
||||
//create vertex
|
||||
// create vertex
|
||||
//
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
fParticleGun->GeneratePrimaryVertex(event);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace B3
|
||||
|
||||
@@ -29,13 +29,12 @@
|
||||
|
||||
#include "Run.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
|
||||
namespace B3b
|
||||
{
|
||||
@@ -44,54 +43,52 @@ namespace B3b
|
||||
|
||||
void Run::RecordEvent(const G4Event* event)
|
||||
{
|
||||
if ( fCollID_cryst < 0 ) {
|
||||
fCollID_cryst
|
||||
= G4SDManager::GetSDMpointer()->GetCollectionID("crystal/edep");
|
||||
//G4cout << " fCollID_cryst: " << fCollID_cryst << G4endl;
|
||||
if (fCollID_cryst < 0) {
|
||||
fCollID_cryst = G4SDManager::GetSDMpointer()->GetCollectionID("crystal/edep");
|
||||
// G4cout << " fCollID_cryst: " << fCollID_cryst << G4endl;
|
||||
}
|
||||
|
||||
if ( fCollID_patient < 0 ) {
|
||||
fCollID_patient
|
||||
= G4SDManager::GetSDMpointer()->GetCollectionID("patient/dose");
|
||||
//G4cout << " fCollID_patient: " << fCollID_patient << G4endl;
|
||||
if (fCollID_patient < 0) {
|
||||
fCollID_patient = G4SDManager::GetSDMpointer()->GetCollectionID("patient/dose");
|
||||
// G4cout << " fCollID_patient: " << fCollID_patient << G4endl;
|
||||
}
|
||||
|
||||
G4int evtNb = event->GetEventID();
|
||||
|
||||
if (evtNb%fPrintModulo == 0) {
|
||||
if (evtNb % fPrintModulo == 0) {
|
||||
G4cout << G4endl << "---> end of event: " << evtNb << G4endl;
|
||||
}
|
||||
|
||||
//Hits collections
|
||||
// Hits collections
|
||||
//
|
||||
G4HCofThisEvent* HCE = event->GetHCofThisEvent();
|
||||
if(!HCE) return;
|
||||
if (!HCE) return;
|
||||
|
||||
//Energy in crystals : identify 'good events'
|
||||
// Energy in crystals : identify 'good events'
|
||||
//
|
||||
const G4double eThreshold = 500*keV;
|
||||
const G4double eThreshold = 500 * keV;
|
||||
G4int nbOfFired = 0;
|
||||
|
||||
auto evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_cryst));
|
||||
|
||||
std::map<G4int,G4double*>::iterator itr;
|
||||
for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
|
||||
G4double edep = *(itr->second);
|
||||
for (auto& mapElement : (*evtMap->GetMap())) {
|
||||
auto edep = *(mapElement.second);
|
||||
if (edep > eThreshold) nbOfFired++;
|
||||
///G4int copyNb = (itr->first);
|
||||
///G4cout << G4endl << " cryst" << copyNb << ": " << edep/keV << " keV ";
|
||||
// auto copyNb = mapElement.first;
|
||||
// G4cout << "\n cryst" << copyNb << ": " << edep/keV << " keV ";
|
||||
}
|
||||
if (nbOfFired == 2) fGoodEvents++;
|
||||
|
||||
//Dose deposit in patient
|
||||
// Dose deposit in patient
|
||||
//
|
||||
G4double dose = 0.;
|
||||
|
||||
evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_patient));
|
||||
|
||||
for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
|
||||
///G4int copyNb = (itr->first);
|
||||
dose = *(itr->second);
|
||||
for (auto& mapElement : (*evtMap->GetMap())) {
|
||||
dose += *(mapElement.second);
|
||||
// auto copyNb = mapElement.first;
|
||||
// G4cout << "\n patient" << copyNb << ": " << G4BestUnit(dose,"Dose");
|
||||
}
|
||||
fSumDose += dose;
|
||||
fStatDose += dose;
|
||||
@@ -101,16 +98,15 @@ void Run::RecordEvent(const G4Event* event)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Run::Merge(const G4Run* aRun)
|
||||
void Run::Merge(const G4Run* run)
|
||||
{
|
||||
const Run* localRun = static_cast<const Run*>(aRun);
|
||||
const Run* localRun = static_cast<const Run*>(run);
|
||||
fGoodEvents += localRun->fGoodEvents;
|
||||
fSumDose += localRun->fSumDose;
|
||||
fStatDose += localRun->fStatDose;
|
||||
G4Run::Merge(aRun);
|
||||
fSumDose += localRun->fSumDose;
|
||||
fStatDose += localRun->fStatDose;
|
||||
G4Run::Merge(run);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3b
|
||||
|
||||
@@ -28,13 +28,15 @@
|
||||
/// \brief Implementation of the B3b::RunAction class
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "Run.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "Run.hh"
|
||||
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
using namespace B3;
|
||||
|
||||
@@ -45,23 +47,25 @@ namespace B3b
|
||||
|
||||
RunAction::RunAction()
|
||||
{
|
||||
//add new units for dose
|
||||
// add new units for dose
|
||||
//
|
||||
const G4double milligray = 1.e-3*gray;
|
||||
const G4double microgray = 1.e-6*gray;
|
||||
const G4double nanogray = 1.e-9*gray;
|
||||
const G4double picogray = 1.e-12*gray;
|
||||
const G4double milligray = 1.e-3 * gray;
|
||||
const G4double microgray = 1.e-6 * gray;
|
||||
const G4double nanogray = 1.e-9 * gray;
|
||||
const G4double picogray = 1.e-12 * gray;
|
||||
|
||||
new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
|
||||
new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
|
||||
new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
|
||||
new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
|
||||
new G4UnitDefinition("milligray", "milliGy", "Dose", milligray);
|
||||
new G4UnitDefinition("microgray", "microGy", "Dose", microgray);
|
||||
new G4UnitDefinition("nanogray", "nanoGy", "Dose", nanogray);
|
||||
new G4UnitDefinition("picogray", "picoGy", "Dose", picogray);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Run* RunAction::GenerateRun()
|
||||
{ return new Run; }
|
||||
{
|
||||
return new Run;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -69,7 +73,7 @@ void RunAction::BeginOfRunAction(const G4Run* run)
|
||||
{
|
||||
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
|
||||
|
||||
//inform the runManager to save random number seed
|
||||
// inform the runManager to save random number seed
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
|
||||
}
|
||||
|
||||
@@ -86,48 +90,35 @@ void RunAction::EndOfRunAction(const G4Run* run)
|
||||
const auto generatorAction = static_cast<const PrimaryGeneratorAction*>(
|
||||
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
|
||||
G4String partName;
|
||||
if (generatorAction)
|
||||
{
|
||||
G4ParticleDefinition* particle
|
||||
= generatorAction->GetParticleGun()->GetParticleDefinition();
|
||||
if (generatorAction) {
|
||||
G4ParticleDefinition* particle = generatorAction->GetParticleGun()->GetParticleDefinition();
|
||||
partName = particle->GetParticleName();
|
||||
}
|
||||
|
||||
//results
|
||||
// results
|
||||
//
|
||||
const Run* b3Run = static_cast<const Run*>(run);
|
||||
G4int nbGoodEvents = b3Run->GetNbGoodEvents();
|
||||
G4double sumDose = b3Run->GetSumDose();
|
||||
G4double sumDose = b3Run->GetSumDose();
|
||||
G4StatAnalysis statDose = b3Run->GetStatDose();
|
||||
|
||||
//print
|
||||
// print
|
||||
//
|
||||
if (IsMaster())
|
||||
{
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "--------------------End of Global Run-----------------------"
|
||||
<< G4endl
|
||||
<< " The run was " << nofEvents << " events ";
|
||||
if (IsMaster()) {
|
||||
G4cout << G4endl << "--------------------End of Global Run-----------------------" << G4endl
|
||||
<< " The run was " << nofEvents << " events ";
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "--------------------End of Local Run------------------------"
|
||||
<< G4endl
|
||||
<< " The run was " << nofEvents << " "<< partName;
|
||||
else {
|
||||
G4cout << G4endl << "--------------------End of Local Run------------------------" << G4endl
|
||||
<< " The run was " << nofEvents << " " << partName;
|
||||
}
|
||||
statDose /= gray;
|
||||
G4cout
|
||||
<< "; Nb of 'good' e+ annihilations: " << nbGoodEvents << G4endl
|
||||
<< " Total dose in patient : " << G4BestUnit(sumDose, "Dose") << G4endl
|
||||
<< " Total dose in patient : " << statDose << " Gy" << G4endl
|
||||
<< "------------------------------------------------------------" << G4endl
|
||||
<< G4endl;
|
||||
G4cout << "; Nb of 'good' e+ annihilations: " << nbGoodEvents << G4endl
|
||||
<< " Total dose in patient : " << G4BestUnit(sumDose, "Dose") << G4endl
|
||||
<< " Total dose in patient : " << statDose << " Gy" << G4endl
|
||||
<< "------------------------------------------------------------" << G4endl << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3b
|
||||
|
||||
@@ -29,26 +29,26 @@
|
||||
|
||||
#include "StackingAction.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4NeutrinoE.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
namespace B3
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
StackingAction::ClassifyNewTrack(const G4Track* track)
|
||||
G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track)
|
||||
{
|
||||
//keep primary particle
|
||||
// keep primary particle
|
||||
if (track->GetParentID() == 0) return fUrgent;
|
||||
|
||||
//kill secondary neutrino
|
||||
if (track->GetDefinition() == G4NeutrinoE::NeutrinoE()) return fKill;
|
||||
else return fUrgent;
|
||||
// kill secondary neutrino
|
||||
if (track->GetDefinition() == G4NeutrinoE::NeutrinoE())
|
||||
return fKill;
|
||||
else
|
||||
return fUrgent;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
} // namespace B3
|
||||
|
||||
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-05-07 I. Hrivnacova (exampleB3-V11-02-00)
|
||||
- Looping over G4THitsMap via range for loop instead of iterators.
|
||||
|
||||
## 2023-11-15 I. Hrivnacova (exampleB3-V11-01-01)
|
||||
- Updated vis.mac macros:
|
||||
Changed "/vis/open OGL [600x600-0+0]" to "/vis/open" to allow run-time choices
|
||||
|
||||
Reference in New Issue
Block a user