111 std::vector<G4String> physExt;
112 std::vector<G4int> physReplace;
116 size_t npc = physExt.size();
118 G4cout <<
"G4PhysListRegistry::GetModularPhysicsList <" 120 <<
", as \"" << plBase <<
"\" with extensions \"";
121 for (
size_t ipc = 0; ipc < npc; ++ipc )
122 G4cout << ((physReplace[ipc]>0)?
"_":
"+") << physExt[ipc];
128 G4cout <<
"### G4PhysListRegistry WARNING: " << name
133 ED <<
"The factory for the physicslist ["<< name <<
"] does not exist!" 135 if ( plBase ==
"" ) {
136 ED <<
"Could determine no sensible base physics list" <<
G4endl;
138 ED <<
"One or more of the extensions does not exist [ ";
139 for (
size_t ipc = 0; ipc < physExt.size(); ++ipc ) {
140 ED << physExt[ipc] <<
" ";
144 G4Exception(
"G4PhysListRegistry::GetModularPhysicsList",
157 for (
size_t ipc = 0; ipc < npc; ++ipc ) {
166 if ( physReplace[ipc] > 0 ) {
168 reporreg =
"ReplacePhysics ";
171 reporreg =
"RegisterPhysics";
173 if (
verbose > 0 )
G4cout <<
"<<< " << reporreg <<
" with " << pcname
174 <<
" \"" << extName <<
"\"" <<
G4endl;
177 G4cout <<
"<<< Reference Physics List " << name <<
" is built" <<
G4endl;
190 char* path = getenv(
"PHYSLIST");
195 G4cout <<
"### G4PhysListRegistry WARNING: " 196 <<
" environment variable PHYSLIST is not defined" 198 <<
" Default Physics Lists " << name
199 <<
" is instantiated" 208 std::vector<G4String> physExt;
209 std::vector<G4int> physReplace;
216 std::vector<G4String>& physExt,
217 std::vector<G4int>& replace,
231 bool allKnown =
false;
243 size_t nb = availBases.size();
244 for (
size_t ib=0; ib<nb; ++ib) {
245 const G4String& testBase = availBases[ib];
246 size_t ipos = workingName.find(testBase);
248 if ( testBase.size() > plBase.size() ) {
251 if ( verb > 3 ) {
G4cout <<
" physlist current best guess: " << testBase <<
G4endl; }
253 if ( verb > 3 ) {
G4cout <<
" physlist match but shorter: " << testBase <<
G4endl; }
256 if ( verb > 3 ) {
G4cout <<
" physlist reject: " << testBase <<
G4endl; }
260 G4cout <<
" physlist " << name <<
", base known " << allKnown
261 <<
" chosen plBase \"" << plBase <<
"\"" <<
G4endl;
269 workingName.erase(0,plBase.size());
274 size_t ne = availExtras.size();
275 while ( ! workingName.empty() ) {
276 char c = workingName.
data()[0];
277 if (
'_' == c ||
'+' == c ) workingName.erase(0,1);
278 G4int replaceExtra = ( c !=
'+' );
280 G4bool extraKnown =
false;
281 for (
size_t ie=0; ie<ne; ++ie) {
282 const G4String& testExtra = availExtras[ie];
283 size_t ipos = workingName.find(testExtra);
285 if ( testExtra.size() > extraName.size() ) {
286 extraName = testExtra;
289 if ( verb > 3 ) {
G4cout <<
" physextra current best guess: " << testExtra <<
G4endl; }
291 if ( verb > 3 ) {
G4cout <<
" physextra match but shorter: " << testExtra <<
G4endl; }
296 if ( verb > 3 ) {
G4cout <<
" physextra reject: " << testExtra <<
G4endl; }
302 G4cout <<
" physextra " << name <<
" [" << workingName <<
"]" 303 <<
", extra known " << extraKnown
304 <<
" chosen extra \"" << extraName <<
"\"" 305 <<
" replace " << replaceExtra <<
G4endl;
311 std::map<G4String,G4String>::const_iterator itr =
318 G4cout <<
" extraName \"" << extraName <<
"\" maps to physics ctor \"" 319 << pcname <<
"\" which is itself realknown " << realknown
323 if ( ! realknown ) allKnown =
false;
324 physExt.push_back(extraName);
325 replace.push_back(replaceExtra);
327 workingName.erase(0,extraName.size());
339 std::map<G4String,G4VBasePhysListStamper*>::const_iterator itr;
350 std::map<G4String,G4String>::const_iterator itr;
369 G4cout <<
"Base G4VModularPhysicsLists in G4PhysListRegistry are:" 371 if ( avail.empty() )
G4cout <<
"... no registered lists" << G4endl;
373 size_t n = avail.size();
374 for (
size_t i=0; i<
n; ++i ) {
375 G4cout <<
" [" << std::setw(3) << i <<
"] " 376 <<
" \"" << avail[i] <<
"\"" <<
G4endl;
382 std::map<G4String,G4String>::const_iterator itr;
383 G4cout <<
"Replacement mappings in G4PhysListRegistry are:" 388 G4cout <<
" " << std::setw(10) << itr->first <<
" => " 389 << std::setw(30) << itr->second <<
" " 390 << ( (known)?
"":
"[unregistered physics]")
393 G4cout <<
"Use these mapping to extend physics list; append with _EXT or +EXT" << G4endl
394 <<
" to use ReplacePhysics() (\"_\") or RegisterPhysics() (\"+\")." std::vector< G4String > availExtensions
const std::vector< G4String > & AvailablePhysicsExtensions() const
void RegisterPhysics(G4VPhysicsConstructor *)
const char * data() const
std::ostringstream G4ExceptionDescription
G4bool IsReferencePhysList(G4String nam) const
G4bool IsKnownPhysicsConstructor(const G4String &name)
void AddFactory(G4String name, G4VBasePhysListStamper *)
G4bool DeconstructPhysListName(const G4String &name, G4String &plBase, std::vector< G4String > &physExt, std::vector< G4int > &replace, G4int verbose=0) const
std::map< G4String, G4VBasePhysListStamper * > factories
G4int GetVerboseLevel() const
G4String userDefault
throw an exception if unsatisfiable?
G4GLOB_DLL std::ostream G4cout
G4VPhysicsConstructor * GetPhysicsConstructor(const G4String &name)
const std::vector< G4String > & AvailablePhysLists() const
std::vector< G4String > availBasePhysLists
G4VModularPhysicsList * GetModularPhysicsListFromEnv()
static G4PhysListRegistry * Instance()
void SetVerboseLevel(G4int value)
void SetUserDefaultPhysList(const G4String &name="")
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void ReplacePhysics(G4VPhysicsConstructor *)
static G4PhysicsConstructorRegistry * Instance()
static G4ThreadLocal G4PhysListRegistry * theInstance
void PrintAvailablePhysLists() const
std::map< G4String, G4String > physicsExtensions
G4String systemDefault
use this if $PHYSLIST isn't set
G4VModularPhysicsList * GetModularPhysicsList(const G4String &name)
const std::vector< G4String > & AvailablePhysListsEM() const
void AddPhysicsExtension(G4String name, G4String procname)