Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -1,4 +1,4 @@
$Id: History 100289 2016-10-17 08:46:50Z gcosmo $
$Id: History 109179 2018-04-03 07:14:46Z gcosmo $
----------------------------------------------------
=========================================================
@@ -15,6 +15,27 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
30-03-18 V.Ivant (testem2-V10-04-04)
- testem2.cc : minor cleanup
26-03-18 V.Ivant (testem2-V10-04-03)
- StepMax - use thread safe instantiation, mesenger merged with
PhysicsListMessenger
- DetectorConstruction - improved method names, not allow to clear
geometry between runs
- PhysicsList - make Opt0 default, removed local instantiation of G4Decay
- Use MixMax default random number generator
15-03-18 V.Ivant (testem2-V10-04-02)
- PhysListEm5DStandard - experimental PhysList with the new
5D gamma conversion model
12-03-18 mma (testem2-V10-04-01)
- testem2.cc : remove G4UI_USE and G4VIS_USE
14-12-17 V.Ivant (testem2-V10-04-00)
- corrected TestEm2.in, run03.mac to optimise output
14-10-16 G.Folger (testem2-V10-02-04)
- remove direct use of theParticleIterator, use GetParticleTableIterator().
fix required by clang39 on Linux and MAC
@@ -27,7 +27,7 @@
/// \brief Main program of the electromagnetic/TestEm2 example
//
//
// $Id: TestEm2.cc 84840 2014-10-21 13:46:12Z gcosmo $
// $Id: TestEm2.cc 109179 2018-04-03 07:14:46Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -43,20 +43,16 @@
#include "ActionInitialization.hh"
#include "SteppingVerbose.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
#ifdef G4UI_USE
#include "G4UIExecutive.hh"
#endif
#include "G4VisExecutive.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv) {
//choose the Random engine
G4Random::setTheEngine(new CLHEP::RanecuEngine);
//detect interactive mode (if no arguments) and define UI session
G4UIExecutive* ui = nullptr;
if (argc == 1) { ui = new G4UIExecutive(argc,argv); }
#ifdef G4MULTITHREADED
G4MTRunManager * runManager = new G4MTRunManager();
@@ -68,46 +64,36 @@ int main(int argc,char** argv) {
G4RunManager * runManager = new G4RunManager();
#endif
// set mandatory initialization classes
//set mandatory initialization classes
DetectorConstruction* detector = new DetectorConstruction();
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new PhysicsList());
// set user actions
//set user actions
runManager->SetUserInitialization(new ActionInitialization(detector));
// get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
//initialize visualization
G4VisManager* visManager = nullptr;
if (argc!=1) // batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
else // define visualization and UI terminal for interactive mode
{
#ifdef G4VIS_USE
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
#endif
#ifdef G4UI_USE
G4UIExecutive * ui = new G4UIExecutive(argc,argv);
ui->SessionStart();
delete ui;
#endif
#ifdef G4VIS_USE
delete visManager;
#endif
}
//get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// job termination
//
if (ui) {
//interactive mode
visManager = new G4VisExecutive;
visManager->Initialize();
ui->SessionStart();
delete ui;
} else {
//batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
//job termination
delete visManager;
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,4 +1,4 @@
# $Id: TestEm2.in 85267 2014-10-27 09:03:32Z gcosmo $
# $Id: TestEm2.in 107960 2017-12-14 13:07:57Z gcosmo $
#
# Macro file for "TestEm2.cc"
# (can be run in batch, without graphic)
@@ -21,9 +21,9 @@
#
/run/setCut 1.0 mm
#
/run/initialize
/process/em/verbose 1
/process/em/workerVerbose 0
/run/initialize
#
/gun/particle e-
/gun/energy 5 GeV
@@ -4,7 +4,7 @@
############################################
**************************************************************
Geant4 version Name: geant4-10-04-patch-02 (25-May-2018)
Geant4 version Name: geant4-10-05-beta-01 (29-June-2018)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -12,23 +12,8 @@
WWW : http://geant4.org/
**************************************************************
/control/cout/ignoreThreadsExcept 0
/run/numberOfThreads 2
*** /run/numberOfThreads command is issued in sequential mode.
Command is ignored.
/run/verbose 1
/testem/det/setMat G4_PbWO4
/testem/det/setLbin 40 0.5
/run/reinitializeGeometry
/testem/det/setRbin 50 0.1
/run/reinitializeGeometry
/testem/run/acceptance 0.949 0.0082 3.0
/testem/phys/addPhysics emstandard_opt0
PhysicsList::AddPhysicsList: <emstandard_opt0>
/run/setCut 1.0 mm
/run/initialize
***** Table : Nb of materials = 10 *****
***** Table : Nb of materials = 9 *****
Material: Water density: 1.000 g/cm3 RadL: 36.092 cm Nucl.Int.Length: 75.356 cm
Imean: 78.000 eV temperature: 293.15 K pressure: 1.00 atm
@@ -138,38 +123,25 @@ PhysicsList::AddPhysicsList: <emstandard_opt0>
ElmMassFraction: 67.10 % ElmAbundance 21.05 %
Material: G4_PbWO4 density: 8.280 g/cm3 RadL: 8.925 mm Nucl.Int.Length: 20.740 cm
Imean: 542.741 eV temperature: 293.15 K pressure: 1.00 atm
---> Element: O (O) Z = 8.0 N = 16 A = 15.999 g/mole
---> Isotope: O16 Z = 8 N = 16 A = 15.99 g/mole abundance: 99.757 %
---> Isotope: O17 Z = 8 N = 17 A = 17.00 g/mole abundance: 0.038 %
---> Isotope: O18 Z = 8 N = 18 A = 18.00 g/mole abundance: 0.205 %
ElmMassFraction: 14.06 % ElmAbundance 66.67 %
---> Element: Pb (Pb) Z = 82.0 N = 207 A = 207.217 g/mole
---> Isotope: Pb204 Z = 82 N = 204 A = 203.97 g/mole abundance: 1.400 %
---> Isotope: Pb206 Z = 82 N = 206 A = 205.97 g/mole abundance: 24.100 %
---> Isotope: Pb207 Z = 82 N = 207 A = 206.98 g/mole abundance: 22.100 %
---> Isotope: Pb208 Z = 82 N = 208 A = 207.98 g/mole abundance: 52.400 %
ElmMassFraction: 45.54 % ElmAbundance 16.67 %
---> Element: W (W) Z = 74.0 N = 184 A = 183.842 g/mole
---> Isotope: W180 Z = 74 N = 180 A = 179.95 g/mole abundance: 0.120 %
---> Isotope: W182 Z = 74 N = 182 A = 181.95 g/mole abundance: 26.500 %
---> Isotope: W183 Z = 74 N = 183 A = 182.95 g/mole abundance: 14.310 %
---> Isotope: W184 Z = 74 N = 184 A = 183.95 g/mole abundance: 30.640 %
---> Isotope: W186 Z = 74 N = 186 A = 185.95 g/mole abundance: 28.430 %
ElmMassFraction: 40.40 % ElmAbundance 16.67 %
Absorber is 17.8491 cm of G4_PbWO4
PhysicsList::ConstructProcess start
/control/cout/ignoreThreadsExcept 0
/run/numberOfThreads 2
*** /run/numberOfThreads command is issued in sequential mode.
Command is ignored.
/run/verbose 1
/testem/det/setMat G4_PbWO4
/testem/det/setLbin 40 0.5
/testem/det/setRbin 50 0.1
/testem/run/acceptance 0.949 0.0082 3.0
/testem/phys/addPhysics emstandard_opt0
PhysicsList::AddPhysicsList: <emstandard_opt0>
/run/setCut 1.0 mm
/process/em/verbose 1
/run/physicsModified
/process/em/workerVerbose 0
/run/physicsModified
/run/initialize
Absorber is 17.8491 cm of G4_PbWO4 R= 4.46227 cm
/gun/particle e-
/gun/energy 5 GeV
/run/printProgress 20
@@ -189,8 +161,8 @@ compt: for gamma SubType= 13 BuildTable= 1
conv: for gamma SubType= 14 BuildTable= 1
Lambda table from 1.022 MeV to 100 TeV, 18 bins per decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheHeitler : Emin= 0 eV Emax= 80 GeV
BetheHeitlerLPM : Emin= 80 GeV Emax= 100 TeV
BetheHeitler : Emin= 0 eV Emax= 80 GeV AngularGenUrban
BetheHeitlerLPM : Emin= 80 GeV Emax= 100 TeV AngularGenUrban
Rayl: for gamma SubType= 11 BuildTable= 1
Lambda table from 100 eV to 100 keV, 7 bins per decade, spline: 0
@@ -554,10 +526,11 @@ Index : 0 used in the geometry : Yes
### Run 0 starts.
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 9876, 54321
----------------------------------------
------- MixMaxRng engine status -------
Current state vector is:
mixmax state, file version 1.0
N=17 V[N]={906770732717044781, 629165745432651234, 1235682547346241386, 68420008233404568, 2262190991329242458, 2266470399991071809, 1976726662926872232, 245458862506414172, 1955974201201518530, 2155248512522080758, 604170912935414061, 1116171330120743511, 1861018313684488333, 1296715403254578286, 1549011045957234151, 370819759640195970, 2230139271784837643} counter= 17sumtot= 1977567618660788324
---------------------------------------
----> Histogram file is opened in testem2.root
--> Event 0 starts.
@@ -568,36 +541,37 @@ Index : 0 used in the geometry : Yes
Run terminated.
Run Summary
Number of events processed : 100
User=5.05s Real=5.29s Sys=0.01s
User=2.920000s Real=2.937130s Sys=0.000000s
===== SUMMARY =====
Total number of events: 100
Mean number of charged steps: 7259.57
Mean number of neutral steps: 4106.07
Mean number of charged steps: 7243.27
Mean number of neutral steps: 4104.09
energy deposit : 95.01 % E0 +- 0.93 % E0
charged traklen: 484.76 radl +- 4.72 radl
neutral traklen: 4206.70 radl +- 136.89 radl
energy deposit : 94.89 % E0 +- 1.11 % E0
charged traklen: 483.88 radl +- 5.68 radl
neutral traklen: 4233.34 radl +- 119.48 radl
90.00 % confinement: radius = 2.92 radl (2.60 cm )
90.00 % confinement: radius = 2.96 radl (2.64 cm )
<<<<ACCEPTANCE>>>> 100 events for Total Energy in Absorber
Edep: 0.950099 delEdep= 0.00109901 nrms= 1.34026
Erms: 0.00933018 delErms= 0.00113018 nrms= 1.37827
Edep: 0.94885 delEdep= -0.000149558 nrms= -0.182388
Erms: 0.0110611 delErms= 0.00286108 nrms= 3.48912
<<<<END>>>> IS ACCEPTED
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 653022131, 168608089
----------------------------------------
------- MixMaxRng engine status -------
Current state vector is:
mixmax state, file version 1.0
N=17 V[N]={813669451166920716, 915193248309464868, 2019028336631320324, 725375911233882969, 621752734653241375, 1140962754503444046, 619630234792985507, 1718169589993349277, 1815988620821611100, 1931397531447879596, 1259925193533438907, 347741036259688487, 1562667380514912651, 575501281937601346, 1248915206512850464, 2125251310845429716, 1584232443418017805} counter= 11sumtot= 272815183652793595
---------------------------------------
... write Root file : testem2.root - done
... close Root file : testem2.root - done
G4 kernel has come to Quit state.
================== Deleting memory pools ===================
Number of memory pools allocated: 9 of which, static: 0
Dynamic pools deleted: 9 / Total memory freed: 0.058 MB
Dynamic pools deleted: 9 / Total memory freed: 0.066 MB
============================================================
RunManagerKernel is deleted. Good bye :)
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm2/include/DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
//
// $Id: DetectorConstruction.hh 98761 2016-08-09 14:07:11Z gcosmo $
// $Id: DetectorConstruction.hh 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -68,23 +68,23 @@ public:
virtual void ConstructSDandField();
const
G4VPhysicalVolume* GetEcal() {return fPhysiEcal;};
G4Material* GetMaterial() {return fMaterial;};
G4VPhysicalVolume* GetEcal() const {return fPhysiEcal;};
const G4Material* GetMaterial() const {return fMaterial;};
// Subdivision of absorber
G4int GetnLtot() {return fNLtot;};
G4int GetnRtot() {return fNRtot;};
G4double GetdLradl() {return fDLradl;};
G4double GetdRradl() {return fDRradl;};
G4double GetdLlength() {return fDLlength;};
G4double GetdRlength() {return fDRlength;};
G4double GetfullLength() {return fEcalLength;};
G4double GetfullRadius() {return fEcalRadius;};
G4int GetnLtot() const {return fNLtot;};
G4int GetnRtot() const {return fNRtot;};
G4double GetdLradl() const {return fDLradl;};
G4double GetdRradl() const {return fDRradl;};
G4double GetdLlength() const {return fDLlength;};
G4double GetdRlength() const {return fDRlength;};
G4double GetfullLength() const {return fEcalLength;};
G4double GetfullRadius() const {return fEcalRadius;};
private:
void DefineMaterials();
G4VPhysicalVolume* ConstructVolumes();
void UpdateParameters();
G4int fNLtot, fNRtot; // nb of bins: longitudinal and radial
G4double fDLradl, fDRradl; // bin thickness (in radl unit)
@@ -23,36 +23,44 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/include/StepMaxMessenger.hh
/// \brief Definition of the StepMaxMessenger class
//
// $Id: StepMaxMessenger.hh 74994 2013-10-25 10:47:45Z gcosmo $
// $Id: $
//
//---------------------------------------------------------------------------
//
// ClassName: PhysListEm5DStandard
//
// Author: IgS 07.11.2017
//
// Modified:
// 17.11.2017 Created using PhysListEmStandard from V.Ivanchenko
//----------------------------------------------------------------------------
//
// This class provides construction of default EM standard physics which
// 5D generator model for gamma conversion
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef StepMaxMessenger_h
#define StepMaxMessenger_h 1
#ifndef PhysListEm5DStandard_h
#define PhysListEm5DStandard_h 1
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
#include "G4UImessenger.hh"
class StepMax;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class StepMaxMessenger: public G4UImessenger
class PhysListEm5DStandard : public G4VPhysicsConstructor
{
public:
StepMaxMessenger(StepMax*);
virtual ~StepMaxMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
explicit PhysListEm5DStandard(G4int ver=0, const G4String& name="");
virtual ~PhysListEm5DStandard();
virtual void ConstructParticle();
virtual void ConstructProcess();
private:
StepMax* fStepMax;
G4UIcmdWithADoubleAndUnit* fStepMaxCmd;
G4int verbose;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,15 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/include/PhysicsList.hh
/// \file electromagnetic/TestEm5/include/PhysicsList.hh
/// \brief Definition of the PhysicsList class
//
//
// $Id: PhysicsList.hh 82293 2014-06-13 15:23:19Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// 14.10.02 (V.Ivanchenko) provide modular list on base of old PhysicsList
// $Id: PhysicsList.hh 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -42,6 +37,7 @@
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
class G4VPhysicsConstructor;
class PhysicsListMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -50,22 +46,23 @@ class PhysicsList: public G4VModularPhysicsList
{
public:
PhysicsList();
virtual ~PhysicsList();
~PhysicsList();
virtual void ConstructParticle();
virtual void ConstructProcess();
void AddPhysicsList(const G4String& name);
void AddStepMax();
virtual void ConstructProcess();
void AddStepMax();
private:
G4String fEmName;
G4VPhysicsConstructor* fEmPhysicsList;
G4VPhysicsConstructor* fDecay;
PhysicsListMessenger* fMessenger;
PhysicsListMessenger* fMessenger;
G4String fEmName;
G4VPhysicsConstructor* fEmPhysicsList;
G4VPhysicsConstructor* fDecayPhysics;
G4VPhysicsConstructor* fHadPhysicsList;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,10 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/include/PhysicsListMessenger.hh
/// \file electromagnetic/TestEm5/include/PhysicsListMessenger.hh
/// \brief Definition of the PhysicsListMessenger class
//
// $Id: PhysicsListMessenger.hh 75118 2013-10-28 09:40:24Z gcosmo $
// $Id: PhysicsListMessenger.hh 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,13 +34,13 @@
#ifndef PhysicsListMessenger_h
#define PhysicsListMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class PhysicsList;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,17 +49,20 @@ class PhysicsListMessenger: public G4UImessenger
public:
PhysicsListMessenger(PhysicsList* );
virtual ~PhysicsListMessenger();
~PhysicsListMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
inline G4double GetMaxChargedStep() const { return fMaxChargedStep; }
private:
PhysicsList* fPhysicsList;
PhysicsList* fPhysicsList;
G4UIdirectory* fPhysDir;
G4UIcmdWithAString* fListCmd;
G4UIdirectory* fPhysDir;
G4UIcmdWithAString* fListCmd;
G4UIcmdWithADoubleAndUnit* fStepMaxCmd;
G4double fMaxChargedStep;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/include/StepMax.hh
/// \brief Definition of the StepMax class
//
// $Id: StepMax.hh 74994 2013-10-25 10:47:45Z gcosmo $
// $Id: StepMax.hh 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,42 +32,41 @@
#define StepMax_h 1
#include "globals.hh"
#include "G4VDiscreteProcess.hh"
#include "G4VEmProcess.hh"
#include "G4ParticleDefinition.hh"
#include "G4Step.hh"
class StepMaxMessenger;
class PhysicsListMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class StepMax : public G4VDiscreteProcess
class StepMax : public G4VEmProcess
{
public:
StepMax(const G4String& processName = "UserMaxStep");
StepMax(PhysicsListMessenger* mess);
virtual ~StepMax();
virtual G4bool IsApplicable(const G4ParticleDefinition&);
void SetMaxStep(G4double);
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
G4double GetMaxStep() {return fMaxChargedStep;};
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual void InitialiseProcess(const G4ParticleDefinition*);
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStep,
G4ForceCondition* cond);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
virtual G4double GetMeanFreePath(const G4Track&,G4double,G4ForceCondition*)
{return DBL_MAX;};
private:
PhysicsListMessenger* fMessenger;
G4double fMaxChargedStep;
StepMaxMessenger* fMess;
G4bool isInitialised;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,4 +1,4 @@
# $Id: run03.mac 81771 2014-06-05 08:32:57Z gcosmo $
# $Id: run03.mac 107960 2017-12-14 13:07:57Z gcosmo $
#
# Macro file for "TestEm2.cc"
# (can be run in batch, without graphic)
@@ -20,9 +20,9 @@
#
/run/setCut 5.0 mm
#
/run/initialize
/process/em/verbose 1
/process/em/workerVerbose 0
/run/initialize
#
/gun/particle e-
/gun/energy 1 GeV
@@ -27,7 +27,7 @@
/// \brief Implementation of the DetectorConstruction class
//
//
// $Id: DetectorConstruction.cc 98761 2016-08-09 14:07:11Z gcosmo $
// $Id: DetectorConstruction.cc 109103 2018-03-27 07:39:04Z gcosmo $
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -56,13 +56,11 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:G4VUserDetectorConstruction(),
fNLtot(40),fNRtot(50),fDLradl(0.5),fDRradl(0.1),
fDLlength(0.),fDRlength(0.),
fMaterial(0),
fEcalLength(0.),fEcalRadius(0.),
fSolidEcal(0),fLogicEcal(0),fPhysiEcal(0),
fDetectorMessenger(0)
:G4VUserDetectorConstruction(),
fNLtot(40),fNRtot(50),fDLradl(0.5),fDRradl(0.1),
fDLlength(0.),fDRlength(0.),fMaterial(nullptr),
fEcalLength(0.),fEcalRadius(0.),
fSolidEcal(nullptr),fLogicEcal(nullptr),fPhysiEcal(nullptr)
{
DefineMaterials();
SetMaterial("G4_PbWO4");
@@ -72,13 +70,8 @@ DetectorConstruction::DetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{ delete fDetectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructVolumes();
{
delete fDetectorMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -123,35 +116,40 @@ void DetectorConstruction::DefineMaterials()
BGO->AddElement(O , natoms=12);
BGO->AddElement(Ge, natoms= 3);
BGO->AddElement(Bi, natoms= 4);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
void DetectorConstruction::UpdateParameters()
{
G4double Radl = fMaterial->GetRadlen();
fDLlength = fDLradl*Radl; fDRlength = fDRradl*Radl;
fEcalLength = fNLtot*fDLlength; fEcalRadius = fNRtot*fDRlength;
if(fSolidEcal) {
fSolidEcal->SetOuterRadius(fEcalRadius);
fSolidEcal->SetZHalfLength(0.5*fEcalLength);
}
}
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
UpdateParameters();
//
// Ecal
//
fSolidEcal = new G4Tubs("Ecal",0.,fEcalRadius,0.5*fEcalLength,0.,360*deg);
fLogicEcal = new G4LogicalVolume( fSolidEcal,fMaterial,"Ecal",0,0,0);
fPhysiEcal = new G4PVPlacement(0,G4ThreeVector(),
fLogicEcal,"Ecal",0,false,0);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
if(!fPhysiEcal) {
fSolidEcal = new G4Tubs("Ecal",0.,fEcalRadius,0.5*fEcalLength,0.,360*deg);
fLogicEcal = new G4LogicalVolume( fSolidEcal,fMaterial,"Ecal",0,0,0);
fPhysiEcal = new G4PVPlacement(0,G4ThreeVector(),
fLogicEcal,"Ecal",0,false,0);
}
G4cout << "Absorber is " << G4BestUnit(fEcalLength,"Length")
<< " of " << fMaterial->GetName() << G4endl;
<< " of " << fMaterial->GetName()
<< " R= " << fEcalRadius/cm << " cm" << G4endl;
//
//always return the physical World
//
@@ -184,7 +182,7 @@ void DetectorConstruction::SetLBining(G4ThreeVector Value)
fNLtot = kMaxBin;
}
fDLradl = Value(1);
G4RunManager::GetRunManager()->ReinitializeGeometry();
UpdateParameters();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -198,24 +196,23 @@ void DetectorConstruction::SetRBining(G4ThreeVector Value)
fNRtot = kMaxBin;
}
fDRradl = Value(1);
G4RunManager::GetRunManager()->ReinitializeGeometry();
UpdateParameters();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::ConstructSDandField()
{
if ( fFieldMessenger.Get() == 0 ) {
// Create global magnetic field messenger.
// Uniform magnetic field is then created automatically if
// the field value is not zero.
G4ThreeVector fieldValue = G4ThreeVector();
G4GlobalMagFieldMessenger* msg =
new G4GlobalMagFieldMessenger(fieldValue);
//msg->SetVerboseLevel(1);
G4AutoDelete::Register(msg);
fFieldMessenger.Put( msg );
}
if ( fFieldMessenger.Get() == nullptr ) {
// Create global magnetic field messenger.
// Uniform magnetic field is then created automatically if
// the field value is not zero.
G4ThreeVector fieldValue = G4ThreeVector();
G4GlobalMagFieldMessenger* msg =
new G4GlobalMagFieldMessenger(fieldValue);
//msg->SetVerboseLevel(1);
G4AutoDelete::Register(msg);
fFieldMessenger.Put( msg );
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,349 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: $
//
//---------------------------------------------------------------------------
//
// ClassName: PhysListEm5DStandard
//
// Author: IgS 07.11.2017
//
// Modified:
// 17.11.2017 Created using PhysListEm5DStandard from V.Ivanchenko
//
//----------------------------------------------------------------------------
//
#include "PhysListEm5DStandard.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleDefinition.hh"
#include "G4EmParameters.hh"
#include "G4LossTableManager.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4RayleighScattering.hh"
#include "G4BetheHeitler5DModel.hh"
#include "G4eMultipleScattering.hh"
#include "G4MuMultipleScattering.hh"
#include "G4hMultipleScattering.hh"
#include "G4CoulombScattering.hh"
#include "G4eCoulombScatteringModel.hh"
#include "G4WentzelVIModel.hh"
#include "G4UrbanMscModel.hh"
#include "G4MuBremsstrahlungModel.hh"
#include "G4MuPairProductionModel.hh"
#include "G4hBremsstrahlungModel.hh"
#include "G4hPairProductionModel.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
#include "G4alphaIonisation.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4Alpha.hh"
#include "G4GenericIon.hh"
#include "G4PhysicsListHelper.hh"
#include "G4BuilderType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEm5DStandard::PhysListEm5DStandard(G4int ver, const G4String&)
: G4VPhysicsConstructor("G4EmStandard_5D"), verbose(ver)
{
G4EmParameters* param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(verbose);
param->SetNumberOfBinsPerDecade(10);
param->SetMscStepLimitType(fUseSafetyPlus);
param->SetLateralDisplacementAlg96(false);
param->SetFluo(true);
SetPhysicsType(bElectromagnetic);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEm5DStandard::~PhysListEm5DStandard()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEm5DStandard::ConstructParticle()
{
// gamma
G4Gamma::Gamma();
// leptons
G4Electron::Electron();
G4Positron::Positron();
G4MuonPlus::MuonPlus();
G4MuonMinus::MuonMinus();
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
// barions
G4Proton::Proton();
G4AntiProton::AntiProton();
// ions
G4Deuteron::Deuteron();
G4Triton::Triton();
G4He3::He3();
G4Alpha::Alpha();
G4GenericIon::GenericIonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEm5DStandard::ConstructProcess()
{
if(verbose > 1) {
G4cout << "### " << GetPhysicsName() << " Construct Processes " << G4endl;
}
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
// muon & hadron bremsstrahlung and pair production
G4MuBremsstrahlung* mub = new G4MuBremsstrahlung();
G4MuPairProduction* mup = new G4MuPairProduction();
G4hBremsstrahlung* pib = new G4hBremsstrahlung();
G4hPairProduction* pip = new G4hPairProduction();
G4hBremsstrahlung* kb = new G4hBremsstrahlung();
G4hPairProduction* kp = new G4hPairProduction();
G4hBremsstrahlung* pb = new G4hBremsstrahlung();
G4hPairProduction* pp = new G4hPairProduction();
// muon & hadron multiple scattering
G4MuMultipleScattering* mumsc = new G4MuMultipleScattering();
mumsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* muss = new G4CoulombScattering();
G4MuMultipleScattering* pimsc = new G4MuMultipleScattering();
pimsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* piss = new G4CoulombScattering();
G4MuMultipleScattering* kmsc = new G4MuMultipleScattering();
kmsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* kss = new G4CoulombScattering();
G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc");
// high energy limit for e+- scattering models
G4double highEnergyLimit = 100*MeV;
// Add standard EM Processes
auto myParticleIterator=GetParticleIterator();
myParticleIterator->reset();
while( (*myParticleIterator)() ){
G4ParticleDefinition* particle = myParticleIterator->value();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// photo-effect and Compton
ph->RegisterProcess(new G4PhotoElectricEffect(), particle);
ph->RegisterProcess(new G4ComptonScattering(), particle);
// Gamma conversion
G4GammaConversion* gc = new G4GammaConversion();
G4VEmModel* theGC5DModel = new G4BetheHeitler5DModel();
gc->SetEmModel(theGC5DModel);
ph->RegisterProcess(gc, particle);
// Rayleigh scattering
ph->RegisterProcess(new G4RayleighScattering(), particle);
} else if (particleName == "e-") {
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "e+") {
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(new G4eplusAnnihilation(), particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "mu+" ||
particleName == "mu-" ) {
ph->RegisterProcess(mumsc, particle);
ph->RegisterProcess(new G4MuIonisation(), particle);
ph->RegisterProcess(mub, particle);
ph->RegisterProcess(mup, particle);
ph->RegisterProcess(muss, particle);
} else if (particleName == "alpha" ||
particleName == "He3") {
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4ionIonisation(), particle);
} else if (particleName == "GenericIon") {
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4ionIonisation(), particle);
} else if (particleName == "pi+" ||
particleName == "pi-" ) {
ph->RegisterProcess(pimsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(pib, particle);
ph->RegisterProcess(pip, particle);
ph->RegisterProcess(piss, particle);
} else if (particleName == "kaon+" ||
particleName == "kaon-" ) {
ph->RegisterProcess(kmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(kb, particle);
ph->RegisterProcess(kp, particle);
ph->RegisterProcess(kss, particle);
} else if (particleName == "proton" ||
particleName == "anti_proton") {
G4hMultipleScattering* pmsc = new G4hMultipleScattering();
pmsc->SetEmModel(new G4WentzelVIModel());
G4hIonisation* hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.1, 10*um);
ph->RegisterProcess(pmsc, particle);
ph->RegisterProcess(hIoni, particle);
ph->RegisterProcess(pb, particle);
ph->RegisterProcess(pp, particle);
ph->RegisterProcess(new G4CoulombScattering(), particle);
} else if (particleName == "B+" ||
particleName == "B-" ||
particleName == "D+" ||
particleName == "D-" ||
particleName == "Ds+" ||
particleName == "Ds-" ||
particleName == "anti_He3" ||
particleName == "anti_alpha" ||
particleName == "anti_deuteron" ||
particleName == "anti_lambda_c+" ||
particleName == "anti_omega-" ||
particleName == "anti_sigma_c+" ||
particleName == "anti_sigma_c++" ||
particleName == "anti_sigma+" ||
particleName == "anti_sigma-" ||
particleName == "anti_triton" ||
particleName == "anti_xi_c+" ||
particleName == "anti_xi-" ||
particleName == "deuteron" ||
particleName == "lambda_c+" ||
particleName == "omega-" ||
particleName == "sigma_c+" ||
particleName == "sigma_c++" ||
particleName == "sigma+" ||
particleName == "sigma-" ||
particleName == "tau+" ||
particleName == "tau-" ||
particleName == "triton" ||
particleName == "xi_c+" ||
particleName == "xi-" ) {
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
}
}
// Deexcitation
//
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,10 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/src/PhysicsList.cc
/// \file electromagnetic/TestEm5/src/PhysicsList.cc
/// \brief Implementation of the PhysicsList class
//
// $Id: PhysicsList.cc 100289 2016-10-17 08:46:50Z gcosmo $
// $Id: PhysicsList.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,6 +35,7 @@
#include "PhysicsListMessenger.hh"
#include "PhysListEmStandard.hh"
#include "PhysListEm5DStandard.hh"
#include "G4EmStandardPhysics.hh"
#include "G4EmStandardPhysics_option1.hh"
@@ -44,33 +45,53 @@
#include "G4EmStandardPhysicsWVI.hh"
#include "G4EmStandardPhysicsGS.hh"
#include "G4EmStandardPhysicsSS.hh"
#include "G4EmLivermorePhysics.hh"
#include "G4EmPenelopePhysics.hh"
#include "G4EmLowEPPhysics.hh"
#include "G4EmDNAPhysics.hh"
#include "G4EmDNAPhysics_option2.hh"
#include "G4EmDNAPhysics_option4.hh"
#include "G4EmDNAPhysics_option6.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4DecayPhysics.hh"
#include "StepMax.hh"
#include "G4LossTableManager.hh"
#include "G4ProcessManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
// particles
#include "G4BosonConstructor.hh"
#include "G4LeptonConstructor.hh"
#include "G4MesonConstructor.hh"
#include "G4BosonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4IonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4DNAGenericIonsManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList()
: G4VModularPhysicsList(),fEmPhysicsList(0),fDecay(0),fMessenger(0)
{
PhysicsList::PhysicsList() : G4VModularPhysicsList(),
fHadPhysicsList(nullptr)
{
fMessenger = new PhysicsListMessenger(this);
SetVerboseLevel(1);
fMessenger = new PhysicsListMessenger(this);
// EM physics
fEmName = "emstandard_opt0";
fEmPhysicsList = new G4EmStandardPhysics();
fDecay = new G4DecayPhysics();
fEmName = G4String("emstandard_opt4");
fEmPhysicsList = new G4EmStandardPhysics_option4();
// Decay physics
fDecayPhysics = new G4DecayPhysics(1);
G4LossTableManager::Instance();
SetDefaultCutValue(1*mm);
}
@@ -78,48 +99,78 @@ PhysicsList::PhysicsList()
PhysicsList::~PhysicsList()
{
delete fMessenger;
delete fEmPhysicsList;
delete fDecay;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructParticle()
{
fEmPhysicsList->ConstructParticle();
fDecay->ConstructParticle();
G4BosonConstructor pBosonConstructor;
pBosonConstructor.ConstructParticle();
G4LeptonConstructor pLeptonConstructor;
pLeptonConstructor.ConstructParticle();
G4MesonConstructor pMesonConstructor;
pMesonConstructor.ConstructParticle();
G4BaryonConstructor pBaryonConstructor;
pBaryonConstructor.ConstructParticle();
G4IonConstructor pIonConstructor;
pIonConstructor.ConstructParticle();
G4ShortLivedConstructor sLivedConstructor;
sLivedConstructor.ConstructParticle();
// Geant4-DNA
G4DNAGenericIonsManager* genericIonsManager;
genericIonsManager=G4DNAGenericIonsManager::Instance();
genericIonsManager->GetIon("alpha++");
genericIonsManager->GetIon("alpha+");
genericIonsManager->GetIon("helium");
genericIonsManager->GetIon("hydrogen");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructProcess()
{
if (verboseLevel > -1) {
G4cout << "PhysicsList::ConstructProcess start" << G4endl;
}
// transportation
//
AddTransportation();
// electromagnetic physics list
//
fEmPhysicsList->ConstructProcess();
// decay process
//
fDecay->ConstructProcess();
// step limitation (as a full process)
//
fDecayPhysics->ConstructProcess();
if(fHadPhysicsList) { fHadPhysicsList->ConstructProcess(); }
AddStepMax();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::AddStepMax()
{
// Step limitation seen as a process
StepMax* stepMaxProcess = new StepMax(fMessenger);
auto particleIterator=GetParticleIterator();
particleIterator->reset();
while ((*particleIterator)()){
G4ParticleDefinition* particle = particleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (stepMaxProcess->IsApplicable(*particle))
{
pmanager ->AddDiscreteProcess(stepMaxProcess);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::AddPhysicsList(const G4String& name)
{
if (verboseLevel>0) {
if (verboseLevel>-1) {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
}
@@ -130,7 +181,7 @@ void PhysicsList::AddPhysicsList(const G4String& name)
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new PhysListEmStandard(name);
} else if (name == "emstandard_opt0") {
fEmName = name;
@@ -148,52 +199,81 @@ void PhysicsList::AddPhysicsList(const G4String& name)
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option2();
} else if (name == "emstandard_opt3") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option3();
} else if (name == "emstandard_opt4") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option4();
} else if (name == "emstandardWVI") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsWVI();
} else if (name == "emstandardGS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsGS();
} else if (name == "emstandardSS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsSS();
} else if (name == "empenelope"){
} else if (name == "emstandard5D") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new PhysListEm5DStandard();
} else if (name == "emstandardWVI") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsWVI();
} else if (name == "emstandardGS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsGS();
} else if (name == "empenelope") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmPenelopePhysics();
} else if (name == "emlivermore"){
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePhysics();
} else if (name == "emlowenergy"){
} else if (name == "emlowenergy") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLowEPPhysics();
} else if (name == "emlivermore") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePhysics();
} else if (name == "dna") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmDNAPhysics();
} else if (name == "dna_opt2") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmDNAPhysics_option2();
} else if (name == "dna_opt4") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmDNAPhysics_option4();
} else if (name == "dna_opt6") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmDNAPhysics_option6();
} else if (name == "had_elastic" && !fHadPhysicsList) {
fHadPhysicsList = new G4HadronElasticPhysics();
} else {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
@@ -203,23 +283,3 @@ void PhysicsList::AddPhysicsList(const G4String& name)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::AddStepMax()
{
// Step limitation seen as a process
StepMax* stepMaxProcess = new StepMax();
auto particleIterator=GetParticleIterator();
particleIterator->reset();
while ((*particleIterator)()){
G4ParticleDefinition* particle = particleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (stepMaxProcess->IsApplicable(*particle))
{
pmanager ->AddDiscreteProcess(stepMaxProcess);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,10 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/src/PhysicsListMessenger.cc
/// \file electromagnetic/TestEm5/src/PhysicsListMessenger.cc
/// \brief Implementation of the PhysicsListMessenger class
//
// $Id: PhysicsListMessenger.cc 78550 2014-01-07 09:43:41Z gcosmo $
// $Id: PhysicsListMessenger.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,22 +35,29 @@
#include "PhysicsList.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
:G4UImessenger(),fPhysicsList(pPhys)
:G4UImessenger(),fPhysicsList(pPhys),fMaxChargedStep(DBL_MAX)
{
fPhysDir = new G4UIdirectory("/testem/phys/");
fPhysDir->SetGuidance("physics list commands");
fListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics",this);
fListCmd->SetGuidance("Add modula physics list.");
fListCmd->SetParameterName("PList",false);
fListCmd->AvailableForStates(G4State_PreInit);
fListCmd->SetToBeBroadcasted(false);
fListCmd->SetToBeBroadcasted(false);
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
fStepMaxCmd->SetGuidance("Set max allowed step length");
fStepMaxCmd->SetParameterName("mxStep",false);
fStepMaxCmd->SetRange("mxStep>0.");
fStepMaxCmd->SetUnitCategory("Length");
fStepMaxCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -58,15 +65,18 @@ PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
PhysicsListMessenger::~PhysicsListMessenger()
{
delete fListCmd;
delete fPhysDir;
delete fPhysDir;
delete fStepMaxCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
{
if( command == fListCmd )
{ fPhysicsList->AddPhysicsList(newValue);}
{ fPhysicsList->AddPhysicsList(newValue); }
if (command == fStepMaxCmd)
{ fMaxChargedStep = fStepMaxCmd->GetNewDoubleValue(newValue); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm2/src/PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.cc 83431 2014-08-21 15:49:56Z gcosmo $
// $Id: PrimaryGeneratorAction.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -70,7 +70,7 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
//this function is called at the begin of event
//
G4double position = -0.5*(fDetector->GetfullLength());
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,position));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -76,12 +76,12 @@ void Run::Reset()
//initialize arrays of cumulative energy deposition
//
for (G4int i=0; i<f_nLbin; i++)
fSumELongit[i]=fSumE2Longit[i]=fSumELongitCumul[i]=fSumE2LongitCumul[i]=0.;
for (G4int j=0; j<f_nRbin; j++)
fSumERadial[j]=fSumE2Radial[j]=fSumERadialCumul[j]=fSumE2RadialCumul[j]=0.;
for (G4int i=0; i<f_nLbin; ++i) {
fSumELongit[i]=fSumE2Longit[i]=fSumELongitCumul[i]=fSumE2LongitCumul[i]=0.;
}
for (G4int j=0; j<f_nRbin; ++j) {
fSumERadial[j]=fSumE2Radial[j]=fSumERadialCumul[j]=fSumE2RadialCumul[j]=0.;
}
//initialize track length
fSumChargTrLength=fSum2ChargTrLength=fSumNeutrTrLength=fSum2NeutrTrLength=0.;
@@ -97,11 +97,11 @@ Run::~Run()
void Run::InitializePerEvent()
{
//initialize arrays of energy deposit per bin
for (G4int i=0; i<f_nLbin; i++)
{ f_dEdL[i] = 0.; }
for (G4int i=0; i<f_nLbin; ++i)
{ f_dEdL[i] = 0.; }
for (G4int j=0; j<f_nRbin; j++)
{ f_dEdR[j] = 0.; }
for (G4int j=0; j<f_nRbin; ++j)
{ f_dEdR[j] = 0.; }
//initialize tracklength
fChargTrLength = fNeutrTrLength = 0.;
@@ -114,7 +114,7 @@ void Run::FillPerEvent()
//accumulate statistic
//
G4double dLCumul = 0.;
for (G4int i=0; i<f_nLbin; i++)
for (G4int i=0; i<f_nLbin; ++i)
{
fSumELongit[i] += f_dEdL[i];
fSumE2Longit[i] += f_dEdL[i]*f_dEdL[i];
@@ -153,12 +153,12 @@ void Run::FillPerEvent()
//profiles
G4double norm = 100./(Ekin+mass);
G4double dLradl = fDet->GetdLradl();
for (G4int i=0; i<f_nLbin; i++) {
for (G4int i=0; i<f_nLbin; ++i) {
G4double bin = (i+0.5)*dLradl;
analysisManager->FillP1(0, bin, norm*f_dEdL[i]/dLradl);
}
G4double dRradl = fDet->GetdRradl();
for (G4int j=0; j<f_nRbin; j++) {
for (G4int j=0; j<f_nRbin; ++j) {
G4double bin = (j+0.5)*dRradl;
analysisManager->FillP1(1, bin, norm*f_dEdR[j]/dRradl);
}
@@ -173,14 +173,14 @@ void Run::Merge(const G4Run* run)
fChargedStep += localRun->fChargedStep;
fNeutralStep += localRun->fNeutralStep;
for (G4int i=0; i<f_nLbin; i++) {
for (G4int i=0; i<f_nLbin; ++i) {
fSumELongit[i] += localRun->fSumELongit[i];
fSumE2Longit[i] += localRun->fSumE2Longit[i];
fSumELongitCumul[i] += localRun->fSumELongitCumul[i];
fSumE2LongitCumul[i] += localRun->fSumE2LongitCumul[i];
}
for (G4int j=0; j<f_nRbin; j++) {
for (G4int j=0; j<f_nRbin; ++j) {
fSumERadial[j] += localRun->fSumERadial[j];
fSumE2Radial[j] += localRun->fSumE2Radial[j];
fSumERadialCumul[j] += localRun->fSumERadialCumul[j];
@@ -220,7 +220,7 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4int i;
for (i=0; i<f_nLbin; i++) {
for (i=0; i<f_nLbin; ++i) {
MeanELongit[i] = norme*fSumELongit[i];
rmsELongit[i] =
norme*std::sqrt(std::abs(NbOfEvents*fSumE2Longit[i]
@@ -244,7 +244,7 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
MyVector MeanERadial(f_nRbin), rmsERadial(f_nRbin);
MyVector MeanERadialCumul(f_nRbin), rmsERadialCumul(f_nRbin);
for (i=0; i<f_nRbin; i++) {
for (i=0; i<f_nRbin; ++i) {
MeanERadial[i] = norme*fSumERadial[i];
rmsERadial[i] = norme*std::sqrt(std::abs(NbOfEvents*fSumE2Radial[i]
- fSumERadial[i]*fSumERadial[i]));
@@ -281,12 +281,12 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
norme = 1./(NbOfEvents*(fDet->GetMaterial()->GetRadlen()));
G4double MeanChargTrLength = norme*fSumChargTrLength;
G4double rmsChargTrLength =
norme*std::sqrt(std::fabs(NbOfEvents*fSum2ChargTrLength
norme*std::sqrt(std::abs(NbOfEvents*fSum2ChargTrLength
- fSumChargTrLength*fSumChargTrLength));
G4double MeanNeutrTrLength = norme*fSumNeutrTrLength;
G4double rmsNeutrTrLength =
norme*std::sqrt(std::fabs(NbOfEvents*fSum2NeutrTrLength
norme*std::sqrt(std::abs(NbOfEvents*fSum2NeutrTrLength
- fSumNeutrTrLength*fSumNeutrTrLength));
//print
@@ -302,7 +302,7 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
G4cout << " bin " << " Mean rms "
<< " bin " << " Mean rms \n" << G4endl;
for (i=0; i<f_nLbin; i++) {
for (i=0; i<f_nLbin; ++i) {
G4double inf=i*dLradl, sup=inf+dLradl;
G4cout << std::setw(8) << inf << "->"
@@ -323,7 +323,7 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
G4cout << " bin " << " Mean rms "
<< " bin " << " Mean rms \n" << G4endl;
for (i=0; i<f_nRbin; i++) {
for (i=0; i<f_nRbin; ++i) {
G4double inf=i*dRradl, sup=inf+dRradl;
G4cout << std::setw(8) << inf << "->"
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm2/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// $Id: RunAction.cc 83431 2014-08-21 15:49:56Z gcosmo $
// $Id: RunAction.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,7 +49,7 @@
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin)
:G4UserRunAction(),
fDet(det),fKin(kin),fRunMessenger(0), fAnalysisManager(0),fRun(0),
fDet(det),fKin(kin),fAnalysisManager(nullptr),fRun(nullptr),
fVerbose(0), fEdeptrue(1.), fRmstrue(1.), fLimittrue(DBL_MAX)
{
fRunMessenger = new RunActionMessenger(this);
@@ -23,52 +23,74 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/src/StepMax.cc
/// \brief Implementation of the StepMax class
//
// $Id: StepMax.cc 98761 2016-08-09 14:07:11Z gcosmo $
// $Id: StepMax.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "StepMax.hh"
#include "StepMaxMessenger.hh"
#include "PhysicsListMessenger.hh"
#include "G4VPhysicalVolume.hh"
#include "G4TransportationProcessType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMax::StepMax(const G4String& processName)
: G4VDiscreteProcess(processName),fMaxChargedStep(DBL_MAX),fMess(0)
StepMax::StepMax(PhysicsListMessenger* mess)
: G4VEmProcess("UserMaxStep", fGeneral),fMessenger(mess),
fMaxChargedStep(DBL_MAX),isInitialised(false)
{
fMess = new StepMaxMessenger(this);
SetProcessSubType(static_cast<G4int>(STEP_LIMITER));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMax::~StepMax() { delete fMess; }
StepMax::~StepMax()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool StepMax::IsApplicable(const G4ParticleDefinition& particle)
G4bool StepMax::IsApplicable(const G4ParticleDefinition& part)
{
return (particle.GetPDGCharge() != 0. && !particle.IsShortLived());
return (part.GetPDGCharge() != 0. && !part.IsShortLived());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void StepMax::SetMaxStep(G4double step)
void StepMax::PreparePhysicsTable(const G4ParticleDefinition&)
{
fMaxChargedStep = step;
if(isInitialised) {
isInitialised = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double StepMax::PostStepGetPhysicalInteractionLength( const G4Track&,
G4double,
G4ForceCondition* condition )
void StepMax::BuildPhysicsTable(const G4ParticleDefinition&)
{
if(!isInitialised) {
fMaxChargedStep = fMessenger->GetMaxChargedStep();
isInitialised = true;
if(fMaxChargedStep < DBL_MAX) {
G4cout << GetProcessName() << ": SubType= " << GetProcessSubType()
<< " Step limit(mm)= " << fMaxChargedStep << G4endl;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void StepMax::InitialiseProcess(const G4ParticleDefinition*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double
StepMax::PostStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4ForceCondition* condition)
{
// condition is set to "Not Forced"
*condition = NotForced;
return fMaxChargedStep;
}
@@ -76,9 +98,9 @@ G4double StepMax::PostStepGetPhysicalInteractionLength( const G4Track&,
G4VParticleChange* StepMax::PostStepDoIt(const G4Track& aTrack, const G4Step&)
{
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,66 +0,0 @@
//
// ********************************************************************
// * 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 electromagnetic/TestEm2/src/StepMaxMessenger.cc
/// \brief Implementation of the StepMaxMessenger class
//
// $Id: StepMaxMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "StepMaxMessenger.hh"
#include "StepMax.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMaxMessenger::StepMaxMessenger(StepMax* stepM)
:G4UImessenger(),fStepMax(stepM),fStepMaxCmd(0)
{
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
fStepMaxCmd->SetGuidance("Set max allowed step length");
fStepMaxCmd->SetParameterName("mxStep",false);
fStepMaxCmd->SetRange("mxStep>0.");
fStepMaxCmd->SetUnitCategory("Length");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMaxMessenger::~StepMaxMessenger()
{
delete fStepMaxCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void StepMaxMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == fStepMaxCmd)
{ fStepMax->SetMaxStep(fStepMaxCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......