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 | // Code developed by: |
---|
27 | // S.Larsson |
---|
28 | // |
---|
29 | // ******************************** |
---|
30 | // * * |
---|
31 | // * PurgMagPhysicsList.cc * |
---|
32 | // * * |
---|
33 | // ******************************** |
---|
34 | // |
---|
35 | // |
---|
36 | // $Id: PurgMagPhysicsList.cc,v 1.5 2006/06/29 16:06:15 gunter Exp $ |
---|
37 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
38 | // |
---|
39 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
40 | |
---|
41 | #include "PurgMagPhysicsList.hh" |
---|
42 | |
---|
43 | #include "G4ParticleDefinition.hh" |
---|
44 | #include "G4ParticleWithCuts.hh" |
---|
45 | #include "G4ProcessManager.hh" |
---|
46 | #include "G4ParticleTypes.hh" |
---|
47 | #include "G4ParticleTable.hh" |
---|
48 | #include "G4Material.hh" |
---|
49 | #include "G4UnitsTable.hh" |
---|
50 | #include "G4ios.hh" |
---|
51 | |
---|
52 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
53 | |
---|
54 | PurgMagPhysicsList::PurgMagPhysicsList(): G4VUserPhysicsList() |
---|
55 | { |
---|
56 | defaultCutValue = 1*micrometer; |
---|
57 | cutForGamma = defaultCutValue; |
---|
58 | cutForElectron = defaultCutValue; |
---|
59 | cutForPositron = defaultCutValue; |
---|
60 | cutForProton = defaultCutValue; |
---|
61 | |
---|
62 | SetVerboseLevel(1); |
---|
63 | } |
---|
64 | |
---|
65 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
66 | |
---|
67 | PurgMagPhysicsList::~PurgMagPhysicsList() |
---|
68 | {} |
---|
69 | |
---|
70 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
71 | |
---|
72 | void PurgMagPhysicsList::ConstructParticle() |
---|
73 | { |
---|
74 | // In this method, static member functions should be called |
---|
75 | // for all particles which you want to use. |
---|
76 | // This ensures that objects of these particle types will be |
---|
77 | // created in the program. |
---|
78 | |
---|
79 | ConstructBosons(); |
---|
80 | ConstructLeptons(); |
---|
81 | ConstructBarions(); |
---|
82 | } |
---|
83 | |
---|
84 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
85 | |
---|
86 | void PurgMagPhysicsList::ConstructBosons() |
---|
87 | { |
---|
88 | |
---|
89 | // gamma |
---|
90 | G4Gamma::GammaDefinition(); |
---|
91 | |
---|
92 | // optical photon |
---|
93 | G4OpticalPhoton::OpticalPhotonDefinition(); |
---|
94 | } |
---|
95 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
96 | |
---|
97 | void PurgMagPhysicsList::ConstructLeptons() |
---|
98 | { |
---|
99 | // leptons |
---|
100 | G4Electron::ElectronDefinition(); |
---|
101 | G4Positron::PositronDefinition(); |
---|
102 | } |
---|
103 | |
---|
104 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
105 | |
---|
106 | void PurgMagPhysicsList::ConstructBarions() |
---|
107 | { |
---|
108 | // barions |
---|
109 | G4Proton::ProtonDefinition(); |
---|
110 | G4AntiProton::AntiProtonDefinition(); |
---|
111 | } |
---|
112 | |
---|
113 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
114 | |
---|
115 | void PurgMagPhysicsList::ConstructProcess() |
---|
116 | { |
---|
117 | AddTransportation(); |
---|
118 | ConstructEM(); |
---|
119 | ConstructGeneral(); |
---|
120 | } |
---|
121 | |
---|
122 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
123 | |
---|
124 | #include "G4MultipleScattering.hh" |
---|
125 | // Bosons |
---|
126 | #include "G4PhotoElectricEffect.hh" |
---|
127 | #include "G4ComptonScattering.hh" |
---|
128 | #include "G4GammaConversion.hh" |
---|
129 | // Leptons |
---|
130 | #include "G4eIonisation.hh" |
---|
131 | #include "G4eBremsstrahlung.hh" |
---|
132 | #include "G4eplusAnnihilation.hh" |
---|
133 | |
---|
134 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
135 | |
---|
136 | void PurgMagPhysicsList::ConstructEM() |
---|
137 | { |
---|
138 | theParticleIterator->reset(); |
---|
139 | while( (*theParticleIterator)() ) |
---|
140 | { |
---|
141 | G4ParticleDefinition* particle = theParticleIterator->value(); |
---|
142 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
---|
143 | G4String particleName = particle->GetParticleName(); |
---|
144 | |
---|
145 | |
---|
146 | if (particleName == "gamma") { |
---|
147 | //gamma |
---|
148 | pmanager->AddDiscreteProcess(new G4GammaConversion); |
---|
149 | pmanager->AddDiscreteProcess(new G4ComptonScattering); |
---|
150 | pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); |
---|
151 | |
---|
152 | } else if (particleName == "e-") { |
---|
153 | //electron |
---|
154 | pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3); |
---|
155 | pmanager->AddProcess(new G4eIonisation, -1, 2,2); |
---|
156 | pmanager->AddProcess(new G4MultipleScattering, -1, 1,1); |
---|
157 | |
---|
158 | } else if (particleName == "e+") { |
---|
159 | //positron |
---|
160 | pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3); |
---|
161 | pmanager->AddProcess(new G4eIonisation, -1, 2,2); |
---|
162 | pmanager->AddProcess(new G4MultipleScattering, -1, 1,1); |
---|
163 | pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4); |
---|
164 | |
---|
165 | } else if (particleName == "proton") { |
---|
166 | //proton |
---|
167 | pmanager->AddProcess(new G4MultipleScattering, -1,1,1); |
---|
168 | |
---|
169 | } else if (particleName == "anti_proton") { |
---|
170 | //antiproton |
---|
171 | pmanager->AddProcess(new G4MultipleScattering, -1,1,1); |
---|
172 | } |
---|
173 | } |
---|
174 | } |
---|
175 | |
---|
176 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
177 | |
---|
178 | void PurgMagPhysicsList::ConstructGeneral() |
---|
179 | { } |
---|
180 | |
---|
181 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
182 | |
---|
183 | void PurgMagPhysicsList::SetCuts() |
---|
184 | { |
---|
185 | if (verboseLevel >0){ |
---|
186 | G4cout << "PurgMagPhysicsList::SetCuts:"; |
---|
187 | G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; |
---|
188 | } |
---|
189 | |
---|
190 | // set cut values for gamma at first and for e- second and next for e+, |
---|
191 | // because some processes for e+/e- need cut values for gamma |
---|
192 | SetCutValue(cutForGamma, "gamma"); |
---|
193 | SetCutValue(cutForElectron, "e-"); |
---|
194 | SetCutValue(cutForPositron, "e+"); |
---|
195 | |
---|
196 | // set cut values for proton and anti_proton before all other hadrons |
---|
197 | // because some processes for hadrons need cut values for proton/anti_proton |
---|
198 | SetCutValue(cutForProton, "proton"); |
---|
199 | SetCutValue(cutForProton, "anti_proton"); |
---|
200 | |
---|
201 | // SetCutValueForOthers(defaultCutValue); |
---|
202 | |
---|
203 | if (verboseLevel>0) DumpCutValuesTable(); |
---|
204 | } |
---|
205 | |
---|
206 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
207 | |
---|
208 | void PurgMagPhysicsList::SetGammaLowLimit(G4double lowcut) |
---|
209 | { |
---|
210 | if (verboseLevel >0){ |
---|
211 | G4cout << "PurgMagPhysicsList::SetCuts:"; |
---|
212 | G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; |
---|
213 | } |
---|
214 | |
---|
215 | // G4Gamma::SetEnergyRange(lowcut,1e5); |
---|
216 | SetGELowLimit(lowcut); |
---|
217 | } |
---|
218 | |
---|
219 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
220 | |
---|
221 | void PurgMagPhysicsList::SetElectronLowLimit(G4double lowcut) |
---|
222 | { |
---|
223 | if (verboseLevel >0){ |
---|
224 | |
---|
225 | G4cout << "PurgMagPhysicsList::SetCuts:"; |
---|
226 | G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; |
---|
227 | } |
---|
228 | |
---|
229 | // G4Electron::SetEnergyRange(lowcut,1e5); |
---|
230 | SetGELowLimit(lowcut); |
---|
231 | } |
---|
232 | |
---|
233 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
234 | |
---|
235 | void PurgMagPhysicsList::SetPositronLowLimit(G4double lowcut) |
---|
236 | { |
---|
237 | if (verboseLevel >0){ |
---|
238 | |
---|
239 | G4cout << "PurgMagPhysicsList::SetCuts:"; |
---|
240 | G4cout << "Positron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; |
---|
241 | } |
---|
242 | |
---|
243 | G4cerr << "PurgMagPhysicsList::SetPositronLowLimit: Not currently able to set Positron LowLimit." << G4endl; |
---|
244 | G4Exception("Positron Low Limit: not implemented in PurgMagPhysicsList"); |
---|
245 | // |
---|
246 | // G4Positron::SetEnergyRange(lowcut,1e5); |
---|
247 | } |
---|
248 | |
---|
249 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
250 | |
---|
251 | void PurgMagPhysicsList::SetProtonLowLimit(G4double lowcut) |
---|
252 | { |
---|
253 | if (verboseLevel >0){ |
---|
254 | |
---|
255 | G4cout << "PurgMagPhysicsList::SetCuts:"; |
---|
256 | G4cout << "Proton cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; |
---|
257 | } |
---|
258 | |
---|
259 | G4cerr << "PurgMagPhysicsList::SetProtonLowLimit: Not currently able to set Proton LowLimit." << G4endl; |
---|
260 | G4Exception("Proton Low Limit: not implemented in PurgMagPhysicsList"); |
---|
261 | // |
---|
262 | // G4Proton::SetEnergyRange(lowcut,1e5); |
---|
263 | // G4AntiProton::SetEnergyRange(lowcut,1e5); |
---|
264 | } |
---|
265 | |
---|
266 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
267 | |
---|
268 | void PurgMagPhysicsList::SetGEPLowLimit(G4double lowcut) |
---|
269 | { |
---|
270 | if (verboseLevel >0){ |
---|
271 | G4cout << "PurgMagPhysicsList::SetGEPLowLimit:"; |
---|
272 | G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; |
---|
273 | } |
---|
274 | |
---|
275 | // G4Gamma::SetEnergyRange(lowcut,1e5); |
---|
276 | // G4Electron::SetEnergyRange(lowcut,1e5); |
---|
277 | // G4Positron::SetEnergyRange(lowcut,1e5); |
---|
278 | this->SetGELowLimit(lowcut); |
---|
279 | |
---|
280 | G4cerr << " SetGEPLowLimit : Uncertain whether setting Positron low limit " << G4endl; |
---|
281 | } |
---|
282 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
283 | |
---|
284 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
285 | void PurgMagPhysicsList::SetGELowLimit(G4double lowcut) |
---|
286 | { |
---|
287 | if (verboseLevel >0){ |
---|
288 | G4cout << "PurgMagPhysicsList::SetGELowLimit:"; |
---|
289 | G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; |
---|
290 | } |
---|
291 | |
---|
292 | G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowcut,1e5); |
---|
293 | } |
---|
294 | void PurgMagPhysicsList::SetGammaCut(G4double val) |
---|
295 | { |
---|
296 | ResetCuts(); |
---|
297 | cutForGamma = val; |
---|
298 | } |
---|
299 | |
---|
300 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
301 | |
---|
302 | void PurgMagPhysicsList::SetElectronCut(G4double val) |
---|
303 | { |
---|
304 | // ResetCuts(); |
---|
305 | cutForElectron = val; |
---|
306 | } |
---|
307 | |
---|
308 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
309 | |
---|
310 | void PurgMagPhysicsList::SetPositronCut(G4double val) |
---|
311 | { |
---|
312 | // ResetCuts(); |
---|
313 | cutForPositron = val; |
---|
314 | } |
---|
315 | |
---|
316 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
317 | |
---|
318 | void PurgMagPhysicsList::SetProtonCut(G4double val) |
---|
319 | { |
---|
320 | //ResetCuts(); |
---|
321 | cutForProton = val; |
---|
322 | } |
---|
323 | |
---|
324 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
325 | |
---|
326 | |
---|
327 | |
---|
328 | |
---|
329 | |
---|
330 | |
---|