Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PhysListFactory.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: G4PhysListFactory
31//
32// Author: 21 April 2008 V. Ivanchenko
33//
34// Modified:
35//
36//----------------------------------------------------------------------------
37//
38
39#include "G4PhysListFactory.hh"
40#include "CHIPS.hh"
41#include "FTFP_BERT.hh"
42#include "FTFP_BERT_TRV.hh"
43#include "FTFP_BERT_HP.hh"
44//#include "FTFP_BERT_DE.hh"
45#include "FTF_BIC.hh"
46#include "LBE.hh"
47#include "LHEP.hh"
48#include "QBBC.hh"
49#include "QGSC_BERT.hh"
50#include "QGSP_BERT.hh"
51#include "QGSP_BERT_CHIPS.hh"
52#include "QGSP_BERT_HP.hh"
53#include "QGSP_BIC.hh"
54#include "QGSP_BIC_HP.hh"
55#include "QGSP_FTFP_BERT.hh"
56#include "QGS_BIC.hh"
57#include "QGSP_INCLXX.hh"
58//#include "QGSP_INCL_ABLA.hh"
59#include "Shielding.hh"
60
68
70 : defName("FTFP_BERT"),verbose(1)
71{
72 nlists_hadr = 19;
73 G4String ss[19] = {
74 "CHIPS",
75 "FTFP_BERT","FTFP_BERT_TRV","FTFP_BERT_HP","FTF_BIC",
76 "LBE","LHEP","QBBC",
77 "QGSC_BERT","QGSP","QGSP_BERT","QGSP_BERT_CHIPS","QGSP_BERT_HP",
78 "QGSP_BIC","QGSP_BIC_HP",
79 "QGSP_FTFP_BERT","QGS_BIC","QGSP_INCLXX",
80 "Shielding"};
81 for(size_t i=0; i<nlists_hadr; ++i) {
82 listnames_hadr.push_back(ss[i]);
83 }
84
85 nlists_em = 7;
86 G4String s1[7] = {"","_EMV","_EMX","_EMY","_EMZ","_LIV","_PEN"};
87 for(size_t i=0; i<nlists_em; ++i) {
88 listnames_em.push_back(s1[i]);
89 }
90}
91
93{}
94
97{
98 // instantiate PhysList by environment variable "PHYSLIST"
99 G4String name = "";
100 char* path = getenv("PHYSLIST");
101 if (path) {
102 name = G4String(path);
103 } else {
104 name = defName;
105 G4cout << "### G4PhysListFactory WARNING: "
106 << " environment variable PHYSLIST is not defined"
107 << G4endl
108 << " Default Physics Lists " << name
109 << " is instantiated"
110 << G4endl;
111 }
112 return GetReferencePhysList(name);
113}
114
117{
118 // analysis on the string
119 size_t n = name.size();
120
121 // last characters in the string
122 size_t em_opt = 0;
123 G4String em_name = "";
124
125 // check EM options
126 if(n > 4) {
127 em_name = name.substr(n - 4, 4);
128 for(size_t i=1; i<nlists_em; ++i) {
129 if(listnames_em[i] == em_name) {
130 em_opt = i;
131 n -= 4;
132 break;
133 }
134 }
135 if(0 == em_opt) { em_name = ""; }
136 }
137
138 // hadronic pHysics List
139 G4String had_name = name.substr(0, n);
140
141 if(0 < verbose) {
142 G4cout << "G4PhysListFactory::GetReferencePhysList <" << had_name
143 << em_name << "> EMoption= " << em_opt << G4endl;
144 }
146 if(had_name == "CHIPS") {p = new CHIPS(verbose);}
147 else if(had_name == "FTFP_BERT") {p = new FTFP_BERT(verbose);}
148 else if(had_name == "FTFP_BERT_TRV") {p = new FTFP_BERT_TRV(verbose);}
149 else if(had_name == "FTFP_BERT_HP") {p = new FTFP_BERT_HP(verbose);}
150 // else if(had_name == "FTFP_BERT_DE") {p = new FTFP_BERT_DE(verbose);}
151 else if(had_name == "FTF_BIC") {p = new FTF_BIC(verbose);}
152 else if(had_name == "LBE") {p = new LBE();}
153 else if(had_name == "LHEP") {p = new LHEP(verbose);}
154 else if(had_name == "QBBC") {p = new QBBC(verbose);}
155 else if(had_name == "QGSC_BERT") {p = new QGSC_BERT(verbose);}
156 else if(had_name == "QGSP_BERT") {p = new QGSP_BERT(verbose);}
157 else if(had_name == "QGSP_BERT_CHIPS"){p = new QGSP_BERT_CHIPS(verbose);}
158 else if(had_name == "QGSP_BERT_HP") {p = new QGSP_BERT_HP(verbose);}
159 else if(had_name == "QGSP_BIC") {p = new QGSP_BIC(verbose);}
160 else if(had_name == "QGSP_BIC_HP") {p = new QGSP_BIC_HP(verbose);}
161 else if(had_name == "QGSP_FTFP_BERT") {p = new QGSP_FTFP_BERT(verbose);}
162 else if(had_name == "QGS_BIC") {p = new QGS_BIC(verbose);}
163 else if(had_name == "QGSP_INCLXX") {p = new QGSP_INCLXX(verbose);}
164 else if(had_name == "Shielding") {p = new Shielding(verbose);}
165 else if(had_name == "ShieldingLEND") {p = new Shielding(verbose,"LEND");}
166 else {
167 G4cout << "### G4PhysListFactory WARNING: "
168 << "PhysicsList " << had_name << " is not known"
169 << G4endl;
170 }
171 if(p) {
172 G4cout << "<<< Reference Physics List " << had_name
173 << em_name << " is built" << G4endl;
174 G4int ver = p->GetVerboseLevel();
175 p->SetVerboseLevel(0);
176 if(0 < em_opt) {
177 if(1 == em_opt) {
179 } else if(2 == em_opt) {
181 } else if(3 == em_opt) {
183 } else if(4 == em_opt) {
185 } else if(5 == em_opt) {
186 p->ReplacePhysics(new G4EmLivermorePhysics(verbose));
187 } else if(6 == em_opt) {
188 p->ReplacePhysics(new G4EmPenelopePhysics(verbose));
189 }
190 }
191 p->SetVerboseLevel(ver);
192 }
193 G4cout << G4endl;
194 return p;
195}
196
198{
199 G4bool res = false;
200 size_t n = name.size();
201 if(n > 4) {
202 G4String em_name = name.substr(n - 4, 4);
203 for(size_t i=1; i<nlists_em; ++i) {
204 if(listnames_em[i] == em_name) {
205 n -= 4;
206 break;
207 }
208 }
209 }
210 G4String had_name = name.substr(0, n);
211 for(size_t i=0; i<nlists_hadr; ++i) {
212 if(had_name == listnames_hadr[i]) {
213 res = true;
214 break;
215 }
216 }
217 return res;
218}
219
220const std::vector<G4String>&
222{
223 return listnames_hadr;
224}
225
226const std::vector<G4String>&
228{
229 return listnames_em;
230}
231
TCHIPS< G4VModularPhysicsList > CHIPS
Definition: CHIPS.hh:50
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
TFTFP_BERT_HP< G4VModularPhysicsList > FTFP_BERT_HP
Definition: FTFP_BERT_HP.hh:63
TFTFP_BERT_TRV< G4VModularPhysicsList > FTFP_BERT_TRV
TFTF_BIC< G4VModularPhysicsList > FTF_BIC
Definition: FTF_BIC.hh:62
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
TLBE< G4VModularPhysicsList > LBE
Definition: LBE.hh:119
TLHEP< G4VModularPhysicsList > LHEP
Definition: LHEP.hh:50
TQGSC_BERT< G4VModularPhysicsList > QGSC_BERT
Definition: QGSC_BERT.hh:50
TQGSP_BERT< G4VModularPhysicsList > QGSP_BERT
Definition: QGSP_BERT.hh:63
TQGSP_BERT_CHIPS< G4VModularPhysicsList > QGSP_BERT_CHIPS
TQGSP_BERT_HP< G4VModularPhysicsList > QGSP_BERT_HP
Definition: QGSP_BERT_HP.hh:62
TQGSP_BIC< G4VModularPhysicsList > QGSP_BIC
Definition: QGSP_BIC.hh:62
TQGSP_BIC_HP< G4VModularPhysicsList > QGSP_BIC_HP
Definition: QGSP_BIC_HP.hh:63
TQGSP_FTFP_BERT< G4VModularPhysicsList > QGSP_FTFP_BERT
TQGSP_INCLXX< G4VModularPhysicsList > QGSP_INCLXX
Definition: QGSP_INCLXX.hh:92
TQGS_BIC< G4VModularPhysicsList > QGS_BIC
Definition: QGS_BIC.hh:63
TShielding< G4VModularPhysicsList > Shielding
Definition: Shielding.hh:65
const std::vector< G4String > & AvailablePhysListsEM() const
G4bool IsReferencePhysList(const G4String &)
G4VModularPhysicsList * ReferencePhysList()
G4VModularPhysicsList * GetReferencePhysList(const G4String &)
const std::vector< G4String > & AvailablePhysLists() const
void SetVerboseLevel(G4int value)
void ReplacePhysics(G4VPhysicsConstructor *)
Definition: QBBC.hh:45