53#define REGREF PhysListReg
100 , systemDefault(
"FTFP_BERT")
132 std::vector<G4String> physExt;
133 std::vector<G4int> physReplace;
137 size_t npc = physExt.size();
139 G4cout <<
"G4PhysListRegistry::GetModularPhysicsList <"
141 <<
", as \"" << plBase <<
"\" with extensions \"";
142 for (
size_t ipc = 0; ipc < npc; ++ipc )
149 G4cout <<
"### G4PhysListRegistry WARNING: " <<
name
154 ED <<
"The factory for the physicslist ["<<
name <<
"] does not exist!"
156 if ( plBase ==
"" ) {
157 ED <<
"Could determine no sensible base physics list" <<
G4endl;
159 ED <<
"One or more of the extensions does not exist [ ";
160 for (
size_t ipc = 0; ipc < physExt.size(); ++ipc ) {
161 ED << physExt[ipc] <<
" ";
165 G4Exception(
"G4PhysListRegistry::GetModularPhysicsList",
178 for (
size_t ipc = 0; ipc < npc; ++ipc ) {
190 reporreg =
"ReplacePhysics ";
193 reporreg =
"RegisterPhysics";
195 if (
verbose > 0 )
G4cout <<
"<<< " << reporreg <<
" with " << pcname
196 <<
" \"" << extName <<
"\"" <<
G4endl;
212 char* path = std::getenv(
"PHYSLIST");
217 G4cout <<
"### G4PhysListRegistry WARNING: "
218 <<
" environment variable PHYSLIST is not defined"
220 <<
" Default Physics Lists " <<
name
221 <<
" is instantiated"
230 std::vector<G4String> physExt;
231 std::vector<G4int> physReplace;
238 std::vector<G4String>& physExt,
239 std::vector<G4int>& replace,
253 bool allKnown =
false;
263 const std::vector<G4String>& availPhysCtors =
271 G4cout <<
" " <<
name <<
", base known=" << ((allKnown)?
"true":
"false")
272 <<
" chosen plBase \"" << plBase <<
"\"" <<
G4endl;
280 workingName.erase(0,plBase.size());
285 while ( ! workingName.empty() ) {
286 char c = workingName.data()[0];
287 if (
'_' == c ||
'+' == c ) workingName.erase(0,1);
290 G4bool extraKnown =
false;
292 extraKnown =
FindLongestMatch(workingName,
"extNames",availExtras,extraName);
296 std::map<G4String,G4String>::const_iterator itr =
301 if ( ! realknown ) allKnown =
false;
304 G4cout <<
" extraName \"" << extraName <<
"\" maps to physics ctor \""
305 << pcname <<
"\" which is itself realknown " << realknown
317 G4cout <<
" physextra " <<
name <<
" [" << workingName <<
"]"
318 <<
", extra known " << extraKnown
319 <<
" chosen extra \"" << extraName <<
"\""
320 <<
" replace " << replaceExtra <<
G4endl;
324 physExt.push_back(extraName);
325 replace.push_back(replaceExtra);
327 workingName.erase(0,extraName.size());
332 G4cout <<
" workingName \"" << workingName <<
"\""
333 <<
" couldn't be found in the extensions list"
348 const std::vector<G4String>& validNames,
355 size_t n = validNames.size();
356 for (
size_t i=0; i<
n; ++i) {
357 const G4String& testName = validNames[i];
358 size_t ipos = workingName.find(testName);
360 if ( testName.size() > bestMatch.size() ) {
361 bestMatch = testName;
364 G4cout <<
" " << searchName <<
" current best guess: "
369 G4cout <<
" " << searchName <<
" match but shorter: "
375 G4cout <<
" " << searchName <<
" reject: " << testName <<
G4endl;
386 std::map<G4String,G4VBasePhysListStamper*>::const_iterator itr;
397 std::map<G4String,G4String>::const_iterator itr;
416 G4cout <<
"Base G4VModularPhysicsLists in G4PhysListRegistry are:"
418 if ( avail.empty() )
G4cout <<
"... no registered lists" <<
G4endl;
420 size_t n = avail.size();
421 for (
size_t i=0; i<
n; ++i ) {
422 G4cout <<
" [" << std::setw(3) << i <<
"] "
423 <<
" \"" << avail[i] <<
"\"" <<
G4endl;
429 std::map<G4String,G4String>::const_iterator itr;
430 G4cout <<
"Replacement mappings in G4PhysListRegistry are:"
435 G4cout <<
" " << std::setw(10) << itr->first <<
" => "
436 << std::setw(30) << itr->second <<
" "
437 << ( (known)?
"":
"[unregistered physics]")
440 G4cout <<
"Use these mapping to extend physics list; append with _EXT or +EXT" <<
G4endl
441 <<
" to use ReplacePhysics() (\"_\") or RegisterPhysics() (\"+\")."
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
void PrintAvailablePhysLists() const
G4VModularPhysicsList * GetModularPhysicsListFromEnv()
static G4ThreadLocal G4PhysListRegistry * theInstance
G4String userDefault
throw an exception if unsatisfiable?
const std::vector< G4String > & AvailablePhysLists() const
std::vector< G4String > availExtensions
void AddFactory(G4String name, G4VBasePhysListStamper *)
std::map< G4String, G4VBasePhysListStamper * > factories
std::vector< G4String > availBasePhysLists
void SetUserDefaultPhysList(const G4String &name="")
const std::vector< G4String > & AvailablePhysListsEM() const
const std::vector< G4String > & AvailablePhysicsExtensions() const
static G4PhysListRegistry * Instance()
G4bool DeconstructPhysListName(const G4String &name, G4String &plBase, std::vector< G4String > &physExt, std::vector< G4int > &replace, G4int verbose=0) const
G4bool IsReferencePhysList(G4String nam) const
G4VModularPhysicsList * GetModularPhysicsList(const G4String &name)
G4String systemDefault
use this if $PHYSLIST isn't set
void AddPhysicsExtension(G4String name, G4String procname)
G4bool FindLongestMatch(const G4String &workName, const G4String &searchName, const std::vector< G4String > &validNames, G4String &bestMatch, G4int verbose=0) const
std::map< G4String, G4String > physicsExtensions
G4VPhysicsConstructor * GetPhysicsConstructor(const G4String &name)
static G4PhysicsConstructorRegistry * Instance()
std::vector< G4String > AvailablePhysicsConstructors() const
G4bool IsKnownPhysicsConstructor(const G4String &name)
void SetVerboseLevel(G4int value)
G4int GetVerboseLevel() const
void RegisterPhysics(G4VPhysicsConstructor *)
void ReplacePhysics(G4VPhysicsConstructor *)
const char * name(G4int ptype)