DefaultPhysicsList.cc
Go to the documentation of this file.
1 #include <G4Version.hh>
2 
3 #include "DefaultPhysicsList.h"
4 
5 #include <utl/ErrorLogger.h>
6 
7 #include <G4UImanager.hh>
8 #include <G4ParticleDefinition.hh>
9 #include <G4ParticleTypes.hh>
10 #include <G4ParticleWithCuts.hh>
11 #include <G4ParticleTable.hh>
12 #include <G4ProcessManager.hh>
13 
14 #if (G4VERSION_NUMBER >= 930)
15 # include <G4hMultipleScattering.hh>
16 # include <G4eMultipleScattering.hh>
17 # include <G4MuMultipleScattering.hh>
18 #else
19 # include "G4MultipleScattering.hh"
20 #endif
21 #include <G4Decay.hh>
22 
23 #include <G4ComptonScattering.hh>
24 #include <G4GammaConversion.hh>
25 #include <G4PhotoElectricEffect.hh>
26 
27 #include <G4eIonisation.hh>
28 #include <G4eBremsstrahlung.hh>
29 #include <G4eplusAnnihilation.hh>
30 
31 #include <G4MuIonisation.hh>
32 #include <G4MuBremsstrahlung.hh>
33 #include <G4MuPairProduction.hh>
34 
35 #include <G4hIonisation.hh>
36 
37 #include <G4Cerenkov.hh>
38 
39 #include <G4IonConstructor.hh>
40 #include <G4BaryonConstructor.hh>
41 #include <G4MesonConstructor.hh>
42 #include <G4LeptonConstructor.hh>
43 
44 // using Geant4 boundary process...
45 //#include <G4OpBoundaryProcess.hh>
46 #include <G4OpAbsorption.hh>
47 #include <G4OpRayleigh.hh>
48 
49 #if (G4VERSION_NUMBER >= 920)
50 # include "tls/DummyProcessAtRest.h"
51 #endif
52 
53 using namespace tls;
54 
55 
57  //G4VUserPhysicsList(verbosity),
58  fVerbosity(verbosity)
59 {
60  G4VUserPhysicsList::SetVerboseLevel(fVerbosity);
61  //defaultCutValue = 0.7*mm;
62  fUImanager = G4UImanager::GetUIpointer();
63 }
64 
65 
67 {
68  INFO("destructing physics list");
69 }
70 
71 
72 void
74 {
75  // pseudo-particle: useful for testing
76  //G4Geantino::GeantinoDefinition();
77  // gamma
78  G4Gamma::GammaDefinition();
79  // optical photon
80  G4OpticalPhoton::OpticalPhotonDefinition();
81 
82  G4LeptonConstructor::ConstructParticle();
83  G4MesonConstructor::ConstructParticle();
84  G4BaryonConstructor::ConstructParticle();
85 }
86 
87 
88 void
90 {
92  this->ConstructEMProcesses();
94 }
95 
96 
97 void
99 {
100  auto decayProcess = new G4Decay();
101 
102  auto& mumProcMan = *G4MuonMinus::MuonMinusDefinition()->GetProcessManager();
103  mumProcMan.AddDiscreteProcess(decayProcess);
104  mumProcMan.SetProcessOrdering(decayProcess, idxPostStep);
105  mumProcMan.SetProcessOrdering(decayProcess, idxAtRest);
106 
107  auto& mupProcMan = *G4MuonPlus::MuonPlusDefinition()->GetProcessManager();
108  mupProcMan.AddDiscreteProcess(decayProcess);
109  mupProcMan.SetProcessOrdering(decayProcess, idxPostStep);
110  mupProcMan.SetProcessOrdering(decayProcess, idxAtRest);
111 
112 #if (G4VERSION_NUMBER >= 920)
113  /* DummyProcessAtRest is only needed if all other AtRestDoIt processes are inactivated
114  (Scintillation, Decay, MuonMinusCaptureAtRest) for a given particle.
115  It is inactivated by default. Remind that changing the activation while in
116  G4State_PreInit or G4State_Init has no effect, i.e. has to happen after the first
117  call to G4RunManagerKernel::InitializePhysics() */
118  auto dummyProcess = new DummyProcessAtRest("DummyProcessAtRest");
119  mumProcMan.AddProcess(dummyProcess);
120  mumProcMan.SetProcessOrdering(dummyProcess, idxAtRest);
121  mupProcMan.AddProcess(dummyProcess);
122  mupProcMan.SetProcessOrdering(dummyProcess, idxAtRest);
123 #endif
124 }
125 
126 
127 void
129 {
130  auto& procMan = *G4OpticalPhoton::OpticalPhotonDefinition()->GetProcessManager();
131  procMan.AddDiscreteProcess(new G4OpAbsorption());
132  procMan.AddDiscreteProcess(new G4OpRayleigh());
133 }
134 
135 
136 void
138 {
139  auto& partIt = *G4ParticleTable::GetParticleTable()->GetIterator();
140  for (partIt.reset(); partIt(); ) {
141  auto& particle = *partIt.value();
142  auto& procMan = *particle.GetProcessManager();
143  const G4String& particleName = particle.GetParticleName();
144 
145  if (particleName == "gamma") {
146  procMan.AddDiscreteProcess(new G4PhotoElectricEffect);
147  procMan.AddDiscreteProcess(new G4ComptonScattering);
148  procMan.AddDiscreteProcess(new G4GammaConversion);
149  } else if (particleName == "e-") {
150  procMan.AddProcess(new G4eMultipleScattering, -1, 1, 1);
151  procMan.AddProcess(new G4eIonisation, -1, 2, 2);
152  procMan.AddProcess(new G4eBremsstrahlung, -1, 3, 3);
153  } else if (particleName == "e+") {
154  procMan.AddProcess(new G4eMultipleScattering, -1, 1, 1);
155  procMan.AddProcess(new G4eIonisation, -1, 2, 2);
156  procMan.AddProcess(new G4eBremsstrahlung, -1, 3, 3);
157  procMan.AddProcess(new G4eplusAnnihilation, 0, -1, 4);
158  } else if (particleName == "mu+" || particleName == "mu-") {
159  procMan.AddProcess(new G4MuMultipleScattering, -1, 1, 1);
160  procMan.AddProcess(new G4MuIonisation, -1, 2, 2);
161  procMan.AddProcess(new G4MuBremsstrahlung, -1, 3, 3);
162  procMan.AddProcess(new G4MuPairProduction, -1, 4, 4);
163  } else if (particle.GetPDGCharge() &&
164  particle.GetParticleName() != "chargedgeantino") {
165  // all others charged particles except geantino
166  procMan.AddProcess(new G4hMultipleScattering, -1, 1, 1);
167  procMan.AddProcess(new G4hIonisation, -1, 2, 2);
168  }
169  }
170 
171  // NOTE: At low energy, where dE/dX is large for the muon, it is best
172  // to set the following number to something low
173  const G4int maxNumPhotons = 3;
174  auto cerenkov = new G4Cerenkov("StandardCerenkov");
175  cerenkov->SetTrackSecondariesFirst(true);
176  cerenkov->SetMaxNumPhotonsPerStep(maxNumPhotons);
177  for (partIt.reset(); partIt(); ) {
178  auto& particle = *partIt.value();
179  auto& procMan = *particle.GetProcessManager();
180  if (cerenkov->IsApplicable(particle)) {
181  procMan.AddProcess(cerenkov);
182  procMan.SetProcessOrdering(cerenkov, idxPostStep);
183  }
184  }
185 }
186 
187 
188 bool
190 {
191  if (false) {
192  // not needed as long as decay process is activated
193  G4cerr << "activating DummyProcessAtRest for mu+" << G4endl;
194  fUImanager->ApplyCommand("/process/activate DummyProcessAtRest mu+");
195  G4cerr << "activating DummyProcessAtRest for mu-" << G4endl;
196  fUImanager->ApplyCommand("/process/activate DummyProcessAtRest mu-");
197  }
198  return false;
199 }
200 
201 
202 bool
204 {
205  G4cerr << "de-activating DummyProcessAtRest for mu+" << G4endl;
206  fUImanager->ApplyCommand("/process/inactivate DummyProcessAtRest mu+");
207  G4cerr << "de-activating DummyProcessAtRest for mu-" << G4endl;
208  fUImanager->ApplyCommand("/process/inactivate DummyProcessAtRest mu-");
209  return true;
210 }
virtual void ConstructProcess() override
Construct processes.
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
virtual bool InactivateCustomProcesses() override
DefaultPhysicsList(const int verbosity=0)
virtual void ConstructParticle() override
Construct particles.
virtual bool ActivateCustomProcesses() override
struct particle_info particle[80]

, generated on Tue Sep 26 2023.