Import Geant4 11.4.1 source tree

This commit is contained in:
Gabriele Cosmo
2026-03-19 16:51:22 +01:00
parent b4a16de652
commit 41f2dd7996
352 changed files with 26342 additions and 24532 deletions
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -1849,7 +1849,7 @@ Using
Run terminated.
Run Summary
Number of events processed : 1000
User=30.290000s Real=30.403408s Sys=0.010000s
User=28.640000s Real=28.731331s Sys=0.010000s
... write file : ExExCh.root - done
... close file : ExExCh.root - done
Graphics systems deleted.
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -929,4 +929,4 @@ Max 2J for sampling of angular correlations 10
Graphics systems deleted.
Visualization Manager deleting...
Execution terminated
User=29.750000s Real=31.704458s Sys=0.030000s
User=28.880000s Real=29.956450s Sys=0.030000s
@@ -30,6 +30,7 @@ set(TESTch2_SCRIPTS
vis.mac
run.mac
analysis_ch2.py
analysis_ch2.ipynb
special_macros/run_Bent_Crystal_Deflection_Radiation.mac
special_macros/run_Bent_Crystal_HE_Deflection.mac
special_macros/run_Radiation.mac
@@ -1,8 +1,17 @@
# Category ch2 History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2026-01-30 Alexei Sytov (ch2-V11-03-02)
- Bug correction in ch2 (otherwise error at the end of execution at RunAction.cc
in the case when the G4ChannelingFastSimModel is switched off);
- Corrections in plot labels and some comments in the python scripts;
- Corrections cmake to copy also jupyter notebook in the build folder;
- Small corrections in comments in macro.
## 2025-10-31 Alexei Sytov (ch2-V11-03-01)
- Update of python analysis tools, no change in Geant4 code.
@@ -245,6 +245,8 @@
"\n",
"############# INPUT #############\n",
"# Feel free to modify the collimator parameters\n",
"# !!! related only to real secondary photons from results.root, not from Spectrum.dat\n",
"# For Spectrum.dat, see the options in the simulation macro.\n",
"apply_collimation = True\n",
"coll_angle = 2.3183 #mrad\n",
"\n",
@@ -252,7 +254,7 @@
"NbinE = 20\n",
"rangeE = [0, 10] #MeV\n",
"\n",
"# path of the spectrum file obtained using all the Bair-Katkov integration photons\n",
"# path of the spectrum file obtained using all the Baier-Katkov integration photons\n",
"BK_spectrum_file = \"Spectrum.dat\"\n",
"#################################\n",
"\n",
@@ -298,24 +300,29 @@
"bw = 0.6\n",
"color0 = '#B1B3FB'\n",
"\n",
"#!!! The spectrum is normalized on the total radiation probability W_rad \n",
"#(from MinPhotonEnergy to the energy of the primary particle) which is equivalent to the radiation yield.\n",
"#The integral is equal to W_rad, not to 1!\n",
"plt.subplot(1,2,1)\n",
"plt.bar(Ebin, spectrum, width=bw, color=color0, linewidth=lw, alpha=1, label='secondary photons')\n",
"plt.errorbar(Ebin, spectrum, yerr=spectrum_err, fmt='o', color='k', capsize=3)\n",
"plt.xlim(rangeE)\n",
"plt.plot(E_ext, S_ext, 'r-', lw=2.5, label='from '+BK_spectrum_file)\n",
"plt.title('Emitted photon spectrum')\n",
"plt.xlabel('E [MeV]', fontsize=fs)\n",
"plt.ylabel('1/N dN/dE', fontsize=fs)\n",
"plt.xlabel('$E$ [MeV]', fontsize=fs)\n",
"plt.ylabel('$dW_{rad}/dE$ [MeV$^{-1}$]', fontsize=fs)\n",
"plt.legend()\n",
"#plt.yscale('log')\n",
"\n",
"#The spectral intensity is the spectrum above multiplied by the energy,\n",
"#so the spectral intensity of bremsstrahlung is nearly constant.\n",
"plt.subplot(1,2,2)\n",
"plt.bar(Ebin, spectral_intensity, width=bw, color=color0, linewidth=lw, alpha=1, label='secondary photons')\n",
"plt.errorbar(Ebin, spectral_intensity, yerr=spectral_intensity_err, fmt='o', color='k', capsize=3)\n",
"plt.plot(E_ext, E_ext * S_ext, 'r-', lw=2.5, label='from '+BK_spectrum_file)\n",
"plt.title('Emitted photon spectral intensity')\n",
"plt.xlabel('E [MeV]', fontsize=fs)\n",
"plt.ylabel('1/N dW/dE', fontsize=fs)\n",
"plt.xlabel('$E$ [MeV]', fontsize=fs)\n",
"plt.ylabel('$E dW_{rad}/dE$', fontsize=fs)\n",
"plt.xlim(rangeE)\n",
"plt.legend()\n",
"#plt.yscale('log')\n",
@@ -158,6 +158,8 @@ if save_fig:
############# INPUT #############
# Feel free to modify the collimator parameters
# !!! related only to real secondary photons from results.root, not from Spectrum.dat
# For Spectrum.dat, see the options in the simulation macro.
apply_collimation = True
coll_angle = 2.3183 #mrad
@@ -165,7 +167,7 @@ coll_angle = 2.3183 #mrad
NbinE = 20
rangeE = [0, 10] #MeV
# path of the spectrum file obtained using all the Bair-Katkov integration photons
# path of the spectrum file obtained using all the Baier-Katkov integration photons
BK_spectrum_file = "Spectrum.dat"
#################################
@@ -211,24 +213,29 @@ lw = 2
bw = 0.6
color0 = '#B1B3FB'
# !!! The spectrum is normalized on the total radiation probability W_rad
# (from MinPhotonEnergy to the energy of the primary particle) which is equivalent to the radiation yield.
# The integral is equal to W_rad, not to 1!
plt.subplot(1,2,1)
plt.bar(Ebin, spectrum, width=bw, color=color0, linewidth=lw, alpha=1, label='secondary photons')
plt.errorbar(Ebin, spectrum, yerr=spectrum_err, fmt='o', color='k', capsize=3)
plt.xlim(rangeE)
plt.plot(E_ext, S_ext, 'r-', lw=2.5, label='from '+BK_spectrum_file)
plt.title('Emitted photon spectrum')
plt.xlabel('E [MeV]', fontsize=fs)
plt.ylabel('1/N dN/dE', fontsize=fs)
plt.xlabel('$E$ [MeV]', fontsize=fs)
plt.ylabel('$dW_{rad}/dE$ [MeV$^{-1}$]', fontsize=fs)
plt.legend()
#plt.yscale('log')
#The spectral intensity is the spectrum above multiplied by the energy,
#so the spectral intensity of bremsstrahlung is nearly constant.
plt.subplot(1,2,2)
plt.bar(Ebin, spectral_intensity, width=bw, color=color0, linewidth=lw, alpha=1, label='secondary photons')
plt.errorbar(Ebin, spectral_intensity, yerr=spectral_intensity_err, fmt='o', color='k', capsize=3)
plt.plot(E_ext, E_ext * S_ext, 'r-', lw=2.5, label='from '+BK_spectrum_file)
plt.title('Emitted photon spectral intensity')
plt.xlabel('E [MeV]', fontsize=fs)
plt.ylabel('1/N dW/dE', fontsize=fs)
plt.xlabel('$E$ [MeV]', fontsize=fs)
plt.ylabel('$E dW_{rad}/dE$', fontsize=fs)
plt.xlim(rangeE)
plt.legend()
#plt.yscale('log')
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -853,4 +853,4 @@ Max 2J for sampling of angular correlations 10
Graphics systems deleted.
Visualization Manager deleting...
Execution terminated
User=30.470000s Real=31.238877s Sys=0.050000s
User=29.390000s Real=30.201438s Sys=0.040000s
@@ -112,6 +112,9 @@ class DetectorConstruction : public G4VUserDetectorConstruction
void SetLindhardAnglesMuPlus(G4double val) {fLindhardAnglesMuPlus = val;}
void SetLindhardAnglesMuMinus(G4double val) {fLindhardAnglesMuMinus = val;}
//get the flag, if the channeling model is switched on/off
G4bool GetChannelingModel() const {return fActivateChannelingModel;}
private:
DetectorConstructionMessenger* fMessenger;
@@ -39,7 +39,9 @@
#the following can be changed or commented:
#the low energy threshold for particle to enter the G4ChannelingFastSimModel:
/crystal/setParticleMinKinEnergy 200 MeV # default value for all charged particles
#the same for specific particles (has priority vs default)
# use it for the particles not in the list below,
# such as ions.
#the same for specific particles (has priority vs default!)
/crystal/setParticleMinKinEnergy/proton 200 MeV
/crystal/setParticleMinKinEnergy/anti_proton 200 MeV
/crystal/setParticleMinKinEnergy/pi+ 200 MeV
@@ -33,6 +33,8 @@
#include "G4ChannelingFastSimModel.hh"
#include "G4Threading.hh"
#include "DetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
@@ -112,35 +114,42 @@ void RunAction::EndOfRunAction(const G4Run*)
analysisManager->Write();
analysisManager->CloseFile();
//getting internal data of G4ChannelingFastSimModel
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4Region* regionCh = regionStore->GetRegion("Crystal");
G4bool someflag=false;
G4ChannelingFastSimModel* channeling =
static_cast<G4ChannelingFastSimModel*>
(regionCh->GetFastSimulationManager()->GetFastSimulationModel("ChannelingModel",
0,someflag));
//necessary for spectrum output
const DetectorConstruction* detConstruction
= static_cast<const DetectorConstruction*>
(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
G4bool activateChannelingModel = detConstruction->GetChannelingModel();
if (!IsMaster() && channeling->GetIfRadiationModelActive())
if(activateChannelingModel)
{
std::vector<G4double> photonEnergyInSpectrum =
channeling->GetRadiationModel()->GetPhotonEnergyInSpectrum();
std::vector<G4double> spectrum =
channeling->GetRadiationModel()->GetTotalSpectrum();
//getting internal data of G4ChannelingFastSimModel
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4Region* regionCh = regionStore->GetRegion("Crystal");
G4bool someflag=false;
G4ChannelingFastSimModel* channeling =
static_cast<G4ChannelingFastSimModel*>
(regionCh->GetFastSimulationManager()->GetFastSimulationModel("ChannelingModel",
0,someflag));
G4int threadID = G4Threading::G4GetThreadId();
if (!IsMaster() && channeling->GetIfRadiationModelActive())
{
std::vector<G4double> photonEnergyInSpectrum =
channeling->GetRadiationModel()->GetPhotonEnergyInSpectrum();
std::vector<G4double> spectrum =
channeling->GetRadiationModel()->GetTotalSpectrum();
std::ofstream file1;
file1.open("Spectrum_"+std::to_string(threadID)+".dat");
G4int threadID = G4Threading::G4GetThreadId();
file1 << std::setprecision(16);
for(std::size_t i = 0; i<spectrum.size(); i++)
{file1 << photonEnergyInSpectrum[i] << " " << spectrum[i] << G4endl;}
std::ofstream file1;
file1.open("Spectrum_"+std::to_string(threadID)+".dat");
file1.close();
file1 << std::setprecision(16);
for(std::size_t i = 0; i<spectrum.size(); i++)
{file1 << photonEnergyInSpectrum[i] << " " << spectrum[i] << G4endl;}
file1.close();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -929,4 +929,4 @@ Max 2J for sampling of angular correlations 10
Graphics systems deleted.
Visualization Manager deleting...
Execution terminated
User=63.740000s Real=75.225054s Sys=0.130000s
User=61.070000s Real=74.330996s Sys=0.100000s
@@ -1,4 +1,4 @@
Random seed: 1764223862
Random seed: 1773843723
Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Forcing G4RunManager type...
############################################
@@ -12,7 +12,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -851,11 +851,11 @@ Number of events to be processed: 10
Run terminated.
Run Summary
Number of events processed : 10
User=122.680000s Real=133.614006s Sys=0.060000s
User=159.260000s Real=170.307012s Sys=0.050000s
--------------------End of Global Run-----------------------
The run had 10 events
Edep in the Radiator Crystal (made of G4_W): 110.52547 +/- 21.888899 MeV
Edep in the Radiator Crystal (made of G4_W): 89.739024 +/- 22.202027 MeV
------------------------------------------------------------
@@ -863,8 +863,8 @@ Run Summary
------------------------------------------------------------
================== Deleting memory pools ===================
Number of memory pools allocated: 12 of which, static: 0
Dynamic pools deleted: 12 / Total memory freed: 0.12 MB
Number of memory pools allocated: 14 of which, static: 0
Dynamic pools deleted: 14 / Total memory freed: 0.13 MB
============================================================
Execution terminated
User=127.940000s Real=151.226294s Sys=11.020000s
User=164.350000s Real=186.815060s Sys=10.960000s
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -1101,7 +1101,7 @@ Event = 0 z0 = -779.999 Primary direction = (0,0,1)
Run terminated.
Run Summary
Number of events processed : 100
User=0.470000s Real=0.475050s Sys=0.010000s
User=0.450000s Real=0.473840s Sys=0.000000s
RunAction: End of run actions are started 1 Nevt= 100 Edep= 4223.57
====================================================
Beam Particle: proton
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -559,7 +559,7 @@ Setting was ignored.
Run terminated.
Run Summary
Number of events processed : 1000000
User=6.580000s Real=8.066991s Sys=0.000000s
User=6.080000s Real=6.141411s Sys=0.010000s
--------------------End of Global Run-----------------------
The run had 1000000 events... write file : output.root - done
@@ -569,4 +569,4 @@ Number of memory pools allocated: 12 of which, static: 0
Dynamic pools deleted: 12 / Total memory freed: 0.025 MB
============================================================
Execution completed
User=7.480000s Real=11.152669s Sys=0.020000s
User=6.940000s Real=8.387166s Sys=0.040000s
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -542,7 +542,7 @@ Setting was ignored.
Run terminated.
Run Summary
Number of events processed : 1000000
User=9.290000s Real=9.591629s Sys=0.050000s
User=8.940000s Real=8.995456s Sys=0.030000s
--------------------End of Global Run-----------------------
The run had 1000000 events... write file : output.root - done
@@ -552,4 +552,4 @@ Number of memory pools allocated: 12 of which, static: 0
Dynamic pools deleted: 12 / Total memory freed: 0.023 MB
============================================================
Execution completed
User=10.160000s Real=11.372977s Sys=0.070000s
User=9.790000s Real=12.182693s Sys=0.060000s
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Geant4 version Name: geant4-11-04-patch-01 (13-March-2026)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -1508,7 +1508,7 @@ Terminate current event processing.
Run terminated.
Run Summary
Number of events processed : 1
User=0.020000s Real=0.015762s Sys=0.000000s
User=0.010000s Real=0.015704s Sys=0.010000s
Sum NoMT: 0
Sum NoMRT: 0
Sum NoMRCondition: 0