Geant4_10
OpNovicePhysicsList.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 
31 #include "globals.hh"
32 #include "OpNovicePhysicsList.hh"
34 
35 #include "G4ParticleDefinition.hh"
36 #include "G4ParticleTypes.hh"
37 #include "G4ParticleTable.hh"
38 
39 #include "G4BosonConstructor.hh"
40 #include "G4LeptonConstructor.hh"
41 #include "G4MesonConstructor.hh"
42 #include "G4BaryonConstructor.hh"
43 #include "G4IonConstructor.hh"
45 
46 #include "G4ProcessManager.hh"
47 
48 #include "G4Cerenkov.hh"
49 #include "G4Scintillation.hh"
50 #include "G4OpAbsorption.hh"
51 #include "G4OpRayleigh.hh"
52 #include "G4OpMieHG.hh"
53 #include "G4OpBoundaryProcess.hh"
54 
55 #include "G4LossTableManager.hh"
56 #include "G4EmSaturation.hh"
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
62  fCerenkovProcess(NULL),
63  fScintillationProcess(NULL),
64  fAbsorptionProcess(NULL),
65  fRayleighScatteringProcess(NULL),
66  fMieHGScatteringProcess(NULL),
67  fBoundaryProcess(NULL),
68  fMessenger(0)
69 {
70  fMessenger = new OpNovicePhysicsListMessenger(this);
71  SetVerboseLevel(0);
72 }
73 
74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75 
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79 
81 {
82  // In this method, static member functions should be called
83  // for all particles which you want to use.
84  // This ensures that objects of these particle types will be
85  // created in the program.
86 
87  G4BosonConstructor bConstructor;
88  bConstructor.ConstructParticle();
89 
90  G4LeptonConstructor lConstructor;
91  lConstructor.ConstructParticle();
92 
93  G4MesonConstructor mConstructor;
94  mConstructor.ConstructParticle();
95 
96  G4BaryonConstructor rConstructor;
97  rConstructor.ConstructParticle();
98 
99  G4IonConstructor iConstructor;
100  iConstructor.ConstructParticle();
101 }
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104 
106 {
108  ConstructDecay();
109  ConstructEM();
110  ConstructOp();
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 
115 #include "G4Decay.hh"
116 
117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118 
120 {
121  // Add Decay Process
122  G4Decay* theDecayProcess = new G4Decay();
123  theParticleIterator->reset();
124  while( (*theParticleIterator)() ){
125  G4ParticleDefinition* particle = theParticleIterator->value();
126  G4ProcessManager* pmanager = particle->GetProcessManager();
127  if (theDecayProcess->IsApplicable(*particle)) {
128  pmanager ->AddProcess(theDecayProcess);
129  // set ordering for PostStepDoIt and AtRestDoIt
130  pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
131  pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
132  }
133  }
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
138 #include "G4ComptonScattering.hh"
139 #include "G4GammaConversion.hh"
140 #include "G4PhotoElectricEffect.hh"
141 
142 #include "G4eMultipleScattering.hh"
143 #include "G4MuMultipleScattering.hh"
144 #include "G4hMultipleScattering.hh"
145 
146 #include "G4eIonisation.hh"
147 #include "G4eBremsstrahlung.hh"
148 #include "G4eplusAnnihilation.hh"
149 
150 #include "G4MuIonisation.hh"
151 #include "G4MuBremsstrahlung.hh"
152 #include "G4MuPairProduction.hh"
153 
154 #include "G4hIonisation.hh"
155 
156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
157 
159 {
160  theParticleIterator->reset();
161  while( (*theParticleIterator)() ){
162  G4ParticleDefinition* particle = theParticleIterator->value();
163  G4ProcessManager* pmanager = particle->GetProcessManager();
164  G4String particleName = particle->GetParticleName();
165 
166  if (particleName == "gamma") {
167  // gamma
168  // Construct processes for gamma
169  pmanager->AddDiscreteProcess(new G4GammaConversion());
170  pmanager->AddDiscreteProcess(new G4ComptonScattering());
171  pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
172 
173  } else if (particleName == "e-") {
174  //electron
175  // Construct processes for electron
176  pmanager->AddProcess(new G4eMultipleScattering(),-1, 1, 1);
177  pmanager->AddProcess(new G4eIonisation(), -1, 2, 2);
178  pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3, 3);
179 
180  } else if (particleName == "e+") {
181  //positron
182  // Construct processes for positron
183  pmanager->AddProcess(new G4eMultipleScattering(),-1, 1, 1);
184  pmanager->AddProcess(new G4eIonisation(), -1, 2, 2);
185  pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3, 3);
186  pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1, 4);
187 
188  } else if( particleName == "mu+" ||
189  particleName == "mu-" ) {
190  //muon
191  // Construct processes for muon
192  pmanager->AddProcess(new G4MuMultipleScattering(),-1, 1, 1);
193  pmanager->AddProcess(new G4MuIonisation(), -1, 2, 2);
194  pmanager->AddProcess(new G4MuBremsstrahlung(), -1, 3, 3);
195  pmanager->AddProcess(new G4MuPairProduction(), -1, 4, 4);
196 
197  } else {
198  if ((particle->GetPDGCharge() != 0.0) &&
199  (particle->GetParticleName() != "chargedgeantino") &&
200  !particle->IsShortLived()) {
201  // all others charged particles except geantino
202  pmanager->AddProcess(new G4hMultipleScattering(),-1,1,1);
203  pmanager->AddProcess(new G4hIonisation(), -1,2,2);
204  }
205  }
206  }
207 }
208 
209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
210 
212 {
213  fCerenkovProcess = new G4Cerenkov("Cerenkov");
214  fScintillationProcess = new G4Scintillation("Scintillation");
215  fAbsorptionProcess = new G4OpAbsorption();
216  fRayleighScatteringProcess = new G4OpRayleigh();
217  fMieHGScatteringProcess = new G4OpMieHG();
218  fBoundaryProcess = new G4OpBoundaryProcess();
219 
220 // fCerenkovProcess->DumpPhysicsTable();
221 // fScintillationProcess->DumpPhysicsTable();
222 // fRayleighScatteringProcess->DumpPhysicsTable();
223 
224  SetVerbose(1);
225 
226  fCerenkovProcess->SetMaxNumPhotonsPerStep(20);
227  fCerenkovProcess->SetMaxBetaChangePerStep(10.0);
228  fCerenkovProcess->SetTrackSecondariesFirst(true);
229 
230  fScintillationProcess->SetScintillationYieldFactor(1.);
231  fScintillationProcess->SetTrackSecondariesFirst(true);
232 
233  // Use Birks Correction in the Scintillation process
234 
235  G4EmSaturation* emSaturation =
237  fScintillationProcess->AddSaturation(emSaturation);
238 
239  theParticleIterator->reset();
240  while( (*theParticleIterator)() ){
241  G4ParticleDefinition* particle = theParticleIterator->value();
242  G4ProcessManager* pmanager = particle->GetProcessManager();
243  G4String particleName = particle->GetParticleName();
244  if (fCerenkovProcess->IsApplicable(*particle)) {
245  pmanager->AddProcess(fCerenkovProcess);
246  pmanager->SetProcessOrdering(fCerenkovProcess,idxPostStep);
247  }
248  if (fScintillationProcess->IsApplicable(*particle)) {
249  pmanager->AddProcess(fScintillationProcess);
250  pmanager->SetProcessOrderingToLast(fScintillationProcess, idxAtRest);
251  pmanager->SetProcessOrderingToLast(fScintillationProcess, idxPostStep);
252  }
253  if (particleName == "opticalphoton") {
254  G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
255  pmanager->AddDiscreteProcess(fAbsorptionProcess);
256  pmanager->AddDiscreteProcess(fRayleighScatteringProcess);
257  pmanager->AddDiscreteProcess(fMieHGScatteringProcess);
258  pmanager->AddDiscreteProcess(fBoundaryProcess);
259  }
260  }
261 }
262 
263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
264 
266 {
267  fCerenkovProcess->SetVerboseLevel(verbose);
268  fScintillationProcess->SetVerboseLevel(verbose);
269  fAbsorptionProcess->SetVerboseLevel(verbose);
270  fRayleighScatteringProcess->SetVerboseLevel(verbose);
271  fMieHGScatteringProcess->SetVerboseLevel(verbose);
272  fBoundaryProcess->SetVerboseLevel(verbose);
273 }
274 
275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
276 
278 {
279  fCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumber);
280 }
281 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
282 
284 {
285  // " G4VUserPhysicsList::SetCutsWithDefault" method sets
286  // the default cut value for all particle types
287  //
289 
291 }
292 
293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetMaxBetaChangePerStep(const G4double d)
Definition: G4Cerenkov.hh:223
static G4LossTableManager * Instance()
void SetNbOfPhotonsCerenkov(G4int)
virtual void ConstructProcess()
void SetTrackSecondariesFirst(const G4bool state)
Definition: G4Cerenkov.hh:217
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4Decay.cc:89
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
static void ConstructParticle()
static void ConstructParticle()
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
static void ConstructParticle()
void SetScintillationYieldFactor(const G4double yieldfactor)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
static void ConstructParticle()
void SetVerboseLevel(G4int value)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4EmSaturation * EmSaturation()
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
Definition: G4Cerenkov.hh:229
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
static void ConstructParticle()
void SetTrackSecondariesFirst(const G4bool state)
void SetProcessOrderingToLast(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
virtual void ConstructParticle()
#define G4endl
Definition: G4ios.hh:61
G4double GetPDGCharge() const
void AddSaturation(G4EmSaturation *sat)
#define theParticleIterator
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
Definition: G4Cerenkov.cc:128