53#include <unordered_set>
58#define G4MT_theMessenger \
59 ((this->subInstanceManager.offset[this->g4vuplInstanceID])._theMessenger)
60#define G4MT_thePLHelper \
61 ((this->subInstanceManager.offset[this->g4vuplInstanceID])._thePLHelper)
62#define fIsPhysicsTableBuilt \
63 ((this->subInstanceManager.offset[this->g4vuplInstanceID]) \
64 ._fIsPhysicsTableBuilt)
65#define fDisplayThreshold \
66 ((this->subInstanceManager.offset[this->g4vuplInstanceID])._fDisplayThreshold)
67#define theParticleIterator \
68 ((this->subInstanceManager.offset[this->g4vuplInstanceID]) \
69 ._theParticleIterator)
149 : verboseLevel(right.verboseLevel)
150 , defaultCutValue(right.defaultCutValue)
151 , isSetDefaultCutValue(right.isSetDefaultCutValue)
152 , fRetrievePhysicsTable(right.fRetrievePhysicsTable)
153 , fStoredInAscii(right.fStoredInAscii)
154 , fIsCheckedForRetrievePhysicsTable(right.fIsCheckedForRetrievePhysicsTable)
155 , fIsRestoredCutValues(right.fIsRestoredCutValues)
156 , directoryPhysicsTable(right.directoryPhysicsTable)
157 , fDisableCheckParticleList(right.fDisableCheckParticleList)
175 ._fIsPhysicsTableBuilt;
197 ._fIsPhysicsTableBuilt;
210 if(newParticle ==
nullptr)
212 G4Exception(
"G4VUserPhysicsList::AddProcessManager",
"Run0252",
221#ifdef G4MULTITHREADED
222 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
223 G4ParticleTable::lockCount()++;
235 if(pmanager ==
nullptr)
245 G4cout <<
"G4VUserPhysicsList::InitializeProcessManager: creating "
267 G4cout <<
"G4VUserPhysicsList::InitializeProcessManager: copying "
277#ifdef G4MULTITHREADED
287#ifdef G4MULTITHREADED
288 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
289 G4ParticleTable::lockCount()++;
304 if(pmanager !=
nullptr)
309 G4cout <<
"G4VUserPhysicsList::RemoveProcessManager: ";
310 G4cout <<
"remove ProcessManager from ";
320#ifdef G4MULTITHREADED
330 std::unordered_set<G4VTrackingManager *> trackingManagers;
342 G4cout <<
"G4VUserPhysicsList::RemoveTrackingManager: ";
343 G4cout <<
"remove TrackingManager from ";
347 trackingManagers.insert(trackingManager);
394 G4cout <<
"G4VUserPhysicsList::SetDefaultCutValue: negative cut values"
395 <<
" :" << value / mm <<
"[mm]" <<
G4endl;
413 G4cout <<
"G4VUserPhysicsList::SetDefaultCutValue:"
429 G4cout <<
"G4VUserPhysicsList::GetCutValue "
430 <<
" : No Default Region " <<
G4endl;
434 "No Default Region");
453 if(region !=
nullptr)
463 G4cout <<
"G4VUserPhysicsList::SetCutValue "
464 <<
" : No Region of " << rname <<
G4endl;
505 G4cout <<
"G4VUserPhysicsList::SetParticleCuts: negative cut values"
506 <<
" :" << cut / mm <<
"[mm]"
507 <<
" for " << particleName <<
G4endl;
515 if(region ==
nullptr)
523 G4cout <<
"G4VUserPhysicsList::SetParticleCuts "
524 <<
" : No Default Region " <<
G4endl;
527 G4Exception(
"G4VUserPhysicsList::SetParticleCuts ",
"Run0254",
531 region = world_region;
540 if(region != world_region &&
542 ->GetDefaultProductionCuts())
547 ->GetDefaultProductionCuts()));
554 G4cout <<
"G4VUserPhysicsList::SetParticleCuts: "
555 <<
" :" << cut / mm <<
"[mm]"
556 <<
" for " << particleName <<
G4endl;
583 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable"
584 <<
" Retrieve Cut Table failed !!" <<
G4endl;
587 G4Exception(
"G4VUserPhysicsList::BuildPhysicsTable",
"Run0255",
595 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable"
596 <<
" Retrieve Cut Table successfully " <<
G4endl;
606 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable"
607 <<
" does not retrieve Cut Table but calculate " <<
G4endl;
632 if(particle != GammaP && particle != EMinusP && particle != EPlusP &&
651 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable "
653 <<
" via custom TrackingManager" <<
G4endl;
656 trackingManager->BuildPhysicsTable(*particle);
667 <<
"#### G4VUserPhysicsList::BuildPhysicsTable() - BuildPhysicsTable("
680 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable "
681 <<
"Physics table can not be retrieved and will be calculated "
692 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable "
705 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable "
715 if(pManager ==
nullptr)
720 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable "
724 <<
" should be created in your PhysicsList" <<
G4endl;
727 G4Exception(
"G4VUserPhysicsList::BuildPhysicsTable",
"Run0271",
736 if(pVector ==
nullptr)
741 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable "
746 G4Exception(
"G4VUserPhysicsList::BuildPhysicsTable",
"Run0272",
753 G4cout <<
"G4VUserPhysicsList::BuildPhysicsTable %%%%%% "
755 G4cout <<
" ProcessManager : " << pManager
756 <<
" ProcessManagerShadow : " << pManagerShadow <<
G4endl;
759 G4cout <<
" " << iv1 <<
" - " << (*pVector)[iv1]->GetProcessName()
762 G4cout <<
"--------------------------------------------------------------"
768 G4cout <<
" " << iv2 <<
" - "
769 << (*pVectorShadow)[iv2]->GetProcessName() <<
G4endl;
779 if(pManagerShadow == pManager)
781 (*pVector)[j]->BuildPhysicsTable(*particle);
785 (*pVector)[j]->BuildWorkerPhysicsTable(*particle);
797 trackingManager->PreparePhysicsTable(*particle);
810 if(pManager ==
nullptr)
815 G4cout <<
"G4VUserPhysicsList::PreparePhysicsTable "
819 <<
" should be created in your PhysicsList" <<
G4endl;
822 G4Exception(
"G4VUserPhysicsList::PreparePhysicsTable",
"Run0273",
831 if(pVector ==
nullptr)
836 G4cout <<
"G4VUserPhysicsList::PreparePhysicsTable "
841 G4Exception(
"G4VUserPhysicsList::PreparePhysicsTable",
"Run0274",
851 if(pManagerShadow == pManager)
853 (*pVector)[j]->PreparePhysicsTable(*particle);
857 (*pVector)[j]->PrepareWorkerPhysicsTable(*particle);
884 G4cout <<
"G4VUserPhysicsList::BuildIntegralPhysicsTable "
885 <<
" BuildPhysicsTable is invoked for "
944 "Fail to store Cut Table");
950 G4cout <<
"G4VUserPhysicsList::StorePhysicsTable "
951 <<
" Store material and cut values successfully" <<
G4endl;
967 if(!(*pVector)[j]->StorePhysicsTable(particle, dir, ascii))
969 G4String comment =
"Fail to store physics table for ";
970 comment += (*pVector)[j]->GetProcessName();
972 G4Exception(
"G4VUserPhysicsList::StorePhysicsTable",
"Run0282",
987 if(!directory.empty())
1006 (*pVector)[j]->RetrievePhysicsTable(particle, directory, ascii);
1013 G4cout <<
"G4VUserPhysicsList::RetrievePhysicsTable "
1014 <<
" Fail to retrieve Physics Table for "
1015 << (*pVector)[j]->GetProcessName() <<
G4endl;
1020 (*pVector)[j]->BuildPhysicsTable(*particle);
1037 G4cout <<
"G4VUserPhysicsList::SetApplyCuts for " << name <<
G4endl;
1107 G4cout <<
"G4VUserPhysicsList::SetVerboseLevel :"
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4MUTEXLOCK(mutex)
#define G4MUTEXUNLOCK(mutex)
#define G4MT_theMessenger
#define theParticleIterator
#define fIsPhysicsTableBuilt
#define fDisplayThreshold
G4GLOB_DLL std::ostream G4cout
static G4PART_DLL G4int & slavetotalspace()
G4int GetInstanceID() const
G4ProcessManager * GetProcessManager() const
G4VTrackingManager * GetTrackingManager() const
void SetMasterProcessManager(G4ProcessManager *aNewPM)
G4bool IsGeneralIon() const
void SetTrackingManager(G4VTrackingManager *aTrackingManager)
G4bool IsShortLived() const
G4ProcessManager * GetMasterProcessManager() const
void SetApplyCutsFlag(G4bool)
G4bool GetApplyCutsFlag() const
const G4String & GetParticleName() const
void SetProcessManager(G4ProcessManager *aProcessManager)
const G4String & GetParticleSubType() const
G4PTblDicIterator * GetIterator() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
void DeleteAllParticles()
G4ParticleDefinition * GetGenericIon() const
static G4PhysicsListHelper * GetPhysicsListHelper()
G4ProcessVector * GetProcessList() const
G4bool RetrieveCutsTable(const G4String &directory, G4bool ascii=false)
void SetVerboseLevel(G4int value)
G4bool StoreCutsTable(const G4String &directory, G4bool ascii=false)
void SetEnergyRange(G4double lowedge, G4double highedge)
static G4ProductionCutsTable * GetProductionCutsTable()
void SetProductionCut(G4double cut, G4int index)
G4double GetProductionCut(G4int index) const
static G4RegionStore * GetInstance()
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
G4ProductionCuts * GetProductionCuts() const
void SetProductionCuts(G4ProductionCuts *cut)
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
const G4String & GetProcessName() const
G4bool _fIsPhysicsTableBuilt
G4ParticleTable::G4PTblDicIterator * _theParticleIterator
G4PhysicsListHelper * _thePLHelper
G4UserPhysicsListMessenger * _theMessenger
G4RUN_DLL G4ThreadLocalStatic T * offset
G4int CreateSubInstance()
G4double GetCutValue(const G4String &pname) const
void SetDefaultCutValue(G4double newCutValue)
void SetPhysicsTableRetrieved(const G4String &directory="")
G4VUserPhysicsList & operator=(const G4VUserPhysicsList &)
void PreparePhysicsTable(G4ParticleDefinition *)
virtual void TerminateWorker()
void SetCutValue(G4double aCut, const G4String &pname)
G4bool RegisterProcess(G4VProcess *process, G4ParticleDefinition *particle)
void UseCoupledTransportation(G4bool vl=true)
void SetCutsForRegion(G4double aCut, const G4String &rname)
G4bool fDisableCheckParticleList
G4ProductionCutsTable * fCutsTable
void AddProcessManager(G4ParticleDefinition *newParticle, G4ProcessManager *newManager=nullptr)
G4bool fIsRestoredCutValues
void RemoveTrackingManager()
void DumpCutValuesTableIfRequested()
G4bool StorePhysicsTable(const G4String &directory=".")
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
G4ParticleTable * theParticleTable
G4String directoryPhysicsTable
void SetVerboseLevel(G4int value)
G4bool fRetrievePhysicsTable
void SetApplyCuts(G4bool value, const G4String &name)
G4bool isSetDefaultCutValue
virtual void RetrievePhysicsTable(G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)
G4bool fIsCheckedForRetrievePhysicsTable
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=nullptr)
void DumpCutValuesTable(G4int flag=1)
G4bool GetApplyCuts(const G4String &name) const
static G4RUN_DLL G4VUPLManager subInstanceManager
virtual ~G4VUserPhysicsList()
void SetCutsWithDefault()
void BuildIntegralPhysicsTable(G4VProcess *, G4ParticleDefinition *)
G4int GetInstanceID() const
void RemoveProcessManager()
virtual void InitializeWorker()
static const G4VUPLManager & GetSubInstanceManager()
void InitializeProcessManager()