Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PhysListFactory Class Reference

#include <G4PhysListFactory.hh>

Public Member Functions

 G4PhysListFactory (G4int ver=1)
 ~G4PhysListFactory ()
G4VModularPhysicsListGetReferencePhysList (const G4String &)
G4VModularPhysicsListReferencePhysList ()
G4bool IsReferencePhysList (const G4String &) const
const std::vector< G4String > & AvailablePhysLists () const
const std::vector< G4String > & AvailablePhysListsEM () const
void SetVerbose (G4int val)

Detailed Description

Definition at line 45 of file G4PhysListFactory.hh.

Constructor & Destructor Documentation

◆ G4PhysListFactory()

G4PhysListFactory::G4PhysListFactory ( G4int ver = 1)

Definition at line 82 of file G4PhysListFactory.cc.

83 : defName("FTFP_BERT"),verbose(ver),theMessenger(nullptr)
84{
85 nlists_hadr = 36;
86 G4String ss[36] = {
87 "FTFP_BERT","FTFP_BERT_TRV","FTFP_BERT_ATL","FTFP_BERT_HP","FTFQGSP_BERT",
88 "FTFP_INCLXX","FTFP_INCLXX_HP","FTF_BIC","LBE","QBBC",
89 "QGSP_BERT","QGSP_BERT_HP","QGSP_BIC","QGSP_BIC_HP","QGSP_BIC_AllHP",
90 "QGSP_FTFP_BERT","QGSP_INCLXX","QGSP_INCLXX_HP","QGS_BIC",
91 "Shielding","ShieldingLEND","ShieldingLIQMD","ShieldingM","NuBeam",
92 "Shielding_HP","ShieldingLIQMD_HP","ShieldingM_HP",
93 "FTFP_BERT_HPT","FTFP_INCLXX_HPT","QGSP_BERT_HPT","QGSP_BIC_HPT",
94 "QGSP_BIC_AllHPT","QGSP_INCLXX_HPT","Shielding_HPT","ShieldingLIQMD_HPT",
95 "ShieldingM_HPT"};
96 for (std::size_t i=0; i<nlists_hadr; ++i) {
97 listnames_hadr.push_back(ss[i]);
98 }
99
100 nlists_em = 12;
101 G4String s1[12] = {"","_EMV","_EMX","_EMY","_EMZ","_LIV","_PEN",
102 "__GS","__SS","_EM0","_WVI","__LE"};
103 for (std::size_t i=0; i<nlists_em; ++i) {
104 listnames_em.push_back(s1[i]);
105 }
106}

◆ ~G4PhysListFactory()

G4PhysListFactory::~G4PhysListFactory ( )

Definition at line 108 of file G4PhysListFactory.cc.

109{
110 delete theMessenger;
111}

Member Function Documentation

◆ AvailablePhysLists()

const std::vector< G4String > & G4PhysListFactory::AvailablePhysLists ( ) const

Definition at line 275 of file G4PhysListFactory.cc.

276{
277 return listnames_hadr;
278}

◆ AvailablePhysListsEM()

const std::vector< G4String > & G4PhysListFactory::AvailablePhysListsEM ( ) const

Definition at line 281 of file G4PhysListFactory.cc.

282{
283 return listnames_em;
284}

◆ GetReferencePhysList()

G4VModularPhysicsList * G4PhysListFactory::GetReferencePhysList ( const G4String & name)

Definition at line 134 of file G4PhysListFactory.cc.

135{
136 // analysis on the string
137 std::size_t n = name.size();
138
139 // last characters in the string
140 std::size_t em_opt = 0;
141 G4String em_name;
142
143 // check EM options
144 if (n > 4) {
145 G4String ss = name.substr(n - 4, 4);
146 for (std::size_t i=1; i<nlists_em; ++i) {
147 if (listnames_em[i] == ss) {
148 em_opt = i;
149 em_name = ss;
150 n -= 4;
151 break;
152 }
153 }
154 // default EM physics
155 if ("_EM0" == em_name) {
156 em_opt = 0;
157 }
158 }
159
160 // hadronic physics
161 G4String had_name = name.substr(0, n);
162
163 if(0 < verbose) {
164 G4cout << "G4PhysListFactory::GetReferencePhysList <" << had_name
165 << em_name << ">" << G4endl;
166 }
167 G4VModularPhysicsList* p = nullptr;
168 if(had_name == "FTFP_BERT") {p = new FTFP_BERT(verbose);}
169 else if(had_name == "FTFP_BERT_HP") {p = new FTFP_BERT_HP(verbose);}
170 else if(had_name == "FTFP_BERT_TRV") {p = new FTFP_BERT_TRV(verbose);}
171 else if(had_name == "FTFP_BERT_ATL") {p = new FTFP_BERT_ATL(verbose);}
172 else if(had_name == "FTFQGSP_BERT") {p = new FTFQGSP_BERT(verbose);}
173 else if(had_name == "FTFP_INCLXX") {p = new FTFP_INCLXX(verbose);}
174 else if(had_name == "FTFP_INCLXX_HP") {p = new FTFP_INCLXX_HP(verbose);}
175 else if(had_name == "FTF_BIC") {p = new FTF_BIC(verbose);}
176 else if(had_name == "LBE") {p = new LBE();}
177 else if(had_name == "QBBC") {p = new QBBC(verbose);}
178 else if(had_name == "QGSP_BERT") {p = new QGSP_BERT(verbose);}
179 else if(had_name == "QGSP_BERT_HP") {p = new QGSP_BERT_HP(verbose);}
180 else if(had_name == "QGSP_BIC") {p = new QGSP_BIC(verbose);}
181 else if(had_name == "QGSP_BIC_HP") {p = new QGSP_BIC_HP(verbose);}
182 else if(had_name == "QGSP_BIC_AllHP") {p = new QGSP_BIC_AllHP(verbose);}
183 else if(had_name == "QGSP_FTFP_BERT") {p = new QGSP_FTFP_BERT(verbose);}
184 else if(had_name == "QGSP_INCLXX") {p = new QGSP_INCLXX(verbose);}
185 else if(had_name == "QGSP_INCLXX_HP") {p = new QGSP_INCLXX_HP(verbose);}
186 else if(had_name == "QGS_BIC") {p = new QGS_BIC(verbose);}
187 else if(had_name == "Shielding") {p = new Shielding(verbose);}
188 else if(had_name == "ShieldingLEND") {p = new ShieldingLEND(verbose);}
189 else if(had_name == "ShieldingLIQMD") {p = new Shielding(verbose,"HP","",true);}
190 else if(had_name == "ShieldingM") {p = new Shielding(verbose,"HP","M");}
191 else if(had_name == "NuBeam") {p = new NuBeam(verbose);}
192 else if(had_name == "Shielding_HP") {p = new Shielding(verbose);}
193 else if(had_name == "ShieldingLIQMD_HP") {p = new Shielding(verbose,"HP","",true);}
194 else if(had_name == "ShieldingM_HP") {p = new Shielding(verbose,"HP","M");}
195 else if(had_name == "FTFP_BERT_HPT") {p = new FTFP_BERT_HP(verbose);
196 p->RegisterPhysics(new G4ThermalNeutrons);}
197 else if(had_name == "FTFP_INCLXX_HPT") {p = new FTFP_INCLXX_HP(verbose);
198 p->RegisterPhysics(new G4ThermalNeutrons);}
199 else if(had_name == "QGSP_BERT_HPT") {p = new QGSP_BERT_HP(verbose);
200 p->RegisterPhysics(new G4ThermalNeutrons);}
201 else if(had_name == "QGSP_BIC_HPT") {p = new QGSP_BIC_HPT(verbose);}
202 else if(had_name == "QGSP_BIC_AllHPT") {p = new QGSP_BIC_AllHP(verbose);
203 p->RegisterPhysics(new G4ThermalNeutrons);}
204 else if(had_name == "QGSP_INCLXX_HPT") {p = new QGSP_INCLXX_HP(verbose);
205 p->RegisterPhysics(new G4ThermalNeutrons);}
206 else if(had_name == "Shielding_HPT") {p = new Shielding(verbose);
207 p->RegisterPhysics(new G4ThermalNeutrons);}
208 else if(had_name == "ShieldingLIQMD_HPT") {p = new Shielding(verbose,"HP","",true);
209 p->RegisterPhysics(new G4ThermalNeutrons);}
210 else if(had_name == "ShieldingM_HPT") {p = new Shielding(verbose,"HP","M");
211 p->RegisterPhysics(new G4ThermalNeutrons);}
212 else {
214 ed << "ERROR: The requested physics list " << had_name
215 << " is NOT available in the Physics List Factory.\n"
216 << "Please choose a valid physics list.\n";
217
218 G4Exception("G4PhysListFactory", "pl0003", FatalException, ed);
219 return nullptr;
220 }
221 if(nullptr != p) {
222 if (had_name != "LBE") {
223 if (1 == em_opt) {
224 p->ReplacePhysics(new G4EmStandardPhysics_option1(verbose));
225 } else if (2 == em_opt) {
226 p->ReplacePhysics(new G4EmStandardPhysics_option2(verbose));
227 } else if (3 == em_opt) {
228 p->ReplacePhysics(new G4EmStandardPhysics_option3(verbose));
229 } else if (4 == em_opt) {
230 p->ReplacePhysics(new G4EmStandardPhysics_option4(verbose));
231 } else if (5 == em_opt) {
232 p->ReplacePhysics(new G4EmLivermorePhysics(verbose));
233 } else if (6 == em_opt) {
234 p->ReplacePhysics(new G4EmPenelopePhysics(verbose));
235 } else if (7 == em_opt) {
236 p->ReplacePhysics(new G4EmStandardPhysicsGS(verbose));
237 } else if (8 == em_opt) {
238 p->ReplacePhysics(new G4EmStandardPhysicsSS(verbose));
239 } else if (10 == em_opt) {
240 p->ReplacePhysics(new G4EmStandardPhysicsWVI(verbose));
241 } else if (11 == em_opt) {
242 p->ReplacePhysics(new G4EmLowEPPhysics(verbose));
243 }
244 }
245 theMessenger = new G4PhysListFactoryMessenger(p);
246 }
247 if(0 < verbose) G4cout << G4endl;
248 return p;
249}
TINCLXXPhysicsListHelper< G4VModularPhysicsList, false, true > FTFP_INCLXX
TINCLXXPhysicsListHelper< G4VModularPhysicsList, true, true > FTFP_INCLXX_HP
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
TINCLXXPhysicsListHelper< G4VModularPhysicsList, true, false > QGSP_INCLXX_HP
TINCLXXPhysicsListHelper< G4VModularPhysicsList, false, false > QGSP_INCLXX
void RegisterPhysics(G4VPhysicsConstructor *)
void ReplacePhysics(G4VPhysicsConstructor *)
const char * name(G4int ptype)

Referenced by ReferencePhysList().

◆ IsReferencePhysList()

G4bool G4PhysListFactory::IsReferencePhysList ( const G4String & name) const

Definition at line 251 of file G4PhysListFactory.cc.

252{
253 G4bool res = false;
254 std::size_t n = name.size();
255 if(n > 4) {
256 G4String em_name = name.substr(n - 4, 4);
257 for (std::size_t i=1; i<nlists_em; ++i) {
258 if(listnames_em[i] == em_name) {
259 n -= 4;
260 break;
261 }
262 }
263 }
264 G4String had_name = name.substr(0, n);
265 for (std::size_t i=0; i<nlists_hadr; ++i) {
266 if(had_name == listnames_hadr[i]) {
267 res = true;
268 break;
269 }
270 }
271 return res;
272}
bool G4bool
Definition G4Types.hh:86

◆ ReferencePhysList()

G4VModularPhysicsList * G4PhysListFactory::ReferencePhysList ( )

Definition at line 114 of file G4PhysListFactory.cc.

115{
116 // instantiate PhysList by environment variable "PHYSLIST"
117 G4String name;
118 const char* path = std::getenv("PHYSLIST");
119 if (nullptr != path) {
120 name = G4String(path);
121 } else {
122 name = defName;
123 G4cout << "### G4PhysListFactory WARNING: "
124 << " environment variable PHYSLIST is not defined"
125 << G4endl
126 << " Default Physics Lists " << name
127 << " is instantiated"
128 << G4endl;
129 }
130 return GetReferencePhysList(name);
131}
G4VModularPhysicsList * GetReferencePhysList(const G4String &)

◆ SetVerbose()

void G4PhysListFactory::SetVerbose ( G4int val)
inline

Definition at line 68 of file G4PhysListFactory.hh.

68{ verbose = val; }

The documentation for this class was generated from the following files: