Geant4-11
Public Member Functions | Private Attributes
G4PhysListFactory Class Reference

#include <G4PhysListFactory.hh>

Public Member Functions

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

Private Attributes

G4String defName
 
std::vector< G4Stringlistnames_em
 
std::vector< G4Stringlistnames_hadr
 
size_t nlists_em
 
size_t nlists_hadr
 
G4UImessengertheMessenger
 
G4int verbose
 

Detailed Description

Definition at line 45 of file G4PhysListFactory.hh.

Constructor & Destructor Documentation

◆ G4PhysListFactory()

G4PhysListFactory::G4PhysListFactory ( G4int  ver = 1)

Definition at line 79 of file G4PhysListFactory.cc.

80 : defName("FTFP_BERT"),verbose(ver),theMessenger(nullptr)
81{
82 nlists_hadr = 23;
83 G4String ss[23] = {
84 "FTFP_BERT","FTFP_BERT_TRV","FTFP_BERT_ATL","FTFP_BERT_HP","FTFQGSP_BERT",
85 "FTFP_INCLXX","FTFP_INCLXX_HP","FTF_BIC", "LBE","QBBC",
86 "QGSP_BERT","QGSP_BERT_HP","QGSP_BIC","QGSP_BIC_HP","QGSP_BIC_AllHP",
87 "QGSP_FTFP_BERT","QGSP_INCLXX","QGSP_INCLXX_HP","QGS_BIC",
88 "Shielding","ShieldingLEND","ShieldingM","NuBeam"};
89 for(size_t i=0; i<nlists_hadr; ++i) {
90 listnames_hadr.push_back(ss[i]);
91 }
92
93 nlists_em = 12;
94 G4String s1[12] = {"","_EMV","_EMX","_EMY","_EMZ","_LIV","_PEN",
95 "__GS","__SS","_EM0","_WVI","__LE"};
96 for(size_t i=0; i<nlists_em; ++i) {
97 listnames_em.push_back(s1[i]);
98 }
99}
std::vector< G4String > listnames_hadr
G4UImessenger * theMessenger
std::vector< G4String > listnames_em

References listnames_em, listnames_hadr, nlists_em, and nlists_hadr.

◆ ~G4PhysListFactory()

G4PhysListFactory::~G4PhysListFactory ( )

Definition at line 101 of file G4PhysListFactory.cc.

102{
103 delete theMessenger;
104}

References theMessenger.

Member Function Documentation

◆ AvailablePhysLists()

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

Definition at line 243 of file G4PhysListFactory.cc.

244{
245 return listnames_hadr;
246}

References listnames_hadr.

Referenced by export_PhysListFactory().

◆ AvailablePhysListsEM()

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

Definition at line 249 of file G4PhysListFactory.cc.

250{
251 return listnames_em;
252}

References listnames_em.

Referenced by export_PhysListFactory().

◆ GetReferencePhysList()

G4VModularPhysicsList * G4PhysListFactory::GetReferencePhysList ( const G4String name)

Definition at line 127 of file G4PhysListFactory.cc.

128{
129 // analysis on the string
130 size_t n = name.size();
131
132 // last characters in the string
133 size_t em_opt = 0;
134 G4String em_name = "";
135
136 // check EM options
137 if(n > 4) {
138 em_name = name.substr(n - 4, 4);
139 for(size_t i=1; i<nlists_em; ++i) {
140 if(listnames_em[i] == em_name) {
141 em_opt = i;
142 n -= 4;
143 break;
144 }
145 }
146 if(0 == em_opt) { em_name = ""; }
147 }
148
149 // hadronic pHysics List
150 G4String had_name = name.substr(0, n);
151
152 if(0 < verbose) {
153 G4cout << "G4PhysListFactory::GetReferencePhysList <" << had_name
154 << em_name << "> EMoption= " << em_opt << G4endl;
155 }
156 G4VModularPhysicsList* p = nullptr;
157 if(had_name == "FTFP_BERT") {p = new FTFP_BERT(verbose);}
158 else if(had_name == "FTFP_BERT_HP") {p = new FTFP_BERT_HP(verbose);}
159 else if(had_name == "FTFP_BERT_TRV") {p = new FTFP_BERT_TRV(verbose);}
160 else if(had_name == "FTFP_BERT_ATL") {p = new FTFP_BERT_ATL(verbose);}
161 else if(had_name == "FTFQGSP_BERT") {p = new FTFQGSP_BERT(verbose);}
162 else if(had_name == "FTFP_INCLXX") {p = new FTFP_INCLXX(verbose);}
163 else if(had_name == "FTFP_INCLXX_HP") {p = new FTFP_INCLXX_HP(verbose);}
164 else if(had_name == "FTF_BIC") {p = new FTF_BIC(verbose);}
165 else if(had_name == "LBE") {p = new LBE();}
166 else if(had_name == "QBBC") {p = new QBBC(verbose);}
167 else if(had_name == "QGSP_BERT") {p = new QGSP_BERT(verbose);}
168 else if(had_name == "QGSP_BERT_HP") {p = new QGSP_BERT_HP(verbose);}
169 else if(had_name == "QGSP_BIC") {p = new QGSP_BIC(verbose);}
170 else if(had_name == "QGSP_BIC_HP") {p = new QGSP_BIC_HP(verbose);}
171 else if(had_name == "QGSP_BIC_AllHP") {p = new QGSP_BIC_AllHP(verbose);}
172 else if(had_name == "QGSP_FTFP_BERT") {p = new QGSP_FTFP_BERT(verbose);}
173 else if(had_name == "QGSP_INCLXX") {p = new QGSP_INCLXX(verbose);}
174 else if(had_name == "QGSP_INCLXX_HP") {p = new QGSP_INCLXX_HP(verbose);}
175 else if(had_name == "QGS_BIC") {p = new QGS_BIC(verbose);}
176 else if(had_name == "Shielding") {p = new Shielding(verbose);}
177 else if(had_name == "ShieldingLEND") {p = new ShieldingLEND(verbose);}
178 else if(had_name == "ShieldingM") {p = new Shielding(verbose,"HP","M");}
179 else if(had_name == "NuBeam") {p = new NuBeam(verbose);}
180 else {
181 p = new FTFP_BERT(verbose);
183 ed << "PhysicsList " << had_name << " is not known;"
184 << " the default FTFP_BERT is created";
185 G4Exception("G4PhysListFactory: ","pl0003",JustWarning,ed,"");
186 }
187 if(nullptr != p) {
188 if(0 < em_opt && had_name != "LBE") {
189 if(1 == em_opt) {
191 } else if(2 == em_opt) {
193 } else if(3 == em_opt) {
195 } else if(4 == em_opt) {
197 } else if(5 == em_opt) {
199 } else if(6 == em_opt) {
201 } else if(7 == em_opt) {
203 } else if(8 == em_opt) {
205 } else if(9 == em_opt) {
207 } else if(10 == em_opt) {
209 } else if(11 == em_opt) {
211 }
212 }
214 }
215 if(0 < verbose) G4cout << G4endl;
216 return p;
217}
TINCLXXPhysicsListHelper< G4VModularPhysicsList, false, true > FTFP_INCLXX
Definition: FTFP_INCLXX.hh:40
TINCLXXPhysicsListHelper< G4VModularPhysicsList, true, true > FTFP_INCLXX_HP
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
TINCLXXPhysicsListHelper< G4VModularPhysicsList, true, false > QGSP_INCLXX_HP
TINCLXXPhysicsListHelper< G4VModularPhysicsList, false, false > QGSP_INCLXX
void ReplacePhysics(G4VPhysicsConstructor *)
Definition: LBE.hh:59
Definition: NuBeam.hh:42
Definition: QBBC.hh:44
const char * name(G4int ptype)

References G4cout, G4endl, G4Exception(), JustWarning, listnames_em, CLHEP::detail::n, G4InuclParticleNames::name(), nlists_em, G4VModularPhysicsList::ReplacePhysics(), theMessenger, and verbose.

Referenced by export_PhysListFactory(), and ReferencePhysList().

◆ IsReferencePhysList()

G4bool G4PhysListFactory::IsReferencePhysList ( const G4String name) const

Definition at line 219 of file G4PhysListFactory.cc.

220{
221 G4bool res = false;
222 size_t n = name.size();
223 if(n > 4) {
224 G4String em_name = name.substr(n - 4, 4);
225 for(size_t i=1; i<nlists_em; ++i) {
226 if(listnames_em[i] == em_name) {
227 n -= 4;
228 break;
229 }
230 }
231 }
232 G4String had_name = name.substr(0, n);
233 for(size_t i=0; i<nlists_hadr; ++i) {
234 if(had_name == listnames_hadr[i]) {
235 res = true;
236 break;
237 }
238 }
239 return res;
240}
bool G4bool
Definition: G4Types.hh:86

References listnames_em, listnames_hadr, CLHEP::detail::n, G4InuclParticleNames::name(), nlists_em, and nlists_hadr.

Referenced by export_PhysListFactory().

◆ ReferencePhysList()

G4VModularPhysicsList * G4PhysListFactory::ReferencePhysList ( )

Definition at line 107 of file G4PhysListFactory.cc.

108{
109 // instantiate PhysList by environment variable "PHYSLIST"
110 G4String name = "";
111 char* path = std::getenv("PHYSLIST");
112 if (path) {
113 name = G4String(path);
114 } else {
115 name = defName;
116 G4cout << "### G4PhysListFactory WARNING: "
117 << " environment variable PHYSLIST is not defined"
118 << G4endl
119 << " Default Physics Lists " << name
120 << " is instantiated"
121 << G4endl;
122 }
124}
G4VModularPhysicsList * GetReferencePhysList(const G4String &)

References defName, G4cout, G4endl, GetReferencePhysList(), and G4InuclParticleNames::name().

Referenced by export_PhysListFactory().

◆ SetVerbose()

void G4PhysListFactory::SetVerbose ( G4int  val)
inline

Definition at line 68 of file G4PhysListFactory.hh.

68{ verbose = val; }

References verbose.

Field Documentation

◆ defName

G4String G4PhysListFactory::defName
private

Definition at line 72 of file G4PhysListFactory.hh.

Referenced by ReferencePhysList().

◆ listnames_em

std::vector<G4String> G4PhysListFactory::listnames_em
private

◆ listnames_hadr

std::vector<G4String> G4PhysListFactory::listnames_hadr
private

Definition at line 73 of file G4PhysListFactory.hh.

Referenced by AvailablePhysLists(), G4PhysListFactory(), and IsReferencePhysList().

◆ nlists_em

size_t G4PhysListFactory::nlists_em
private

◆ nlists_hadr

size_t G4PhysListFactory::nlists_hadr
private

Definition at line 75 of file G4PhysListFactory.hh.

Referenced by G4PhysListFactory(), and IsReferencePhysList().

◆ theMessenger

G4UImessenger* G4PhysListFactory::theMessenger
private

Definition at line 78 of file G4PhysListFactory.hh.

Referenced by GetReferencePhysList(), and ~G4PhysListFactory().

◆ verbose

G4int G4PhysListFactory::verbose
private

Definition at line 77 of file G4PhysListFactory.hh.

Referenced by GetReferencePhysList(), and SetVerbose().


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