Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VHadronPhysics.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// $Id$
27//
28//---------------------------------------------------------------------------
29//
30// ClassName: G4VHadronPhysics
31//
32// Author: 28 June 2009 V.Ivanchenko
33//
34// Modified:
35//
36//----------------------------------------------------------------------------
37//
38
39#include "G4VHadronPhysics.hh"
40#include "G4SystemOfUnits.hh"
49#include "G4Neutron.hh"
50#include "G4MesonConstructor.hh"
52#include "G4IonConstructor.hh"
54#include "G4ProcessVector.hh"
55#include "G4ProcessManager.hh"
56
59{
60 SetVerboseLevel(verb);
61 if (verboseLevel>1) {
62 G4cout << "### G4VHadronPhysics: <" << aName << "> is created "
63 << G4endl;
64 }
65}
66
68{
69 G4int n = builders.size();
70 if(n > 0) {
71 for(G4int i=0; i<n; i++) {delete builders[i];}
72 }
73}
74
76{
77 G4MesonConstructor pMesonConstructor;
78 pMesonConstructor.ConstructParticle();
79
80 G4BaryonConstructor pBaryonConstructor;
81 pBaryonConstructor.ConstructParticle();
82
83 G4IonConstructor pIonConstructor;
84 pIonConstructor.ConstructParticle();
85
86 G4ShortLivedConstructor pShortLivedConstructor;
87 pShortLivedConstructor.ConstructParticle();
88}
89
92 G4double emin,
93 G4double emax)
94{
95 builders.push_back(mBuilder);
96 G4HadronicInteraction* model = mBuilder->GetModel();
97 model->SetMinEnergy(emin);
98 model->SetMaxEnergy(emax);
99 if (verboseLevel>1) {
100 G4cout << "### G4VHadronPhysics <"
101 << model->GetModelName() << " Emin(GeV)= "
102 << emin/GeV << " Emax(GeV)= " << emax/GeV
103 << G4endl;
104 }
105
106 return model;
107}
108
111 G4double emin,
112 G4double emax)
113{
114 if(!model) return model;
115 model->SetMinEnergy(emin);
116 model->SetMaxEnergy(emax);
117 if (verboseLevel>1) {
118 G4cout << "### G4VHadronPhysics <"
119 << model->GetModelName() << " Emin(GeV)= "
120 << emin/GeV << " Emax(GeV)= " << emax/GeV
121 << G4endl;
122 }
123 return model;
124}
125
126void
129{
130 const G4ParticleDefinition* p =
132 if(!p) {
133 G4cout << "### G4VHadronPhysics WARNING: fails to find particle "
134 << pname << G4endl;
135 } else {
137 }
138}
139
140void
143{
144 if(!p) return;
146 if(!had) return;
147 had->AddDataSet(xsec);
148 if (verboseLevel>1) {
149 G4cout << "### G4VHadronPhysics: the inelastic cross section "
150 << " is added for " << p->GetParticleName()
151 << G4endl;
152 }
153}
154
155void
158{
159 const G4ParticleDefinition* p =
161 if(!p) {
162 G4cout << "### G4VHadronPhysics WARNING: fails to find particle "
163 << pname << G4endl;
164 } else {
165 AddElasticCrossSection(p, xsec);
166 }
167}
168
169void
172{
173 if(!p) return;
175 if(!had) return;
176 had->AddDataSet(xsec);
177 if (verboseLevel>1) {
178 G4cout << "### G4VHadronPhysics: the inelastic cross section "
179 << " is added for " << p->GetParticleName()
180 << G4endl;
181 }
182}
183
184void
186{
188 if(!had) return;
189 had->AddDataSet(xsec);
190 if (verboseLevel>1) {
191 G4cout << "### G4VHadronPhysics: the capture cross section "
192 << " is added for neutron"
193 << G4endl;
194 }
195}
196
197void
199{
201 if(!had) return;
202 had->AddDataSet(xsec);
203 if (verboseLevel>1) {
204 G4cout << "### G4VHadronPhysics: the fission cross section "
205 << " is added for neutron"
206 << G4endl;
207 }
208}
209
212{
213 G4HadronicProcess* had = 0;
214 const G4ParticleDefinition* p =
216 if(!p) {
217 G4cout << "### G4VHadronPhysics WARNING: fails to find particle "
218 << pname << G4endl;
219 return had;
220 }
221 return FindInelasticProcess(p);
222}
223
226{
227 G4HadronicProcess* had = 0;
228 if(!p) return had;
229 G4ProcessManager* pmanager = p->GetProcessManager();
230 G4ProcessVector* pv = pmanager->GetProcessList();
231 size_t n = pv->size();
232 if(0 < n) {
233 for(size_t i=0; i<n; ++i) {
234 if(fHadronInelastic == ((*pv)[i])->GetProcessSubType()) {
235 had = static_cast<G4HadronicProcess*>((*pv)[i]);
236 return had;
237 }
238 }
239 }
240 G4ParticleDefinition* part = const_cast<G4ParticleDefinition*>(p);
241 had = new G4HadronInelasticProcess(part->GetParticleName()+"Inelastic",part);
242 pmanager->AddDiscreteProcess(had);
243 return had;
244}
245
248{
249 G4HadronicProcess* had = 0;
250 const G4ParticleDefinition* p =
252 if(!p) {
253 G4cout << "### G4VHadronPhysics WARNING: fails to find particle "
254 << pname << G4endl;
255 return had;
256 }
257 return FindElasticProcess(p);
258}
259
262{
263 G4HadronicProcess* had = 0;
264 if(!p) return had;
265 G4ProcessManager* pmanager = p->GetProcessManager();
266 G4ProcessVector* pv = pmanager->GetProcessList();
267 size_t n = pv->size();
268 if(0 < n) {
269 for(size_t i=0; i<n; ++i) {
270 if(fHadronElastic == ((*pv)[i])->GetProcessSubType()) {
271 had = static_cast<G4HadronicProcess*>((*pv)[i]);
272 return had;
273 }
274 }
275 }
276 had = new G4HadronElasticProcess("hElastic");
277 pmanager->AddDiscreteProcess(had);
278 return had;
279}
280
282{
283 G4HadronicProcess* had = 0;
284 G4ProcessManager* pmanager =
286 G4ProcessVector* pv = pmanager->GetProcessList();
287 size_t n = pv->size();
288 if(0 < n) {
289 for(size_t i=0; i<n; ++i) {
290 if(fCapture == ((*pv)[i])->GetProcessSubType()) {
291 had = static_cast<G4HadronicProcess*>((*pv)[i]);
292 return had;
293 }
294 }
295 }
296 had = new G4HadronCaptureProcess("nCapture");
297 pmanager->AddDiscreteProcess(had);
298 return had;
299}
300
302{
303 G4HadronicProcess* had = 0;
304 G4ProcessManager* pmanager =
306 G4ProcessVector* pv = pmanager->GetProcessList();
307 size_t n = pv->size();
308 if(0 < n) {
309 for(size_t i=0; i<n; ++i) {
310 if(fFission == ((*pv)[i])->GetProcessSubType()) {
311 had = static_cast<G4HadronicProcess*>((*pv)[i]);
312 return had;
313 }
314 }
315 }
316 had = new G4HadronFissionProcess("nFission");
317 pmanager->AddDiscreteProcess(had);
318 return had;
319}
320
@ fHadronElastic
@ fHadronInelastic
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static void ConstructParticle()
void SetMinEnergy(G4double anEnergy)
const G4String & GetModelName() const
void SetMaxEnergy(const G4double anEnergy)
void AddDataSet(G4VCrossSectionDataSet *aDataSet)
static void ConstructParticle()
static void ConstructParticle()
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4ProcessVector * GetProcessList() const
G4int size() const
G4HadronicInteraction * GetModel()
void AddFissionCrossSection(G4VCrossSectionDataSet *)
G4HadronicProcess * FindCaptureProcess()
G4HadronicProcess * FindInelasticProcess(const G4String &)
G4HadronicProcess * FindFissionProcess()
virtual void ConstructParticle()
void AddCaptureCrossSection(G4VCrossSectionDataSet *)
void AddInelasticCrossSection(const G4String &, G4VCrossSectionDataSet *)
G4HadronicInteraction * BuildModel(G4VHadronModelBuilder *, G4double emin, G4double emax)
virtual ~G4VHadronPhysics()
G4VHadronPhysics(const G4String &name="hInelastic", G4int verbose=0)
G4HadronicInteraction * NewModel(G4HadronicInteraction *, G4double emin, G4double emax)
G4HadronicProcess * FindElasticProcess(const G4String &)
void AddElasticCrossSection(const G4String &, G4VCrossSectionDataSet *)
void SetVerboseLevel(G4int value)