Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PhysListFactory.cc 103591 2017-04-19 07:53:55Z gcosmo $
|
||||
// $Id: G4PhysListFactory.cc 107319 2017-11-08 16:29:22Z gcosmo $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "FTFP_BERT_HP.hh"
|
||||
#include "FTFP_BERT_TRV.hh"
|
||||
#include "FTFP_BERT_ATL.hh"
|
||||
#include "FTFQGSP_BERT.hh"
|
||||
#include "FTFP_INCLXX.hh"
|
||||
#include "FTFP_INCLXX_HP.hh"
|
||||
#include "FTF_BIC.hh"
|
||||
@@ -59,6 +60,7 @@
|
||||
#include "QGSP_INCLXX.hh"
|
||||
#include "QGSP_INCLXX_HP.hh"
|
||||
#include "Shielding.hh"
|
||||
#include "ShieldingLEND.hh"
|
||||
#include "NuBeam.hh"
|
||||
|
||||
#include "G4EmStandardPhysics.hh"
|
||||
@@ -70,14 +72,16 @@
|
||||
#include "G4EmStandardPhysicsSS.hh"
|
||||
#include "G4EmLivermorePhysics.hh"
|
||||
#include "G4EmPenelopePhysics.hh"
|
||||
#include "G4PhysListFactoryMessenger.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
G4PhysListFactory::G4PhysListFactory()
|
||||
: defName("FTFP_BERT"),verbose(1)
|
||||
: defName("FTFP_BERT"),verbose(1),theMessenger(nullptr)
|
||||
{
|
||||
nlists_hadr = 22;
|
||||
G4String ss[22] = {
|
||||
"FTFP_BERT","FTFP_BERT_TRV","FTFP_BERT_ATL","FTFP_BERT_HP","FTFP_INCLXX",
|
||||
"FTFP_INCLXX_HP","FTF_BIC", "LBE","QBBC",
|
||||
nlists_hadr = 23;
|
||||
G4String ss[23] = {
|
||||
"FTFP_BERT","FTFP_BERT_TRV","FTFP_BERT_ATL","FTFP_BERT_HP","FTFQGSP_BERT",
|
||||
"FTFP_INCLXX","FTFP_INCLXX_HP","FTF_BIC", "LBE","QBBC",
|
||||
"QGSP_BERT","QGSP_BERT_HP","QGSP_BIC","QGSP_BIC_HP","QGSP_BIC_AllHP",
|
||||
"QGSP_FTFP_BERT","QGSP_INCLXX","QGSP_INCLXX_HP","QGS_BIC",
|
||||
"Shielding","ShieldingLEND","ShieldingM","NuBeam"};
|
||||
@@ -93,7 +97,9 @@ G4PhysListFactory::G4PhysListFactory()
|
||||
}
|
||||
|
||||
G4PhysListFactory::~G4PhysListFactory()
|
||||
{}
|
||||
{
|
||||
delete theMessenger;
|
||||
}
|
||||
|
||||
G4VModularPhysicsList*
|
||||
G4PhysListFactory::ReferencePhysList()
|
||||
@@ -145,11 +151,12 @@ G4PhysListFactory::GetReferencePhysList(const G4String& name)
|
||||
G4cout << "G4PhysListFactory::GetReferencePhysList <" << had_name
|
||||
<< em_name << "> EMoption= " << em_opt << G4endl;
|
||||
}
|
||||
G4VModularPhysicsList* p = 0;
|
||||
G4VModularPhysicsList* p = nullptr;
|
||||
if(had_name == "FTFP_BERT") {p = new FTFP_BERT(verbose);}
|
||||
else if(had_name == "FTFP_BERT_HP") {p = new FTFP_BERT_HP(verbose);}
|
||||
else if(had_name == "FTFP_BERT_TRV") {p = new FTFP_BERT_TRV(verbose);}
|
||||
else if(had_name == "FTFP_BERT_ATL") {p = new FTFP_BERT_ATL(verbose);}
|
||||
else if(had_name == "FTFQGSP_BERT") {p = new FTFQGSP_BERT(verbose);}
|
||||
else if(had_name == "FTFP_INCLXX") {p = new FTFP_INCLXX(verbose);}
|
||||
else if(had_name == "FTFP_INCLXX_HP") {p = new FTFP_INCLXX_HP(verbose);}
|
||||
else if(had_name == "FTF_BIC") {p = new FTF_BIC(verbose);}
|
||||
@@ -165,7 +172,7 @@ G4PhysListFactory::GetReferencePhysList(const G4String& name)
|
||||
else if(had_name == "QGSP_INCLXX_HP") {p = new QGSP_INCLXX_HP(verbose);}
|
||||
else if(had_name == "QGS_BIC") {p = new QGS_BIC(verbose);}
|
||||
else if(had_name == "Shielding") {p = new Shielding(verbose);}
|
||||
else if(had_name == "ShieldingLEND") {p = new Shielding(verbose,"LEND");}
|
||||
else if(had_name == "ShieldingLEND") {p = new ShieldingLEND(verbose);}
|
||||
else if(had_name == "ShieldingM") {p = new Shielding(verbose,"HP","M");}
|
||||
else if(had_name == "NuBeam") {p = new NuBeam(verbose);}
|
||||
else {
|
||||
@@ -178,7 +185,7 @@ G4PhysListFactory::GetReferencePhysList(const G4String& name)
|
||||
<< em_name << " is built" << G4endl;
|
||||
G4int ver = p->GetVerboseLevel();
|
||||
p->SetVerboseLevel(0);
|
||||
if(0 < em_opt) {
|
||||
if(0 < em_opt && had_name != "LBE") {
|
||||
if(1 == em_opt) {
|
||||
p->ReplacePhysics(new G4EmStandardPhysics_option1(verbose));
|
||||
} else if(2 == em_opt) {
|
||||
@@ -198,6 +205,7 @@ G4PhysListFactory::GetReferencePhysList(const G4String& name)
|
||||
}
|
||||
}
|
||||
p->SetVerboseLevel(ver);
|
||||
theMessenger = new G4PhysListFactoryMessenger(p);
|
||||
}
|
||||
G4cout << G4endl;
|
||||
return p;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
namespace g4alt {
|
||||
|
||||
G4PhysListFactory::G4PhysListFactory()
|
||||
G4PhysListFactory::G4PhysListFactory()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -53,30 +53,30 @@ void G4PhysListFactory::SetDefaultReferencePhysList(const G4String& name)
|
||||
return G4PhysListRegistry::Instance()->SetUserDefaultPhysList(name);
|
||||
}
|
||||
|
||||
G4VModularPhysicsList*
|
||||
G4VModularPhysicsList*
|
||||
G4PhysListFactory::ReferencePhysList()
|
||||
{
|
||||
return G4PhysListRegistry::Instance()->GetModularPhysicsListFromEnv();
|
||||
}
|
||||
|
||||
G4VModularPhysicsList*
|
||||
G4VModularPhysicsList*
|
||||
G4PhysListFactory::GetReferencePhysList(const G4String& name)
|
||||
{
|
||||
return G4PhysListRegistry::Instance()->GetModularPhysicsList(name);
|
||||
}
|
||||
|
||||
|
||||
G4bool G4PhysListFactory::IsReferencePhysList(const G4String& name)
|
||||
{
|
||||
return G4PhysListRegistry::Instance()->IsReferencePhysList(name);
|
||||
}
|
||||
|
||||
const std::vector<G4String>&
|
||||
const std::vector<G4String>&
|
||||
G4PhysListFactory::AvailablePhysLists() const
|
||||
{
|
||||
return G4PhysListRegistry::Instance()->AvailablePhysLists();
|
||||
}
|
||||
|
||||
const std::vector<G4String>&
|
||||
const std::vector<G4String>&
|
||||
G4PhysListFactory::AvailablePhysListsEM() const
|
||||
{
|
||||
return G4PhysListRegistry::Instance()->AvailablePhysListsEM();
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PhysListFactoryMessenger.cc 66704 2013-01-10 18:20:17Z gunter $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// ClassName: G4PhysListFactoryMessenger
|
||||
//
|
||||
// Author: 2017 V.Ivanchenko
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
#include "G4PhysListFactoryMessenger.hh"
|
||||
#include "G4VModularPhysicsList.hh"
|
||||
#include "G4RadioactiveDecayPhysics.hh"
|
||||
#include "G4OpticalPhysics.hh"
|
||||
|
||||
G4PhysListFactoryMessenger::G4PhysListFactoryMessenger(G4VModularPhysicsList* pl)
|
||||
{
|
||||
//G4cout << "### G4PhysListFactoryMessenger constructed" << G4endl;
|
||||
thePhysList = pl;
|
||||
|
||||
theDir = new G4UIdirectory("/physics_lists/factory/");
|
||||
theDir->SetGuidance("commands for configuration of physics lists.");
|
||||
|
||||
theRadDecay = new G4UIcommand("/physics_lists/factory/addRadioactiveDecay",this);
|
||||
theRadDecay->SetGuidance("Enable radioactive decay.");
|
||||
theRadDecay->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
|
||||
|
||||
theOptical = new G4UIcommand("/physics_lists/factory/addOptical",this);
|
||||
theOptical->SetGuidance("Enable optical physics.");
|
||||
theOptical->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
|
||||
}
|
||||
|
||||
G4PhysListFactoryMessenger::~G4PhysListFactoryMessenger()
|
||||
{
|
||||
delete theOptical;
|
||||
delete theRadDecay;
|
||||
delete theDir;
|
||||
}
|
||||
|
||||
void G4PhysListFactoryMessenger::SetNewValue(G4UIcommand* aComm, G4String)
|
||||
{
|
||||
if(aComm == theRadDecay) {
|
||||
thePhysList->RegisterPhysics(new G4RadioactiveDecayPhysics(1));
|
||||
} else if(aComm == theOptical) {
|
||||
thePhysList->RegisterPhysics(new G4OpticalPhysics(1));
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:
|
||||
// $Id:
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -52,10 +52,13 @@
|
||||
|
||||
G4ThreadLocal G4PhysListRegistry* G4PhysListRegistry::theInstance = 0;
|
||||
|
||||
const int doReplace = 0x01; // _ (ReplacePhysics) vs. + (RegisterPhysics)
|
||||
const int isCtorName = 0x02; // true if actual physCtor name vs. ext name
|
||||
|
||||
G4PhysListRegistry* G4PhysListRegistry::Instance()
|
||||
{
|
||||
if ( 0 == theInstance) {
|
||||
static G4ThreadLocal G4PhysListRegistry *manager_G4MT_TLS_ = 0;
|
||||
static G4ThreadLocal G4PhysListRegistry *manager_G4MT_TLS_ = 0;
|
||||
if (!manager_G4MT_TLS_) manager_G4MT_TLS_ = new G4PhysListRegistry;
|
||||
G4PhysListRegistry &manager = *manager_G4MT_TLS_;
|
||||
theInstance = &manager;
|
||||
@@ -70,8 +73,11 @@ G4PhysListRegistry* G4PhysListRegistry::Instance()
|
||||
theInstance->AddPhysicsExtension("PEN","G4EmPenelopePhysics");
|
||||
// the GS EM extension originally required double underscores
|
||||
// support either one or two as __GS is confusing to users
|
||||
// same for __SS
|
||||
theInstance->AddPhysicsExtension("GS","G4EmStandardPhysicsGS");
|
||||
theInstance->AddPhysicsExtension("_GS","G4EmStandardPhysicsGS");
|
||||
theInstance->AddPhysicsExtension("SS","G4EmStandardPhysicsSS");
|
||||
theInstance->AddPhysicsExtension("_SS","G4EmStandardPhysicsSS");
|
||||
|
||||
return theInstance;
|
||||
}
|
||||
@@ -105,15 +111,15 @@ void G4PhysListRegistry::AddPhysicsExtension(G4String name, G4String procname)
|
||||
physicsExtensions[name] = procname;
|
||||
}
|
||||
|
||||
G4VModularPhysicsList*
|
||||
G4VModularPhysicsList*
|
||||
G4PhysListRegistry::GetModularPhysicsList(const G4String& name)
|
||||
{
|
||||
//
|
||||
//
|
||||
//
|
||||
G4String plBase = "";
|
||||
std::vector<G4String> physExt;
|
||||
std::vector<G4int> physReplace;
|
||||
G4bool allKnown =
|
||||
G4bool allKnown =
|
||||
DeconstructPhysListName(name,plBase,physExt,physReplace,verbose);
|
||||
|
||||
size_t npc = physExt.size();
|
||||
@@ -121,13 +127,13 @@ G4PhysListRegistry::GetModularPhysicsList(const G4String& name)
|
||||
G4cout << "G4PhysListRegistry::GetModularPhysicsList <"
|
||||
<< name << ">"
|
||||
<< ", as \"" << plBase << "\" with extensions \"";
|
||||
for ( size_t ipc = 0; ipc < npc; ++ipc )
|
||||
G4cout << ((physReplace[ipc]>0)?"_":"+") << physExt[ipc];
|
||||
for ( size_t ipc = 0; ipc < npc; ++ipc )
|
||||
G4cout << ((physReplace[ipc]&doReplace)?"_":"+") << physExt[ipc];
|
||||
G4cout << "\"" << G4endl;
|
||||
}
|
||||
|
||||
if ( ! allKnown ) {
|
||||
// couldn't match what the user wanted ...
|
||||
// couldn't match what the user wanted ...
|
||||
G4cout << "### G4PhysListRegistry WARNING: " << name
|
||||
<< " is not known" << G4endl << G4endl;
|
||||
if ( ! unknownFatal ) return 0;
|
||||
@@ -144,36 +150,37 @@ G4PhysListRegistry::GetModularPhysicsList(const G4String& name)
|
||||
}
|
||||
ED << "]" << G4endl;
|
||||
}
|
||||
G4Exception("G4PhysListRegistry::GetModularPhysicsList",
|
||||
G4Exception("G4PhysListRegistry::GetModularPhysicsList",
|
||||
"PhysicsList002", FatalException, ED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if we want this method "const" then the next line becomes more complex
|
||||
// because there is no const version of [] (which adds an entry if the
|
||||
// because there is no const version of [] (which adds an entry if the
|
||||
// key doesn't exist)
|
||||
G4VModularPhysicsList* pl = factories[plBase]->Instantiate(verbose);
|
||||
G4PhysicsConstructorRegistry* pcRegistry =
|
||||
G4PhysicsConstructorRegistry* pcRegistry =
|
||||
G4PhysicsConstructorRegistry::Instance();
|
||||
G4int ver = pl->GetVerboseLevel();
|
||||
pl->SetVerboseLevel(0);
|
||||
for ( size_t ipc = 0; ipc < npc; ++ipc ) {
|
||||
// got back a list of short names, need to use the map to get the
|
||||
// got back a list of short names, need to use the map to get the
|
||||
// full physics constructor name
|
||||
G4String extName = physExt[ipc];
|
||||
G4String pcname = physicsExtensions[extName];
|
||||
G4String pcname =
|
||||
((physReplace[ipc]&isCtorName)) ? extName : physicsExtensions[extName];
|
||||
// this doesn't have a verbose option ... it should
|
||||
// but G4PhysicsConstructorFactory doesn't support it
|
||||
G4VPhysicsConstructor* pctor = pcRegistry->GetPhysicsConstructor(pcname);
|
||||
G4String reporreg = "";
|
||||
if ( physReplace[ipc] > 0 ) {
|
||||
if (( physReplace[ipc] & doReplace)) {
|
||||
pl->ReplacePhysics(pctor);
|
||||
reporreg = "ReplacePhysics ";
|
||||
} else {
|
||||
pl->RegisterPhysics(pctor);
|
||||
reporreg = "RegisterPhysics";
|
||||
}
|
||||
if ( verbose > 0 ) G4cout << "<<< " << reporreg << " with " << pcname
|
||||
if ( verbose > 0 ) G4cout << "<<< " << reporreg << " with " << pcname
|
||||
<< " \"" << extName << "\"" << G4endl;
|
||||
}
|
||||
pl->SetVerboseLevel(ver);
|
||||
@@ -183,10 +190,10 @@ G4PhysListRegistry::GetModularPhysicsList(const G4String& name)
|
||||
return pl;
|
||||
}
|
||||
|
||||
G4VModularPhysicsList*
|
||||
G4VModularPhysicsList*
|
||||
G4PhysListRegistry::GetModularPhysicsListFromEnv()
|
||||
{
|
||||
//
|
||||
//
|
||||
// instantiate PhysList by environment variable "PHYSLIST"
|
||||
// if not set use default
|
||||
G4String name = "";
|
||||
@@ -196,11 +203,11 @@ G4PhysListRegistry::GetModularPhysicsListFromEnv()
|
||||
} else {
|
||||
name = userDefault;
|
||||
G4cout << "### G4PhysListRegistry WARNING: "
|
||||
<< " environment variable PHYSLIST is not defined"
|
||||
<< G4endl
|
||||
<< " Default Physics Lists " << name
|
||||
<< " is instantiated"
|
||||
<< G4endl;
|
||||
<< " environment variable PHYSLIST is not defined"
|
||||
<< G4endl
|
||||
<< " Default Physics Lists " << name
|
||||
<< " is instantiated"
|
||||
<< G4endl;
|
||||
}
|
||||
return GetModularPhysicsList(name);
|
||||
}
|
||||
@@ -215,53 +222,42 @@ G4bool G4PhysListRegistry::IsReferencePhysList(G4String name) const
|
||||
}
|
||||
|
||||
G4bool G4PhysListRegistry::DeconstructPhysListName(const G4String& name,
|
||||
G4String& plBase,
|
||||
G4String& plBase,
|
||||
std::vector<G4String>& physExt,
|
||||
std::vector<G4int>& replace,
|
||||
G4int verb) const
|
||||
{
|
||||
// Take apart a name given to us by the user
|
||||
// this name might be a base PhysList + unknown number of extensions
|
||||
// Extensions preceeded with a "_" should use
|
||||
// Extensions preceeded with a "_" should use
|
||||
// ReplacePhysics()
|
||||
// those proceeded with a "+" should use
|
||||
// RegisterPhysics()
|
||||
// the former is in line with previous behaviour, while the second allows
|
||||
// the former is in line with previous behaviour, while the second allows
|
||||
// additional flexibility
|
||||
plBase = "";
|
||||
physExt.clear();
|
||||
replace.clear();
|
||||
bool allKnown = false;
|
||||
|
||||
|
||||
G4String workingName = name;
|
||||
|
||||
const std::vector<G4String>& availBases = AvailablePhysLists();
|
||||
const std::vector<G4String>& availBases = AvailablePhysLists();
|
||||
const std::vector<G4String>& availExtras = AvailablePhysicsExtensions();
|
||||
|
||||
G4PhysicsConstructorRegistry* physConstRegistry =
|
||||
G4PhysicsConstructorRegistry* physConstRegistry =
|
||||
G4PhysicsConstructorRegistry::Instance();
|
||||
|
||||
const std::vector<G4String>& availPhysCtors =
|
||||
physConstRegistry->AvailablePhysicsConstructors();
|
||||
|
||||
// find the longest base list that is contained in the user supplied name
|
||||
// and starts at the beginning
|
||||
size_t nb = availBases.size();
|
||||
for (size_t ib=0; ib<nb; ++ib) {
|
||||
const G4String& testBase = availBases[ib];
|
||||
size_t ipos = workingName.find(testBase);
|
||||
if ( ipos == 0 ) {
|
||||
if ( testBase.size() > plBase.size() ) {
|
||||
plBase = testBase;
|
||||
allKnown = true;
|
||||
if ( verb > 3 ) { G4cout << " physlist current best guess: " << testBase << G4endl; }
|
||||
} else {
|
||||
if ( verb > 3 ) { G4cout << " physlist match but shorter: " << testBase << G4endl; }
|
||||
}
|
||||
} else {
|
||||
if ( verb > 3 ) { G4cout << " physlist reject: " << testBase << G4endl; }
|
||||
}
|
||||
}
|
||||
if ( verb > 2 ) {
|
||||
G4cout << " physlist " << name << ", base known " << allKnown
|
||||
<< " chosen plBase \"" << plBase << "\"" << G4endl;
|
||||
G4String bestBase = "";
|
||||
allKnown = FindLongestMatch(workingName,"base",availBases,plBase);
|
||||
if ( verb > 2 ) {
|
||||
G4cout << " " << name << ", base known=" << ((allKnown)?"true":"false")
|
||||
<< " chosen plBase \"" << plBase << "\"" << G4endl;
|
||||
}
|
||||
if ( ! allKnown ) {
|
||||
// didn't find any matching base physics list
|
||||
@@ -271,75 +267,57 @@ G4bool G4PhysListRegistry::DeconstructPhysListName(const G4String& name,
|
||||
// remove base name for working name
|
||||
workingName.erase(0,plBase.size());
|
||||
|
||||
// now start trying to match up extensions
|
||||
// now start trying to match up extensions and/or physCtors
|
||||
// each should be preceeded by at "_" (replace) or "+" (register)
|
||||
// but don't freak if it isn't, just assume "_"
|
||||
size_t ne = availExtras.size();
|
||||
while ( ! workingName.empty() ) {
|
||||
char c = workingName.data()[0]; // leading character
|
||||
if ( '_' == c || '+' == c ) workingName.erase(0,1); // and remove it
|
||||
G4int replaceExtra = ( c != '+' );
|
||||
G4int replaceExtra = (( c != '+' ) ? doReplace : 0 );
|
||||
G4String extraName = "";
|
||||
G4bool extraKnown = false;
|
||||
for (size_t ie=0; ie<ne; ++ie) {
|
||||
const G4String& testExtra = availExtras[ie];
|
||||
size_t ipos = workingName.find(testExtra);
|
||||
if ( ipos == 0 ) {
|
||||
if ( testExtra.size() > extraName.size() ) {
|
||||
extraName = testExtra;
|
||||
extraKnown = true;
|
||||
#ifdef G4VERBOSE
|
||||
if ( verb > 3 ) {
|
||||
G4cout << " physextra current best guess: "
|
||||
<< testExtra << G4endl;
|
||||
}
|
||||
} else {
|
||||
if ( verb > 3 ) {
|
||||
G4cout << " physextra match but shorter: "
|
||||
<< testExtra << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if ( verb > 3 ) {
|
||||
G4cout << " physextra reject: " << testExtra << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if ( verb > 2 ) {
|
||||
G4cout << " physextra " << name << " [" << workingName << "]"
|
||||
<<", extra known " << extraKnown
|
||||
<< " chosen extra \"" << extraName << "\""
|
||||
<< " replace " << replaceExtra << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
extraKnown = FindLongestMatch(workingName,"extNames",availExtras,extraName);
|
||||
if ( extraKnown ) {
|
||||
// physics mapping name is known, but is it actually linked to physics?
|
||||
//const issue// G4String pcname = physicsExtensions[extraName];
|
||||
std::map<G4String,G4String>::const_iterator itr =
|
||||
//const issue// G4String pcname = physicsExtensions[extraName];
|
||||
std::map<G4String,G4String>::const_iterator itr =
|
||||
physicsExtensions.find(extraName);
|
||||
G4String pcname = "";
|
||||
if ( itr != physicsExtensions.end() ) pcname = itr->second;
|
||||
bool realknown = physConstRegistry->IsKnownPhysicsConstructor(pcname);
|
||||
if ( ! realknown ) allKnown = false;
|
||||
#ifdef G4VERBOSE
|
||||
if ( verb > 2 ) {
|
||||
if ( verb > 2 ) {
|
||||
G4cout << " extraName \"" << extraName << "\" maps to physics ctor \""
|
||||
<< pcname << "\" which is itself realknown " << realknown
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
if ( ! realknown ) allKnown = false;
|
||||
} else {
|
||||
// perhaps it's an explicit physCtor name
|
||||
extraKnown =
|
||||
FindLongestMatch(workingName,"physCtors",availPhysCtors,extraName);
|
||||
if ( extraKnown ) replaceExtra |= isCtorName; // flag it
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if ( verb > 2 ) {
|
||||
G4cout << " physextra " << name << " [" << workingName << "]"
|
||||
<<", extra known " << extraKnown
|
||||
<< " chosen extra \"" << extraName << "\""
|
||||
<< " replace " << replaceExtra << G4endl;
|
||||
}
|
||||
#endif
|
||||
if ( extraKnown ) {
|
||||
physExt.push_back(extraName);
|
||||
replace.push_back(replaceExtra);
|
||||
// and remove it so we can look for the next bit
|
||||
workingName.erase(0,extraName.size());
|
||||
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if ( verb > 2 ) {
|
||||
G4cout << " workingName \"" << workingName << "\""
|
||||
if ( verb > 2 ) {
|
||||
G4cout << " workingName \"" << workingName << "\""
|
||||
<< " couldn't be found in the extensions list"
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -353,6 +331,43 @@ G4bool G4PhysListRegistry::DeconstructPhysListName(const G4String& name,
|
||||
return allKnown;
|
||||
}
|
||||
|
||||
G4bool G4PhysListRegistry::FindLongestMatch(const G4String& workingName,
|
||||
const G4String& searchName,
|
||||
const std::vector<G4String>& validNames,
|
||||
G4String& bestMatch,
|
||||
G4int verb) const
|
||||
{
|
||||
bestMatch = "";
|
||||
bool found = false;
|
||||
|
||||
size_t n = validNames.size();
|
||||
for (size_t i=0; i<n; ++i) {
|
||||
const G4String& testName = validNames[i];
|
||||
size_t ipos = workingName.find(testName);
|
||||
if ( ipos == 0 ) {
|
||||
if ( testName.size() > bestMatch.size() ) {
|
||||
bestMatch = testName;
|
||||
found = true;
|
||||
if ( verb > 3 ) {
|
||||
G4cout << " " << searchName << " current best guess: "
|
||||
<< testName << G4endl;
|
||||
}
|
||||
} else {
|
||||
if ( verb > 3 ) {
|
||||
G4cout << " " << searchName << " match but shorter: "
|
||||
<< testName << G4endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( verb > 3 ) {
|
||||
G4cout << " " << searchName << " reject: " << testName << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<G4String>& G4PhysListRegistry::AvailablePhysLists() const
|
||||
{
|
||||
availBasePhysLists.clear();
|
||||
@@ -378,7 +393,7 @@ const std::vector<G4String>& G4PhysListRegistry::AvailablePhysicsExtensions() co
|
||||
const std::vector<G4String>& G4PhysListRegistry::AvailablePhysListsEM() const
|
||||
{
|
||||
// in principle this method could weed out all the extensions that aren't
|
||||
// EM replacements ... but for now just use it as a synonym for
|
||||
// EM replacements ... but for now just use it as a synonym for
|
||||
// AvailablePhysicsExtensions()
|
||||
return AvailablePhysicsExtensions();
|
||||
}
|
||||
@@ -414,4 +429,3 @@ void G4PhysListRegistry::PrintAvailablePhysLists() const
|
||||
<< " to use ReplacePhysics() (\"_\") or RegisterPhysics() (\"+\")."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user