54 #define REGREF PhysListReg // REGREF is used to make instances unique
55 #include "G4RegisterPhysicsConstructors.icc"
58 #include "G4RegisterPhysLists.icc"
95 , systemDefault(
"FTFP_BERT")
127 std::vector<G4String> physExt;
128 std::vector<G4int> physReplace;
132 size_t npc = physExt.size();
134 G4cout <<
"G4PhysListRegistry::GetModularPhysicsList <"
136 <<
", as \"" << plBase <<
"\" with extensions \"";
137 for (
size_t ipc = 0; ipc < npc; ++ipc )
144 G4cout <<
"### G4PhysListRegistry WARNING: " << name
149 ED <<
"The factory for the physicslist ["<< name <<
"] does not exist!"
151 if ( plBase ==
"" ) {
152 ED <<
"Could determine no sensible base physics list" <<
G4endl;
154 ED <<
"One or more of the extensions does not exist [ ";
155 for (
size_t ipc = 0; ipc < physExt.size(); ++ipc ) {
156 ED << physExt[ipc] <<
" ";
160 G4Exception(
"G4PhysListRegistry::GetModularPhysicsList",
173 for (
size_t ipc = 0; ipc < npc; ++ipc ) {
185 reporreg =
"ReplacePhysics ";
188 reporreg =
"RegisterPhysics";
190 if (
verbose > 0 )
G4cout <<
"<<< " << reporreg <<
" with " << pcname
191 <<
" \"" << extName <<
"\"" <<
G4endl;
194 G4cout <<
"<<< Reference Physics List " << name <<
" is built" <<
G4endl;
207 char* path = getenv(
"PHYSLIST");
212 G4cout <<
"### G4PhysListRegistry WARNING: "
213 <<
" environment variable PHYSLIST is not defined"
215 <<
" Default Physics Lists " << name
216 <<
" is instantiated"
225 std::vector<G4String> physExt;
226 std::vector<G4int> physReplace;
233 std::vector<G4String>& physExt,
234 std::vector<G4int>& replace,
248 bool allKnown =
false;
258 const std::vector<G4String>& availPhysCtors =
266 G4cout <<
" " << name <<
", base known=" << ((allKnown)?
"true":
"false")
267 <<
" chosen plBase \"" << plBase <<
"\"" <<
G4endl;
275 workingName.erase(0,plBase.size());
280 while ( ! workingName.empty() ) {
281 char c = workingName.
data()[0];
282 if (
'_' == c ||
'+' == c ) workingName.erase(0,1);
285 G4bool extraKnown =
false;
287 extraKnown =
FindLongestMatch(workingName,
"extNames",availExtras,extraName);
291 std::map<G4String,G4String>::const_iterator itr =
296 if ( ! realknown ) allKnown =
false;
299 G4cout <<
" extraName \"" << extraName <<
"\" maps to physics ctor \""
300 << pcname <<
"\" which is itself realknown " << realknown
312 G4cout <<
" physextra " << name <<
" [" << workingName <<
"]"
313 <<
", extra known " << extraKnown
314 <<
" chosen extra \"" << extraName <<
"\""
315 <<
" replace " << replaceExtra <<
G4endl;
319 physExt.push_back(extraName);
320 replace.push_back(replaceExtra);
322 workingName.erase(0,extraName.size());
327 G4cout <<
" workingName \"" << workingName <<
"\""
328 <<
" couldn't be found in the extensions list"
343 const std::vector<G4String>& validNames,
350 size_t n = validNames.size();
351 for (
size_t i=0; i<
n; ++i) {
352 const G4String& testName = validNames[i];
353 size_t ipos = workingName.find(testName);
355 if ( testName.size() > bestMatch.size() ) {
356 bestMatch = testName;
359 G4cout <<
" " << searchName <<
" current best guess: "
364 G4cout <<
" " << searchName <<
" match but shorter: "
370 G4cout <<
" " << searchName <<
" reject: " << testName <<
G4endl;
381 std::map<G4String,G4VBasePhysListStamper*>::const_iterator itr;
392 std::map<G4String,G4String>::const_iterator itr;
411 G4cout <<
"Base G4VModularPhysicsLists in G4PhysListRegistry are:"
413 if ( avail.empty() )
G4cout <<
"... no registered lists" << G4endl;
415 size_t n = avail.size();
416 for (
size_t i=0; i<
n; ++i ) {
417 G4cout <<
" [" << std::setw(3) << i <<
"] "
418 <<
" \"" << avail[i] <<
"\"" <<
G4endl;
424 std::map<G4String,G4String>::const_iterator itr;
425 G4cout <<
"Replacement mappings in G4PhysListRegistry are:"
430 G4cout <<
" " << std::setw(10) << itr->first <<
" => "
431 << std::setw(30) << itr->second <<
" "
432 << ( (known)?
"":
"[unregistered physics]")
435 G4cout <<
"Use these mapping to extend physics list; append with _EXT or +EXT" << G4endl
436 <<
" to use ReplacePhysics() (\"_\") or RegisterPhysics() (\"+\")."
std::vector< G4String > availExtensions
const std::vector< G4String > & AvailablePhysLists() const
std::ostringstream G4ExceptionDescription
G4VModularPhysicsList * GetModularPhysicsListFromEnv()
G4bool DeconstructPhysListName(const G4String &name, G4String &plBase, std::vector< G4String > &physExt, std::vector< G4int > &replace, G4int verbose=0) const
std::vector< G4String > availBasePhysLists
static G4ThreadLocal G4PhysListRegistry * theInstance
G4int GetVerboseLevel() const
G4bool FindLongestMatch(const G4String &workName, const G4String &searchName, const std::vector< G4String > &validNames, G4String &bestMatch, G4int verbose=0) const
G4VPhysicsConstructor * GetPhysicsConstructor(const G4String &name)
static G4PhysicsConstructorRegistry * Instance()
static G4PhysListRegistry * Instance()
std::map< G4String, G4VBasePhysListStamper * > factories
G4String systemDefault
use this if $PHYSLIST isn't set
std::vector< G4String > AvailablePhysicsConstructors() const
std::map< G4String, G4String > physicsExtensions
const std::vector< G4String > & AvailablePhysicsExtensions() const
void RegisterPhysics(G4VPhysicsConstructor *)
void SetUserDefaultPhysList(const G4String &name="")
G4bool IsReferencePhysList(G4String nam) const
const char * data() const
void AddFactory(G4String name, G4VBasePhysListStamper *)
void PrintAvailablePhysLists() const
G4VModularPhysicsList * GetModularPhysicsList(const G4String &name)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void ReplacePhysics(G4VPhysicsConstructor *)
const std::vector< G4String > & AvailablePhysListsEM() const
G4GLOB_DLL std::ostream G4cout
G4bool IsKnownPhysicsConstructor(const G4String &name)
G4String userDefault
throw an exception if unsatisfiable?
void AddPhysicsExtension(G4String name, G4String procname)
void SetVerboseLevel(G4int value)