Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -1,6 +1,9 @@
#---Adding all exoticphysics examples subdirectories explicitly
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
add_subdirectory(channeling)
add_subdirectory(dmparticle)
+6
View File
@@ -15,6 +15,12 @@ track of all tags.
----------------------------------------------------------
10 November 2020: B. Morgan (exExoticPhysics-V10-06-01)
- Migration to G4RunManagerFactory.
03 November 2020: B. Morgan (exExoticPhysics-V10-06-00)
- Support same CMake version range as core Geant4
31 January 2019: I. Hrivnacova (exExoticphysics-V10-05-00)
- Merged GitHub PR #4: all Boolean operators now return G4bool.
@@ -1,7 +1,10 @@
#----------------------------------------------------------------------------
# Setup the project
#
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(channeling)
#----------------------------------------------------------------------------
@@ -14,6 +14,9 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 10, 2020 B. Morgan (channelingExample-V10-06-00)
- Migration to G4RunManagerFactory.
May 08, 2018 B. Morgan (channelingExample-V10-04-00)
- Include G4Types before use of G4MULTITHREADED. For forward
compatibility with move to #defines over -D for G4 preprocessor
View File
@@ -28,23 +28,12 @@
#include "G4Types.hh"
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4RunManagerFactory.hh"
#include "G4ScoringManager.hh"
#include "G4UImanager.hh"
#ifdef G4MULTITHREADED
#include "UserActionInitialization.hh"
#else
#include "PrimaryGeneratorAction.hh"
#include "StackingAction.hh"
#include "EventAction.hh"
#include "RunAction.hh"
#endif
#include "DetectorConstruction.hh"
@@ -69,12 +58,8 @@ int main(int argc,char** argv)
}
// Construct the default run manager
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager;
auto* runManager = G4RunManagerFactory::CreateRunManager();
runManager->SetNumberOfThreads(G4Threading::G4GetNumberOfCores() - 2);
#else
G4RunManager* runManager = new G4RunManager;
#endif
// Activate UI-command base scorer
G4ScoringManager * scManager = G4ScoringManager::GetScoringManager();
@@ -90,15 +75,8 @@ int main(int argc,char** argv)
physlist->RegisterPhysics(biasingPhysics);
runManager->SetUserInitialization(physlist);
#ifndef G4MULTITHREADED
// Set user action classes
runManager->SetUserAction(new PrimaryGeneratorAction());
runManager->SetUserAction(new EventAction());
runManager->SetUserAction(new StackingAction());
runManager->SetUserAction(new RunAction());
#else
runManager->SetUserInitialization(new UserActionInitialization());
#endif
runManager->SetUserInitialization(new DetectorConstruction());
@@ -1,10 +1,11 @@
Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Forcing G4RunManager type...
############################################
!!! WARNING - FPE detection is activated !!!
############################################
**************************************************************
Geant4 version Name: geant4-10-06-ref-06 (26-June-2020)
Geant4 version Name: geant4-10-07-ref-00 (4-December-2020)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -14,7 +15,7 @@
<<< Geant4 Physics List simulation engine: FTFP_BERT
G4VModularPhysicsList::ReplacePhysics: G4EmStandardwith type : 2 is replaces with G4EmStandard_opt4_channeling
G4VModularPhysicsList::ReplacePhysics: G4EmStandard with type : 2 is replaced with G4EmStandard_opt4_channeling
Using Root
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
@@ -30,10 +31,12 @@ Registered graphics systems are:
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateXm (OGLIXm, OGLI)
OpenGLStoredXm (OGLSXm, OGL, OGLS)
OpenGLImmediateX (OGLIX, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSXm_FALLBACK)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK)
OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK)
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RayTracerX)
Registering model factories...
@@ -80,7 +83,7 @@ data/Si220pl_eld.txt
Attaching biasing operator ChannelingChangeXS-Many to logical volume crystal.logic
--- G4CoupledTransportation is used
FTFP_BERT : new threshold between BERT and FTFP is over the interval
hInelastic FTFP_BERT : threshold between BERT and FTFP is over the interval
for pions : 3 to 6 GeV
for kaons : 3 to 6 GeV
for proton : 3 to 6 GeV
@@ -149,7 +152,7 @@ ePairProd: for e- SubType=4
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 21x1001 from 0.1 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
ePairProd : Emin= 0 eV Emax= 10 TeV
ePairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for e-, integral:1 SubType=1 BuildTable=1
Lambda table from 100 eV to 10 TeV, 20 bins/decade, spline: 1
@@ -178,7 +181,7 @@ ePairProd: for e+ SubType=4
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 21x1001 from 0.1 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
ePairProd : Emin= 0 eV Emax= 10 TeV
ePairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
annihil: for e+, integral:1 SubType=5 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
@@ -202,14 +205,14 @@ hBrems: for proton SubType=3
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 10 TeV
hBrem : Emin= 0 eV Emax= 10 TeV ModifiedMephi
hPairProd: for proton SubType=4
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 13x1001 from 7.50618 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 10 TeV
hPairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for proton, integral:1 SubType=1 BuildTable=1
Used Lambda table of anti_proton
@@ -254,14 +257,14 @@ hBrems: for anti_proton SubType=3
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 10 TeV
hBrem : Emin= 0 eV Emax= 10 TeV ModifiedMephi
hPairProd: for anti_proton SubType=4
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 13x1001 from 7.50618 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 10 TeV
hPairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for anti_proton, integral:1 SubType=1 BuildTable=1
Lambda table from 100 eV to 10 TeV, 20 bins/decade, spline: 1
@@ -281,14 +284,14 @@ hBrems: for kaon+ SubType=3
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 10 TeV
hBrem : Emin= 0 eV Emax= 10 TeV ModifiedMephi
hPairProd: for kaon+ SubType=4
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 14x1001 from 3.94942 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 10 TeV
hPairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for kaon+, integral:1 SubType=1 BuildTable=1
Lambda table from 100 eV to 10 TeV, 20 bins/decade, spline: 1
@@ -308,14 +311,14 @@ hBrems: for kaon- SubType=3
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 10 TeV
hBrem : Emin= 0 eV Emax= 10 TeV ModifiedMephi
hPairProd: for kaon- SubType=4
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 14x1001 from 3.94942 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 10 TeV
hPairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for kaon-, integral:1 SubType=1 BuildTable=1
Used Lambda table of kaon+
@@ -336,14 +339,14 @@ muBrems: for mu+ SubType=3
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 10 TeV
MuBrem : Emin= 0 eV Emax= 10 TeV ModifiedMephi
muPairProd: for mu+ SubType=4
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 17x1001 from 1 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 10 TeV
muPairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for mu+, integral:1 SubType=1 BuildTable=1
Lambda table from 100 eV to 10 TeV, 20 bins/decade, spline: 1
@@ -364,14 +367,14 @@ muBrems: for mu- SubType=3
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 10 TeV
MuBrem : Emin= 0 eV Emax= 10 TeV ModifiedMephi
muPairProd: for mu- SubType=4
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 17x1001 from 1 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 10 TeV
muPairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for mu-, integral:1 SubType=1 BuildTable=1
Used Lambda table of mu+
@@ -391,14 +394,14 @@ hBrems: for pi+ SubType=3
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 10 TeV
hBrem : Emin= 0 eV Emax= 10 TeV ModifiedMephi
hPairProd: for pi+ SubType=4
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 16x1001 from 1.11656 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 10 TeV
hPairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for pi+, integral:1 SubType=1 BuildTable=1
Lambda table from 100 eV to 10 TeV, 20 bins/decade, spline: 1
@@ -418,14 +421,14 @@ hBrems: for pi- SubType=3
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 10 TeV
hBrem : Emin= 0 eV Emax= 10 TeV ModifiedMephi
hPairProd: for pi- SubType=4
dE/dx and range tables from 100 eV to 10 TeV in 220 bins
Lambda tables from threshold to 10 TeV, 20 bins/decade, spline: 1
Sampling table 16x1001 from 1.11656 GeV to 10 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 10 TeV
hPairProd : Emin= 0 eV Emax= 10 TeV ModifiedMephi
CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Used Lambda table of pi+
@@ -454,6 +457,28 @@ CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Process: nKiller
---------------------------------------------------
Hadronic Processes for B-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: B-Inelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
Hadronic Processes for D-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: D-Inelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
Hadronic Processes for GenericIon
@@ -528,6 +553,19 @@ CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Process: hFritiofCaptureAtRest
---------------------------------------------------
Hadronic Processes for anti_lambda
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: anti_lambdaInelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
Hadronic Processes for anti_neutron
@@ -639,8 +677,8 @@ CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: lambdaInelastic
Model: BertiniCascade: 0 eV ---> 6 GeV
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
@@ -705,8 +743,8 @@ CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: sigma-Inelastic
Model: BertiniCascade: 0 eV ---> 6 GeV
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hBertiniCaptureAtRest
@@ -747,12 +785,12 @@ Store e- internal conversion data 0
Electron internal conversion ID 2
Correlated gamma emission flag 0
Max 2J for sampling of angular correlations 10
Upload data before 1st event for Z < 9
=======================================================================
G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
See commands in /vis/modeling/trajectories/ for other options.
### Run 0 starts.
... open Root analysis file : ExExCh.root - done
... create file : ExExCh.root - done
... open analysis file : ExExCh.root - done
--> Event 0 starts.
--> Event 1 starts.
--> Event 2 starts.
@@ -1753,7 +1791,10 @@ See commands in /vis/modeling/trajectories/ for other options.
--> Event 997 starts.
--> Event 998 starts.
--> Event 999 starts.
... write Root file : ExExCh.root - done
... close Root file : ExExCh.root - done
... write file : ExExCh.root - done
... close file : ExExCh.root - done
0 events have been kept for refreshing and/or reviewing.
"/vis/reviewKeptEvents" to review them one by one.
"/vis/enable", then "/vis/viewer/flush" or "/vis/viewer/rebuild" to see them accumulated.
Graphics systems deleted.
Visualization Manager deleting...
@@ -25,13 +25,8 @@
//
//
#include "G4Types.hh"
#ifdef G4MULTITHREADED
#ifndef UserActionInitialization_h
#define UserActionInitialization_h 1
#endif
#include "G4VUserActionInitialization.hh"
class G4GeneralParticleSource;
-2
View File
@@ -26,7 +26,6 @@
#include "G4Types.hh"
#ifdef G4MULTITHREADED
#include "UserActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
@@ -52,4 +51,3 @@ void UserActionInitialization::Build() const {
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
View File
+4 -1
View File
@@ -1,6 +1,9 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(dmparticle)
#----------------------------------------------------------------------------
View File
@@ -14,6 +14,9 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
10-11-20 B. Morgan (dmparticle-V10-06-00)
- Migration to G4RunManagerFactory.
17-05-18 J.Allison (dmparticle-V10-04-01)
- RunAction.cc: Remove vis commands.
@@ -29,7 +32,7 @@ track of all tags.
- fixed LDMP production model
06-06-17 I.Hrivnacova (dmparticle-V10-03-02)
- fixed Doxygen documentation
- fixed Doxygen documentation
06-06-17 V.Ivanchenko (dmparticle-V10-03-01)
- general cleanup of the code and documentation
View File
+11 -16
View File
@@ -32,8 +32,7 @@
#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4MTRunManager.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
#include "Randomize.hh"
@@ -47,7 +46,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc,char** argv)
{
// Instantiate G4UIExecutive if interactive mode
G4UIExecutive* ui = nullptr;
@@ -58,36 +57,32 @@ int main(int argc,char** argv)
//choose the Random engine
CLHEP::HepRandom::setTheEngine(new CLHEP::Ranlux64Engine);
G4UImanager* UI = G4UImanager::GetUIpointer();
G4UImanager* UI = G4UImanager::GetUIpointer();
PhysicsList* phys = new PhysicsList();
// defined mass of LDM particles
if(argc > 2) {
if(argc > 2) {
G4String s = argv[2];
UI->ApplyCommand("/control/verbose 1");
UI->ApplyCommand("/testex/phys/setLDMPhotonMass " + s + " GeV");
}
if(argc > 3) {
if(argc > 3) {
G4String s = argv[3];
UI->ApplyCommand("/testex/phys/setLDMHiMass " + s + " GeV");
}
// Construct the default run manager
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager;
auto* runManager = G4RunManagerFactory::CreateRunManager();
G4int nThreads = std::min(G4Threading::G4GetNumberOfCores(),2);
runManager->SetNumberOfThreads(nThreads);
G4cout << "===== dmparticle is started with "
G4cout << "===== dmparticle is started with "
<< runManager->GetNumberOfThreads() << " threads =====" << G4endl;
#else
G4RunManager* runManager = new G4RunManager();
#endif
// set mandatory initialization classes
DetectorConstruction* det = new DetectorConstruction();
runManager->SetUserInitialization( phys );
runManager->SetUserInitialization( det);
// set user action classes
runManager->SetUserInitialization( new ActionInitialization(det));
@@ -101,10 +96,10 @@ int main(int argc,char** argv)
UI->ApplyCommand(command+fileName);
}
else //define visualization and UI terminal for interactive mode
{
{
ui->SessionStart();
delete ui;
}
}
// job termination
delete visManager;
delete runManager;
File diff suppressed because it is too large Load Diff
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
@@ -1,6 +1,9 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(monopole)
#----------------------------------------------------------------------------
@@ -14,6 +14,9 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
10 November 2020: B. Morgan (monopole-V10-06-00)
- Migration to G4RunManagerFactory.
21 February 2020: V.Ivantchenko (monopole-V10-06-00)
- G4MonopolePhysics - minor code clean-up for thread safety
- monopole.cc - do not instantiate VisManager in the batch mode;
@@ -34,7 +37,7 @@ track of all tags.
- monopole.cc - do not instantiate VisManager in the batch mode, default
number of threads is now 1
- Run, RunAction - extend histograms and printouts to restricted dEdx and
delta-electron cross section (needed to fix problem #2126)
delta-electron cross section (needed to fix problem #2126)
23 October 2018: I.Hrivnacova (monopole-V10-04-06)
- Define the field setup data (fMonFieldSetup) in the DetectorConstruction class
@@ -43,11 +46,11 @@ track of all tags.
19 October 2018: I.Hrivnacova (monopole-V10-04-05)
Macro review and code clean-up:
- Removed not used and not working commands:
/testex/det/setField
/testex/det/setField
not used, duplicates /testex/fld/setField 0.2 tesla
/testex/det/update
not used
/monopole/magCharge, elCharge, Mass
/monopole/magCharge, elCharge, Mass
not working, as these parameters need to be set at a very early stage
/testex/run/verbose
the set verbose level is not used
@@ -60,11 +63,11 @@ Macro review and code clean-up:
15 October 2018: I.Hrivnacova (monopole-V10-04-04)
- Removed run initialization from main and added init_vis.mac
macro for interactive session
- Explicitly define physics lists ("FTFP_BERT")
- Explicitly define physics lists ("FTFP_BERT")
- Added the default value of magnetic field 0.2 tesla
and also setting of this value in monopole.in and init_vis.mac
- Fixed updating geometry parameters after initialization
by calling G4RunManager::ReinitializeGeometry() instead of
by calling G4RunManager::ReinitializeGeometry() instead of
GeometryHasBeenModified()
- Added printing production cuts table in RunAction::EndOfRunAction
@@ -85,9 +88,9 @@ Macro review and code clean-up:
8 March 2018: J. Apostolakis (monopole-V10-04-00)
- As equations of motion do not use Electric field, changed
G4MonopoleEquation to use G4MagneticField (instead of
G4MonopoleEquation to use G4MagneticField (instead of
G4ElectroMagneticField.)
This is needed due to correction of inheritance in
This is needed due to correction of inheritance in
magfield-V10-04-00 which is a co-working tag.
21 November 17: V.Ivantchenko (monopole-V10-03-04)
@@ -106,32 +109,32 @@ Macro review and code clean-up:
- switch to G4AnalysisManager
01 September 15: I. Hrivnacova (monopole-V10-01-00)
- Removed EventAction and EventActionMessenger classes, now obsolete, and
replaced /testex/event/printModulo commands in macros with
- Removed EventAction and EventActionMessenger classes, now obsolete, and
replaced /testex/event/printModulo commands in macros with
/run/printProgress
16 October 14: I. Hrivnacova (monopole-V10-00-00)
- Fixed coding guidelines (long lines) in G4MonopoleTransportation.cc
- Fixed coding guidelines (long lines) in G4MonopoleTransportation.cc
03 December 13: I. Hrivnacova (monopole-V09-06-06)
- Updated README for removing AIDA
10 May 13: J.Apostolakis (monopole-V09-06-05)
- G4MonopoleTransportation and G4MonopoleEquation:
Adapted to use G4ChargeState to pass Magnetic & Electric Charge,
and to changed signature of SetChargeMomentumMass.
- G4MonopoleTransportation and G4MonopoleEquation:
Adapted to use G4ChargeState to pass Magnetic & Electric Charge,
and to changed signature of SetChargeMomentumMass.
19 February 13: V.Ivantchenko (monopole-V09-06-04)
- G4MonopoleTransportation - removed local variable fVerboseLevel
and Get/Set methods; use instead verboseLevel variable from
and Get/Set methods; use instead verboseLevel variable from
the base class
13 February 13: I.Hrivnacova (monopole-V09-06-03)
- Applied coding guidelines
- Applied coding guidelines
(virtual keyword, data members names and initialization)
01 February 13: V.Ivant (monopole-V09-06-02)
- G4MonopolePhysics - fixed warning at initialisation
- G4MonopolePhysics - fixed warning at initialisation
31 January 13: V.Ivant (monopole-V09-06-01)
- fixed initialisation after MT was introduced
@@ -142,15 +145,15 @@ Macro review and code clean-up:
20 September 12: I.Hrivnacova (monopole-V09-05-03)
- Adding explicit includes of G4SystemOfUnits.hh and G4PhysicalConstants.hh
where needed
- Replaced tabulators with space characters
- Replaced tabulators with space characters
19 September 12: V.Ivant (monopole-V09-05-02)
- remove not needed file
4 September 12: I.Hrivnacova (monopole-V09-05-01)
- Updated CMakeLists.txt:
adding visualization, copying macros, install target and comment lines
- Adding .README
adding visualization, copying macros, install target and comment lines
- Adding .README
28 May 12: V.Ivant (monopole-V09-05-00)
- applied code convention
@@ -166,10 +169,10 @@ Macro review and code clean-up:
- Fix AIDA file option.
6 June 10: J.Perl (monopole-V09-03-05)
- Remove unused variable in EventAction
- Remove unused variable in EventAction
4 June 10: J.Perl (monopole-V09-03-04)
- Updated vis usage
- Updated vis usage
04 June 10: V.Ivant (monopole-V09-03-03)
- Substituted QGSP by QGSP_BERT
@@ -190,7 +193,7 @@ Macro review and code clean-up:
11 June 08: V.Ivant (monopole-V09-01-00)
- Remove AIDA from GNUmakefile
- Fixed compillation warnings
- Fixed compillation warnings
16 August 07: V.Ivant (monopole-V09-00-00)
- First release
@@ -32,11 +32,7 @@
#include "G4Types.hh"
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
@@ -56,19 +52,19 @@
namespace {
void PrintUsage() {
G4cerr
G4cerr
<< " Usage: " << G4endl
<< " monopole [-m macro ] [-s setupMonopole] [-t nThreads]" << G4endl
<< " Note: " << G4endl
<< " -s should be followed by a composed string, eg. \'1 0 100 GeV\'" << G4endl
<< " -t option is available only for multi-threaded mode." << G4endl
<< " -t option is for multi-threaded mode." << G4endl
<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc,char** argv)
{
// Evaluate arguments
//
@@ -79,35 +75,27 @@ int main(int argc,char** argv)
G4String macro;
G4String setupMonopole;
#ifdef G4MULTITHREADED
G4int nThreads = 1;
#endif
for ( G4int i=1; i<argc; i=i+2 ) {
if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
else if ( G4String(argv[i]) == "-s" ) setupMonopole = argv[i+1];
#ifdef G4MULTITHREADED
else if ( G4String(argv[i]) == "-t" ) {
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
}
#endif
else {
PrintUsage();
return 1;
}
}
}
// Construct the default run manager
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager();
if ( nThreads > 0 ) {
auto* runManager = G4RunManagerFactory::CreateRunManager();
if ( nThreads > 0 ) {
runManager->SetNumberOfThreads(nThreads);
}
}
G4cout << "===== Example is started with "
<< runManager->GetNumberOfThreads() << " threads =====" << G4endl;
#else
G4RunManager* runManager = new G4RunManager();
#endif
// Instantiate G4UIExecutive if interactive
G4UIExecutive* ui = nullptr;
if ( macro.empty() ) {
@@ -153,7 +141,7 @@ int main(int argc,char** argv)
G4String command = "/control/execute ";
UImanager->ApplyCommand(command+macro);
}
else {
else {
// interactive mode : define UI session
visManager = new G4VisExecutive();
visManager->Initialize();
@@ -1,10 +1,11 @@
Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Forcing G4RunManager type...
############################################
!!! WARNING - FPE detection is activated !!!
############################################
**************************************************************
Geant4 version Name: geant4-10-06-ref-06 (26-June-2020)
Geant4 version Name: geant4-10-07-ref-00 (4-December-2020)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -12,6 +13,7 @@
WWW : http://geant4.org/
**************************************************************
===== Example is started with 1 threads =====
G4PhysListFactory::GetReferencePhysList <FTFP_BERT> EMoption= 0
<<< Geant4 Physics List simulation engine: FTFP_BERT
@@ -36,10 +38,8 @@ Monopole is created: m(GeV)= 100 Qel= 0 Qmag= 68.518
---------------------------------------------------------
G4MonopoleEquation::G4MonopoleEquation
G4ChordFinder: Creating G4MagInt_Driver with stepMinimum = 0.01 numVar= 6
G4ChordFinder: Creating G4MagInt_Driver with stepMinimum = 0.01 numVar= 8
FTFP_BERT : new threshold between BERT and FTFP is over the interval
hInelastic FTFP_BERT : threshold between BERT and FTFP is over the interval
for pions : 3 to 6 GeV
for kaons : 3 to 6 GeV
for proton : 3 to 6 GeV
@@ -70,8 +70,6 @@ G4ProcessManager: particle[monopole]
/run/printProgress 10
/testex/fld/setField 0.2 tesla
G4MonopoleEquation::G4MonopoleEquation
G4ChordFinder: Creating G4MagInt_Driver with stepMinimum = 0.01 numVar= 6
G4ChordFinder: Creating G4MagInt_Driver with stepMinimum = 0.01 numVar= 8
/gun/particle monopole
/gun/energy 100 GeV
/run/beamOn 100
@@ -100,10 +98,11 @@ Rayl: for gamma SubType=11 BuildTable=1
LivermoreRayleigh : Emin= 0 eV Emax= 100 TeV CullenGenerator
msc: for e- SubType= 10
RangeFactor= 0.04, stepLimType: 1, latDisp: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llimit=1
WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llimit=1
eIoni: for e- SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -127,10 +126,11 @@ CoulombScat: for e-, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 100 MeV Emax= 100 TeV
msc: for e+ SubType= 10
RangeFactor= 0.04, stepLimType: 1, latDisp: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llimit=1
WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llimit=1
eIoni: for e+ SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -158,9 +158,9 @@ CoulombScat: for e+, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 100 MeV Emax= 100 TeV
msc: for proton SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
hIoni: for proton SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -174,14 +174,14 @@ hBrems: for proton SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for proton SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for proton, integral:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1
@@ -190,9 +190,9 @@ CoulombScat: for proton, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for GenericIon SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
ionIoni: for GenericIon SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -204,9 +204,9 @@ ionIoni: for GenericIon SubType=2
BetheBloch : Emin= 2 MeV Emax= 100 TeV
msc: for alpha SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
ionIoni: for alpha SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -217,9 +217,9 @@ ionIoni: for alpha SubType=2
BetheBloch : Emin=7.9452 MeV Emax= 100 TeV
msc: for anti_proton SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
hIoni: for anti_proton SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -233,14 +233,14 @@ hBrems: for anti_proton SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for anti_proton SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for anti_proton, integral:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1
@@ -249,9 +249,9 @@ CoulombScat: for anti_proton, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for kaon+ SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
hIoni: for kaon+ SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -265,14 +265,14 @@ hBrems: for kaon+ SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for kaon+ SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for kaon+, integral:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1
@@ -281,9 +281,9 @@ CoulombScat: for kaon+, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for kaon- SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
hIoni: for kaon- SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -297,14 +297,14 @@ hBrems: for kaon- SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for kaon- SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for kaon-, integral:1 SubType=1 BuildTable=1
Used Lambda table of kaon+
@@ -313,9 +313,9 @@ CoulombScat: for kaon-, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for mu+ SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0, polarAngLim(deg)= 180
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
muIoni: for mu+ SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -330,14 +330,14 @@ muBrems: for mu+ SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 100 TeV
MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
muPairProd: for mu+ SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 1 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for mu+, integral:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1
@@ -346,9 +346,9 @@ CoulombScat: for mu+, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for mu- SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0, polarAngLim(deg)= 180
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
muIoni: for mu- SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -363,14 +363,14 @@ muBrems: for mu- SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 100 TeV
MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
muPairProd: for mu- SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 1 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for mu-, integral:1 SubType=1 BuildTable=1
Used Lambda table of mu+
@@ -379,9 +379,9 @@ CoulombScat: for mu-, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for pi+ SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
hIoni: for pi+ SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -395,14 +395,14 @@ hBrems: for pi+ SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for pi+ SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for pi+, integral:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1
@@ -411,9 +411,9 @@ CoulombScat: for pi+, integral:1 SubType=1 BuildTable=1
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for pi- SubType= 10
RangeFactor= 0.2, stepLimType: 0, latDisp: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llimit=1
hIoni: for pi- SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
@@ -427,14 +427,14 @@ hBrems: for pi- SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for pi- SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Used Lambda table of pi+
@@ -463,6 +463,28 @@ CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Process: nKiller
---------------------------------------------------
Hadronic Processes for B-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: B-Inelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
Hadronic Processes for D-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: D-Inelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
Hadronic Processes for GenericIon
@@ -537,6 +559,19 @@ CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Process: hFritiofCaptureAtRest
---------------------------------------------------
Hadronic Processes for anti_lambda
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: anti_lambdaInelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
Hadronic Processes for anti_neutron
@@ -648,8 +683,8 @@ CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: lambdaInelastic
Model: BertiniCascade: 0 eV ---> 6 GeV
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
@@ -714,8 +749,8 @@ CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: sigma-Inelastic
Model: BertiniCascade: 0 eV ---> 6 GeV
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hBertiniCaptureAtRest
@@ -756,7 +791,6 @@ Store e- internal conversion data 0
Electron internal conversion ID 2
Correlated gamma emission flag 0
Max 2J for sampling of angular correlations 10
Upload data before 1st event for Z < 9
=======================================================================
### Run 0 starts.
@@ -772,14 +806,15 @@ Index : 0 used in the geometry : Yes
Index : 1 used in the geometry : Yes
Material : G4_Si
Range cuts : gamma 700 um e- 700 um e+ 700 um proton 700 um
Energy thresholds : gamma 5.87994 keV e- 424.707 keV e+ 410.72 keV proton 70 keV
Energy thresholds : gamma 5.87535 keV e- 424.726 keV e+ 410.692 keV proton 70 keV
Region(s) which use this couple :
DefaultRegionForTheWorld
==================================================================
### Run 0 start.
... open Root analysis file : monopole.root - done
... create file : monopole.root - done
... open analysis file : monopole.root - done
--> Event 0 starts.
--> Event 10 starts.
--> Event 20 starts.
@@ -793,7 +828,7 @@ Index : 1 used in the geometry : Yes
The run consists of 100 monopole of 100 GeV
through 10 cm of G4_Si (density: 2.33 g/cm3 )
Projected Range= 7.7972 cm rms= 176.42 um
Projected Range= 7.796 cm rms= 174.62 um
##################################################################
### Stopping Powers and Cross Sections
@@ -802,7 +837,7 @@ Index : 1 used in the geometry : Yes
restr tot restr tot p mpl
##################################################################
0. 0.001 24.5 24.5 0.633-4.04e-16 0 0
1. 0.00126 27.3 27.3 0.71-4.54e-16 0 0
1. 0.00126 27.4 27.3 0.71-4.54e-16 0 0
2. 0.00158 30.7 30.8 0.797-5.09e-16 0 0
3. 0.002 34.6 34.6 0.894-5.71e-16 0 0
4. 0.00251 38.8 38.8 1-6.41e-16 0 0
@@ -811,9 +846,9 @@ Index : 1 used in the geometry : Yes
7. 0.00501 54.8 54.8 1.42-9.05e-16 0 0
8. 0.00631 61.4 61.5 1.59-1.02e-15 0 0
9. 0.00794 69 68.9 1.78-1.14e-15 0 0
10. 0.01 77.2 77.4 2-1.28e-15 0 0
11. 0.0126 85.2 85.2 2.25-1.43e-15 0 0
12. 0.0158 93.4 93.5 2.52-1.61e-15 0 0
10. 0.01 77.4 77.4 2-1.28e-15 0 0
11. 0.0126 85.3 85.2 2.25-1.43e-15 0 0
12. 0.0158 93.3 93.5 2.52-1.61e-15 0 0
13. 0.02 102 102 2.83-1.81e-15 0 0
14. 0.0251 110 110 3.17-2.03e-15 0 0
15. 0.0316 118 118 3.56-2.27e-15 0 0
@@ -827,46 +862,46 @@ Index : 1 used in the geometry : Yes
23. 0.2 90.6 90.6 8.94-5.71e-15 0 0
24. 0.251 82.1 82.1 10-6.41e-15 0 0
25. 0.316 74.2 74.2 11.3-7.19e-15 0 0
26. 0.398 66.7 66.8 12.6-8.07e-15 0 0
26. 0.398 66.8 66.8 12.6-8.07e-15 0 0
27. 0.501 59.8 59.7 14.2-9.05e-15 0 0
28. 0.631 53.4 53.4 15.9-1.02e-14 0 0
29. 0.794 47 47.1 17.8-1.14e-14 0 0
28. 0.631 53.3 53.4 15.9-1.02e-14 0 0
29. 0.794 47.2 47.1 17.8-1.14e-14 0 0
30. 1 40.8 40.8 20-1.28e-14 0 0
31. 1.26 35.3 35.3 22.5-1.43e-14 0 0
32. 1.58 30.4 30.4 25.2-1.61e-14 0 0
33. 2 26 26.1 28.3-1.81e-14 0 0
33. 2 26.1 26.1 28.3-1.81e-14 0 0
34. 2.51 22.2 22.3 31.7-2.03e-14 0 0
35. 3.16 18.9 18.9 35.6-2.27e-14 0 0
36. 3.98 16.1 16 40.1-2.55e-14 0 0
37. 5.01 13.6 13.6 44.3 0.0264 0 0
38. 6.31 11.4 11.4 47.2 3.1 0 0
39. 7.94 9.6 9.61 50.6 7.11 0 0
36. 3.98 16.1 16 39.9-2.55e-14 0 0
37. 5.01 13.6 13.6 44.5 0.0264 0 0
38. 6.31 11.4 11.4 47.7 3.1 0 0
39. 7.94 9.59 9.61 50.4 7.11 0 0
40. 10 8.05 8.05 54.9 12.2 0 0
41. 12.6 6.73 6.69 60.4 18.5 0 0
42. 15.8 5.58 5.58 67.2 26.3 0 0
43. 20 4.65 4.66 75.6 35.8 0 0
44. 25.1 3.91 3.91 85.7 47.2 0 0
41. 12.6 6.7 6.69 60.4 18.5 0 0
42. 15.8 5.57 5.58 67.1 26.3 0 0
43. 20 4.66 4.66 75.6 35.8 0 0
44. 25.1 3.91 3.91 85.8 47.2 0 0
45. 31.6 3.27 3.27 98 60.8 0 0
46. 39.8 2.73 2.74 113 77 0 0
46. 39.8 2.74 2.74 113 77 0 0
47. 50.1 2.29 2.29 130 96.2 0 0
48. 63.1 1.92 1.92 151 119 0 0
49. 79.4 1.61 1.61 175 145 0 0
50. 100 1.36 1.36 204 176 0 0
51. 126 1.15 1.15 238 213 0 0
52. 158 0.984 0.984 277 255 0 0
53. 200 0.842 0.847 322 304 0.00783 0
54. 251 0.723 0.736 375 361 0.0239 0
55. 316 0.629 0.646 437 427 0.0303 0
56. 398 0.554 0.575 510 503 0.0339 0
57. 501 0.495 0.52 580 591 0.0353 0
58. 631 0.45 0.476 633 631 0.036 0
59. 794 0.414 0.444 671 670 0.0364 0
60. 1e+03 0.388 0.421 707 708 0.0368 0
52. 158 0.983 0.984 277 255 0 0
53. 200 0.842 0.847 322 304 0.00775 0
54. 251 0.724 0.736 376 361 0.024 0
55. 316 0.628 0.646 437 427 0.0302 0
56. 398 0.554 0.575 509 503 0.0338 0
57. 501 0.495 0.52 588 591 0.0353 0
58. 631 0.449 0.476 638 631 0.036 0
59. 794 0.414 0.444 667 670 0.0364 0
60. 1e+03 0.388 0.421 708 708 0.0368 0
61. 1.26e+03 0.369 0.405 748 747 0.0373 0
62. 1.58e+03 0.355 0.395 786 786 0.0379 0
62. 1.58e+03 0.355 0.395 785 786 0.0379 0
63. 2e+03 0.346 0.39 825 825 0.0385 0
64. 2.51e+03 0.34 0.388 864 864 0.0391 0
65. 3.16e+03 0.337 0.39 903 903 0.0396 0
65. 3.16e+03 0.337 0.39 902 903 0.0396 0
66. 3.98e+03 0.336 0.395 942 942 0.0401 0
67. 5.01e+03 0.336 0.401 981 981 0.0406 0
68. 6.31e+03 0.337 0.409 1.02e+03 1.02e+03 0.0409 0
@@ -874,9 +909,9 @@ Index : 1 used in the geometry : Yes
70. 1e+04 0.34 0.426 1.1e+03 1.1e+03 0.0414 0
71. 1.26e+04 0.342 0.435 1.14e+03 1.14e+03 0.0416 0
72. 1.58e+04 0.344 0.445 1.18e+03 1.18e+03 0.0417 0
73. 2e+04 0.346 0.454 1.21e+03 1.22e+03 0.0418 8.29
74. 2.51e+04 0.348 0.457 1.24e+03 1.26e+03 0.0418 50.7
75. 3.16e+04 0.349 0.459 1.26e+03 1.3e+03 0.0417 83.8
73. 2e+04 0.346 0.454 1.22e+03 1.22e+03 0.0418 8.23
74. 2.51e+04 0.348 0.457 1.24e+03 1.26e+03 0.0418 50.2
75. 3.16e+04 0.349 0.459 1.25e+03 1.3e+03 0.0417 83.6
76. 3.98e+04 0.351 0.46 1.28e+03 1.35e+03 0.0417 111
77. 5.01e+04 0.352 0.462 1.3e+03 1.39e+03 0.0417 132
78. 6.31e+04 0.353 0.463 1.32e+03 1.43e+03 0.0417 148
@@ -899,8 +934,8 @@ Index : 1 used in the geometry : Yes
95. 3.16e+06 0.356 0.679 1.38e+03 2.04e+03 0.0417 197
96. 3.98e+06 0.356 0.741 1.36e+03 2.05e+03 0.0417 197
97. 5.01e+06 0.356 0.821 1.33e+03 2.06e+03 0.0417 197
98. 6.31e+06 0.356 0.923 1.3e+03 2.07e+03 0.0417 197
98. 6.31e+06 0.356 0.924 1.3e+03 2.07e+03 0.0417 197
99. 7.94e+06 0.356 1.05 1.27e+03 2.08e+03 0.0417 197
##################################################################
... write Root file : monopole.root - done
... close Root file : monopole.root - done
... write file : monopole.root - done
... close file : monopole.root - done
@@ -1,6 +1,9 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(dmc)
#----------------------------------------------------------------------------
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+10 -7
View File
@@ -14,6 +14,9 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
10 November 2020 B. Morgan (phononExample-V10-06-00)
- Migration to G4RunManagerFactory.
24 June 2018 G.Folger (phononExample-V10-04-03)
- Correct Windows specific references for windows line ends
@@ -27,7 +30,7 @@ track of all tags.
21 March 2018 G.Folger (phononExample-V10-04-00)
- update references for caustic and timing
changed caused by new CLHEP 2.4.0.4 with changes in random
changed caused by new CLHEP 2.4.0.4 with changes in random
4 December 2017 G.Folger (phononExample-V10-03-08)
@@ -40,7 +43,7 @@ track of all tags.
24 October 2017 G.Folger (phononExample-V10-03-06)
- create caustic and timings with \n at least line, drop first
empty line; it is difficult to create file without final \nl
- update references for this change.
- update references for this change.
24 October 2017 G.Folger (phononExample-V10-03-05)
- update references for caustic and timing
@@ -74,7 +77,7 @@ track of all tags.
19 November 2016 A.Dotti (phononExample-V10-02-08)
- explicit set of SD to manager
14 October 2016 G.Folger (phononExample-V10-02-07)
- remove direct use of {a,the}ParticleIterator, use GetParticleTableIterator().
fix required by clang39 on Linux and MAC
@@ -93,7 +96,7 @@ track of all tags.
- run.in: do not set random seed, this changes caustic.ssv and timing.ssv
26 July 2016: Gunter Folger (phononExample-V10-02-02)
- add clang/icc specific references, and switch depending on compiler
- add clang/icc specific references, and switch depending on compiler
17 February 2016: E. Bagli (phononExample-V10-02-01)
- run.in: set the random seed in the macro file
@@ -199,7 +202,7 @@ NOTE: XPhysicsList.cc still has process verbosity.
to use of h_Planck. Updated run.out to reflect reduced message output.
13 June 2013: A. Dotti (phononExample-V09-06-03)
- Adding reference files for MT mode, adding CTestDefinitions.txt
- Adding reference files for MT mode, adding CTestDefinitions.txt
file containing new ctest with OS/Mode reference files
6 June 2013: G. Cosmo (phononExample-V09-06-02)
@@ -215,7 +218,7 @@ NOTE: XPhysicsList.cc still has process verbosity.
- Fixed cases of variable shadowing.
15 November 2012: I. Hrivnacova (phononExample-V09-05-08)
- Fixed files descriptions, .README for a change in the example
- Fixed files descriptions, .README for a change in the example
directory name.
14 November 2012: I. Hrivnacova (phononExample-V09-05-07)
@@ -247,7 +250,7 @@ NOTE: XPhysicsList.cc still has process verbosity.
- Added explicit include of units and physical constants
- Replaced own defined PI with pi from physical constants
- Adding Copyright where missing
- Allocate XLogicalLattice on heap to avoid a stack overflow
- Allocate XLogicalLattice on heap to avoid a stack overflow
- Added file descriptions (for Doxygen documentation)
- Added .README file
- Replaced tabulations with space characters
@@ -59,11 +59,7 @@ int main(int argc,char** argv) {
// Construct the run manager
//
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager;
#else
G4RunManager* runManager = new G4RunManager;
#endif
auto* runManager = G4RunManagerFactory::CreateRunManager();
// Set mandatory initialization classes
//
@@ -73,7 +69,7 @@ int main(int argc,char** argv) {
G4VUserPhysicsList* physics = new XPhysicsList();
physics->SetCuts();
runManager->SetUserInitialization(physics);
// Set user action classes
//
runManager->SetUserInitialization(new XActionInitialization);
@@ -86,10 +82,10 @@ int main(int argc,char** argv) {
// Initialize G4 kernel (replaces /run/initialize macro command)
//
runManager->Initialize();
// Get the pointer to the User Interface manager
//
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if (ui) // Define UI session for interactive mode
{
@@ -0,0 +1,254 @@
///\file "exoticphysics/saxs/.README.txt"
///\brief Example SAXS README page
/*! \page Examplesaxs Example saxs
\author Gianfranco Patern&ograve; - INFN and University Ferrara (Italy) \n
paterno@fe.infn.it
The example saxs implements the typical setup of a Small Angle X-ray
Scattering (SAXS) experiment. It is meant to illustrate the
usage of molecular interference (MI) of Rayleigh (coherent) scattering
of photons inside the matter, which is implemented in the
G4PenelopeRayleighModelMI model.
\section saxs_s1 Geometry
The setup consists of a phantom/sample under investigation, slits
to collimate the photon beam and a shielded detector to collect
the photons scattered by the phantom (see SAXSDetectorConstruction).
The geometry is scalable through the interactive commands defined
in the SAXSDetectorConstructionMessenger class. All the significant
quantities, such as the setup (scattering) rotation angle, the position
and size of all the volumes, as well as the phantom material can be
set via macro commands.
Two macro files come with this example: saxs.in and saxs_slits.in.
-# In the saxs.in macro, the phantom is a cylinder with a diameter and
a height of 10 mm made of a mixture of 80% fat and 20% water.
In general, if the argument of <code>/det/setPhantomMaterial</code> command is 2,
as in this case, the material is a biological tissue ("MedMat")
defined as a mixture of fat, water, collagen and hydroxyapatite.
The weight fraction of the mixture components can be set through commands
\verbatim
/det/setComp0
/det/setComp1
/det/setComp2
/det/setComp3
\endverbatim
respectively.
The tissue form factor (including MI) is automatically calculated as a
weighed sum of the form factors of the basis components.
In this case, no slits are foreseen and the sensitive detector
positioned 400 mm downstream of the phantom collects all the photons
transmitted and scattered by the phantom, which is irradiated
by a pencil beam with an energy of 20 keV.
-# In the saxs_slits.in macro, the phantom is again a cylinder with a
diameter and a height of 10 mm. The phantom is made of a custom
material ("CustomMat") whose density and composition is set through
\verbatim
/det/setCustomMatDensity
/det/setCustomMatHmassfract,
/det/setCustomMatNmassfract
/det/setCustomMatOmassfract
\endverbatim
commands. In general, a custom material can be defined by
specifying the mass fraction of H, C, N, O, Na, P, S, Cl, K, and Ca via
commands analogous to those mentioned above. In this case, the material
composition corresponds to that of ammonium nitrate
(NH<sub>4</sub>NO<sub>3</sub>).
For a custom material, the user can provide the path of the file with
the material form factor (with MI) through the
\verbatim
/det/SetCustomMatFF
\endverbatim
command. As an example, the file myFF.dat contains the form factor of
NH<sub>4</sub>NO<sub>3</sub> measured by Harding in 1999.
In this case the slits upstream and downstream the phantom
are present. This setup is suitable for both monochromatic and
polychromatic beams. To speed-up the simulation, a monochromatic
photon beam was chosen, but a polychromatic beam can be easily defined.
\section saxs_s2 Physics
In this example, only electromagnetic processes and decays are considered.
They are defined in a custom physics list that allows the user to
choose among various EM PhysicsList constructors. In particular,
by choosing G4EmPenelopePhysicsMI and setting fUseMIFlag as true,
it is possible to enable the molecular interference effects. This
is the default configuration.
\section saxs_s3 Action Initialization
SAXSActionInitialization class instantiates and registers to
Geant4 kernel all user action classes. While in sequential mode
the action classes are instatiated just once, by invoking the
method: SAXSActionInitialization::Build(),
in multi-threading mode the same method is invoked for each thread
worker and so all user action classes are defined thread-local.
A run action class is instantiated both thread-local and global.
That's why its instance is created also in the method
SAXSActionInitialization::BuildForMaster(), which is
invoked only in multi-threading mode.
\section saxs_s4 Primary generator
The primary generator action class employs the G4GeneralParticleSource (GPS)
generator. The primary beam has to be defined via the G4 built-in
commands of the G4GeneralParticleSource in a input macro file.
In particular, a photon beam directed toward the phantom must be defined
to test the MI effects. The X-ray beam can be monochromatic or
polychromatic, parallel or divergent.
\section saxs_s5 Event and Detector Response
An event consists of the generation of a single particle which is
transported through the phantom and then to the sensitive detector.
The interactions of the photons inside the phantom, and in particular,
the scattering events, are scored in a dedicated ntuple through the
SAXSSteppingAction class.
The hits of the particles on the sensitive detector positioned
downstream of the phantom (SAXSSensitiveDetectorHit) are recorded
in a dedicated ntuple through the SAXSSensitiveDetector class.
\section saxs_s6 Analysis
The analysis tools are used to accumulate statistics.
ntuple are created in SAXSRunAction::SAXSRunAction()
constructor for the following quantities:
Ntuple1 (<code>part</code>) - Particles impinging on the Sensitive Detector (SD):
- energy of the particles
- position of the hits
- momentum of the particles
- time of the hits
- type of impinging particles
- ID number of the impinging particles
- number of scattering events a primary had before hitting the SD
- event number of the hits
Ntuple2 (<code>scatt</code>) - Interactions of photons inside the phantom:
- ID of the process occurred
(0-> transportation, 1->Rayleigh, 2->Compton, 3->Photoelectic)
- initial energy of the particles
- scattering angle
The ntuples are saved in the output file in a format
selected in SAXSAnalysis.hh.
When running in multi-threading mode, the ntuples accumulated
on threads are automatically merged in a single output file.
The default output format is root. Two root scripts come with
this example to analyze the output file: scattAnalysis.C and
ADXRD.C. The first can be used to analyze the <code>scatt</code> ntuple, while
the second can be used for <code>part</code> ntuple.
\section saxs_s7 How to run
Execute <code>saxs</code> in the 'interactive mode' with visualization:
\verbatim
% ./saxs
\endverbatim
and type in the commands line by line:
\verbatim
Idle> /control/verbose 2
Idle> /tracking/verbose 1
Idle> ...
Idle> /run/beamOn 10
Idle> ...
Idle> exit
\endverbatim
or it is possible to run a macro file (test.in is a simple macro where the
primary beam is defined through the usual GPS commands):
\verbatim
Idle> /control/execute test.in
Idle> /run/beamOn 10
....
Idle> exit
\endverbatim
Execute saxs in the 'batch' mode from macro files (without visualization)
\verbatim
% ./saxs saxs.in [Ncores]
% ./saxs saxs_slits.in [Ncores]
\endverbatim
<code>Ncores</code> (optional argument) is the number of threads the user wants
to use in MT mode.
\section saxs_s8 Appendix
The following paragraphs are common to all basic examples
\subsection saxs_s8a Visualization
The visualization manager is set via the G4VisExecutive class
in the main() function in saxs.cc.
The initialisation of the drawing is done via a set of /vis/ commands
in the macro vis.mac. This macro is automatically read from
the main function when the example is used in interactive running mode.
By default, vis.mac opens an OpenGL viewer (<code>/vis/open OGL</code>).
The user can change the initial viewer by commenting out this line
and instead uncommenting one of the other <code>/vis/open</code>
statements, such as
HepRepFile or DAWNFILE (which produce files that can be viewed with the
HepRApp and DAWN viewers, respectively). Note that one can always
open new viewers at any time from the command line. For example, if
you already have a view in, say, an OpenGL window with a name
"viewer-0", then
\verbatim
/vis/open DAWNFILE
\endverbatim
then to get the same view
\verbatim
/vis/viewer/copyView viewer-0
\endverbatim
or to get the same view *plus* scene-modifications
\verbatim
/vis/viewer/set/all viewer-0
\endverbatim
then to see the result
\verbatim
/vis/viewer/flush
\endverbatim
The DAWNFILE, HepRepFile drivers are always available
(since they require no external libraries), but the OGL driver requires
that the Geant4 libraries have been built with the OpenGL option.
vis.mac has additional commands that demonstrate additional functionality
of the vis system, such as displaying text, axes, scales, date, logo and
shows how to change viewpoint and style.
To see even more commands use <code>help</code> or <code>ls</code> or
browse the available UI commands in the Application Developers Guide.
For more information on visualization, including information on how to
install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
for example,
http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
(where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
The tracks are automatically drawn at the end of each event, accumulated
for all events and erased at the beginning of the next run.
\subsection saxs_s8b User Interfaces
The user command interface is set via the G4UIExecutive class
in the main() function in saxs.cc
The selection of the user command interface is then done automatically
according to the Geant4 configuration or it can be done explicitly via
the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
*/
@@ -0,0 +1,361 @@
#include "TFile.h"
#include "TTree.h"
#include "TH1D.h"
#include "TH2D.h"
#include "TH1I.h"
#include "TF1.h"
#include "TProfile2D.h"
#include "TGraph.h"
#include "TGraph2D.h"
#include "TGraphErrors.h"
#include "TGaxis.h"
#include "TAxis.h"
#include "TMath.h"
#include "TRandom3.h"
#include "TCanvas.h"
#include "TLegend.h"
#include <iostream>
#include <fstream>
#include <vector>
#include "string.h"
#include <sstream>
#define pi 3.1415926535
using namespace std;
void ADXRD()
{
gROOT->Reset();
//----------------------------------input--------------------------------
//open a simulation result file
TFile* file = TFile::Open("output.root");
//histogram parameters
Double_t binXsize = 0.5; //mm
Double_t binXStart = -200.; //mm
Double_t binXEnd = -binXStart;
Int_t nbinsX = binXEnd*2./binXsize;
Double_t binYsize = 0.5; //mm
Double_t binYStart = -200.; //mm
Double_t binYEnd = binXEnd;
Int_t nbinsY = binYEnd*2./binYsize;
Double_t Nbin = 92;
Double_t thetaMin = 1; //deg
Double_t thetaMax = 27; //deg
//cuts
Double_t Emin = 0.; //keV
Double_t Emax = 140.; //keV
Double_t angCut = 0.; //deg
Bool_t IWantOnlyScatt = true;
Bool_t IWantOnlyRayleighScatt = false;
Bool_t IWantOnlyComptonScatt = false;
Bool_t IWantOnlyDiffraction = false;
//plot options
Bool_t IWantThetaDistribution = true;
Bool_t IWantEdistrib = true;
Bool_t IWantPlot2D = true;
Bool_t IWantProfiles = false;
Bool_t IWantBoxAnalysis = false;
Bool_t IWantPlotEtheta = true;
Int_t nbp = 2;
gStyle->SetOptStat(kFALSE);
//gStyle->SetPalette(52); //52->gray, 53->hot
//Energy Distribution Analysis
Double_t NbinE = 140;
Double_t EMin = 0; //keV
Double_t EMax = 140; //keV
Double_t Angle = 2.58; //deg
Double_t DeltaAngle = 2.; //deg
Bool_t ApplyThetaCut = false;
//export
Bool_t IwantExportScattering = false;
Char_t ExportScattFileName[128];
sprintf(ExportScattFileName,"scatt.txt");
Bool_t IwantExportVariables = false;
Char_t ExportVarFileName[128];
sprintf(ExportVarFileName,"var.txt");
Bool_t IwantExportImage = false;
Char_t ExportImageFileName[128];
sprintf(ExportImageFileName,"image.txt");
//-----------------------------------------------------------------------
//tree definition
Double_t x,y,energy;
Int_t kind,ID,nri,nci,ndi;
TTree* t1 = (TTree*)file->Get("part");
t1->SetBranchAddress("e",&energy);
t1->SetBranchAddress("posx",&x);
t1->SetBranchAddress("posy",&y);
t1->SetBranchAddress("type",&kind);
t1->SetBranchAddress("trackID",&ID);
t1->SetBranchAddress("NRi",&nri);
t1->SetBranchAddress("NCi",&nci);
t1->SetBranchAddress("NDi",&ndi);
Int_t N = t1->GetEntries();
const Int_t Nval = N;
//scatt cut
Char_t cutScatt[128];
if (IWantOnlyScatt) {
if (IWantOnlyRayleighScatt) {
sprintf(cutScatt,"type==0 & trackID==1 & e>=%f & e<=%f & NRi>=1 & NCi==0 & NDi==0",Emin,Emax);
} else if (IWantOnlyComptonScatt) {
sprintf(cutScatt,"type==0 & trackID==1 & e>=%f & e<=%f & NRi==0 & NCi>=1 & NDi==0",Emin,Emax);
} else if (IWantOnlyDiffraction) {
sprintf(cutScatt,"type==0 & trackID==1 & e>=%f & e<=%f & NRi==0 & NCi==0 & NDi>1",Emin,Emax);
} else {
sprintf(cutScatt,"type==0 & trackID==1 & e>=%f & e<=%f & (NRi+NCi+NDi)>=1",Emin,Emax);
}
} else {
sprintf(cutScatt,"type==0 & trackID==1 & e>=%f & e<=%f",Emin,Emax);
}
//spatial distribution
TH2D* SpatialDistribution = new TH2D("SpatialDistribution", "Spatial Distribution", nbinsX, binXStart, binXEnd, nbinsY, binYStart, binYEnd);
t1->Project("SpatialDistribution","posy:posx",cutScatt);
if (IWantPlot2D) {
SpatialDistribution->SetXTitle("X (mm)");
SpatialDistribution->GetXaxis()->CenterTitle();
SpatialDistribution->GetXaxis()->SetTitleOffset(1.2);
SpatialDistribution->SetYTitle("Y (mm)");
SpatialDistribution->GetYaxis()->CenterTitle();
SpatialDistribution->GetYaxis()->SetTitleOffset(1.3);
TCanvas* c1 = new TCanvas("c1","",1000,1100);
c1->cd();
SpatialDistribution->SetContour(50);
SpatialDistribution->Draw("colz");
}
//profiles (projections transformed in profiles by myself)
if (IWantProfiles) {
TCanvas* c2 = new TCanvas("c2","",1200,900);
c2->Divide(2,1);
Int_t bcx = Int_t(nbinsX/2.);
Int_t bcy = Int_t(nbinsY/2.);
Double_t sf = 1./(2.*nbp+1.);
TH1D* profileX = SpatialDistribution->ProjectionX("px", bcx-nbp, bcx+nbp);
profileX->Scale(sf);
profileX->SetTitle("X profile");
c2->cd(1);
//profileX->Fit("gaus");
profileX->Draw();
TH1D* profileY = SpatialDistribution->ProjectionY("py", bcy-nbp, bcy+nbp);
profileY->Scale(sf);
profileY->SetTitle("Y profile");
c2->cd(2);
//profileY->Fit("gaus");
profileY->Draw();
cout << endl;
cout << "profileX FWHM: " << profileX->GetRMS()*2.35 << " mm" << endl;
cout << "profileY FWHM: " << profileY->GetRMS()*2.35 << " mm" << endl;
cout << endl;
}
//theta distribution
TH1D* thetaDistr = new TH1D("thetaDistr", "", Nbin, thetaMin, thetaMax);
t1->Project("thetaDistr","acos(momz)*180/acos(-1)",cutScatt);
Double_t Norig = thetaDistr->Integral();
Double_t val, angle;
for (Int_t i=1; i<=Nbin; i++) {
angle = thetaDistr->GetBinCenter(i)*acos(-1)/180;
val = thetaDistr->GetBinContent(i);
thetaDistr->SetBinContent(i,val/TMath::Sin(angle));
}
Double_t Ndiv = thetaDistr->Integral();
thetaDistr->Scale(Norig/Ndiv);
cout << endl << "total counts of thetaDistr: " << thetaDistr->Integral() << endl;
if (IWantThetaDistribution) {
thetaDistr->SetLineColor(kBlack);
thetaDistr->SetLineWidth(2);
thetaDistr->SetXTitle("#theta (degree)");
thetaDistr->GetXaxis()->CenterTitle();
thetaDistr->GetXaxis()->SetTitleOffset(1.1);
//thetaDistr->GetXaxis()->SetRangeUser(2., 12.);
thetaDistr->SetYTitle("Counts");
thetaDistr->GetYaxis()->CenterTitle();
thetaDistr->GetYaxis()->SetTitleOffset(1.2);
TCanvas* c3 = new TCanvas("c3","",1100,1100);
c3->cd();
thetaDistr->Draw("HIST");
}
//Energy Distribution Analysis
if (IWantEdistrib) {
//Theta cut
Char_t cutTheta[256];
if (ApplyThetaCut) {
sprintf(cutTheta,"type==0 & TMath::Abs(acos(momz)-%f) <= %f",Angle*0.017453293,DeltaAngle*0.017453293);
} else {
sprintf(cutTheta,"");
}
//Energy distribution of scattered photons
TH1D* edistrib = new TH1D("edistrib", "", NbinE, EMin, EMax);
t1->Project("edistrib", "e", cutTheta);
edistrib->SetLineColor(kRed);
edistrib->SetLineWidth(2);
edistrib->SetXTitle("E (keV)");
edistrib->GetXaxis()->CenterTitle();
edistrib->GetXaxis()->SetTitleOffset(1.1);
edistrib->SetYTitle("Counts (a. u.)");
edistrib->GetYaxis()->CenterTitle();
edistrib->GetYaxis()->SetTitleOffset(1.3);
edistrib->SetTitle("Energy spectrum of the particles impinging on the detector");
TCanvas* c4 = new TCanvas("c4","",1200,800);
c4->cd();
gStyle->SetOptStat(kFALSE);
edistrib->Draw();
Int_t Ntot = edistrib->Integral();
cout << "total counts of edistrib: " << Ntot << endl;
}
//Box Score Analysis
if (IWantBoxAnalysis) {
Int_t xBins = 40;
Int_t yBins = 40;
Int_t zBins = 20;
Double_t xlow = -25; //mm
Double_t xup = 25;
Double_t ylow = -25;
Double_t yup = 25;
Double_t zlow = -10;
Double_t zup = 10;
Double_t rngadd = 1.; //Box plot range margin (mm)
TH3D* XYZ = new TH3D("XYZ","Hot spots", xBins, xlow-rngadd, xup+rngadd, zBins, zlow-rngadd, zup+rngadd, yBins, ylow-rngadd, yup+rngadd);
t1->Project("XYZ", "posy:posz:posx",cutScatt);
XYZ->SetFillColor(2);
XYZ->SetXTitle("x (mm)");
XYZ->GetXaxis()->CenterTitle();
XYZ->GetXaxis()->SetTitleOffset(1.8);
XYZ->SetYTitle("z (mm)");
XYZ->GetYaxis()->CenterTitle();
XYZ->GetYaxis()->SetTitleOffset(2.4);
XYZ->SetZTitle("y (mm)");
XYZ->GetZaxis()->CenterTitle();
XYZ->GetZaxis()->SetTitleOffset(1.8);
gStyle->SetCanvasPreferGL(kTRUE);
TCanvas* c5 = new TCanvas("c5","Box Score Analysis",1200,800);
c5->cd();
XYZ->Draw("glbox");
}
//energy-angle correlation of impinging photons
if (IWantPlotEtheta) {
TH2D* Etheta = new TH2D("Etheta", "", NbinE, EMin, EMax, Nbin, thetaMin, thetaMax);
t1->Project("Etheta","acos(momz)*180/acos(-1):e");
Etheta->SetXTitle("E (keV)");
Etheta->GetXaxis()->CenterTitle();
Etheta->GetXaxis()->SetTitleOffset(1.2);
Etheta->SetYTitle("#theta (degree)");
Etheta->GetYaxis()->CenterTitle();
Etheta->GetYaxis()->SetTitleOffset(1.3);
TCanvas* c6 = new TCanvas("c6","",1000,1100);
c6->cd();
Etheta->SetContour(50);
Etheta->Draw("colz");
}
//export scattering data
if (IwantExportScattering) {
//open a txt file
ofstream f(ExportScattFileName);
if(!f) {
cout << "Error opening the file!";
return;
}
//variables extraction from tree
for (Int_t i=1; i<=Nbin; i++) {
Double_t ang = thetaDistr->GetBinCenter(i);
Double_t scatt = thetaDistr->GetBinContent(i);
if (ang >= angCut) {
f << ang << " " << scatt << endl;
}
}
//close the txt file
f.close();
cout << "writing the file with the scattering data successful!" << endl << endl;
}
//export (x,y) variables
if (IwantExportVariables) {
//open a txt file
ofstream f(ExportVarFileName);
if(!f) {
cout << "Error opening the file!";
return;
}
for (Int_t i=0; i<Nval; i++) {
t1->GetEntry(i);
if (IWantOnlyScatt) {
if (kind==0 && ID==1 && energy>=Emin && energy<=Emax && nri+nci+ndi>=1) {
f << x << " " << y << endl;
}
} else {
f << x << " " << y << endl;
}
}
//close the txt file
f.close();
cout << "writing the file with the (x,y) variables successful!" << endl << endl;
}
//export Image
if (IwantExportImage) {
//open a txt file
ofstream fout(ExportImageFileName);
if (!fout) {
cout << "Error opening the file!";
return;
}
//variables extraction from histogram
Double_t counts = 0.;
for (Int_t i=1; i<=nbinsY; i++) {
for (Int_t j=1; j<=nbinsX; j++) {
counts = SpatialDistribution->GetBinContent(j,i);
fout << counts << " ";
}
fout << endl;
}
//close the txt file
fout.close();
cout << "writing text image file successful!" << endl << endl;
}
}
@@ -0,0 +1,77 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(saxs)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
option(WITH_GEANT4_UIVIS "Build SAXS with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
find_package(Geant4 REQUIRED ui_all vis_all)
else()
find_package(Geant4 REQUIRED)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
# Setup include directory for this project
include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
add_executable(saxs saxs.cc ${sources} ${headers})
target_link_libraries(saxs ${Geant4_LIBRARIES})
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build SAXS. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
set(SAXS_SCRIPTS
init_vis.mac
vis.mac
gui.mac
geom.mac
myFF.dat
saxs.in
saxs_slits.in
test.in
scattAnalysis.C
ADXRD.C
)
foreach(_script ${SAXS_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# For internal Geant4 use - but has no effect if you build this
# example standalone
# add_custom_target(saxs_custom DEPENDS saxs)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
install(TARGETS saxs DESTINATION bin)
@@ -0,0 +1,28 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Exotic Examples History file
-----------------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 10, 2020, B. Morgan (saxs-V10-06-03)
- Migration to G4RunManagerFactory.
Nov 6, 2020, I. Hrivnacova (saxs-V10-06-02)
- Fixed doxygen documentation
Nov 2, 2020, G. Paternò and L. Pandola (saxs-V10-06-01)
- Finalize documentation (README and .README.txt)
Oct 13, 2020, G. Paternò and L. Pandola (saxs-V10-06-00)
- First import.
+218
View File
@@ -0,0 +1,218 @@
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Extended Example saxs
--------------------
The example saxs implements the typical setup of a Small Angle X-ray
Scattering (SAXS) experiment. It is meant to illustrate the
usage of molecular interference (MI) of Rayleigh (coherent) scattering
of photons inside the matter, which is implemented in the
G4PenelopeRayleighModelMI model.
1- GEOMETRY
The setup consists of a phantom/sample under investigation, slits
to collimate the photon beam and a shielded detector to collect
the photons scattered by the phantom (see SAXSDetectorConstruction).
The geometry is scalable through the interactive commands defined
in the SAXSDetectorConstructionMessenger class. All the significant
quantities, such as the setup (scattering) rotation angle, the position
and size of all the volumes, as well as the phantom material can be
set via macro commands.
Two macro files come with this example: saxs.in and saxs_slits.in.
In the saxs.in macro, the phantom is a cylinder with a diameter and
a height of 10 mm made of a mixture of 80% fat and 20% water.
In general, if the argument of /det/setPhantomMaterial command is 2,
as in this case, the material is a biological tissue ("MedMat")
defined as a mixture of fat, water, collagen and hydroxyapatite.
The weight fraction of the mixture components can be set through commands
/det/setComp0, /det/setComp1, /det/setComp2, /det/setComp3, respectively.
The tissue form factor (including MI) is automatically calculated as a
weighed sum of the form factors of the basis components.
In this case, no slits are foreseen and the sensitive detector
positioned 400 mm downstream of the phantom collects all the photons
transmitted and scattered by the phantom, which is irradiated
by a pencil beam with an energy of 20 keV.
In the saxs_slits.in macro, the phantom is again a cylinder with a
diameter and a height of 10 mm. The phantom is made of a custom
material ("CustomMat") whose density and composition is set through
/det/setCustomMatDensity and /det/setCustomMatHmassfract,
/det/setCustomMatNmassfract, /det/setCustomMatOmassfract commands,
respectively. In general, a custom material can be defined by
specifying the mass fraction of H, C, N, O, Na, P, S, Cl, K, and Ca via
commands analogous to those mentioned above. In this case, the material
composition corresponds to that of ammonium nitrate (NH4NO3).
For a custom material, the user can provide the path of the file with
the material form factor (with MI) through the /det/SetCustomMatFF
command. As an example, the file myFF.dat contains the form factor of
NH4NO3 measured by Harding in 1999.
In this case the slits upstream and downstream the phantom
are present. This setup is suitable for both monochromatic and
polychromatic beams. To speed-up the simulation, a monochromatic
photon beam was chosen, but a polychromatic beam can be easily defined.
2- PHYSICS
In this example, only electromagnetic processes and decays are considered.
They are defined in a custom physics list that allows the user to
choose among various EM PhysicsList constructors. In particular,
by choosing G4EmPenelopePhysicsMI and setting fUseMIFlag as true,
it is possible to enable the molecular interference effects. This
is the default configuration.
3- ACTION INITALIZATION
SAXSActionInitialization class instantiates and registers to
Geant4 kernel all user action classes. While in sequential mode
the action classes are instatiated just once, by invoking the
method: SAXSActionInitialization::Build(),
in multi-threading mode the same method is invoked for each thread
worker and so all user action classes are defined thread-local.
A run action class is instantiated both thread-local and global.
That's why its instance is created also in the method
SAXSActionInitialization::BuildForMaster(), which is
invoked only in multi-threading mode.
4- PRIMARY GENERATOR
The primary generator action class employs the G4GeneralParticleSource (GPS)
generator. The primary beam has to be defined via the G4 built-in
commands of the G4GeneralParticleSource in a input macro file.
In particular, a photon beam directed toward the phantom must be defined
to test the MI effects. The X-ray beam can be monochromatic or
polychromatic, parallel or divergent.
5- EVENT AND DETECTOR RESPONSE
An event consists of the generation of a single particle which is
transported through the phantom and then to the sensitive detector.
The interactions of the photons inside the phantom, and in particular,
the scattering events, are scored in a dedicated ntuple through the
SAXSSteppingAction class.
The hits of the particles on the sensitive detector positioned
downstream of the phantom (SAXSSensitiveDetectorHit) are recorded
in a dedicated ntuple through the SAXSSensitiveDetector class.
6- ANALYSIS:
The analysis tools are used to accumulate statistics.
ntuple are created in SAXSRunAction::SAXSRunAction()
constructor for the following quantities:
Ntuple1 (part) - Particles impinging on the Sensitive Detector (SD):
- energy of the particles
- position of the hits
- momentum of the particles
- time of the hits
- type of impinging particles
- ID number of the impinging particles
- number of scattering events a primary had before hitting the SD
- event number of the hits
Ntuple2 (scatt) - Interactions of photons inside the phantom:
- ID of the process occurred
(0-> transportation, 1->Rayleigh, 2->Compton, 3->Photoelectic)
- initial energy of the particles
- scattering angle
The ntuples are saved in the output file in a format
selected in SAXSAnalysis.hh.
When running in multi-threading mode, the ntuples accumulated
on threads are automatically merged in a single output file.
The default output format is root. Two root scripts come with
this example to analyze the output file: scattAnalysis.C and
ADXRD.C. The first can be used to analyze the scatt ntuple, while
the second can be used for part ntuple.
7- HOW TO RUN
- Execute saxs in the 'interactive mode' with visualization:
% ./saxs
and type in the commands line by line:
Idle> /control/verbose 2
Idle> /tracking/verbose 1
Idle> ...
Idle> /run/beamOn 10
Idle> ...
Idle> exit
or it is possible to run a macro file (test.in is a simple macro where the
primary beam is defined through the usual GPS commands):
Idle> /control/execute test.in
Idle> /run/beamOn 10
....
Idle> exit
- Execute saxs in the 'batch' mode from macro files
(without visualization)
% ./saxs saxs.in [Ncores]
% ./saxs saxs_slits.in [Ncores]
Ncores (optional argument) is the number of threads the user wants to use in
MT mode.
The following paragraphs are common to all basic examples
A- VISUALISATION
The visualization manager is set via the G4VisExecutive class
in the main() function in saxs.cc.
The initialisation of the drawing is done via a set of /vis/ commands
in the macro vis.mac. This macro is automatically read from
the main function when the example is used in interactive running mode.
By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
The user can change the initial viewer by commenting out this line
and instead uncommenting one of the other /vis/open statements, such as
HepRepFile or DAWNFILE (which produce files that can be viewed with the
HepRApp and DAWN viewers, respectively). Note that one can always
open new viewers at any time from the command line. For example, if
you already have a view in, say, an OpenGL window with a name
"viewer-0", then
/vis/open DAWNFILE
then to get the same view
/vis/viewer/copyView viewer-0
or to get the same view *plus* scene-modifications
/vis/viewer/set/all viewer-0
then to see the result
/vis/viewer/flush
The DAWNFILE, HepRepFile drivers are always available
(since they require no external libraries), but the OGL driver requires
that the Geant4 libraries have been built with the OpenGL option.
vis.mac has additional commands that demonstrate additional functionality
of the vis system, such as displaying text, axes, scales, date, logo and
shows how to change viewpoint and style.
To see even more commands use help or ls or browse the available UI commands
in the Application Developers Guide.
For more information on visualization, including information on how to
install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
for example,
http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
(where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
The tracks are automatically drawn at the end of each event, accumulated
for all events and erased at the beginning of the next run.
B- USER INTERFACES
The user command interface is set via the G4UIExecutive class
in the main() function in saxs.cc
The selection of the user command interface is then done automatically
according to the Geant4 configuration or it can be done explicitly via
the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
@@ -0,0 +1,28 @@
/det/setPhantomMaterial 1
/det/setPhantomDiameter 20. mm
/det/setPhantomHeight 20. mm
/det/setPhantomZ 500. mm #default is 0
/det/setThetaSetup 0.192 #[rad] (default is 0)
/det/setSlits true #default is false
/det/setSlit1Thickness 5. mm
/det/setSlit2Thickness 5. mm
/det/setSlit3Thickness 5. mm
/det/setSlit4Thickness 5. mm
/det/setSlit1SampleDistance 350. mm
/det/setSlit2SampleDistance 50. mm
/det/setSlit3SampleDistance 50. mm
/det/setSlit4SampleDistance 450. mm
/det/setSlit1xAperture 4. mm
/det/setSlit2xAperture 4. mm
/det/setSlit3xAperture 4. mm
/det/setSlit4xAperture 4. mm
/det/setSlit1yAperture 4. mm
/det/setSlit2yAperture 4. mm
/det/setSlit3yAperture 4. mm
/det/setSlit4yAperture 4. mm
/det/setDetectorSize 20. mm
/det/setDetectorThickness 20. mm
/det/setDetectorSampleDistance 500. mm
@@ -0,0 +1,25 @@
# This file permits to customize, with commands,
# the menu bar of the G4UIXm, G4UIQt, G4UIWin32 sessions.
# It has no effect with G4UIterminal.
#
# File :
/gui/addMenu g4file G4File
/gui/addButton g4file Continue "continue"
/gui/addButton g4file Exit "exit"
#
# Run menu :
/gui/addMenu run Run
/gui/addButton run "test beam" "/control/execute test.in"
/gui/addButton run "beamOn 1" "/run/beamOn 1"
#
# Gun menu :
/gui/addMenu gun Gun
/gui/addButton gun "gamma" "/gps/particle gamma"
/gui/addButton gun "20 keV" "/gps/energy 20. keV"
#
# Viewer menu :
/gui/addMenu viewer Viewer
/gui/addButton viewer "Set lateral view" "/vis/viewer/set/viewpointThetaPhi 90 0"
/gui/addButton viewer "Set front view" "/vis/viewer/set/viewpointThetaPhi 180 0"
/gui/addButton viewer "Set top view" "/vis/viewer/set/viewpointThetaPhi 90 90"
/gui/addButton viewer "geometry test" "/geometry/test/run"
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * 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: G4EmPenelopePhysicsMI.cc 109526 2018-04-30 07:11:52Z gcosmo $
// customized by gpaterno for MI in Rayleigh Scattering, March 2019
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef G4EmPenelopePhysicsMI_h
#define G4EmPenelopePhysicsMI_h 1
#include "G4VPhysicsConstructor.hh"
#include "G4EmParticleList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4EmPenelopePhysicsMI : public G4VPhysicsConstructor
{
public:
explicit G4EmPenelopePhysicsMI(G4int ver=1, const G4String& name="",
G4bool useMI=true);
virtual ~G4EmPenelopePhysicsMI();
virtual void ConstructParticle();
virtual void ConstructProcess();
private:
G4int fVerbose;
G4EmParticleList fPartList;
G4bool fUseMIFlag;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSActionInitialization.hh
/// \brief Definition of the SAXSActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSActionInitialization_h
#define SAXSActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
#include "G4GeneralParticleSource.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Action initialization class.
class SAXSActionInitialization : public G4VUserActionInitialization {
public:
SAXSActionInitialization();
~SAXSActionInitialization();
private:
virtual void Build() const;
virtual void BuildForMaster() const;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,40 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSAnalysis.hh
/// \brief Implementation of the SAXSAnalysis class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSAnalysis_h
#define SAXSAnalysis_h 1
#include "g4root.hh"
//#include "g4xml.hh"
//#include "g4csv.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,269 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSDetectorConstruction.hh
/// \brief Implementation of the SAXSDetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSDetectorConstruction_h
#define SAXSDetectorConstruction_h 1
#endif
#include "SAXSDetectorConstructionMessenger.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4RunManager.hh"
#include "globals.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4NistManager.hh"
#include "G4ExtendedMaterial.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Detector construction.
class SAXSDetectorConstruction : public G4VUserDetectorConstruction
{
public:
SAXSDetectorConstruction();
~SAXSDetectorConstruction();
void DefineMaterials();
void SetGeometricalVariables();
virtual G4VPhysicalVolume* Construct();
G4LogicalVolume* GetSensitiveVolume() const {return fSensitiveVolume;}
G4LogicalVolume* GetPhantom() const {return fPhantomLogic;}
protected:
G4LogicalVolume* fSensitiveVolume;
private:
virtual void ConstructSDandField();
SAXSDetectorConstructionMessenger* fMessenger;
G4bool fIWantSlits;
//-----------------definition of Volumes-------------------
//World
G4Box* fWorldSolid;
G4LogicalVolume* fWorldLogic;
G4VPhysicalVolume* fWorldPhysical;
//Phantom
G4LogicalVolume* fPhantomLogic;
G4VPhysicalVolume* fPhantomPhysical;
G4Material* fPhantomMaterial;
G4int fPhantomMaterialIndex;
//Slits
G4LogicalVolume* fSlit1Logic;
G4LogicalVolume* fSlit2Logic;
G4LogicalVolume* fSlit3Logic;
G4LogicalVolume* fSlit4Logic;
G4VPhysicalVolume* fSlit1Physical;
G4VPhysicalVolume* fSlit2Physical;
G4VPhysicalVolume* fSlit3Physical;
G4VPhysicalVolume* fSlit4Physical;
//Detector
G4LogicalVolume* fDetectorLogic;
G4VPhysicalVolume* fDetectorPhysical;
//Shielding
G4LogicalVolume* fShieldingLogic;
G4VPhysicalVolume* fShieldingPhysical;
G4LogicalVolume* fShieldingBackLogic;
G4VPhysicalVolume* fShieldingBackPhysical;
//--------------------definition of Materials--------------
//materials for MIFF study
G4Material* fFat;
G4Material* fWater;
G4Material* fBoneMatrix;
G4Material* fMineral;
G4Material* fMedMat;
G4Material* fPMMA;
G4Material* fAdipose;
G4Material* fGlandular;
G4Material* fBreast5050;
G4Material* fcarcinoma;
G4Material* fLexan;
G4Material* fKapton;
G4Material* fNylon;
G4Material* fPolyethylene;
G4Material* fPolystyrene;
G4Material* fGrayMatter;
G4Material* fWhiteMatter;
G4Material* fbeefBlood;
G4Material* fFormaline;
G4Material* fAcetone;
G4Material* fHperoxide;
G4Material* fCIRS3070;
G4Material* fCIRS5050;
G4Material* fCIRS7030;
G4Material* fRMI454;
G4Material* fBone;
G4Material* ffatLowX;
G4Material* fbonematrixLowX;
G4Material* fdryBoneLowX;
G4Material* fliver;
G4Material* fkidney;
//custom material
G4ExtendedMaterial* fCustomMat;
G4double fCustomMatDensity;
G4double fCustomMatHmassfract;
G4double fCustomMatCmassfract;
G4double fCustomMatNmassfract;
G4double fCustomMatOmassfract;
G4double fCustomMatNamassfract;
G4double fCustomMatPmassfract;
G4double fCustomMatSmassfract;
G4double fCustomMatClmassfract;
G4double fCustomMatKmassfract;
G4double fCustomMatCamassfract;
G4String fCustomMatFF;
//definitions of variables for MedMat composition
G4double fComp0,fComp1,fComp2,fComp3;
//other materials
G4Material* fAir;
G4Material* fTungsten;
G4Material* fLead;
G4Material* fGe;
//-------------definition of Geometrical Variables---------
//World
G4double fWorldSize;
//Phantom
G4double fPhantomDiameter;
G4double fPhantomHeight;
G4double fPhantomZ;
//setup angle (rad)
G4double fthetaSetup;
//Slits
G4double fSlitSize;
G4double fSlit1Thickness;
G4double fSlit2Thickness;
G4double fSlit3Thickness;
G4double fSlit4Thickness;
G4double fSlit1SampleDistance; //center-center
G4double fSlit2SampleDistance;
G4double fSlit3SampleDistance;
G4double fSlit4SampleDistance;
G4double fSlit1xAperture;
G4double fSlit2xAperture;
G4double fSlit3xAperture;
G4double fSlit4xAperture;
G4double fSlit1yAperture;
G4double fSlit2yAperture;
G4double fSlit3yAperture;
G4double fSlit4yAperture;
//Detector
G4double fDetectorThickness;
G4double fDetectorSize;
G4double fDetectorSampleDistance; //center-center
//Shielding
G4double fShieldingThickness;
//-------------set methods for the messenger---------------
public:
void SetCustomMatFF(const G4String& ffname) {fCustomMatFF = ffname;}
void SetCustomMatDensity(G4double csd) {fCustomMatDensity = csd;}
void SetCustomMatHmassfract(G4double csHmf) {fCustomMatHmassfract = csHmf;}
void SetCustomMatCmassfract(G4double csCmf) {fCustomMatCmassfract = csCmf;}
void SetCustomMatNmassfract(G4double csNmf) {fCustomMatNmassfract = csNmf;}
void SetCustomMatOmassfract(G4double csOmf) {fCustomMatOmassfract = csOmf;}
void SetCustomMatNamassfract(G4double csNamf) {fCustomMatNamassfract = csNamf;}
void SetCustomMatPmassfract(G4double csPmf) {fCustomMatPmassfract = csPmf;}
void SetCustomMatSmassfract(G4double csSmf) {fCustomMatSmassfract = csSmf;}
void SetCustomMatClmassfract(G4double csClmf) {fCustomMatClmassfract = csClmf;}
void SetCustomMatKmassfract(G4double csKmf) {fCustomMatKmassfract = csKmf;}
void SetCustomMatCamassfract(G4double csCamf) {fCustomMatCamassfract = csCamf;}
void SetPhantomMaterial(G4int mat) {fPhantomMaterialIndex = mat;}
void SetPhantomDiameter(G4double diam) {fPhantomDiameter = diam;}
void SetPhantomHeight(G4double ht) {fPhantomHeight = ht;}
void SetPhantomZ(G4double PhZ) {fPhantomZ = PhZ;}
void SetComp0(G4double c0) {fComp0 = c0;}
void SetComp1(G4double c1) {fComp1 = c1;}
void SetComp2(G4double c2) {fComp2 = c2;}
void SetComp3(G4double c3) {fComp3 = c3;}
void SetThetaSetup(G4double theta) {fthetaSetup = theta;}
void SetSlits(G4bool bslits) {fIWantSlits = bslits;}
void SetSlit1Thickness(G4double sl1th) {fSlit1Thickness = sl1th;}
void SetSlit2Thickness(G4double sl2th) {fSlit2Thickness = sl2th;}
void SetSlit3Thickness(G4double sl3th) {fSlit3Thickness = sl3th;}
void SetSlit4Thickness(G4double sl4th) {fSlit4Thickness = sl4th;}
void SetSlit1SampleDistance(G4double slSampleDist1)
{fSlit1SampleDistance = slSampleDist1;}
void SetSlit2SampleDistance(G4double slSampleDist2)
{fSlit2SampleDistance = slSampleDist2;}
void SetSlit3SampleDistance(G4double slSampleDist3)
{fSlit3SampleDistance = slSampleDist3;}
void SetSlit4SampleDistance(G4double slSampleDist4)
{fSlit4SampleDistance = slSampleDist4;}
void SetSlit1xAperture(G4double aperture1x) {fSlit1xAperture = aperture1x;}
void SetSlit2xAperture(G4double aperture2x) {fSlit2xAperture = aperture2x;}
void SetSlit3xAperture(G4double aperture3x) {fSlit3xAperture = aperture3x;}
void SetSlit4xAperture(G4double aperture4x) {fSlit4xAperture = aperture4x;}
void SetSlit1yAperture(G4double aperture1y) {fSlit1yAperture = aperture1y;}
void SetSlit2yAperture(G4double aperture2y) {fSlit2yAperture = aperture2y;}
void SetSlit3yAperture(G4double aperture3y) {fSlit3yAperture = aperture3y;}
void SetSlit4yAperture(G4double aperture4y) {fSlit4yAperture = aperture4y;}
void SetDetectorSize(G4double detSize) {fDetectorSize = detSize;}
void SetDetectorThickness(G4double detTh) {fDetectorThickness = detTh;}
void SetDetectorSampleDistance(G4double detDist)
{fDetectorSampleDistance = detDist;}
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSDetectorConstructionMessenger.hh
/// \brief Implementation of the SAXSDetectorConstructionMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSDetectorConstructionMessenger_h
#define SAXSDetectorConstructionMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class SAXSDetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADouble;
class G4UIcmdWithABool;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// DetectorConstruction messenger.
class SAXSDetectorConstructionMessenger: public G4UImessenger
{
public:
SAXSDetectorConstructionMessenger(SAXSDetectorConstruction* detconstr);
~SAXSDetectorConstructionMessenger();
virtual void SetNewValue(G4UIcommand* command,G4String newValues);
private:
SAXSDetectorConstruction* fDetector;
G4UIdirectory* fCmdDir;
G4UIcmdWithAString* fSetCustomMatFFfilename;
G4UIcmdWithADouble* fSetCustomMatDensityCmd;
G4UIcmdWithADouble* fSetCustomMatHmassfractCmd;
G4UIcmdWithADouble* fSetCustomMatCmassfractCmd;
G4UIcmdWithADouble* fSetCustomMatNmassfractCmd;
G4UIcmdWithADouble* fSetCustomMatOmassfractCmd;
G4UIcmdWithADouble* fSetCustomMatNamassfractCmd;
G4UIcmdWithADouble* fSetCustomMatPmassfractCmd;
G4UIcmdWithADouble* fSetCustomMatSmassfractCmd;
G4UIcmdWithADouble* fSetCustomMatClmassfractCmd;
G4UIcmdWithADouble* fSetCustomMatKmassfractCmd;
G4UIcmdWithADouble* fSetCustomMatCamassfractCmd;
G4UIcmdWithAnInteger* fPhantomMaterialCmd;
G4UIcmdWithADoubleAndUnit* fPhantomDiameterCmd;
G4UIcmdWithADoubleAndUnit* fPhantomHeightCmd;
G4UIcmdWithADoubleAndUnit* fPhantomZCmd;
G4UIcmdWithADouble* fSetComp0Cmd;
G4UIcmdWithADouble* fSetComp1Cmd;
G4UIcmdWithADouble* fSetComp2Cmd;
G4UIcmdWithADouble* fSetComp3Cmd;
G4UIcmdWithADouble* fThetaSetupCmd;
G4UIcmdWithABool* fSetSlitsCmd;
G4UIcmdWithADoubleAndUnit* fSlit1ThicknessCmd;
G4UIcmdWithADoubleAndUnit* fSlit2ThicknessCmd;
G4UIcmdWithADoubleAndUnit* fSlit3ThicknessCmd;
G4UIcmdWithADoubleAndUnit* fSlit4ThicknessCmd;
G4UIcmdWithADoubleAndUnit* fSlit1DistanceCmd;
G4UIcmdWithADoubleAndUnit* fSlit2DistanceCmd;
G4UIcmdWithADoubleAndUnit* fSlit3DistanceCmd;
G4UIcmdWithADoubleAndUnit* fSlit4DistanceCmd;
G4UIcmdWithADoubleAndUnit* fSlit1xApertureCmd;
G4UIcmdWithADoubleAndUnit* fSlit2xApertureCmd;
G4UIcmdWithADoubleAndUnit* fSlit3xApertureCmd;
G4UIcmdWithADoubleAndUnit* fSlit4xApertureCmd;
G4UIcmdWithADoubleAndUnit* fSlit1yApertureCmd;
G4UIcmdWithADoubleAndUnit* fSlit2yApertureCmd;
G4UIcmdWithADoubleAndUnit* fSlit3yApertureCmd;
G4UIcmdWithADoubleAndUnit* fSlit4yApertureCmd;
G4UIcmdWithADoubleAndUnit* fDetectorThicknessCmd;
G4UIcmdWithADoubleAndUnit* fDetectorSizeCmd;
G4UIcmdWithADoubleAndUnit* fDetectorDistanceCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSEventAction.hh
/// \brief Implementation of the SAXSEventAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSEventAction_h
#define SAXSEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
#include <iostream>
#include <fstream>
#include <map>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Event action.
class SAXSEventAction : public G4UserEventAction
{
public:
SAXSEventAction();
virtual ~SAXSEventAction();
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
private:
G4int fSensitiveDetector_ID;
G4int fVerboseLevel;
G4int fNRi;
G4int fNCi;
G4int fNDi;
G4double fEventWeight;
public:
inline void SetVerbose(G4int val) {fVerboseLevel = val;}
inline G4int GetVerbose() const {return fVerboseLevel;}
void AddNRi() {fNRi++;}
void AddNCi() {fNCi++;}
void AddNDi() {fNDi++;}
void UpdateEventWeight(G4double ew) {fEventWeight = ew;}
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSPhysicsList.hh
/// \brief Implementation of the SAXSPhysicsList class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSPhysicsList_h
#define SAXSPhysicsList_h 1
#include "globals.hh"
#include "G4VUserPhysicsList.hh"
#include "G4VModularPhysicsList.hh"
#include <vector>
class G4VPhysicsConstructor;
class SAXSPhysicsListMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Physics list.
/// It includes various EM constructors, which can be selected through macro.
/// By defualt "standard" Penelope physics is used. In order to activate
/// Molecular interference (MI) effects in Rayleigh scattering, choose
/// G4EmPenelopeMI PhysicsList with fUseMIFlag variable set as true (default).
class SAXSPhysicsList : public G4VUserPhysicsList
{
public:
SAXSPhysicsList();
virtual ~SAXSPhysicsList();
public:
virtual void ConstructParticle();
virtual void ConstructProcess();
virtual void SetCuts();
//for the Messenger
void SetDefaultCutsValue(G4double);
void SelectPhysicsList(const G4String& name);
void SetUseMIFlag(G4bool val){fUseMIFlag = val;};
G4bool GetUseMIFlag(){return fUseMIFlag;};
private:
SAXSPhysicsList & operator = (const SAXSPhysicsList &right);
SAXSPhysicsList(const SAXSPhysicsList&);
G4VPhysicsConstructor* fParticleList;
G4VPhysicsConstructor* fEmPhysicsList;
G4bool fUseMIFlag;
SAXSPhysicsListMessenger* fPMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -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. *
// ********************************************************************
//
/// \file SAXSPhysicsListMessenger.hh
/// \brief Definition of the SAXSPhysicsListMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSPhysicsListMessenger_h
#define SAXSPhysicsListMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class SAXSPhysicsList;
class G4UIdirectory;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// PhysicsList messenger
class SAXSPhysicsListMessenger : public G4UImessenger
{
public:
SAXSPhysicsListMessenger(SAXSPhysicsList*);
virtual ~SAXSPhysicsListMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
SAXSPhysicsList* fPhysicsList;
G4UIdirectory* fPhysDir;
G4UIcmdWithADoubleAndUnit* fCutsCmd;
G4UIcmdWithAString* fListCmd;
G4UIcmdWithABool* fUseMIFlagCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,61 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSPrimaryGeneratorAction.hh
/// \brief Definition of the SAXSPrimaryGeneratorAction class
//
/// The G4GeneralParticleSource generator is defined and the
/// features of the primary beam are set through macro commands
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSPrimaryGeneratorAction_h
#define SAXSPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4GeneralParticleSource;
class G4ParticleGun;
class G4Event;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SAXSPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
SAXSPrimaryGeneratorAction();
virtual ~SAXSPrimaryGeneratorAction();
virtual void GeneratePrimaries(G4Event*);
private:
G4GeneralParticleSource* fParticleGPS;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSRunAction.hh
/// \brief Definition of the SAXSRunAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSRunAction_h
#define SAXSRunAction_h 1
#include "SAXSRunActionMessenger.hh"
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
class SAXSRunActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Run action class.
class SAXSRunAction : public G4UserRunAction
{
public:
SAXSRunAction();
virtual ~SAXSRunAction();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
void SetFileName(G4String);
private:
G4String fFileName;
SAXSRunActionMessenger* fMessenger;
G4bool fIsFileOpened;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSRunActionMessenger.hh
/// \brief Definition of the SAXSRunActionMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSRunActionMessenger_h
#define SAXSRunActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIcmdWithAString;
class SAXSRunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// RunAction messenger.
class SAXSRunActionMessenger: public G4UImessenger
{
public:
SAXSRunActionMessenger(SAXSRunAction*);
virtual ~SAXSRunActionMessenger();
virtual void SetNewValue(G4UIcommand*,G4String);
private:
SAXSRunAction* fRunAction;
G4UIcmdWithAString* fSetFileNameCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,71 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSSensitiveDetector.hh
/// \brief Definition of the SAXSSensitiveDetector class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSSensitiveDetector_h
#define SAXSSensitiveDetector_h 1
#include "SAXSSensitiveDetectorHit.hh"
#include "SAXSSensitiveDetectorMessenger.hh"
#include "G4VSensitiveDetector.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Sensitive detector.
/// It stores the features of the impinging particles.
class SAXSSensitiveDetector : public G4VSensitiveDetector
{
public:
SAXSSensitiveDetector(G4String);
virtual ~SAXSSensitiveDetector();
virtual void Initialize(G4HCofThisEvent*);
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
virtual void EndOfEvent(G4HCofThisEvent*);
void SetVarStopAndKill(G4bool bVar) {fVarStopAndKill = bVar;}
private:
SensitiveDetectorHitsCollection* fHitsCollection;
G4int fHCID;
SAXSSensitiveDetectorMessenger* fSDMessenger;
G4bool fVarStopAndKill;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,130 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSSensitiveDetectorHit.hh
/// \brief Definition of the SAXSSensitiveDetectorHit class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSSensitiveDetectorHit_h
#define SAXSSensitiveDetectorHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Sensitive Detector hit
///
/// It records:
/// - the spatial coordinate of the hit
/// - the time at which the hit occurred
/// - the type, ID, weight, momentum and energy of the impinging particle
/// - the ID of the impinging particle parent
class SAXSSensitiveDetectorHit : public G4VHit
{
public:
SAXSSensitiveDetectorHit();
SAXSSensitiveDetectorHit(const SAXSSensitiveDetectorHit &right);
virtual ~SAXSSensitiveDetectorHit(){;}
const SAXSSensitiveDetectorHit& operator=(const SAXSSensitiveDetectorHit &right);
int operator==(const SAXSSensitiveDetectorHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
virtual void Draw();
virtual void Print();
private:
G4int fTrackID;
G4int fTrackIDP;
G4double fTime;
G4ThreeVector fPos;
G4ThreeVector fMom;
G4double fEnergy;
G4int fType;
G4double fWeight;
public:
inline void SetTrackID(G4int z) {fTrackID = z;}
inline G4int GetTrackID() const {return fTrackID;}
inline void SetTrackIDP(G4int z) {fTrackIDP = z;}
inline G4int GetTrackIDP() const {return fTrackIDP;}
inline void SetTime(G4double t) {fTime = t;}
inline G4double GetTime() const {return fTime;}
inline void SetPos(G4ThreeVector xyz) {fPos = xyz;}
inline G4ThreeVector GetPos() const {return fPos;}
inline void SetMom(G4ThreeVector xyz) {fMom = xyz;}
inline G4ThreeVector GetMom() const {return fMom;}
inline void SetEnergy(G4double energy) {fEnergy = energy;}
inline G4double GetEnergy() const {return fEnergy;}
inline void SetType(G4int type) {fType = type;}
inline G4int GetType() const {return fType;}
inline void SetWeight(G4double weight) {fWeight = weight;}
inline G4double GetWeight() const {return fWeight;}
};
using SensitiveDetectorHitsCollection = G4THitsCollection<SAXSSensitiveDetectorHit>;
extern G4ThreadLocal G4Allocator<SAXSSensitiveDetectorHit> *hitAllocator;
inline void* SAXSSensitiveDetectorHit::operator new(size_t)
{
if (!hitAllocator)
{
hitAllocator = new G4Allocator<SAXSSensitiveDetectorHit>;
}
return hitAllocator->MallocSingle();
}
inline void SAXSSensitiveDetectorHit::operator delete(void *aHit)
{
if (!hitAllocator)
{
hitAllocator = new G4Allocator<SAXSSensitiveDetectorHit>;
}
hitAllocator->FreeSingle((SAXSSensitiveDetectorHit*) aHit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSSensitiveDetectorMessenger.hh
/// \brief Implementation of the SAXSSensitiveDetectorMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSSensitiveDetectorMessenger_h
#define SAXSSensitiveDetectorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class SAXSSensitiveDetector;
class G4UIdirectory;
class G4UIcmdWithABool;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// SensitiveDetector messenger.
class SAXSSensitiveDetectorMessenger : public G4UImessenger
{
public:
SAXSSensitiveDetectorMessenger(SAXSSensitiveDetector*);
~SAXSSensitiveDetectorMessenger();
virtual void SetNewValue(G4UIcommand*,G4String);
private:
SAXSSensitiveDetector* fSenDet;
G4UIdirectory* fSenDetDir;
G4UIcmdWithABool* fUserStopAndKillCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSSteppingAction.hh
/// \brief Definition of the SAXSSteppingAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SAXSSteppingAction_h
#define SAXSSteppingAction_h 1
#include "G4UserSteppingAction.hh"
#include "globals.hh"
#include <map>
class SAXSEventAction;
class G4LogicalVolume;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Stepping Action.
/// It is used to retrive information about every interaction of the photons
/// occuring iside the phantom, and in particular, scattering events.
/// The total number of scattering events (subdivided by tyoe) is passed to
/// the EventAction class and stored at the end of the event.
class SAXSSteppingAction : public G4UserSteppingAction
{
public:
SAXSSteppingAction(SAXSEventAction*);
virtual ~SAXSSteppingAction();
virtual void UserSteppingAction(const G4Step*);
private:
SAXSEventAction* fEventAction;
G4LogicalVolume* fPhantom;
G4int fEventNumber;
G4int fNSe;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,10 @@
#Macro for the initialization in interactive mode
#Geometry setting
/control/execute geom.mac
#Initialize kernel
/run/initialize
#Visualization setting
/control/execute vis.mac
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "SAXSDetectorConstruction.hh"
#include "SAXSPhysicsList.hh"
#include "SAXSActionInitialization.hh"
#include "SAXSRunAction.hh"
#include "SAXSEventAction.hh"
#include "SAXSSteppingAction.hh"
#include "SAXSAnalysis.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "G4Timer.hh"
#include "Randomize.hh"
#include <time.h>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
G4Timer* theTimer = new G4Timer();
theTimer->Start();
//Choose the Random engine and reset the seed (before the RunManager)
G4Random::setTheEngine(new CLHEP::RanecuEngine);
G4int seed = time(0);
G4cout << "Random seed: " << seed << G4endl;
CLHEP::HepRandom::setTheSeed(seed);
//Construct the run manager
auto* runManager = G4RunManagerFactory::CreateRunManager();
int vNumberOfThreads = 2;
if (argc>2) {
vNumberOfThreads = atoi(argv[2]);
}
if (vNumberOfThreads > 0) {
runManager->SetNumberOfThreads(vNumberOfThreads);
}
//Set mandatory initialization classes
runManager->SetUserInitialization(new SAXSDetectorConstruction);
runManager->SetUserInitialization(new SAXSPhysicsList());
//Set user action classes
runManager->SetUserInitialization(new SAXSActionInitialization());
//Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
//No arguments: set the batch mode
if (argc!=1) {
//Batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
} else {
//Visualization manager
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
//Define UI session for interactive mode
G4UIExecutive* ui = new G4UIExecutive(argc,argv);
UImanager->ApplyCommand("/control/execute init_vis.mac");
if (ui->IsGUI())
UImanager->ApplyCommand("/control/execute gui.mac");
ui->SessionStart();
delete ui;
delete visManager;
}
//Job termination
delete runManager;
G4AnalysisManager* man = G4AnalysisManager::Instance();
man->CloseFile();
theTimer->Stop();
G4cout << "Execution terminated" << G4endl;
G4cout << (*theTimer) << G4endl;
delete theTimer;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,51 @@
#Medical material (MedMat) definition
/det/setComp0 0.80 #Comp0->Fat
/det/setComp1 0.20 #Comp1->Water
/det/setComp2 0.00 #Comp2->Collagen (BM)
/det/setComp3 0.00 #Comp3->Mineral (HA)
#Custom Material (CustomMat) definition
/det/setCustomMatDensity 1.72 #[g/mol]
/det/setCustomMatHmassfract 0.0504
/det/setCustomMatNmassfract 0.3500
/det/setCustomMatOmassfract 0.5996
/det/SetCustomMatFF myFF.dat #NH4NO3
/det/setPhantomMaterial 2 #see the list below
/det/setPhantomDiameter 10. mm
/det/setPhantomHeight 10. mm
/det/setPhantomZ 500. mm #default is 0
/det/setDetectorSize 400. mm
/det/setDetectorThickness 20. mm
/det/setDetectorSampleDistance 400. mm
/phys/SelectPhysicsList penelopeMI #To activate MI effect, set "penelopeMI"
/run/setCut .1 mm
/run/verbose 1
/run/initialize
/run/setfilenamesave output #output filename (without extention)
#source
/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/radius 1. mm
/gps/pos/centre 0. 0. 0. mm
/gps/direction 0 0 1
/gps/particle gamma
/gps/ene/type Mono
/gps/ene/mono 20. keV
/run/printProgress 100000
/run/beamOn 1000000
#materials for the Phantom:
#1->Water, 2->MedMat, 3->PMMA, 4->Adipose, 5->Glandular, 6->Breast5050, 7->carcinoma,
#8->kidney, 9->liver, 10->Fat, 11->BoneMatrix, 12->Mineral, 13->Bone, 14->fatLowX,
#15->bonematrixLowX, 16->dryBoneLowX, 17->Lexan, 18->Kapton, 19->Nylon,
#20->Polyethylene, 21->Polystyrene, 22->Formaline, 23->Acetone, 24->Hperoxide
#25->CIRS3070, 26->CIRS5050, 27->CIRS7030, 28->RMI454, 29->Air, 30->CustomMat
@@ -0,0 +1,72 @@
#Medical material (MedMat) definition
/det/setComp0 0.80 #Comp0->Fat
/det/setComp1 0.20 #Comp1->Water
/det/setComp2 0.00 #Comp2->Collagen (BM)
/det/setComp3 0.00 #Comp3->Mineral (HA)
#Custom Material (CustomMat) definition
/det/setCustomMatDensity 1.72 #[g/mol]
/det/setCustomMatHmassfract 0.0504
/det/setCustomMatNmassfract 0.3500
/det/setCustomMatOmassfract 0.5996
/det/SetCustomMatFF myFF.dat #NH4NO3
/det/setPhantomMaterial 30 #see the list below
/det/setPhantomDiameter 10. mm
/det/setPhantomHeight 10. mm
/det/setPhantomZ 500. mm #default is 0
/det/setThetaSetup 0.192 #[rad] (default is 0)
/det/setSlits true #default is false
/det/setSlit1Thickness 5. mm
/det/setSlit2Thickness 5. mm
/det/setSlit3Thickness 5. mm
/det/setSlit4Thickness 5. mm
/det/setSlit1SampleDistance 350. mm
/det/setSlit2SampleDistance 50. mm
/det/setSlit3SampleDistance 50. mm
/det/setSlit4SampleDistance 450. mm
/det/setSlit1xAperture 4. mm
/det/setSlit2xAperture 4. mm
/det/setSlit3xAperture 4. mm
/det/setSlit4xAperture 4. mm
/det/setSlit1yAperture 4. mm
/det/setSlit2yAperture 4. mm
/det/setSlit3yAperture 4. mm
/det/setSlit4yAperture 4. mm
/det/setDetectorSize 50. mm
/det/setDetectorThickness 20. mm
/det/setDetectorSampleDistance 500. mm
/phys/SelectPhysicsList penelopeMI #To activate MI effect, set "penelopeMI"
/run/setCut .1 mm
/run/verbose 1
/run/initialize
/run/setfilenamesave output #output filename (without extention)
#source
/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/radius 2. mm
/gps/pos/centre 0. 0. 0. mm
/gps/direction 0 0 1
/gps/particle gamma
/gps/ene/type Mono
/gps/ene/mono 20. keV
/run/printProgress 100000
/run/beamOn 1000000
#materials for the Phantom:
#1->Water, 2->MedMat, 3->PMMA, 4->Adipose, 5->Glandular, 6->Breast5050, 7->carcinoma,
#8->kidney, 9->liver, 10->Fat, 11->BoneMatrix, 12->Mineral, 13->Bone, 14->fatLowX,
#15->bonematrixLowX, 16->dryBoneLowX, 17->Lexan, 18->Kapton, 19->Nylon,
#20->Polyethylene, 21->Polystyrene, 22->Formaline, 23->Acetone, 24->Hperoxide
#25->CIRS3070, 26->CIRS5050, 27->CIRS7030, 28->RMI454, 29->Air, 30->CustomMat
@@ -0,0 +1,187 @@
#include "TFile.h"
#include "TTree.h"
#include "TH1D.h"
#include "TH2D.h"
#include "TH1I.h"
#include "TF1.h"
#include "TProfile2D.h"
#include "TGraph.h"
#include "TGraph2D.h"
#include "TGraphErrors.h"
#include "TGaxis.h"
#include "TAxis.h"
#include "TMath.h"
#include "TRandom3.h"
#include "TCanvas.h"
#include "TLegend.h"
#include <iostream>
#include <fstream>
#include <vector>
#include "string.h"
#include <sstream>
#define pi 3.1415926535
using namespace std;
void scattAnalysis()
{
gROOT->Reset();
//----------------------------------input--------------------------------
//open a simulation result file
TFile* file = TFile::Open("output.root");
//scattering histogram parameters
Double_t thetalimit = 0.5; //deg
Double_t Nbin = 120.;
Double_t thetaMin = 0.; //deg
Double_t thetaMax = 30.; //deg
//options
Bool_t IwantTotalScatterig = false;
Bool_t IWantPlotComptonScattering = false;
Bool_t IWantPlotPlotComparison = false;
Bool_t IWantPlotProcessDistrib = false;
//export
Bool_t IwantExportScattDistrib = false;
Char_t ExportFileName[128];
sprintf(ExportFileName,"SimResults.txt");
//-----------------------------------------------------------------------
//definitions
Char_t cutproc[256];
Double_t val, angle;
//cut definition
if (IwantTotalScatterig) {
sprintf(cutproc,"(processID == 1 || processID == 2)");
} else {
sprintf(cutproc,"processID == 1");
}
//define a tree from the ntuple contained in the input file
TTree* scatt = (TTree*)file->Get("scatt");
Int_t N = scatt->GetEntries();
//Rayleigh/Total scattering
TH1D* thetaDistr = new TH1D("thetaDistr", "", Nbin, thetaMin, thetaMax);
scatt->Project("thetaDistr", "theta", cutproc);
Double_t Norig = thetaDistr->Integral();
for (Int_t i=1; i<=Nbin; i++) {
angle = thetaDistr->GetBinCenter(i);
if (angle >= thetalimit) {
val = thetaDistr->GetBinContent(i);
thetaDistr->SetBinContent(i,val/TMath::Sin(angle*pi/180));
}
}
Double_t Ndiv = thetaDistr->Integral();
thetaDistr->Scale(Norig/Ndiv);
cout << endl << "Scattering events: " << thetaDistr->Integral() << endl << endl;
thetaDistr->SetLineColor(kRed);
thetaDistr->SetLineWidth(2);
thetaDistr->SetXTitle("#theta (deg)");
thetaDistr->GetXaxis()->CenterTitle();
thetaDistr->GetXaxis()->SetTitleOffset(1.1);
thetaDistr->GetXaxis()->SetRangeUser(0., thetaMax);
thetaDistr->SetYTitle("Counts (a.u.)");
thetaDistr->GetYaxis()->CenterTitle();
thetaDistr->GetYaxis()->SetTitleOffset(1.5);
thetaDistr->SetTitle("");
TCanvas* c1 = new TCanvas("c1","",1200,800);
c1->cd();
gStyle->SetOptStat(kFALSE);
thetaDistr->Draw("HIST");
//Compton scattering
if (IWantPlotComptonScattering) {
TH1D* thetaDistrCompt = new TH1D("thetaDistrCompt", "", Nbin, thetaMin, thetaMax);
scatt->Project("thetaDistrCompt", "theta", "processID == 2");
Double_t NorigC = thetaDistrCompt->Integral();
for (Int_t i=1; i<=Nbin; i++) {
angle = thetaDistrCompt->GetBinCenter(i);
if (angle >= thetalimit) {
val = thetaDistrCompt->GetBinContent(i);
thetaDistrCompt->SetBinContent(i,val/TMath::Sin(angle*pi/180));
}
}
Double_t NdivC = thetaDistrCompt->Integral();
thetaDistrCompt->Scale(NorigC/NdivC);
thetaDistrCompt->SetLineColor(kBlue);
thetaDistrCompt->SetLineWidth(2);
if (IWantPlotPlotComparison) {
thetaDistrCompt->Draw("HIST SAME");
TLegend* leg = new TLegend(0.7,0.75,0.85,0.85);
leg->SetBorderSize(0);
leg->AddEntry(thetaDistr,"Rayleigh","lp");
leg->AddEntry(thetaDistrCompt,"Compton","lp");
leg->Draw();
} else {
thetaDistrCompt->SetXTitle("#theta (deg)");
thetaDistrCompt->GetXaxis()->CenterTitle();
thetaDistrCompt->GetXaxis()->SetTitleOffset(1.1);
thetaDistrCompt->GetXaxis()->SetRangeUser(0., thetaMax);
thetaDistr->SetYTitle("Counts (a.u.)");
thetaDistrCompt->GetYaxis()->CenterTitle();
thetaDistrCompt->GetYaxis()->SetTitleOffset(1.5);
thetaDistrCompt->SetTitle("");
TCanvas* c2 = new TCanvas("c2","",1200,800);
c2->cd();
thetaDistrCompt->Draw("HIST SAME");
}
}
//process distribution (0->transport, 1->Rayleigh, 2->Compton, 3->Photoel,
// 4->Pair prod, 5->Nuclear, 6->Diffraction)
if (IWantPlotProcessDistrib) {
TH1D* procDistr = new TH1D("procDistr", "process distribution", 70, 0, 7);
scatt->Project("procDistr", "processID");
procDistr->SetLineColor(kBlack);
procDistr->SetLineWidth(2);
procDistr->SetXTitle("process");
procDistr->GetXaxis()->CenterTitle();
procDistr->GetXaxis()->SetTitleOffset(1.1);
procDistr->SetYTitle("Counts");
procDistr->GetYaxis()->CenterTitle();
procDistr->GetYaxis()->SetTitleOffset(1.2);
TCanvas* c3 = new TCanvas("c3","",1200,800);
c3->cd();
procDistr->Draw();
}
//export scattering data
if (IwantExportScattDistrib) {
ofstream f(ExportFileName);
if (!f) {
cout << "Error opening the file!";
return;
}
for (Int_t i=1; i<=Nbin; i++) {
angle = thetaDistr->GetBinCenter(i);
if (angle >= thetalimit) {
val = thetaDistr->GetBinContent(i);
f << angle << " " << val << endl;
}
}
f.close();
cout << "writing successful!" << endl << endl;
}
}
@@ -0,0 +1,455 @@
//
// ********************************************************************
// * 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: G4EmPenelopePhysicsMI.cc 109526 2018-04-30 07:11:52Z gcosmo $
// customized by gpaterno for MI in Rayleigh Scattering, March 2019
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4EmPenelopePhysicsMI.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTable.hh"
//Processes and models
//gamma
#include "G4PhotoElectricEffect.hh"
#include "G4PenelopePhotoElectricModel.hh"
#include "G4ComptonScattering.hh"
#include "G4PenelopeComptonModel.hh"
#include "G4GammaConversion.hh"
#include "G4PenelopeGammaConversionModel.hh"
#include "G4RayleighScattering.hh"
#include "G4PenelopeRayleighModel.hh"
#include "G4PenelopeRayleighModelMI.hh"
//e- and e+
#include "G4eMultipleScattering.hh"
#include "G4UniversalFluctuation.hh"
#include "G4eIonisation.hh"
#include "G4PenelopeIonisationModel.hh"
#include "G4eBremsstrahlung.hh"
#include "G4PenelopeBremsstrahlungModel.hh"
//e+ only
#include "G4eplusAnnihilation.hh"
#include "G4PenelopeAnnihilationModel.hh"
//mu
#include "G4MuMultipleScattering.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4MuBremsstrahlungModel.hh"
#include "G4MuPairProductionModel.hh"
#include "G4hBremsstrahlungModel.hh"
#include "G4hPairProductionModel.hh"
//hadrons
#include "G4hMultipleScattering.hh"
#include "G4MscStepLimitType.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
#include "G4alphaIonisation.hh"
#include "G4IonParametrisedLossModel.hh"
#include "G4NuclearStopping.hh"
//msc models
#include "G4UrbanMscModel.hh"
#include "G4GoudsmitSaundersonMscModel.hh"
#include "G4WentzelVIModel.hh"
#include "G4CoulombScattering.hh"
#include "G4eCoulombScatteringModel.hh"
#include "G4LossTableManager.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4UAtomicDeexcitation.hh"
//particles
#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"
#include "G4EmModelActivator.hh"
//factory
#include "G4PhysicsConstructorFactory.hh"
G4_DECLARE_PHYSCONSTR_FACTORY(G4EmPenelopePhysicsMI);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EmPenelopePhysicsMI::G4EmPenelopePhysicsMI(G4int ver, const G4String&,
G4bool UseMIFlag):
G4VPhysicsConstructor("G4EmPenelopeMI"), fVerbose(ver),fUseMIFlag(UseMIFlag)
{
G4EmParameters* param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(fVerbose);
param->SetMinEnergy(100*eV);
param->SetLowestElectronEnergy(100*eV);
param->SetNumberOfBinsPerDecade(20);
param->SetMscRangeFactor(0.02);
param->SetMscStepLimitType(fUseDistanceToBoundary);
param->SetMuHadLateralDisplacement(true);
param->SetFluo(true);
param->SetPIXEElectronCrossSectionModel("Penelope");
SetPhysicsType(bElectromagnetic);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EmPenelopePhysicsMI::~G4EmPenelopePhysicsMI()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmPenelopePhysicsMI::ConstructParticle()
{
//gamma
G4Gamma::Gamma();
//leptons
G4Electron::Electron();
G4Positron::Positron();
G4MuonPlus::MuonPlus();
G4MuonMinus::MuonMinus();
//mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
//baryons
G4Proton::Proton();
G4AntiProton::AntiProton();
//ions
G4Deuteron::Deuteron();
G4Triton::Triton();
G4He3::He3();
G4Alpha::Alpha();
G4GenericIon::GenericIonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmPenelopePhysicsMI::ConstructProcess()
{
if(fVerbose > 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->SetEmModel(new G4WentzelVIModel());
G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc");
//high energy limit for e+- scattering models
G4double highEnergyLimit = G4EmParameters::Instance()->MscEnergyLimit();
//nuclear stopping
G4NuclearStopping* pnuc = new G4NuclearStopping();
//Applicability range for Penelope models
//for higher energies, the Standard models are used
G4double PenelopeHighEnergyLimit = 1.0*GeV;
//Add Penelope EM Processes
G4ParticleTable* table = G4ParticleTable::GetParticleTable();
for (const auto& particleName : fPartList.PartNames()) {
G4ParticleDefinition* particle = table->FindParticle(particleName);
if (!particle) { continue; }
if (particleName == "gamma") {
//Photo-electric effect
G4PhotoElectricEffect* thePhotoElectricEffect = new G4PhotoElectricEffect();
G4PenelopePhotoElectricModel* thePEPenelopeModel = new
G4PenelopePhotoElectricModel();
thePEPenelopeModel->SetHighEnergyLimit(PenelopeHighEnergyLimit);
thePhotoElectricEffect->SetEmModel(thePEPenelopeModel);
ph->RegisterProcess(thePhotoElectricEffect, particle);
//Compton scattering
G4ComptonScattering* theComptonScattering = new G4ComptonScattering();
G4PenelopeComptonModel* theComptonPenelopeModel =
new G4PenelopeComptonModel();
theComptonPenelopeModel->SetHighEnergyLimit(PenelopeHighEnergyLimit);
theComptonScattering->SetEmModel(theComptonPenelopeModel);
ph->RegisterProcess(theComptonScattering, particle);
//Gamma conversion
G4GammaConversion* theGammaConversion = new G4GammaConversion();
G4PenelopeGammaConversionModel* theGCPenelopeModel =
new G4PenelopeGammaConversionModel();
theGammaConversion->SetEmModel(theGCPenelopeModel);
ph->RegisterProcess(theGammaConversion, particle);
//Rayleigh scattering (modified by gpaterno)
G4RayleighScattering* theRayleigh = new G4RayleighScattering();
G4PenelopeRayleighModelMI* theRayleighPenelopeModel =
new G4PenelopeRayleighModelMI();
theRayleighPenelopeModel->SetVerbosityLevel(1);
theRayleighPenelopeModel->SetMIActive(fUseMIFlag);
//theRayleighPenelopeModel->SetHighEnergyLimit(PenelopeHighEnergyLimit);
theRayleigh->SetEmModel(theRayleighPenelopeModel);
ph->RegisterProcess(theRayleigh, particle);
} else if (particleName == "e-") {
//multiple scattering
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->SetEmModel(msc1);
msc->SetEmModel(msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
//Ionisation
G4eIonisation* eIoni = new G4eIonisation();
G4PenelopeIonisationModel* theIoniPenelope =
new G4PenelopeIonisationModel();
theIoniPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
eIoni->AddEmModel(0,theIoniPenelope,new G4UniversalFluctuation());
eIoni->SetStepFunction(0.2, 100*um); //
//Bremsstrahlung
G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
G4PenelopeBremsstrahlungModel* theBremPenelope =
new G4PenelopeBremsstrahlungModel();
theBremPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
eBrem->SetEmModel(theBremPenelope);
//register processes
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(eIoni, particle);
ph->RegisterProcess(eBrem, particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "e+") {
//multiple scattering
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->SetEmModel(msc1);
msc->SetEmModel(msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
//Ionisation
G4eIonisation* eIoni = new G4eIonisation();
G4PenelopeIonisationModel* theIoniPenelope =
new G4PenelopeIonisationModel();
theIoniPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
eIoni->AddEmModel(0,theIoniPenelope,new G4UniversalFluctuation());
eIoni->SetStepFunction(0.2, 100*um); //
//Bremsstrahlung
G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
G4PenelopeBremsstrahlungModel* theBremPenelope =
new G4PenelopeBremsstrahlungModel();
theBremPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
eBrem->SetEmModel(theBremPenelope);
//Annihilation
G4eplusAnnihilation* eAnni = new G4eplusAnnihilation();
G4PenelopeAnnihilationModel* theAnnPenelope =
new G4PenelopeAnnihilationModel();
theAnnPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
eAnni->AddEmModel(0, theAnnPenelope);
//register processes
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(eIoni, particle);
ph->RegisterProcess(eBrem, particle);
ph->RegisterProcess(eAnni, particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "mu+" ||particleName == "mu-") {
G4MuIonisation* muIoni = new G4MuIonisation();
muIoni->SetStepFunction(0.2, 50*um);
ph->RegisterProcess(mumsc, particle);
ph->RegisterProcess(muIoni, particle);
ph->RegisterProcess(mub, particle);
ph->RegisterProcess(mup, particle);
ph->RegisterProcess(new G4CoulombScattering(), particle);
} else if (particleName == "alpha" || particleName == "He3") {
G4hMultipleScattering* msc = new G4hMultipleScattering();
G4ionIonisation* ionIoni = new G4ionIonisation();
ionIoni->SetStepFunction(0.1, 10*um);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(ionIoni, particle);
ph->RegisterProcess(pnuc, particle);
} else if (particleName == "GenericIon") {
G4ionIonisation* ionIoni = new G4ionIonisation();
ionIoni->SetEmModel(new G4IonParametrisedLossModel());
ionIoni->SetStepFunction(0.1, 1*um);
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(ionIoni, particle);
ph->RegisterProcess(pnuc, particle);
} else if (particleName == "pi+" || particleName == "pi-" ) {
G4hMultipleScattering* pimsc = new G4hMultipleScattering();
G4hIonisation* hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.2, 50*um);
ph->RegisterProcess(pimsc, particle);
ph->RegisterProcess(hIoni, particle);
ph->RegisterProcess(pib, particle);
ph->RegisterProcess(pip, particle);
} else if (particleName == "kaon+" || particleName == "kaon-" ) {
G4hMultipleScattering* kmsc = new G4hMultipleScattering();
G4hIonisation* hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.2, 50*um);
ph->RegisterProcess(kmsc, particle);
ph->RegisterProcess(hIoni, particle);
ph->RegisterProcess(kb, particle);
ph->RegisterProcess(kp, particle);
} else if (particleName == "proton" || particleName == "anti_proton") {
G4hMultipleScattering* pmsc = new G4hMultipleScattering();
G4hIonisation* hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.2, 50*um);
ph->RegisterProcess(pmsc, particle);
ph->RegisterProcess(hIoni, particle);
ph->RegisterProcess(pb, particle);
ph->RegisterProcess(pp, particle);
ph->RegisterProcess(pnuc, 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);
}
}
//Nuclear stopping
pnuc->SetMaxKinEnergy(MeV);
//Deexcitation
G4VAtomDeexcitation* deexcitation = new G4UAtomicDeexcitation();
G4LossTableManager::Instance()->SetAtomDeexcitation(deexcitation);
G4EmModelActivator mact(GetPhysicsName());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSActionInitialization.cc
/// \brief Implementation of the SAXSActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SAXSActionInitialization.hh"
#include "SAXSPrimaryGeneratorAction.hh"
#include "SAXSRunAction.hh"
#include "SAXSEventAction.hh"
#include "SAXSSteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSActionInitialization::SAXSActionInitialization() :
G4VUserActionInitialization()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSActionInitialization::~SAXSActionInitialization()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSActionInitialization::Build() const
{
SetUserAction(new SAXSPrimaryGeneratorAction());
SetUserAction(new SAXSRunAction());
SAXSEventAction* eventAction = new SAXSEventAction();
SetUserAction(eventAction);
SetUserAction(new SAXSSteppingAction(eventAction));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SAXSActionInitialization::BuildForMaster() const
{
SetUserAction(new SAXSRunAction());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,542 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSDetectorConstructionMessenger.cc
/// \brief Implementation of the SAXSDetectorConstructionMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SAXSDetectorConstructionMessenger.hh"
#include "SAXSDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
#include "G4RunManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSDetectorConstructionMessenger::SAXSDetectorConstructionMessenger
(SAXSDetectorConstruction* detconstr):
G4UImessenger(), fDetector(detconstr)
{
fCmdDir = new G4UIdirectory("/det/");
fCmdDir->SetGuidance("Detector Control");
fSetCustomMatFFfilename = new G4UIcmdWithAString("/det/SetCustomMatFF",this);
fSetCustomMatFFfilename->SetGuidance("Set CustomMat FF filename");
fSetCustomMatFFfilename->SetParameterName("mmff",false);
fSetCustomMatFFfilename->AvailableForStates(G4State_PreInit);
fSetCustomMatDensityCmd = new G4UIcmdWithADouble("/det/setCustomMatDensity",
this);
fSetCustomMatDensityCmd->SetGuidance("Set density for custom material");
fSetCustomMatDensityCmd->SetParameterName("cmden",false);
fSetCustomMatDensityCmd->SetRange("cmden>0.");
fSetCustomMatDensityCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatHmassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatHmassfract",this);
fSetCustomMatHmassfractCmd->
SetGuidance("Set H mass fraction for custom material");
fSetCustomMatHmassfractCmd->SetParameterName("cmHmf",false);
fSetCustomMatHmassfractCmd->SetRange("cmHmf>=0.");
fSetCustomMatHmassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatCmassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatCmassfract",this);
fSetCustomMatCmassfractCmd->
SetGuidance("Set C mass fraction for custom material");
fSetCustomMatCmassfractCmd->SetParameterName("cmCmf",false);
fSetCustomMatCmassfractCmd->SetRange("cmCmf>=0.");
fSetCustomMatCmassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatNmassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatNmassfract",this);
fSetCustomMatNmassfractCmd->SetGuidance
("Set N mass fraction for custom material");
fSetCustomMatNmassfractCmd->SetParameterName("cmNmf",false);
fSetCustomMatNmassfractCmd->SetRange("cmNmf>=0.");
fSetCustomMatNmassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatOmassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatOmassfract",this);
fSetCustomMatOmassfractCmd->SetGuidance
("Set O mass fraction for custom material");
fSetCustomMatOmassfractCmd->SetParameterName("cmOmf",false);
fSetCustomMatOmassfractCmd->SetRange("cmOmf>=0.");
fSetCustomMatOmassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatNamassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatNamassfract",this);
fSetCustomMatNamassfractCmd->
SetGuidance("Set Na mass fraction for custom material");
fSetCustomMatNamassfractCmd->SetParameterName("cmNamf",false);
fSetCustomMatNamassfractCmd->SetRange("cmNamf>=0.");
fSetCustomMatNamassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatPmassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatPmassfract",this);
fSetCustomMatPmassfractCmd->
SetGuidance("Set P mass fraction for custom material");
fSetCustomMatPmassfractCmd->SetParameterName("cmPmf",false);
fSetCustomMatPmassfractCmd->SetRange("cmPmf>=0.");
fSetCustomMatPmassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatSmassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatSmassfract",this);
fSetCustomMatSmassfractCmd->
SetGuidance("Set S mass fraction for custom material");
fSetCustomMatSmassfractCmd->SetParameterName("cmSmf",false);
fSetCustomMatSmassfractCmd->SetRange("cmSmf>=0.");
fSetCustomMatSmassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatClmassfractCmd =
new G4UIcmdWithADouble("/det/setCustomMatClmassfract",this);
fSetCustomMatClmassfractCmd->
SetGuidance("Set Cl mass fraction for custom material");
fSetCustomMatClmassfractCmd->SetParameterName("cmClmf",false);
fSetCustomMatClmassfractCmd->SetRange("cmClmf>=0.");
fSetCustomMatClmassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatKmassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatKmassfract",this);
fSetCustomMatKmassfractCmd->
SetGuidance("Set K mass fraction for custom material");
fSetCustomMatKmassfractCmd->SetParameterName("cmKmf",false);
fSetCustomMatKmassfractCmd->SetRange("cmKmf>=0.");
fSetCustomMatKmassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetCustomMatCamassfractCmd = new G4UIcmdWithADouble
("/det/setCustomMatCamassfract",this);
fSetCustomMatCamassfractCmd->
SetGuidance("Set Ca mass fraction for custom material");
fSetCustomMatCamassfractCmd->SetParameterName("cmCamf",false);
fSetCustomMatCamassfractCmd->SetRange("cmCamf>=0.");
fSetCustomMatCamassfractCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fPhantomMaterialCmd = new G4UIcmdWithAnInteger("/det/setPhantomMaterial",this);
fPhantomMaterialCmd->SetGuidance("Set Phantom material");
fPhantomMaterialCmd->SetParameterName("PhantomMat",false);
fPhantomMaterialCmd->SetRange("PhantomMat>=1 && PhantomMat<=30");
fPhantomMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fPhantomDiameterCmd =
new G4UIcmdWithADoubleAndUnit("/det/setPhantomDiameter",this);
fPhantomDiameterCmd->SetGuidance("Set Phantom Diameter");
fPhantomDiameterCmd->SetParameterName("PhantomDiameter",false);
fPhantomDiameterCmd->SetUnitCategory("Length");
fPhantomDiameterCmd->SetRange("PhantomDiameter>0.");
fPhantomDiameterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fPhantomHeightCmd = new G4UIcmdWithADoubleAndUnit("/det/setPhantomHeight",this);
fPhantomHeightCmd->SetGuidance("Set Phantom Thickness");
fPhantomHeightCmd->SetParameterName("PhantomHeight",false);
fPhantomHeightCmd->SetUnitCategory("Length");
fPhantomHeightCmd->SetRange("PhantomHeight>0.");
fPhantomHeightCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fPhantomZCmd = new G4UIcmdWithADoubleAndUnit("/det/setPhantomZ",this);
fPhantomZCmd->SetGuidance("Set Phantom Z");
fPhantomZCmd->SetParameterName("PhantomZ",false);
fPhantomZCmd->SetUnitCategory("Length");
fPhantomZCmd->SetRange("PhantomZ>=0.");
fPhantomZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetComp0Cmd = new G4UIcmdWithADouble("/det/setComp0",this);
fSetComp0Cmd->SetGuidance("Set Comp0 for medical material");
fSetComp0Cmd->SetParameterName("c0",false);
fSetComp0Cmd->SetRange("c0>=0.");
fSetComp0Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetComp1Cmd = new G4UIcmdWithADouble("/det/setComp1",this);
fSetComp1Cmd->SetGuidance("Set Comp1 for medical material");
fSetComp1Cmd->SetParameterName("c1",false);
fSetComp1Cmd->SetRange("c1>=0.");
fSetComp1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetComp2Cmd = new G4UIcmdWithADouble("/det/setComp2",this);
fSetComp2Cmd->SetGuidance("Set Comp2 for medical material");
fSetComp2Cmd->SetParameterName("c2",false);
fSetComp2Cmd->SetRange("c2>=0.");
fSetComp2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetComp3Cmd = new G4UIcmdWithADouble("/det/setComp3",this);
fSetComp3Cmd->SetGuidance("Set Comp3 for medical material");
fSetComp3Cmd->SetParameterName("c3",false);
fSetComp3Cmd->SetRange("c3>=0.");
fSetComp3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fThetaSetupCmd = new G4UIcmdWithADouble("/det/setThetaSetup",this);
fThetaSetupCmd->SetGuidance("Set theta setup (rad)");
fThetaSetupCmd->SetParameterName("theta",false);
fThetaSetupCmd->SetRange("theta>=0.");
fThetaSetupCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetSlitsCmd = new G4UIcmdWithABool("/det/setSlits", this);
fSetSlitsCmd->SetGuidance("set Slits");
fSetSlitsCmd->SetParameterName("fIWantSlits",true);
fSetSlitsCmd->SetDefaultValue(false);
fSlit1ThicknessCmd = new G4UIcmdWithADoubleAndUnit("/det/setSlit1Thickness",this);
fSlit1ThicknessCmd->SetGuidance("Set Slit1 Thickness");
fSlit1ThicknessCmd->SetParameterName("Slit1Thickness",false);
fSlit1ThicknessCmd->SetUnitCategory("Length");
fSlit1ThicknessCmd->SetRange("Slit1Thickness>0.");
fSlit1ThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit2ThicknessCmd = new G4UIcmdWithADoubleAndUnit("/det/setSlit2Thickness",this);
fSlit2ThicknessCmd->SetGuidance("Set Slit2 Thickness");
fSlit2ThicknessCmd->SetParameterName("Slit2Thickness",false);
fSlit2ThicknessCmd->SetUnitCategory("Length");
fSlit2ThicknessCmd->SetRange("Slit2Thickness>0.");
fSlit2ThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit3ThicknessCmd = new G4UIcmdWithADoubleAndUnit("/det/setSlit3Thickness",this);
fSlit3ThicknessCmd->SetGuidance("Set Slit3 Thickness");
fSlit3ThicknessCmd->SetParameterName("Slit3Thickness",false);
fSlit3ThicknessCmd->SetUnitCategory("Length");
fSlit3ThicknessCmd->SetRange("Slit3Thickness>0.");
fSlit3ThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit4ThicknessCmd = new G4UIcmdWithADoubleAndUnit("/det/setSlit4Thickness",this);
fSlit4ThicknessCmd->SetGuidance("Set Slit4 Thickness");
fSlit4ThicknessCmd->SetParameterName("Slit4Thickness",false);
fSlit4ThicknessCmd->SetUnitCategory("Length");
fSlit4ThicknessCmd->SetRange("Slit4Thickness>0.");
fSlit4ThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit1DistanceCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit1SampleDistance",this);
fSlit1DistanceCmd->SetGuidance("Set Slit1-to-Sample Distance");
fSlit1DistanceCmd->SetParameterName("Slit1dist",false);
fSlit1DistanceCmd->SetUnitCategory("Length");
fSlit1DistanceCmd->SetRange("Slit1dist>0.");
fSlit1DistanceCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit2DistanceCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit2SampleDistance",this);
fSlit2DistanceCmd->SetGuidance("Set Slit2-to-Sample Distance");
fSlit2DistanceCmd->SetParameterName("Slit2dist",false);
fSlit2DistanceCmd->SetUnitCategory("Length");
fSlit2DistanceCmd->SetRange("Slit2dist>0.");
fSlit2DistanceCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit3DistanceCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit3SampleDistance",this);
fSlit3DistanceCmd->SetGuidance("Set Slit3-to-Sample Distance");
fSlit3DistanceCmd->SetParameterName("Slit3dist",false);
fSlit3DistanceCmd->SetUnitCategory("Length");
fSlit3DistanceCmd->SetRange("Slit3dist>0.");
fSlit3DistanceCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit4DistanceCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit4SampleDistance",this);
fSlit4DistanceCmd->SetGuidance("Set Slit4-to-Sample Distance");
fSlit4DistanceCmd->SetParameterName("Slit4dist",false);
fSlit4DistanceCmd->SetUnitCategory("Length");
fSlit4DistanceCmd->SetRange("Slit4dist>0.");
fSlit4DistanceCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit1xApertureCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit1xAperture",this);
fSlit1xApertureCmd->SetGuidance("Set Slit1 x Aperture");
fSlit1xApertureCmd->SetParameterName("Slit1xAp",false);
fSlit1xApertureCmd->SetUnitCategory("Length");
fSlit1xApertureCmd->SetRange("Slit1xAp>0.");
fSlit1xApertureCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit2xApertureCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit2xAperture",this);
fSlit2xApertureCmd->SetGuidance("Set Slit2 x Aperture");
fSlit2xApertureCmd->SetParameterName("Slit2xAp",false);
fSlit2xApertureCmd->SetUnitCategory("Length");
fSlit2xApertureCmd->SetRange("Slit2xAp>0.");
fSlit2xApertureCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit3xApertureCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit3xAperture",this);
fSlit3xApertureCmd->SetGuidance("Set Slit3 x Aperture");
fSlit3xApertureCmd->SetParameterName("Slit3xAp",false);
fSlit3xApertureCmd->SetUnitCategory("Length");
fSlit3xApertureCmd->SetRange("Slit3xAp>0.");
fSlit3xApertureCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit4xApertureCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit4xAperture",this);
fSlit4xApertureCmd->SetGuidance("Set Slit4 x Aperture");
fSlit4xApertureCmd->SetParameterName("Slit4xAp",false);
fSlit4xApertureCmd->SetUnitCategory("Length");
fSlit4xApertureCmd->SetRange("Slit4xAp>0.");
fSlit4xApertureCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit1yApertureCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit1yAperture",this);
fSlit1yApertureCmd->SetGuidance("Set Slit1 y Aperture");
fSlit1yApertureCmd->SetParameterName("Slit1yAp",false);
fSlit1yApertureCmd->SetUnitCategory("Length");
fSlit1yApertureCmd->SetRange("Slit1yAp>0.");
fSlit1yApertureCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit2yApertureCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit2yAperture",this);
fSlit2yApertureCmd->SetGuidance("Set Slit2 y Aperture");
fSlit2yApertureCmd->SetParameterName("Slit2yAp",false);
fSlit2yApertureCmd->SetUnitCategory("Length");
fSlit2yApertureCmd->SetRange("Slit2yAp>0.");
fSlit2yApertureCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit3yApertureCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit3yAperture",this);
fSlit3yApertureCmd->SetGuidance("Set Slit3 y Aperture");
fSlit3yApertureCmd->SetParameterName("Slit3yAp",false);
fSlit3yApertureCmd->SetUnitCategory("Length");
fSlit3yApertureCmd->SetRange("Slit3yAp>0.");
fSlit3yApertureCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSlit4yApertureCmd =
new G4UIcmdWithADoubleAndUnit("/det/setSlit4yAperture",this);
fSlit4yApertureCmd->SetGuidance("Set Slit4 y Aperture");
fSlit4yApertureCmd->SetParameterName("Slit4yAp",false);
fSlit4yApertureCmd->SetUnitCategory("Length");
fSlit4yApertureCmd->SetRange("Slit4yAp>0.");
fSlit4yApertureCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fDetectorThicknessCmd = new G4UIcmdWithADoubleAndUnit
("/det/setDetectorThickness",this);
fDetectorThicknessCmd->SetGuidance("Set Detector Thickness");
fDetectorThicknessCmd->SetParameterName("DetectorThickness",false);
fDetectorThicknessCmd->SetUnitCategory("Length");
fDetectorThicknessCmd->SetRange("DetectorThickness>0.");
fDetectorThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fDetectorSizeCmd = new G4UIcmdWithADoubleAndUnit("/det/setDetectorSize",this);
fDetectorSizeCmd->SetGuidance("Set DetectorSize");
fDetectorSizeCmd->SetParameterName("scrnsize",false);
fDetectorSizeCmd->SetUnitCategory("Length");
fDetectorSizeCmd->SetRange("scrnsize>0.");
fDetectorSizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fDetectorDistanceCmd = new G4UIcmdWithADoubleAndUnit
("/det/setDetectorSampleDistance",this);
fDetectorDistanceCmd->SetGuidance("Set Detector Distance");
fDetectorDistanceCmd->SetParameterName("detDist",false);
fDetectorDistanceCmd->SetUnitCategory("Length");
fDetectorDistanceCmd->SetRange("detDist>0.");
fDetectorDistanceCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SAXSDetectorConstructionMessenger::~SAXSDetectorConstructionMessenger()
{
delete fCmdDir;
delete fSetCustomMatFFfilename;
delete fSetCustomMatDensityCmd;
delete fSetCustomMatHmassfractCmd;
delete fSetCustomMatCmassfractCmd;
delete fSetCustomMatNmassfractCmd;
delete fSetCustomMatOmassfractCmd;
delete fSetCustomMatNamassfractCmd;
delete fSetCustomMatPmassfractCmd;
delete fSetCustomMatSmassfractCmd;
delete fSetCustomMatClmassfractCmd;
delete fSetCustomMatKmassfractCmd;
delete fSetCustomMatCamassfractCmd;
delete fPhantomMaterialCmd;
delete fPhantomDiameterCmd;
delete fPhantomHeightCmd;
delete fPhantomZCmd;
delete fSetComp0Cmd;
delete fSetComp1Cmd;
delete fSetComp2Cmd;
delete fSetComp3Cmd;
delete fThetaSetupCmd;
delete fSetSlitsCmd;
delete fSlit1ThicknessCmd;
delete fSlit2ThicknessCmd;
delete fSlit3ThicknessCmd;
delete fSlit4ThicknessCmd;
delete fSlit1DistanceCmd;
delete fSlit2DistanceCmd;
delete fSlit3DistanceCmd;
delete fSlit4DistanceCmd;
delete fSlit1xApertureCmd;
delete fSlit2xApertureCmd;
delete fSlit3xApertureCmd;
delete fSlit4xApertureCmd;
delete fSlit1yApertureCmd;
delete fSlit2yApertureCmd;
delete fSlit3yApertureCmd;
delete fSlit4yApertureCmd;
delete fDetectorThicknessCmd;
delete fDetectorSizeCmd;
delete fDetectorDistanceCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SAXSDetectorConstructionMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if (command == fSetCustomMatFFfilename)
fDetector->SetCustomMatFF(newValue);
if (command == fSetCustomMatDensityCmd)
fDetector->SetCustomMatDensity
(fSetCustomMatDensityCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatHmassfractCmd)
fDetector->SetCustomMatHmassfract
(fSetCustomMatHmassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatCmassfractCmd)
fDetector->SetCustomMatCmassfract
(fSetCustomMatCmassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatNmassfractCmd)
fDetector->SetCustomMatNmassfract
(fSetCustomMatNmassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatOmassfractCmd)
fDetector->SetCustomMatOmassfract
(fSetCustomMatOmassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatNamassfractCmd)
fDetector->SetCustomMatNamassfract
(fSetCustomMatNamassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatPmassfractCmd)
fDetector->SetCustomMatPmassfract
(fSetCustomMatPmassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatSmassfractCmd)
fDetector->SetCustomMatSmassfract
(fSetCustomMatSmassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatClmassfractCmd)
fDetector->SetCustomMatClmassfract
(fSetCustomMatClmassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatKmassfractCmd)
fDetector->SetCustomMatKmassfract
(fSetCustomMatKmassfractCmd->GetNewDoubleValue(newValue));
if (command == fSetCustomMatCamassfractCmd)
fDetector->SetCustomMatCamassfract
(fSetCustomMatCamassfractCmd->GetNewDoubleValue(newValue));
if (command == fPhantomMaterialCmd) {
fDetector->SetPhantomMaterial
(fPhantomMaterialCmd->GetNewIntValue(newValue));}
if (command == fPhantomDiameterCmd) {
fDetector->SetPhantomDiameter
(fPhantomDiameterCmd->GetNewDoubleValue(newValue));}
if (command == fPhantomHeightCmd) {
fDetector->SetPhantomHeight
(fPhantomHeightCmd->GetNewDoubleValue(newValue));}
if (command == fPhantomZCmd) {
fDetector->SetPhantomZ
(fPhantomZCmd->GetNewDoubleValue(newValue));}
if (command == fSetComp0Cmd)
fDetector->SetComp0(fSetComp0Cmd->GetNewDoubleValue(newValue));
if (command == fSetComp1Cmd)
fDetector->SetComp1(fSetComp1Cmd->GetNewDoubleValue(newValue));
if (command == fSetComp2Cmd)
fDetector->SetComp2(fSetComp2Cmd->GetNewDoubleValue(newValue));
if (command == fSetComp3Cmd)
fDetector->SetComp3(fSetComp3Cmd->GetNewDoubleValue(newValue));
if (command == fThetaSetupCmd)
fDetector->SetThetaSetup
(fThetaSetupCmd->GetNewDoubleValue(newValue));
if (command == fSetSlitsCmd)
fDetector->SetSlits(fSetSlitsCmd->GetNewBoolValue(newValue));
if (command == fSlit1ThicknessCmd)
fDetector->SetSlit1Thickness
(fSlit1ThicknessCmd->GetNewDoubleValue(newValue));
if (command == fSlit2ThicknessCmd)
fDetector->SetSlit2Thickness
(fSlit2ThicknessCmd->GetNewDoubleValue(newValue));
if (command == fSlit3ThicknessCmd)
fDetector->SetSlit3Thickness
(fSlit3ThicknessCmd->GetNewDoubleValue(newValue));
if (command == fSlit4ThicknessCmd)
fDetector->SetSlit4Thickness
(fSlit4ThicknessCmd->GetNewDoubleValue(newValue));
if (command == fSlit1DistanceCmd)
fDetector->SetSlit1SampleDistance
(fSlit1DistanceCmd->GetNewDoubleValue(newValue));
if (command == fSlit2DistanceCmd)
fDetector->SetSlit2SampleDistance
(fSlit2DistanceCmd->GetNewDoubleValue(newValue));
if (command == fSlit3DistanceCmd)
fDetector->SetSlit3SampleDistance
(fSlit3DistanceCmd->GetNewDoubleValue(newValue));
if (command == fSlit4DistanceCmd)
fDetector->SetSlit4SampleDistance
(fSlit4DistanceCmd->GetNewDoubleValue(newValue));
if (command == fSlit1xApertureCmd)
fDetector->SetSlit1xAperture
(fSlit1xApertureCmd->GetNewDoubleValue(newValue));
if (command == fSlit2xApertureCmd)
fDetector->SetSlit2xAperture
(fSlit2xApertureCmd->GetNewDoubleValue(newValue));
if (command == fSlit3xApertureCmd)
fDetector->SetSlit3xAperture
(fSlit3xApertureCmd->GetNewDoubleValue(newValue));
if (command == fSlit4xApertureCmd)
fDetector->SetSlit4xAperture
(fSlit4xApertureCmd->GetNewDoubleValue(newValue));
if (command == fSlit1yApertureCmd)
fDetector->SetSlit1yAperture
(fSlit1yApertureCmd->GetNewDoubleValue(newValue));
if (command == fSlit2yApertureCmd)
fDetector->SetSlit2yAperture
(fSlit2yApertureCmd->GetNewDoubleValue(newValue));
if (command == fSlit3yApertureCmd)
fDetector->SetSlit3yAperture
(fSlit3yApertureCmd->GetNewDoubleValue(newValue));
if (command == fSlit4yApertureCmd)
fDetector->SetSlit4yAperture
(fSlit4yApertureCmd->GetNewDoubleValue(newValue));
if (command == fDetectorThicknessCmd)
fDetector->SetDetectorThickness
(fDetectorThicknessCmd->GetNewDoubleValue(newValue));
if (command == fDetectorSizeCmd)
fDetector->SetDetectorSize
(fDetectorSizeCmd->GetNewDoubleValue(newValue));
if (command == fDetectorDistanceCmd)
fDetector->SetDetectorSampleDistance
(fDetectorDistanceCmd->GetNewDoubleValue(newValue));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,139 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSEventAction.cc
/// \brief Implementation of the SAXSEventAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
#include "SAXSAnalysis.hh"
#include "SAXSEventAction.hh"
#include "SAXSSensitiveDetectorHit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SAXSEventAction::SAXSEventAction():
G4UserEventAction(),
fSensitiveDetector_ID(-1),
fVerboseLevel(0),
fNRi(0),
fNCi(0),
fNDi(0),
fEventWeight(0.)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SAXSEventAction::~SAXSEventAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SAXSEventAction::BeginOfEventAction(const G4Event*)
{
fNRi = 0;
fNCi = 0;
fNDi = 0;
fEventWeight = 1.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SAXSEventAction::EndOfEventAction(const G4Event* aEvent)
{
//instantiating The Sensitive Detector Manager
G4SDManager* SDman = G4SDManager::GetSDMpointer();
//Hit Detection System
if (fSensitiveDetector_ID==-1) {
G4String SensitiveDetectorName;
if (SDman->FindSensitiveDetector(SensitiveDetectorName="det",0)) {
fSensitiveDetector_ID =
SDman->GetCollectionID(SensitiveDetectorName="det/collection");
}
}
SensitiveDetectorHitsCollection* fSensitiveDetectorHC = 0;
G4HCofThisEvent* HCE = aEvent->GetHCofThisEvent();
if (HCE) {
if (fSensitiveDetector_ID != -1) {
G4VHitsCollection* aHC = HCE->GetHC(fSensitiveDetector_ID);
fSensitiveDetectorHC = (SensitiveDetectorHitsCollection*)(aHC);
}
}
//instantiating The Analysis Manager
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
//get the Event Number
G4int eventNumber =
G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
//filling the SD scoring ntuple
if (fSensitiveDetectorHC) {
size_t vNumberOfHit = fSensitiveDetectorHC->entries();
for (size_t i=0; i<vNumberOfHit; i++) {
SAXSSensitiveDetectorHit* aHit = (*fSensitiveDetectorHC)[i];
analysisManager->FillNtupleDColumn(0,0,aHit->GetEnergy()/CLHEP::keV);
analysisManager->FillNtupleDColumn(0,1,aHit->GetPos().x()/CLHEP::mm);
analysisManager->FillNtupleDColumn(0,2,aHit->GetPos().y()/CLHEP::mm);
analysisManager->FillNtupleDColumn(0,3,aHit->GetPos().z()/CLHEP::mm);
analysisManager->FillNtupleDColumn(0,4,aHit->GetMom().x());
analysisManager->FillNtupleDColumn(0,5,aHit->GetMom().y());
analysisManager->FillNtupleDColumn(0,6,aHit->GetMom().z());
analysisManager->FillNtupleDColumn(0,7,aHit->GetTime()/CLHEP::ns);
analysisManager->FillNtupleIColumn(0,8,aHit->GetType());
analysisManager->FillNtupleIColumn(0,9,aHit->GetTrackID());
analysisManager->FillNtupleIColumn(0,10,fNRi);
analysisManager->FillNtupleIColumn(0,11,fNCi);
analysisManager->FillNtupleIColumn(0,12,fNDi);
analysisManager->FillNtupleIColumn(0,13,eventNumber);
analysisManager->FillNtupleDColumn(0,14,aHit->GetWeight());
analysisManager->AddNtupleRow(0);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,195 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSPhysicsList.cc
/// \brief Implementation of the SAXSPhysicsList class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SAXSPhysicsList.hh"
#include "SAXSPhysicsListMessenger.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "globals.hh"
#include "G4ProcessManager.hh"
#include "G4Threading.hh"
//Particles
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
//EM Physics Lists
#include "G4EmStandardPhysics.hh"
#include "G4EmLivermorePhysics.hh"
#include "G4EmPenelopePhysics.hh"
#include "G4EmLowEPPhysics.hh"
#include "G4EmStandardPhysics_option4.hh"
#include "G4EmPenelopePhysicsMI.hh"
//EM options
#include "G4EmSaturation.hh"
#include "G4LossTableManager.hh"
#include "G4UAtomicDeexcitation.hh"
//Hadronic and Extra Physics Lists
#include "G4EmExtraPhysics.hh"
#include "G4HadronPhysicsQGSP_BIC_HP.hh"
#include "G4HadronElasticPhysicsHP.hh"
#include "G4IonPhysics.hh"
#include "G4StoppingPhysics.hh"
//Optical processes
#include "G4Cerenkov.hh"
#include "G4Scintillation.hh"
#include "G4OpAbsorption.hh"
#include "G4OpRayleigh.hh"
#include "G4OpMieHG.hh"
#include "G4OpBoundaryProcess.hh"
//Decays
#include "G4Decay.hh"
#include "G4DecayPhysics.hh"
#include "G4RadioactiveDecayPhysics.hh"
#include "G4PhysicsListHelper.hh"
#include "G4RadioactiveDecayBase.hh"
#include "G4NuclideTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSPhysicsList::SAXSPhysicsList():
G4VUserPhysicsList(),
fUseMIFlag(true),
fPMessenger(0)
{
G4cout << "### PhysicsList instantiated ###" << G4endl;
G4LossTableManager::Instance();
//set default cuts value
defaultCutValue = 0.1*mm;
//define the messenger
fPMessenger = new SAXSPhysicsListMessenger(this);
//set verbosity
SetVerboseLevel(1);
//particle list
fParticleList = new G4DecayPhysics(verboseLevel);
//EM Physics
fEmPhysicsList = new G4EmPenelopePhysics(verboseLevel);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSPhysicsList::~SAXSPhysicsList() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSPhysicsList::ConstructParticle()
{
fParticleList->ConstructParticle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSPhysicsList::ConstructProcess()
{
//transportation
AddTransportation();
//EM physics
fEmPhysicsList->ConstructProcess();
//Atomic deexcitation
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
de->SetFluo(true); //Activate deexcitation processes and fluorescence
de->SetAuger(true); //Activate Auger effect if deexcitation is activated
de->SetAugerCascade(true); //Activate Auger Cascade if deexcitation is activated
de->SetPIXE(true); //Activate Particle Induced X-Ray Emission (PIXE)
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSPhysicsList::SelectPhysicsList(const G4String& name)
{
if (verboseLevel>1) {
G4cout << "### PhysicsList::SelectPhysicsList: <" << name << "> ###" << G4endl;
}
if (name == "standard") {
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics(verboseLevel);
G4cout << "### selected Standard PhysicsList ###" << G4endl;
} else if (name == "standard_option4") {
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option4(verboseLevel);
G4cout << "### selected Standard_option4 PhysicsList ###" << G4endl;
} else if (name == "livermore") {
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePhysics(verboseLevel);
G4cout << "### selected Livermore PhysicsList ###" << G4endl;
} else if (name == "penelope") {
delete fEmPhysicsList;
fEmPhysicsList = new G4EmPenelopePhysics(verboseLevel);
G4cout << "### selected Penelope PhysicsList ###" << G4endl;
} else if (name == "penelopeMI") {
delete fEmPhysicsList;
fEmPhysicsList = new G4EmPenelopePhysicsMI(verboseLevel,"G4EmPenelopeMI",fUseMIFlag);
G4cout << "### selected Penelope PhysicsList with MI effects ###" << G4endl;
} else if (name == "LowEP") {
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLowEPPhysics(1,name);
G4cout << "### selected LowEP PhysicsList ###" << G4endl;
} else {
G4cout << "### PhysicsList::SelectPhysicsList: <" << name
<< ">"<< " is not defined ###" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSPhysicsList::SetCuts()
{
//set the default cuts value for all particle types
SetCutsWithDefault();
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSPhysicsList::SetDefaultCutsValue(G4double value)
{
//define a new default cuts value
defaultCutValue = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSPhysicsListMessenger.cc
/// \brief Definition of the SAXSPhysicsListMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SAXSPhysicsListMessenger.hh"
#include "SAXSPhysicsList.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSPhysicsListMessenger::SAXSPhysicsListMessenger(SAXSPhysicsList* pPhys):
G4UImessenger(),
fPhysicsList(pPhys)
{
fPhysDir = new G4UIdirectory("/phys/");
fPhysDir->SetGuidance("PhysicsList control");
fCutsCmd = new G4UIcmdWithADoubleAndUnit("/phys/setCuts",this);
fCutsCmd->SetGuidance("set cuts");
fCutsCmd->SetParameterName("cuts",false);
fCutsCmd->SetUnitCategory("Length");
fCutsCmd->SetRange("cuts>0.");
fCutsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fListCmd = new G4UIcmdWithAString("/phys/SelectPhysicsList",this);
fListCmd->SetGuidance("Select the EM physics list");
fListCmd->SetParameterName("PList",false);
fListCmd->AvailableForStates(G4State_PreInit);
fUseMIFlagCmd = new G4UIcmdWithABool("/phys/useMIFlag",this);
fUseMIFlagCmd->SetGuidance
("Enable (default) or disable MI for the PenelopeMI physics list");
fUseMIFlagCmd->SetParameterName("useMIFlag", true);
fUseMIFlagCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSPhysicsListMessenger::~SAXSPhysicsListMessenger()
{
delete fPhysDir;
delete fCutsCmd;
delete fListCmd;
delete fUseMIFlagCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSPhysicsListMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if (command == fCutsCmd)
fPhysicsList->SetDefaultCutsValue(fCutsCmd->GetNewDoubleValue(newValue));
if (command == fListCmd)
fPhysicsList->SelectPhysicsList(newValue);
if (command == fUseMIFlagCmd)
fPhysicsList->SetUseMIFlag(fUseMIFlagCmd->GetNewBoolValue(newValue));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSPrimaryGeneratorAction.cc
/// \brief Implementation of the SAXSPrimaryGeneratorAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SAXSPrimaryGeneratorAction.hh"
#include "SAXSDetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4AutoLock.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "G4GeneralParticleSource.hh"
#include "G4ParticleGun.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSPrimaryGeneratorAction::SAXSPrimaryGeneratorAction() :
G4VUserPrimaryGeneratorAction()
{
fParticleGPS = new G4GeneralParticleSource();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSPrimaryGeneratorAction::~SAXSPrimaryGeneratorAction()
{
delete fParticleGPS;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
fParticleGPS->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,148 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSRunAction.cc
/// \brief Implementation of the SAXSRunAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "SAXSRunAction.hh"
#include "SAXSRunActionMessenger.hh"
#include "SAXSDetectorConstruction.hh"
#include "SAXSAnalysis.hh"
#include "G4SDManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSRunAction::SAXSRunAction():
G4UserRunAction(),
fIsFileOpened(false)
{
//set the number of events to print progress during the simulation
G4RunManager::GetRunManager()->SetPrintProgress(10000);
//define the messenger
fMessenger = new SAXSRunActionMessenger(this);
//default output filename (can be set through macro)
fFileName = "output";
//Create the analysis manager
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetFileName(fFileName);
analysisManager->SetNtupleMerging(true); //only for root
analysisManager->SetVerboseLevel(1);
//Creating the SD scoring ntuple
analysisManager->CreateNtuple("part","Particle");
analysisManager->CreateNtupleDColumn("e");
analysisManager->CreateNtupleDColumn("posx");
analysisManager->CreateNtupleDColumn("posy");
analysisManager->CreateNtupleDColumn("posz");
analysisManager->CreateNtupleDColumn("momx");
analysisManager->CreateNtupleDColumn("momy");
analysisManager->CreateNtupleDColumn("momz");
analysisManager->CreateNtupleDColumn("t");
analysisManager->CreateNtupleIColumn("type");
analysisManager->CreateNtupleIColumn("trackID");
analysisManager->CreateNtupleIColumn("NRi");
analysisManager->CreateNtupleIColumn("NCi");
analysisManager->CreateNtupleIColumn("NDi");
analysisManager->CreateNtupleIColumn("eventID");
analysisManager->CreateNtupleDColumn("weight");
analysisManager->FinishNtuple();
//Creating ntuple for scattering
analysisManager->CreateNtuple("scatt","Scattering");
analysisManager->CreateNtupleIColumn("processID");
analysisManager->CreateNtupleDColumn("e");
analysisManager->CreateNtupleDColumn("theta");
analysisManager->CreateNtupleDColumn("weight");
analysisManager->FinishNtuple();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSRunAction::~SAXSRunAction() {
//write results
if (fIsFileOpened)
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSRunAction::BeginOfRunAction(const G4Run*)
{
//open the output file
if (!fIsFileOpened)
{
G4AnalysisManager::Instance()->OpenFile(fFileName);
fIsFileOpened = true;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSRunAction::EndOfRunAction(const G4Run* run)
{
G4int nofEvents = run->GetNumberOfEvent();
if (nofEvents == 0) return;
//print
if (IsMaster()) {
G4cout
<< G4endl
<< "--------------------End of Global Run-----------------------"
<< G4endl
<< " The run had " << nofEvents << " events";
} else {
G4cout
<< G4endl
<< "--------------------End of Local Run------------------------"
<< G4endl
<< " The run had " << nofEvents << " events";
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSRunAction::SetFileName(G4String filename)
{
//method to set the output filename
if (filename != "") fFileName = filename;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSRunActionMessenger.cc
/// \brief Definition of the SAXSRunActionMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SAXSRunActionMessenger.hh"
#include "SAXSRunAction.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSRunActionMessenger::SAXSRunActionMessenger(SAXSRunAction* runaction):
G4UImessenger(),
fSetFileNameCmd(0)
{
fRunAction = runaction;
fSetFileNameCmd = new G4UIcmdWithAString("/run/setfilenamesave",this);
fSetFileNameCmd->SetGuidance("Set File Name Save");
fSetFileNameCmd->SetParameterName("SetFileNameSave",false);
fSetFileNameCmd->SetDefaultValue("output");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSRunActionMessenger::~SAXSRunActionMessenger() {delete fSetFileNameCmd;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSRunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if (command == fSetFileNameCmd) fRunAction->SetFileName(newValue);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSSensitiveDetector.cc
/// \brief Implementation of the SAXSSensitiveDetector class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "SAXSSensitiveDetector.hh"
#include "SAXSSensitiveDetectorHit.hh"
#include "G4HCofThisEvent.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4SDManager.hh"
#include "G4Navigator.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SAXSSensitiveDetector::SAXSSensitiveDetector(G4String name):
G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="collection");
fHCID = -1;
fVarStopAndKill = true;
fSDMessenger = new SAXSSensitiveDetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SAXSSensitiveDetector::~SAXSSensitiveDetector() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SAXSSensitiveDetector::Initialize(G4HCofThisEvent* HCE)
{
fHitsCollection =
new SensitiveDetectorHitsCollection(SensitiveDetectorName,collectionName[0]);
if(fHCID<0)
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
HCE->AddHitsCollection(fHCID,fHitsCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
bool SAXSSensitiveDetector::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4Track* vTrack = aStep->GetTrack();
G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
G4ThreeVector worldPosition = preStepPoint->GetPosition();
G4ThreeVector localPosition = preStepPoint->GetTouchableHandle()->
GetHistory()->GetTopTransform().TransformPoint(worldPosition);
G4ThreeVector mom = preStepPoint->GetMomentumDirection();
//if the partcile is not on the boundary of the sensitive detector, return
if (!(preStepPoint->GetStepStatus() == fGeomBoundary)) {return false;}
G4int vType = -1;
if(preStepPoint->GetMass() == 0 && preStepPoint->GetCharge() == 0) {
vType = 0;
}
else if(preStepPoint->GetMass() != 0 && preStepPoint->GetCharge() == 0) {
vType = 1;
}
else if(preStepPoint->GetMass() != 0 && preStepPoint->GetCharge() > 0) {
vType = 2;
}
else if(preStepPoint->GetMass() != 0 && preStepPoint->GetCharge() < 0) {
vType = 3;
}
//insert a hit
SAXSSensitiveDetectorHit* aHit = new SAXSSensitiveDetectorHit();
aHit->SetPos(localPosition);
aHit->SetMom(mom);
aHit->SetType(vType);
aHit->SetEnergy(preStepPoint->GetKineticEnergy());
aHit->SetTime(preStepPoint->GetGlobalTime());
aHit->SetTrackID(vTrack->GetTrackID());
aHit->SetWeight(vTrack->GetWeight());
fHitsCollection->insert(aHit);
if (fVarStopAndKill) {vTrack->SetTrackStatus(fStopAndKill);}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SAXSSensitiveDetector::EndOfEvent(G4HCofThisEvent*) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,130 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSSensitiveDetectorHit.cc
/// \brief Implementation of the SAXSSensitiveDetectorHit class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "SAXSSensitiveDetectorHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4AttDefStore.hh"
#include "G4AttDef.hh"
#include "G4AttValue.hh"
#include "G4UIcommand.hh"
#include "G4UnitsTable.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ThreadLocal G4Allocator<SAXSSensitiveDetectorHit>* hitAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SAXSSensitiveDetectorHit::SAXSSensitiveDetectorHit() :
G4VHit()
{
fTime = 0.;
fPos = G4ThreeVector(0.,0.,0.);
fMom = G4ThreeVector(0.,0.,0.);
fEnergy = 0.;
fType = -1;
fTrackID = -1;
fWeight = -1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SAXSSensitiveDetectorHit::SAXSSensitiveDetectorHit(const SAXSSensitiveDetectorHit &right):
G4VHit()
{
fTrackID = right.fTrackID;
fTrackIDP = right.fTrackIDP;
fPos = right.fPos;
fMom = right.fMom;
fTime = right.fTime;
fEnergy = right.fEnergy;
fType = right.fType;
fWeight = right.fWeight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const SAXSSensitiveDetectorHit& SAXSSensitiveDetectorHit::operator=
(const SAXSSensitiveDetectorHit &right)
{
fTrackID = right.fTrackID;
fTrackIDP = right.fTrackIDP;
fPos = right.fPos;
fMom = right.fMom;
fTime = right.fTime;
fEnergy = right.fEnergy;
fType = right.fType;
fWeight = right.fWeight;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int SAXSSensitiveDetectorHit::operator==(const SAXSSensitiveDetectorHit &) const
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SAXSSensitiveDetectorHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (pVVisManager)
{
G4Circle circle(fPos);
circle.SetScreenSize(2);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,1.,0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SAXSSensitiveDetectorHit::Print()
{
G4cout << " Hit at time " << fTime/ns
<< " (nsec) - pos(x,y,z) " << fPos/mm
<< " (mm) - mom(x,y,z) " << fMom/eV << " eV" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -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. *
// ********************************************************************
//
/// \file SAXSSensitiveDetectorMessenger.cc
/// \brief Implementation of the SAXSSensitiveDetectorMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SAXSSensitiveDetectorMessenger.hh"
#include "SAXSSensitiveDetector.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSSensitiveDetectorMessenger::SAXSSensitiveDetectorMessenger(SAXSSensitiveDetector* SD):
G4UImessenger(), fSenDet(SD)
{
fSenDetDir = new G4UIdirectory("/sd/");
fSenDetDir->SetGuidance("Sensitive Detector control.");
fUserStopAndKillCmd = new G4UIcmdWithABool("/sd/setSK", this);
fUserStopAndKillCmd->SetGuidance("bStopAndKill: (1) true, (0) false.");
fUserStopAndKillCmd->SetParameterName("bStopAndKill", true);
fUserStopAndKillCmd->SetDefaultValue(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSSensitiveDetectorMessenger::~SAXSSensitiveDetectorMessenger()
{
delete fSenDetDir;
delete fUserStopAndKillCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSSensitiveDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if (command == fUserStopAndKillCmd)
fSenDet->SetVarStopAndKill(fUserStopAndKillCmd->GetNewBoolValue(newValue));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,172 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file SAXSSteppingAction.cc
/// \brief Definition of the SAXSSteppingAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
#include "SAXSSteppingAction.hh"
#include "SAXSEventAction.hh"
#include "SAXSDetectorConstruction.hh"
#include "SAXSAnalysis.hh"
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4OpticalPhoton.hh"
#include <cmath>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSSteppingAction::SAXSSteppingAction(SAXSEventAction* eventAction):
G4UserSteppingAction(),
fEventAction(eventAction),
fPhantom(0),
fEventNumber(-1),
fNSe(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SAXSSteppingAction::~SAXSSteppingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SAXSSteppingAction::UserSteppingAction(const G4Step* step)
{
//DetectorConstruction instance
const SAXSDetectorConstruction* detectorConstruction =
static_cast<const SAXSDetectorConstruction*>
(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
//get Phantom volume
fPhantom = detectorConstruction->GetPhantom();
//get pre and post step points
G4StepPoint* preStepPoint = step->GetPreStepPoint();
G4StepPoint* postStepPoint = step->GetPostStepPoint();
//get the volume of the current step
G4LogicalVolume* volume = preStepPoint->GetTouchableHandle()
->GetVolume()->GetLogicalVolume();
//get track and particle name
G4Track* track = step->GetTrack();
G4int ID = track->GetTrackID();
G4String partName = track->GetDefinition()->GetParticleName();
//update the primary particle (event) weight
G4double PrimaryWeight = 1.;
if (partName == "gamma" && ID==1) {
PrimaryWeight = track->GetWeight();
fEventAction->UpdateEventWeight(PrimaryWeight);
}
//if the particle is not a primary photon stepping in the phantom, exit!
if (volume != fPhantom || partName != "gamma" || ID!=1) return;
//if it is a new event, reset variable values to 0
G4int eventNumber = G4RunManager::GetRunManager()
->GetCurrentEvent()->GetEventID();
if (eventNumber != fEventNumber) {
fEventNumber = eventNumber;
fNSe = 0;
}
//identify the process that occurred
G4String Process;
if (postStepPoint->GetProcessDefinedStep() != NULL) {
Process = postStepPoint->GetProcessDefinedStep()->GetProcessName();
} else {
Process = "UserLimit";
}
//G4cout << "Process: " << Process << G4endl;
G4int ProcIndex = -1;
if (Process == "Transportation" || Process == "CoupledTransportation"
|| Process == "UserLimit") {
ProcIndex = 0;
}
if (Process == "Rayl" || Process == "biasWrapper(Rayl)") {
ProcIndex = 1;
fNSe++;
fEventAction->AddNRi();
}
if (Process == "compt" || Process == "biasWrapper(compt)") {
ProcIndex = 2;
fNSe++;
fEventAction->AddNCi();
}
if (Process == "phot" || Process == "biasWrapper(phot)") ProcIndex = 3;
if (Process == "conv" || Process == "biasWrapper(conv)") ProcIndex = 4;
if (Process == "photonNuclear" ||
Process == "biasWrapper(photonNuclear)") {
ProcIndex = 5;
}
if (Process == "PowderDiffraction" ||
Process == "biasWrapper(PowderDiffraction)") {
ProcIndex = 6;
fNSe++;
fEventAction->AddNDi();
}
//G4cout << "ProcIndex: " << ProcIndex << G4endl;
//calculate the scattering angle
G4ThreeVector mom1 = preStepPoint->GetMomentumDirection();
G4ThreeVector mom2 = postStepPoint->GetMomentumDirection();
G4double theta = mom1.angle(mom2);
//fill the Scattering ntuple
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if (theta > 1e-6) { //record only if the angle is not 0
analysisManager->FillNtupleIColumn(1,0,ProcIndex);
analysisManager->FillNtupleDColumn(1,1,
preStepPoint->GetKineticEnergy()/CLHEP::keV);
analysisManager->FillNtupleDColumn(1,2,theta/CLHEP::deg);
analysisManager->FillNtupleDColumn(1,3,track->GetWeight());
analysisManager->AddNtupleRow(1);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,10 @@
#test beam
/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/radius 1. mm
/gps/pos/centre 0. 0. 0. mm
/gps/direction 0 0 1
/gps/particle gamma
/gps/ene/type Mono
/gps/ene/mono 20. keV
@@ -0,0 +1,52 @@
#Macro for the visualization
#Create an empty scene
/vis/scene/create
#Create a scene handler for a specific graphics system
/vis/open OGL
#Draw the scene
/vis/viewer/reset
/vis/viewer/set/viewpointThetaPhi 135. 45. deg
/vis/viewer/zoom 0.5
#Specify style (surface, wireframe, auxiliary edges,...)
/vis/viewer/set/style wireframe
/vis/viewer/set/lineSegmentsPerCircle 100
#Geometry
#/vis/geometry/set/lineWidth all 1 3
#/vis/geometry/set/colour PhantomLogic 1 0 0 0
#Decoration
#Axes
/vis/set/lineWidth 3
/vis/scene/add/axes 0 0 0 0.10 m #Simple axes: x=red, y=green, z=blue.
#Name
#/vis/set/textColour red
#/vis/set/textLayout right
#/vis/scene/add/text2D 0.9 -.9 24 ! ! saxs
#Frame
#/vis/set/colour red
#/vis/set/lineWidth 2
#/vis/scene/add/frame #Simple frame around the view
#/vis/set/colour #Revert to default colour (white)
#/vis/set/lineWidth #Revert to default line width (1.)
#Commands for the drawing the tracks
/vis/scene/add/eventID #Drawn at end of event
/tracking/storeTrajectory 0 #(if too many tracks cause core dumped => storeTrajectory 0)
/vis/scene/endOfEventAction accumulate
/vis/scene/add/trajectories smooth rich
#/vis/modeling/trajectories/create/drawByParticleID
/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
#Draw hits at end of event:
/vis/scene/add/hits
#Geometry test (it can cause a "core dumped")
/geometry/navigator/reset
/geometry/test/run
@@ -1,6 +1,9 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(ExUCN)
#----------------------------------------------------------------------------
+5 -17
View File
@@ -43,11 +43,7 @@
#include "ExUCNDetectorConstruction.hh"
#include "ExUCNActionInitialization.hh"
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
@@ -82,20 +78,16 @@ int main(int argc,char** argv)
G4String macro;
G4String session;
#ifdef G4MULTITHREADED
G4int nThreads = 0;
#endif
G4long myseed = 1234;
for ( G4int i=1; i<argc; i=i+2 ) {
if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
else if ( G4String(argv[i]) == "-u" ) session = argv[i+1];
else if ( G4String(argv[i]) == "-r" ) myseed = atoi(argv[i+1]);
#ifdef G4MULTITHREADED
else if ( G4String(argv[i]) == "-t" ) {
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
}
#endif
else {
PrintUsage();
return 1;
@@ -114,12 +106,8 @@ int main(int argc,char** argv)
// Construct the default run manager
//
#ifdef G4MULTITHREADED
G4MTRunManager * runManager = new G4MTRunManager;
auto* runManager = G4RunManagerFactory::CreateRunManager();
if ( nThreads > 0 ) runManager->SetNumberOfThreads(nThreads);
#else
G4RunManager * runManager = new G4RunManager;
#endif
// Seed the random number generator manually
G4Random::setTheSeed(myseed);
@@ -147,11 +135,11 @@ int main(int argc,char** argv)
// Get the pointer to the User Interface manager
//
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if ( macro.size() ) {
// batch mode
G4String command = "/control/execute ";
UImanager->ApplyCommand(command+macro);
UImanager->ApplyCommand(command+macro);
}
else
{ // interactive mode : define UI session
@@ -166,7 +154,7 @@ int main(int argc,char** argv)
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not
// be deleted in the main() program !
delete visManager;
delete runManager;
+14 -9
View File
@@ -1,10 +1,11 @@
Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Forcing G4RunManager type...
############################################
!!! WARNING - FPE detection is activated !!!
############################################
**************************************************************
Geant4 version Name: geant4-10-06-ref-06 (26-June-2020)
Geant4 version Name: geant4-10-07-ref-00 (4-December-2020)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -15,7 +16,7 @@
***** Table : Nb of materials = 2 *****
Material: G4_Galactic density: 0.000 kg/m3 RadL: 204310101.835 pc Nucl.Int.Length: 113427275.267 pc
Material: G4_Galactic density: 0.000 mg/cm3 RadL: 204310098.490 pc Nucl.Int.Length: 113427284.261 pc
Imean: 21.800 eV temperature: 2.73 K pressure: 0.00 atm
---> Element: H (H) Z = 1.0 N = 1 A = 1.008 g/mole
@@ -37,7 +38,6 @@
G4ChordFinder: Creating G4MagInt_Driver with stepMinimum = 0.01 numVar= 8
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
@@ -52,10 +52,12 @@ Registered graphics systems are:
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateXm (OGLIXm, OGLI)
OpenGLStoredXm (OGLSXm, OGL, OGLS)
OpenGLImmediateX (OGLIX, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSXm_FALLBACK)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK)
OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK)
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RayTracerX)
Registering model factories...
@@ -107,7 +109,7 @@ Index : 0 used in the geometry : Yes
Index : 1 used in the geometry : Yes
Material : G4_Ni
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- 1.45649 MeV e+ -1 MeV proton 100 keV
Energy thresholds : gamma -1 MeV e- 1.44302 MeV e+ -1 MeV proton 100 keV
Region(s) which use this couple :
DefaultRegionForTheWorld
@@ -1486,7 +1488,7 @@ Terminate current event processing.
Run terminated.
Run Summary
Number of events processed : 1
User=0.030000s Real=0.038753s Sys=0.000000s
User=0.030000s Real=0.037779s Sys=0.000000s
Sum NoMT: 0
Sum NoMRT: 0
Sum NoMRCondition: 0
@@ -1502,6 +1504,9 @@ Sum No. E > V SnellTransmit: 0
Sum No. E > V MR SnellTransmit: 0
Sum No. E > V DiffuseTransmit: 0
0 events have been kept for refreshing and/or reviewing.
"/vis/reviewKeptEvents" to review them one by one.
"/vis/enable", then "/vis/viewer/flush" or "/vis/viewer/rebuild" to see them accumulated.
#
Graphics systems deleted.
Visualization Manager deleting...
@@ -14,6 +14,9 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 10, 2020 B. Morgan (ExUCN-V10-06-00)
- Migration to G4RunManagerFactory.
Nov 5, 2019 J.Apostolakis (ExUCN-V10-05-00)
- Enabled use of Gravity in physics list
( setting flags in G4Transportation. )