Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -40,7 +40,7 @@ target_link_libraries(TestEm15 ${Geant4_LIBRARIES} )
# relies on these scripts being in the current working directory.
#
set(TestEm15_SCRIPTS
electron.mac muon.mac proton.mac TestEm15.in TestEm15.out vis.mac
gamma.mac electron.mac muon.mac proton.mac TestEm15.in TestEm15.out vis.mac
)
foreach(_script ${TestEm15_SCRIPTS})
@@ -1,4 +1,4 @@
$Id: History 100277 2016-10-17 08:32:55Z gcosmo $
$Id: History 110788 2018-06-14 06:45:08Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -14,6 +14,25 @@ track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13-06-18 mma (testem15-V10-04-06)
- PhysicsList: add G4EmStandardPhysicsWVI, GS, SS
24-05-18 IgS (testem15-V10-04-05)
- extended README, added README.gamma
22-05-18 IgS (testem15-V10-04-03)
- Use G4RotationMarix to convert to gamma reference system
- Use default random number generator
17-04-18 IgS (testem15-V10-04-02)
- Extended testem15 with gamma -> e+ e- 5D conversion code.
09-04-18 mma (testem15-V10-04-01)
- testem15.cc : set visualisation only in interactive mode
20-03-18 mma (testem15-V10-04-00)
- testem15.cc : remove G4UI_USE and G4VIS_USE
14-10-16 G.Folger (testem15-V10-02-02)
- remove direct use of {a,the}ParticleIterator, use GetParticleTableIterator().
@@ -27,7 +46,7 @@ track of all tags.
17-06-14 mma (testem15-V10-00-01)
- remove PhysicsList::SetCuts()
11-06-14 mma (testem15-V10-00-00)
- rm local commands for PhysicsList::SetCuts()
@@ -1,4 +1,4 @@
$Id: README 66241 2012-12-13 18:34:42Z gunter $
$Id: README 110463 2018-05-24 14:48:23Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -8,67 +8,77 @@ $Id: README 66241 2012-12-13 18:34:42Z gunter $
TestEm15
--------
How to compute and plot the final state of Multiple Scattering
considered as an isolated process.
The method is exposed below : see item Physics.
How to compute and plot the final state of Multiple Scattering
or Gamma Conversion considered as an isolated processes.
The method is exposed below : see item Physics.
1- GEOMETRY DEFINITION
It is a single box representing a 'semi infinite' homogeneous medium.
Two parameters define the geometry :
- the material of the box,
- the (full) size of the box.
The default geometry (100 m of water) is constructed in
DetectorConstruction, but the above parameters can be changed
interactively via the commands defined in DetectorMessenger.
It is a single box representing a 'semi infinite' homogeneous medium.
Two parameters define the geometry :
- the material of the box,
- the (full) size of the box.
The default geometry (100 m of water) is constructed in
DetectorConstruction, but the above parameters can be changed
interactively via the commands defined in DetectorMessenger.
2- PHYSICS LIST
The physics list contains the standard electromagnetic processes.
In order not to introduce 'articicial' constraints on the step size,
there is no limitation from the maximum energy lost per step.
The physics list contains the standard electromagnetic processes.
In order not to introduce 'artificial' constraints on the step size,
there is no limitation from the maximum energy lost per step.
3- AN EVENT : THE PRIMARY GENERATOR
The primary kinematic consists of a single particle starting at the edge
of the box. The type of the particle and its energy are set in
PrimaryGeneratorAction (1 MeV electron), and can be changed via the G4
build-in commands of ParticleGun class (see the macros provided with
this example).
The primary kinematic consists of a single particle starting at the edge
of the box. The type of the particle and its energy are set in
PrimaryGeneratorAction (1 MeV electron), and can be changed via the G4
build-in commands of ParticleGun class (see the macros provided with
this example).
4- PHYSICS
All discrete processes are inactivated (see provided macros),
so that Multiple Scattering is 'forced' to determine the first step of
the primary particle. The step size and the final state are computed
and plotted. Then the event is immediately killed.
The result is compared with the 'input' data, i.e. with the cross
sections stored in the PhysicsTables and used by Geant4.
The stepMax command provides an additionnal control of the step size of
so that Multiple Scattering or Gamma Conversion is 'forced' to
determine the first step of the primary particle.
The step size and the final state are computed and plotted.
Then the event is immediately killed.
The result is compared with the 'input' data, i.e. with the cross
sections stored in the PhysicsTables and used by Geant4.
The stepMax command provides an additional control of the step size of
the multiple scattering.
5- HISTOGRAMS
The test contains 9 built-in 1D histograms, which are managed by
G4AnalysisManager and its Messenger. The histos can be individually
activated with the command :
/analysis/h1/set id nbBins valMin valMax unit
where unit is the desired unit for the histo (MeV or keV, etc..)
(see the macros xxxx.mac).
The test contains 16 built-in 1D histograms, which are managed by
G4AnalysisManager and its Messenger. The histos can be individually
activated with the command :
/analysis/h1/set id nbBins valMin valMax unit
where unit is the desired unit for the histo (MeV or keV, etc..)
(see the macros xxxx.mac).
1 Multiple Scattering. True step length
2 Multiple Scattering. Geom step length
3 Multiple Scattering. Ratio geomSl/trueSl
4 Multiple Scattering. Lateral displacement: radius
5 Multiple Scattering. Lateral displac: psi_space
6 Multiple Scattering. Angular distrib: theta_plane
7 Multiple Scattering. Phi-position angle
8 Multiple Scattering. Phi-direction angle
9 Multiple Scattering. Correlation: cos(phiPos-phiDir)
2 Multiple Scattering. Geom step length
3 Multiple Scattering. Ratio geomSl/trueSl
4 Multiple Scattering. Lateral displacement: radius
5 Multiple Scattering. Lateral displac: psi_space
6 Multiple Scattering. Angular distrib: theta_plane
7 Multiple Scattering. Phi-position angle
8 Multiple Scattering. Phi-direction angle
9 Multiple Scattering. Correlation: cos(phiPos-phiDir)
10 Gamma Conversion. Open Angle * Egamma
11 Gamma Conversion. Log10(P recoil)
12 Gamma Conversion. Phi P recoil angle
13 Gamma Conversion. Phi P plus angle
14 Gamma Conversion. 2 * cos(phiplus + phiminus) Asymmetry
15 Gamma Conversion. E plus / E gamma
16 Gamma Conversion. Phi of Gamma Polarization
The histograms are managed by the HistoManager class and its Messenger.
The histos can be individually activated with the command :
@@ -79,34 +89,40 @@ $Id: README 66241 2012-12-13 18:34:42Z gunter $
/analysis/setFileName name (default testem15)
It is possible to choose the format of the histogram file : root (default),
hbook, xml, csv, by using namespace in HistoManager.hh
hbook, xml, csv, by using namespace in HistoManager.hh
It is also possible to print selected histograms on an ascii file:
/analysis/h1/setAscii id
All selected histos will be written on a file name.ascii (default testem15)
6- VISUALIZATION
The Visualization Manager is set in the main().
The initialisation of the drawing is done via the commands
/vis/... in the macro vis.mac. To get visualisation:
> /control/execute vis.mac
The detector has a default view which is a longitudinal view of the
box.
The tracks are drawn at the end of event, and erased at the end of run.
The Visualization Manager is set in the main().
The initialization of the drawing is done via the commands
/vis/... in the macro vis.mac. To get visualization:
> /control/execute vis.mac
The detector has a default view which is a longitudinal view of the
box.
The tracks are drawn at the end of event, and erased at the end of run.
7- HOW TO START ?
execute TestEm15 in 'batch' mode from macro files :
% TestEm15 compt.mac
execute TestEm15 in 'interactive mode' with visualization :
% TestEm15
Idle> control/execute vis.mac
....
Idle> type your commands
....
Idle> exit
execute TestEm15 in 'batch' mode from macro files :
% TestEm15 compt.mac
execute TestEm15 in 'interactive mode' with visualization :
% TestEm15
Idle> control/execute vis.mac
....
Idle> type your commands
....
Idle> exit
8 - MACROS
The examples of macros for Multiple Scattering:
electron.mac muon.mac proton.mac
The example of Gamma Conversion macro :
gamma.mac
@@ -0,0 +1,48 @@
TestEm15 : gamma.mac
-- tests of the 5D gamma -> e+e- conversion model G4BetheHeitler5DModel
All discrete processes are inactivated (see macro),
so Gamma Conversion is 'forced'.
Histograms :
10 # Open Angle (rad)* E gamma (MeV)
The most probable value of the pair opening angle multiplied by the
photon energy is 1.6 rad*MeV.
Olsen, Phys. Rev. 131 (1963) 406. See also Fig. 7 of arXiv:1802.08253
11 # Log10 ( recoil momentum)
The distribution of the recoil momentum is described by
Jost, Phys. Rev. 80 (1950) 189 (no form factor).
See also Fig. 2 of Astroparticle Physics 88 (2017) 60.
12 # Phi recoil
13 # Phi positron
14 # Asymmetry 2 * cos(phi_+ + phi_-)
For a photon propagating along x, polarized along y, the average value of
2 * cos(phi_+ + phi_-),
provides a measurement of the polarization asymmetry, A.
Eq. (12) of Nucl. Instrum. Meth. A 729 (2013) 765
The azimuthal angle of the event defined as the bisector angle
of the azimuthal angles of the positron and of the electron,
(phi_+ + phi_-)/2,
provides the optimal measurement of the asymmetry
Astroparticle Physics 88 (2017) 30.
For high-energy photons (E >> 20 MeV), the asymptotic expression for A
can be used for comparison.
Boldyshev, Yad. Fiz. 14 (1971) 1027, Sov.J.Nucl.Phys. 14 (1972) 576.
See also eq. (13) of arXiv:1802.08253
Example : A ~ 0.17 at 100 GeV.
15 # E plus / E gamma
x_+ = E plus / E gamma has a more-or-less flat spectrum that extends
almost from 0. to 1.
See Fig. 16 page 261 of "The Quantum Theory of Radiation", W. Heitler,
3rd edition, 1954.
16 # Phi of Gamma Polarization
The phi of polarization vector after transformation into reference system
defined by gamma direction (z) , gamma polarization (x).
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm15/TestEm15.cc
/// \brief Main program of the electromagnetic/TestEm15 example
//
// $Id: TestEm15.cc 82283 2014-06-13 14:49:40Z gcosmo $
// $Id: TestEm15.cc 110439 2018-05-23 11:24:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -42,72 +42,58 @@
#include "RunAction.hh"
#include "SteppingAction.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
#ifdef G4UI_USE
#include "G4UIExecutive.hh"
#endif
#include "G4VisExecutive.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv) {
//choose the Random engine
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
//detect interactive mode (if no arguments) and define UI session
G4UIExecutive* ui = nullptr;
if (argc == 1) ui = new G4UIExecutive(argc,argv);
//my Verbose output class
G4VSteppingVerbose::SetInstance(new SteppingVerbose);
// Construct the default run manager
//construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
//set mandatory initialization classes
DetectorConstruction* det;
PrimaryGeneratorAction* prim;
runManager->SetUserInitialization(det = new DetectorConstruction);
runManager->SetUserInitialization(new PhysicsList);
runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
// set user action classes
//set user action classes
RunAction* run;
runManager->SetUserAction(run = new RunAction(det,prim));
runManager->SetUserAction(new SteppingAction(det,run));
// get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
if (argc!=1) // batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
else //define visualization and UI terminal for interactive mode
{
#ifdef G4VIS_USE
G4VisManager* visManager = new G4VisExecutive;
//initialize visualization
G4VisManager* visManager = nullptr;
//get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if (ui) {
//interactive mode
visManager = new G4VisExecutive;
visManager->Initialize();
#endif
#ifdef G4UI_USE
G4UIExecutive * ui = new G4UIExecutive(argc,argv);
ui->SessionStart();
delete ui;
#endif
#ifdef G4VIS_USE
delete visManager;
#endif
}
ui->SessionStart();
delete ui;
}
else {
//batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
// job termination
//
//job termination
delete visManager;
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -4,7 +4,7 @@
############################################
**************************************************************
Geant4 version Name: geant4-10-04-patch-02 (25-May-2018)
Geant4 version Name: geant4-10-05-beta-01 (29-June-2018)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -239,8 +239,8 @@ compt: for gamma SubType= 13 BuildTable= 1
conv: for gamma SubType= 14 BuildTable= 1
Lambda table from 1.022 MeV to 100 TeV, 18 bins per decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheHeitler : Emin= 0 eV Emax= 80 GeV
BetheHeitlerLPM : Emin= 80 GeV Emax= 100 TeV
BetheHeitler : Emin= 0 eV Emax= 80 GeV AngularGenUrban
BetheHeitlerLPM : Emin= 80 GeV Emax= 100 TeV AngularGenUrban
msc: for e- SubType= 10
RangeFactor= 0.04, stepLimitType: 1, latDisplacement: 1
@@ -483,14 +483,15 @@ G4GeometryManager::ReportVoxelStats -- Voxel Statistics
Total CPU time elapsed for geometry optimisation: 0 seconds
### Run 0 starts.
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 9876, 54321
----------------------------------------
------- MixMaxRng engine status -------
Current state vector is:
mixmax state, file version 1.0
N=17 V[N]={906770732717044781, 629165745432651234, 1235682547346241386, 68420008233404568, 2262190991329242458, 2266470399991071809, 1976726662926872232, 245458862506414172, 1955974201201518530, 2155248512522080758, 604170912935414061, 1116171330120743511, 1861018313684488333, 1296715403254578286, 1549011045957234151, 370819759640195970, 2230139271784837643} counter= 17sumtot= 1977567618660788324
---------------------------------------
Run terminated.
Run Summary
Number of events processed : 10000
User=0.05s Real=0.05s Sys=0s
User=0.050000s Real=0.046529s Sys=0.000000s
The run consists of 10000 e- of 5 MeV through 100 m of Water (density: 1 g/cm3 )
@@ -506,16 +507,17 @@ Run Summary
Verification from G4EmCalculator.
transport mean free path : 3.3438 mm
transport mean free path : 8.3595 cm
range from restrict dE/dx: 2.7529 cm
---> effective facRange : 1
compute theta0 from Highland : 620.23 mrad (35.536 deg)
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 9876, 54321
----------------------------------------
------- MixMaxRng engine status -------
Current state vector is:
mixmax state, file version 1.0
N=17 V[N]={906770732717044781, 629165745432651234, 1235682547346241386, 68420008233404568, 2262190991329242458, 2266470399991071809, 1976726662926872232, 245458862506414172, 1955974201201518530, 2155248512522080758, 604170912935414061, 1116171330120743511, 1861018313684488333, 1296715403254578286, 1549011045957234151, 370819759640195970, 2230139271784837643} counter= 17sumtot= 1977567618660788324
---------------------------------------
#
/gun/energy 100 keV
/run/beamOn 10000
@@ -553,39 +555,41 @@ Index : 1 used in the geometry : Yes
### Run 1 starts.
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 9876, 54321
----------------------------------------
------- MixMaxRng engine status -------
Current state vector is:
mixmax state, file version 1.0
N=17 V[N]={906770732717044781, 629165745432651234, 1235682547346241386, 68420008233404568, 2262190991329242458, 2266470399991071809, 1976726662926872232, 245458862506414172, 1955974201201518530, 2155248512522080758, 604170912935414061, 1116171330120743511, 1861018313684488333, 1296715403254578286, 1549011045957234151, 370819759640195970, 2230139271784837643} counter= 17sumtot= 1977567618660788324
---------------------------------------
Run terminated.
Run Summary
Number of events processed : 10000
User=0.13s Real=0.19s Sys=0s
User=0.090000s Real=0.092069s Sys=0.000000s
The run consists of 10000 e- of 100 keV through 100 m of Water (density: 1 g/cm3 )
Process calls frequency ---> msc = 10000
truePathLength : 6.31 um +- 468.8 nm
geomPathLength : 6.1846 um +- 450.2 nm
lateralDisplac : 940.52 nm +- 264.27 nm
Psi : 150.31 mrad +- 38.61 mrad (8.6123 deg +- 2.2122 deg)
truePathLength : 6.2917 um +- 475.13 nm
geomPathLength : 6.167 um +- 456.34 nm
lateralDisplac : 900.24 nm +- 215.58 nm
Psi : 144.38 mrad +- 30.394 mrad (8.2722 deg +- 1.7415 deg)
Theta_plane : 247.48 mrad (14.18 deg)
phi correlation: 0.078588 +- 0.13471 (std::cos(phi_pos - phi_dir))
Theta_plane : 237.39 mrad (13.601 deg)
phi correlation: 0.1687 +- 0.14409 (std::cos(phi_pos - phi_dir))
Verification from G4EmCalculator.
transport mean free path : 1.5763 cm
transport mean free path : 157.63 um
range from restrict dE/dx: 143.25 um
---> effective facRange : 0.00040031
---> effective facRange : 0.039915
compute theta0 from Highland : 180.76 mrad (10.357 deg)
compute theta0 from Highland : 180.47 mrad (10.34 deg)
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 1197317911, 1555409489
----------------------------------------
------- MixMaxRng engine status -------
Current state vector is:
mixmax state, file version 1.0
N=17 V[N]={1878980021025824702, 1628414055095832785, 1423143082747383991, 183667810127059502, 873516494016093427, 2258436403847706357, 1766924342952509880, 2241182633882843117, 2300825244934056284, 1830781790629245517, 1820847226663247493, 1777236837741601357, 2188299593755602463, 457984591036031706, 1928140369650879678, 2142169973060122804, 1229191732611238510} counter= 13sumtot= 259626093212952161
---------------------------------------
G4 kernel has come to Quit state.
UserDetectorConstruction deleted.
UserPhysicsList deleted.
@@ -0,0 +1,57 @@
# $Id$
#
# Macro file for "TestEm15.cc"
# (can be run in batch, without graphic)
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setMat Aluminium
#
/testem/phys/addPhysics emstandard5D
#
/run/initialize
#
/run/setCut 1 mm
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate Rayl
#
# direction 1 0 0
/gun/particle gamma
/gun/energy 20 MeV
/gun/polarization 0.0 1.0 0.0
#
/analysis/setFileName gamma
#
# msc
#
#/analysis/setActivation true
#/analysis/verbose 4
#/analysis/h1/set 1 100 0 1000 um #true step length
#/analysis/h1/set 2 100 0 1000 um #geom step length
#/analysis/h1/set 3 100 0 1.1 none #ratio geom/true
#/analysis/h1/set 4 100 0 500 um #lateral radius
#/analysis/h1/set 5 100 0 +25 deg #psi_space angle
#/analysis/h1/set 6 100 -50 +50 deg #theta_plane angle
#/analysis/h1/set 7 90 -180 +180 deg #phi-position angle
#/analysis/h1/set 8 90 -180 +180 deg #phi-direction angle
#/analysis/h1/set 9 100 -1 +1 none #phi correlation
#
# conv
#
/control/alias pi 3.141592653589793
#
/analysis/h1/set 10 100 0.0 10.0 MeV # Open Angle (rad)* E gamma (MeV)
/analysis/h1/set 11 100 -2.0 2.0 none # Log10 ( recoil momentum)
/analysis/h1/set 12 100 -{pi} {pi} none # Phi recoil
/analysis/h1/set 13 100 -{pi} {pi} none # Phi positron
/analysis/h1/set 14 100 -2.0 2.0 none # Asymmentry 2 * cos(phi_+ + phi_-)
/analysis/h1/set 15 100 0.0 1.0 none # E plus / E gamma
/analysis/h1/set 16 100 -{pi} {pi} none # Phi of Gamma Polarization
#
###/tracking/verbose 2
###/run/beamOn 1
#
/run/beamOn 100000
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: $
//
//---------------------------------------------------------------------------
//
// ClassName: PhysListEm5DStandard
//
// Author: IgS 07.11.2017
//
// Modified:
// 17.11.2017 Created using PhysListEmStandard from V.Ivanchenko
//----------------------------------------------------------------------------
//
// This class provides construction of default EM standard physics which
// 5D generator model for gamma conversion
//
#ifndef PhysListEm5DStandard_h
#define PhysListEm5DStandard_h 1
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysListEm5DStandard : public G4VPhysicsConstructor
{
public:
explicit PhysListEm5DStandard(G4int ver=0, const G4String& name="");
virtual ~PhysListEm5DStandard();
virtual void ConstructParticle();
virtual void ConstructProcess();
private:
G4int verbose;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: HistoManager.cc 72240 2013-07-12 08:42:44Z gcosmo $
// $Id: HistoManager.cc 110439 2018-05-23 11:24:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -60,20 +60,28 @@ void HistoManager::Book()
analysisManager->SetActivation(true); //enable inactivation of histograms
// Define histograms start values
const G4int kMaxHisto = 10;
const G4String id[] = { "0", "1", "2", "3" , "4", "5", "6" , "7", "8", "9"};
const G4int kMaxHisto = 17;
const G4String id[] = { "0", "1", "2", "3" , "4", "5", "6" , "7", "8", "9",
"10","11","12","13","14","15","16"};
const G4String title[] =
{ "dummy", //0
"Multiple Scattering. True step length", //1
"Multiple Scattering. Geom step length", //2
"Multiple Scattering. Ratio geomSl/trueSl", //3
"Multiple Scattering. Lateral displacement: radius", //4
"Multiple Scattering. Lateral displac: psi_space", //5
"Multiple Scattering. Angular distrib: theta_plane", //6
"Multiple Scattering. Phi-position angle", //7
"Multiple Scattering. Phi-direction angle", //8
"Multiple Scattering. Correlation: std::cos(phiPos-phiDir)"//9
};
{ "dummy", //0
"Multiple Scattering. True step length", //1
"Multiple Scattering. Geom step length", //2
"Multiple Scattering. Ratio geomSl/trueSl", //3
"Multiple Scattering. Lateral displacement: radius", //4
"Multiple Scattering. Lateral displac: psi_space", //5
"Multiple Scattering. Angular distrib: theta_plane", //6
"Multiple Scattering. Phi-position angle", //7
"Multiple Scattering. Phi-direction angle", //8
"Multiple Scattering. Correlation: std::cos(phiPos-phiDir)",//9
"Gamma Conversion. Open Angle * Egamma", //10
"Gamma Conversion. Log10(P recoil)", //11
"Gamma Conversion. Phi P recoil angle", //12
"Gamma Conversion. Phi P plus angle", //13
"Gamma Conversion. 2 * cos(phiplus + phiminus) Asymmetry", //14
"Gamma Conversion. E plus / E gamma", //15
"Gamma Conversion. Phi of Gamma Polarization" //16
};
// Default values (to be reset via /analysis/h1/set command)
G4int nbins = 100;
@@ -0,0 +1,351 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: $
//
//---------------------------------------------------------------------------
//
// ClassName: PhysListEm5DStandard
//
// Author: IgS 07.11.2017
//
// Modified:
// 17.11.2017 Created using PhysListEm5DStandard from V.Ivanchenko
//
//----------------------------------------------------------------------------
//
#include "PhysListEm5DStandard.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleDefinition.hh"
#include "G4EmParameters.hh"
#include "G4LossTableManager.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4RayleighScattering.hh"
#include "G4BetheHeitler5DModel.hh"
#include "G4eMultipleScattering.hh"
#include "G4MuMultipleScattering.hh"
#include "G4hMultipleScattering.hh"
#include "G4CoulombScattering.hh"
#include "G4eCoulombScatteringModel.hh"
#include "G4WentzelVIModel.hh"
#include "G4UrbanMscModel.hh"
#include "G4MuBremsstrahlungModel.hh"
#include "G4MuPairProductionModel.hh"
#include "G4hBremsstrahlungModel.hh"
#include "G4hPairProductionModel.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
#include "G4alphaIonisation.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4Alpha.hh"
#include "G4GenericIon.hh"
#include "G4PhysicsListHelper.hh"
#include "G4BuilderType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEm5DStandard::PhysListEm5DStandard(G4int ver, const G4String&)
: G4VPhysicsConstructor("G4EmStandard_5D"), verbose(ver)
{
G4EmParameters* param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(verbose);
param->SetNumberOfBinsPerDecade(10);
param->SetMscStepLimitType(fUseSafetyPlus);
#if G4VERSION_NUMBER >= 1040
param->SetLateralDisplacementAlg96(false);
#endif
param->SetFluo(true);
SetPhysicsType(bElectromagnetic);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEm5DStandard::~PhysListEm5DStandard()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEm5DStandard::ConstructParticle()
{
// gamma
G4Gamma::Gamma();
// leptons
G4Electron::Electron();
G4Positron::Positron();
G4MuonPlus::MuonPlus();
G4MuonMinus::MuonMinus();
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
// barions
G4Proton::Proton();
G4AntiProton::AntiProton();
// ions
G4Deuteron::Deuteron();
G4Triton::Triton();
G4He3::He3();
G4Alpha::Alpha();
G4GenericIon::GenericIonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEm5DStandard::ConstructProcess()
{
if(verbose > 1) {
G4cout << "### " << GetPhysicsName() << " Construct Processes " << G4endl;
}
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
// muon & hadron bremsstrahlung and pair production
G4MuBremsstrahlung* mub = new G4MuBremsstrahlung();
G4MuPairProduction* mup = new G4MuPairProduction();
G4hBremsstrahlung* pib = new G4hBremsstrahlung();
G4hPairProduction* pip = new G4hPairProduction();
G4hBremsstrahlung* kb = new G4hBremsstrahlung();
G4hPairProduction* kp = new G4hPairProduction();
G4hBremsstrahlung* pb = new G4hBremsstrahlung();
G4hPairProduction* pp = new G4hPairProduction();
// muon & hadron multiple scattering
G4MuMultipleScattering* mumsc = new G4MuMultipleScattering();
mumsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* muss = new G4CoulombScattering();
G4MuMultipleScattering* pimsc = new G4MuMultipleScattering();
pimsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* piss = new G4CoulombScattering();
G4MuMultipleScattering* kmsc = new G4MuMultipleScattering();
kmsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* kss = new G4CoulombScattering();
G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc");
// high energy limit for e+- scattering models
G4double highEnergyLimit = 100*MeV;
// Add standard EM Processes
auto myParticleIterator=GetParticleIterator();
myParticleIterator->reset();
while( (*myParticleIterator)() ){
G4ParticleDefinition* particle = myParticleIterator->value();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// photo-effect and Compton
ph->RegisterProcess(new G4PhotoElectricEffect(), particle);
ph->RegisterProcess(new G4ComptonScattering(), particle);
// Gamma conversion
G4GammaConversion* gc = new G4GammaConversion();
G4VEmModel* theGC5DModel = new G4BetheHeitler5DModel();
gc->SetEmModel(theGC5DModel);
ph->RegisterProcess(gc, particle);
// Rayleigh scattering
ph->RegisterProcess(new G4RayleighScattering(), particle);
} else if (particleName == "e-") {
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "e+") {
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(new G4eplusAnnihilation(), particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "mu+" ||
particleName == "mu-" ) {
ph->RegisterProcess(mumsc, particle);
ph->RegisterProcess(new G4MuIonisation(), particle);
ph->RegisterProcess(mub, particle);
ph->RegisterProcess(mup, particle);
ph->RegisterProcess(muss, particle);
} else if (particleName == "alpha" ||
particleName == "He3") {
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4ionIonisation(), particle);
} else if (particleName == "GenericIon") {
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4ionIonisation(), particle);
} else if (particleName == "pi+" ||
particleName == "pi-" ) {
ph->RegisterProcess(pimsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(pib, particle);
ph->RegisterProcess(pip, particle);
ph->RegisterProcess(piss, particle);
} else if (particleName == "kaon+" ||
particleName == "kaon-" ) {
ph->RegisterProcess(kmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(kb, particle);
ph->RegisterProcess(kp, particle);
ph->RegisterProcess(kss, particle);
} else if (particleName == "proton" ||
particleName == "anti_proton") {
G4hMultipleScattering* pmsc = new G4hMultipleScattering();
pmsc->SetEmModel(new G4WentzelVIModel());
G4hIonisation* hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.1, 10*um);
ph->RegisterProcess(pmsc, particle);
ph->RegisterProcess(hIoni, particle);
ph->RegisterProcess(pb, particle);
ph->RegisterProcess(pp, particle);
ph->RegisterProcess(new G4CoulombScattering(), particle);
} else if (particleName == "B+" ||
particleName == "B-" ||
particleName == "D+" ||
particleName == "D-" ||
particleName == "Ds+" ||
particleName == "Ds-" ||
particleName == "anti_He3" ||
particleName == "anti_alpha" ||
particleName == "anti_deuteron" ||
particleName == "anti_lambda_c+" ||
particleName == "anti_omega-" ||
particleName == "anti_sigma_c+" ||
particleName == "anti_sigma_c++" ||
particleName == "anti_sigma+" ||
particleName == "anti_sigma-" ||
particleName == "anti_triton" ||
particleName == "anti_xi_c+" ||
particleName == "anti_xi-" ||
particleName == "deuteron" ||
particleName == "lambda_c+" ||
particleName == "omega-" ||
particleName == "sigma_c+" ||
particleName == "sigma_c++" ||
particleName == "sigma+" ||
particleName == "sigma-" ||
particleName == "tau+" ||
particleName == "tau-" ||
particleName == "triton" ||
particleName == "xi_c+" ||
particleName == "xi-" ) {
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
}
}
// Deexcitation
//
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,7 @@
/// \brief Implementation of the PhysicsList class
//
//
// $Id: PhysicsList.cc 100277 2016-10-17 08:32:55Z gcosmo $
// $Id: PhysicsList.cc 110788 2018-06-14 06:45:08Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -190,6 +190,11 @@ void PhysicsList::ConstructProcess()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4EmStandardPhysics_option3.hh"
#include "G4EmStandardPhysicsWVI.hh"
#include "G4EmStandardPhysicsGS.hh"
#include "G4EmStandardPhysicsSS.hh"
#include "G4EmLivermorePolarizedPhysics.hh"
#include "PhysListEm5DStandard.hh"
void PhysicsList::AddPhysicsList(const G4String& name)
{
@@ -210,7 +215,35 @@ void PhysicsList::AddPhysicsList(const G4String& name)
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option3();
} else if (name == "emstandardSS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsSS();
} else if (name == "emstandardWVI") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsWVI();
} else if (name == "emstandardGS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsGS();
} else if (name == "emstandard5D") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new PhysListEm5DStandard();
} else if (name == "emlivermorePola") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePolarizedPhysics();
} else {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
<< " is not defined"
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm15/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// $Id: RunAction.cc 82283 2014-06-13 14:49:40Z gcosmo $
// $Id: RunAction.cc 109394 2018-04-18 06:22:36Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -129,83 +129,87 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
G4cout << "\t" << procName << " = " << count;
}
if (fTotalCount == 0) return;
if (fTotalCount > 0) {
//compute path length and related quantities
//
G4double MeanTPL = fTruePL /fTotalCount;
G4double MeanTPL2 = fTruePL2/fTotalCount;
G4double rmsTPL = std::sqrt(std::fabs(MeanTPL2 - MeanTPL*MeanTPL));
G4double MeanGPL = fGeomPL /fTotalCount;
G4double MeanGPL2 = fGeomPL2/fTotalCount;
G4double rmsGPL = std::sqrt(std::fabs(MeanGPL2 - MeanGPL*MeanGPL));
G4double MeanLaD = fLDispl /fTotalCount;
G4double MeanLaD2 = fLDispl2/fTotalCount;
G4double rmsLaD = std::sqrt(std::fabs(MeanLaD2 - MeanLaD*MeanLaD));
G4double MeanPsi = fPsiSpa /(fTotalCount);
G4double MeanPsi2 = fPsiSpa2/(fTotalCount);
G4double rmsPsi = std::sqrt(std::fabs(MeanPsi2 - MeanPsi*MeanPsi));
G4double MeanTeta = fTetPrj /(2*fTotalCount);
G4double MeanTeta2 = fTetPrj2/(2*fTotalCount);
G4double rmsTeta = std::sqrt(std::fabs(MeanTeta2 - MeanTeta*MeanTeta));
G4double MeanCorrel = fPhiCor /(fTotalCount);
G4double MeanCorrel2 = fPhiCor2/(fTotalCount);
G4double rmsCorrel = std::sqrt(std::fabs(MeanCorrel2-MeanCorrel*MeanCorrel));
G4cout << "\n\n truePathLength :\t" << G4BestUnit(MeanTPL,"Length")
<< " +- " << G4BestUnit( rmsTPL,"Length")
<< "\n geomPathLength :\t" << G4BestUnit(MeanGPL,"Length")
<< " +- " << G4BestUnit( rmsGPL,"Length")
<< "\n lateralDisplac :\t" << G4BestUnit(MeanLaD,"Length")
<< " +- " << G4BestUnit( rmsLaD,"Length")
<< "\n Psi :\t" << MeanPsi/mrad << " mrad"
<< " +- " << rmsPsi /mrad << " mrad"
<< " (" << MeanPsi/deg << " deg"
<< " +- " << rmsPsi /deg << " deg)"
<< G4endl;
G4cout << "\n Theta_plane :\t" << rmsTeta/mrad << " mrad"
<< " (" << rmsTeta/deg << " deg)"
<< "\n phi correlation:\t" << MeanCorrel
<< " +- " << rmsCorrel
<< " (std::cos(phi_pos - phi_dir))"
<< G4endl;
//cross check from G4EmCalculator
//
G4cout << "\n Verification from G4EmCalculator. \n";
G4EmCalculator emCal;
//get transport mean free path (for multiple scattering)
G4double MSmfp = emCal.GetMeanFreePath(energy,particle,"msc",material);
//compute path length and related quantities
//
G4double MeanTPL = fTruePL /fTotalCount;
G4double MeanTPL2 = fTruePL2/fTotalCount;
G4double rmsTPL = std::sqrt(std::fabs(MeanTPL2 - MeanTPL*MeanTPL));
//get range from restricted dedx
G4double range = emCal.GetRangeFromRestricteDEDX(energy,particle,material);
G4double MeanGPL = fGeomPL /fTotalCount;
G4double MeanGPL2 = fGeomPL2/fTotalCount;
G4double rmsGPL = std::sqrt(std::fabs(MeanGPL2 - MeanGPL*MeanGPL));
G4double MeanLaD = fLDispl /fTotalCount;
G4double MeanLaD2 = fLDispl2/fTotalCount;
G4double rmsLaD = std::sqrt(std::fabs(MeanLaD2 - MeanLaD*MeanLaD));
G4double MeanPsi = fPsiSpa /(fTotalCount);
G4double MeanPsi2 = fPsiSpa2/(fTotalCount);
G4double rmsPsi = std::sqrt(std::fabs(MeanPsi2 - MeanPsi*MeanPsi));
G4double MeanTeta = fTetPrj /(2*fTotalCount);
G4double MeanTeta2 = fTetPrj2/(2*fTotalCount);
G4double rmsTeta = std::sqrt(std::fabs(MeanTeta2 - MeanTeta*MeanTeta));
G4double MeanCorrel = fPhiCor /(fTotalCount);
G4double MeanCorrel2 = fPhiCor2/(fTotalCount);
G4double rmsCorrel =
std::sqrt(std::fabs(MeanCorrel2-MeanCorrel*MeanCorrel));
G4cout << "\n\n truePathLength :\t" << G4BestUnit(MeanTPL,"Length")
<< " +- " << G4BestUnit( rmsTPL,"Length")
<< "\n geomPathLength :\t" << G4BestUnit(MeanGPL,"Length")
<< " +- " << G4BestUnit( rmsGPL,"Length")
<< "\n lateralDisplac :\t" << G4BestUnit(MeanLaD,"Length")
<< " +- " << G4BestUnit( rmsLaD,"Length")
<< "\n Psi :\t" << MeanPsi/mrad << " mrad"
<< " +- " << rmsPsi /mrad << " mrad"
<< " (" << MeanPsi/deg << " deg"
<< " +- " << rmsPsi /deg << " deg)"
<< G4endl;
G4cout << "\n Theta_plane :\t" << rmsTeta/mrad << " mrad"
<< " (" << rmsTeta/deg << " deg)"
<< "\n phi correlation:\t" << MeanCorrel
<< " +- " << rmsCorrel
<< " (std::cos(phi_pos - phi_dir))"
<< G4endl;
//cross check from G4EmCalculator
//
G4cout << "\n Verification from G4EmCalculator. \n";
G4EmCalculator emCal;
//effective facRange
G4double efFacrange = MeanTPL/std::max(MSmfp, range);
if (MeanTPL/range >= 0.99) efFacrange = 1.;
G4cout << "\n transport mean free path :\t" << G4BestUnit(MSmfp,"Length")
<< "\n range from restrict dE/dx:\t" << G4BestUnit(range,"Length")
<< "\n ---> effective facRange :\t" << efFacrange
<< G4endl;
G4cout << "\n compute theta0 from Highland :\t"
<< ComputeMscHighland(MeanTPL)/mrad << " mrad"
<< " (" << ComputeMscHighland(MeanTPL)/deg << " deg)"
<< G4endl;
//get transport mean free path (for multiple scattering)
G4double MSmfp = emCal.GetMeanFreePath(energy,particle,"msc",material);
//get range from restricted dedx
G4double range = emCal.GetRangeFromRestricteDEDX(energy,particle,material);
//effective facRange
G4double efFacrange = MeanTPL/std::max(MSmfp, range);
if (MeanTPL/range >= 0.99) efFacrange = 1.;
G4cout << "\n transport mean free path :\t" << G4BestUnit(MSmfp,"Length")
<< "\n range from restrict dE/dx:\t" << G4BestUnit(range,"Length")
<< "\n ---> effective facRange :\t" << efFacrange
<< G4endl;
G4cout << "\n compute theta0 from Highland :\t"
<< ComputeMscHighland(MeanTPL)/mrad << " mrad"
<< " (" << ComputeMscHighland(MeanTPL)/deg << " deg)"
<< G4endl;
} else
G4cout<< G4endl;
//restore default format
G4cout.precision(prec);
// delete and remove all contents in fProcCounter
while (fProcCounter->size()>0){
OneProcessCount* aProcCount=fProcCounter->back();
@@ -217,8 +221,8 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
//save histograms
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->IsActive() ) {
analysisManager->Write();
analysisManager->CloseFile();
analysisManager->Write();
analysisManager->CloseFile();
}
// show Rndm status
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm15/src/SteppingAction.cc
/// \brief Implementation of the SteppingAction class
//
// $Id: SteppingAction.cc 73022 2013-08-15 09:09:48Z gcosmo $
// $Id: SteppingAction.cc 110439 2018-05-23 11:24:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,9 +35,13 @@
#include "DetectorConstruction.hh"
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4ParticleTypes.hh"
#include "G4RunManager.hh"
#include <G4ThreeVector.hh>
#include <G4RotationMatrix.hh>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det,
@@ -64,57 +68,144 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
//
G4RunManager::GetRunManager()->AbortEvent();
//count processes and keep only Multiple Scattering
//count processes and keep only Multiple Scattering or gamma converion
//
G4StepPoint* endPoint = aStep->GetPostStepPoint();
G4String procName = endPoint->GetProcessDefinedStep()->GetProcessName();
fRunAction->CountProcesses(procName);
if (procName != "msc" && procName != "muMsc" && procName != "stepMax") return;
//below, only multiple Scattering happens
//
G4ThreeVector position = endPoint->GetPosition();
G4ThreeVector direction = endPoint->GetMomentumDirection();
G4double truePathLength = aStep->GetStepLength();
G4double geomPathLength = position.x() + 0.5*fDetector->GetBoxSize();
G4double ratio = geomPathLength/truePathLength;
fRunAction->SumPathLength(truePathLength,geomPathLength);
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH1(1,truePathLength);
analysisManager->FillH1(2,geomPathLength);
analysisManager->FillH1(3,ratio);
G4double yend = position.y(), zend = position.z();
G4double lateralDisplacement = std::sqrt(yend*yend + zend*zend);
fRunAction->SumLateralDisplacement(lateralDisplacement);
analysisManager->FillH1(4,lateralDisplacement);
G4double psi = std::atan(lateralDisplacement/geomPathLength);
fRunAction->SumPsi(psi);
analysisManager->FillH1(5,psi);
G4double xdir = direction.x(), ydir = direction.y(), zdir = direction.z();
G4double tetaPlane = std::atan2(ydir, xdir);
fRunAction->SumTetaPlane(tetaPlane);
analysisManager->FillH1(6,tetaPlane);
tetaPlane = std::atan2(zdir, xdir);
fRunAction->SumTetaPlane(tetaPlane);
analysisManager->FillH1(6,tetaPlane);
G4double phiPos = std::atan2(zend, yend);
analysisManager->FillH1(7,phiPos);
G4double phiDir = std::atan2(zdir, ydir);
analysisManager->FillH1(8,phiDir);
if (procName == "msc" || procName == "muMsc" || procName == "stepMax") {
//below, only multiple Scattering happens
//
G4ThreeVector position = endPoint->GetPosition();
G4ThreeVector direction = endPoint->GetMomentumDirection();
G4double truePathLength = aStep->GetStepLength();
G4double geomPathLength = position.x() + 0.5*fDetector->GetBoxSize();
G4double ratio = geomPathLength/truePathLength;
fRunAction->SumPathLength(truePathLength,geomPathLength);
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH1(1,truePathLength);
analysisManager->FillH1(2,geomPathLength);
analysisManager->FillH1(3,ratio);
G4double yend = position.y(), zend = position.z();
G4double lateralDisplacement = std::sqrt(yend*yend + zend*zend);
fRunAction->SumLateralDisplacement(lateralDisplacement);
analysisManager->FillH1(4,lateralDisplacement);
G4double psi = std::atan(lateralDisplacement/geomPathLength);
fRunAction->SumPsi(psi);
analysisManager->FillH1(5,psi);
G4double xdir = direction.x(), ydir = direction.y(), zdir = direction.z();
G4double tetaPlane = std::atan2(ydir, xdir);
fRunAction->SumTetaPlane(tetaPlane);
analysisManager->FillH1(6,tetaPlane);
tetaPlane = std::atan2(zdir, xdir);
fRunAction->SumTetaPlane(tetaPlane);
analysisManager->FillH1(6,tetaPlane);
G4double phiPos = std::atan2(zend, yend);
analysisManager->FillH1(7,phiPos);
G4double phiDir = std::atan2(zdir, ydir);
analysisManager->FillH1(8,phiDir);
G4double phiCorrel = 0.;
if (lateralDisplacement > 0.)
phiCorrel = (yend*ydir + zend*zdir)/lateralDisplacement;
fRunAction->SumPhiCorrel(phiCorrel);
analysisManager->FillH1(9,phiCorrel);
G4double phiCorrel = 0.;
if (lateralDisplacement > 0.)
phiCorrel = (yend*ydir + zend*zdir)/lateralDisplacement;
fRunAction->SumPhiCorrel(phiCorrel);
analysisManager->FillH1(9,phiCorrel);
} else if (procName == "conv" ) {
// gamma conversion
G4StepPoint* PrePoint = aStep->GetPreStepPoint();
G4double EGamma = PrePoint->GetTotalEnergy();
G4ThreeVector PGamma = PrePoint->GetMomentum();
G4ThreeVector PolaGamma = PrePoint->GetPolarization();
G4double Eplus=-1;
// G4double Eminus=-1;
// G4double Erecoil=-1;
G4ThreeVector Pplus, Pminus, Precoil;
//G4int recPDG;
const G4TrackVector* secondary = fpSteppingManager->GetSecondary();
for (size_t lp=0; lp< std::min((*secondary).size(),size_t(2) ); lp++) {
if ((*secondary)[lp]->GetDefinition()==G4Electron::ElectronDefinition()) {
// Eminus = (*secondary)[lp]->GetTotalEnergy();
Pminus = (*secondary)[lp]->GetMomentum();
} //else {
if ((*secondary)[lp]->GetDefinition()==G4Positron::PositronDefinition()) {
Eplus = (*secondary)[lp]->GetTotalEnergy();
Pplus = (*secondary)[lp]->GetMomentum();
}
}
if ( (*secondary).size() >= 3 ) {
// Erecoil = (*secondary)[2]->GetTotalEnergy();
Precoil = (*secondary)[2]->GetMomentum();
// recPDG = (*secondary)[2]->GetDynamicParticle()->GetPDGcode();
} else {
// Erecoil = 0.0;
Precoil = G4ThreeVector();
// recPDG = 0;
}
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
// Fill Histograms
G4ThreeVector gammadir = PGamma.unit(); // gamma direction
G4ThreeVector z = gammadir;
G4ThreeVector x(1.,0.,0.);
// pola perpendicular to direction
if ( PolaGamma.mag() != 0.0 ) {
x = PolaGamma.unit();
} else { // Pola = 0 case
// Direction (z) is unitary vector
// (projection to plane) p_proj = p - (p o d)/(d o d) x d
if ( x.howOrthogonal(z) != 0) {
x = x - x.dot(z) * z;
}
if (x.mag() != 0.0 ) {
x = x.unit();
} else {
x.set(0.0,0.0,1.0);
}
}
G4ThreeVector y = z;
y = y.cross(x);
G4RotationMatrix GtoW(x,y,z); // from gamma ref. sys. to World
G4RotationMatrix WtoG = inverseOf(GtoW); // from World to gamma ref. sys.
G4double angleE = Pplus.angle(Pminus) * EGamma;
analysisManager->FillH1(10,angleE);
analysisManager->FillH1(11,std::log10(Precoil.mag()));
//analysisManager->FillH1(12,Precoil.rotateUz(gammadir).phi());
analysisManager->FillH1(12,Precoil.transform(WtoG).phi());
// G4double phiPlus = Pplus.rotateUz(gammadir).phi();
// G4double phiMinus = Pminus.rotateUz(gammadir).phi();
G4double phiPlus = Pplus.transform(WtoG).phi();
G4double phiMinus = Pminus.transform(WtoG).phi();
analysisManager->FillH1(13,phiPlus);
analysisManager->FillH1(14,std::cos(phiPlus + phiMinus) * -2.0);
analysisManager->FillH1(15,Eplus/EGamma);
//G4double phiPola = PolaGamma.rotateUz(gammadir).phi();
G4double phiPola = PolaGamma.transform(WtoG).phi();
analysisManager->FillH1(16, phiPola);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......