Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VUserPhysicsList Class Referenceabstract

#include <G4VUserPhysicsList.hh>

+ Inheritance diagram for G4VUserPhysicsList:

Public Member Functions

 G4VUserPhysicsList ()
 
virtual ~G4VUserPhysicsList ()
 
 G4VUserPhysicsList (const G4VUserPhysicsList &)
 
G4VUserPhysicsListoperator= (const G4VUserPhysicsList &)
 
virtual void ConstructParticle ()=0
 
void Construct ()
 
virtual void ConstructProcess ()=0
 
void UseCoupledTransportation (G4bool vl=true)
 
virtual void SetCuts ()
 
void SetDefaultCutValue (G4double newCutValue)
 
G4double GetDefaultCutValue () const
 
void BuildPhysicsTable ()
 
void PreparePhysicsTable (G4ParticleDefinition *)
 
void BuildPhysicsTable (G4ParticleDefinition *)
 
G4bool StorePhysicsTable (const G4String &directory=".")
 
G4bool IsPhysicsTableRetrieved () const
 
G4bool IsStoredInAscii () const
 
const G4StringGetPhysicsTableDirectory () const
 
void SetPhysicsTableRetrieved (const G4String &directory="")
 
void SetStoredInAscii ()
 
void ResetPhysicsTableRetrieved ()
 
void ResetStoredInAscii ()
 
void DumpList () const
 
void DumpCutValuesTable (G4int flag=1)
 
void DumpCutValuesTableIfRequested ()
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
void SetCutsWithDefault ()
 
void SetCutValue (G4double aCut, const G4String &pname)
 
G4double GetCutValue (const G4String &pname) const
 
void SetCutValue (G4double aCut, const G4String &pname, const G4String &rname)
 
void SetParticleCuts (G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
 
void SetParticleCuts (G4double cut, const G4String &particleName, G4Region *region=0)
 
void SetCutsForRegion (G4double aCut, const G4String &rname)
 
void ResetCuts ()
 obsolete methods
 
void SetApplyCuts (G4bool value, const G4String &name)
 
G4bool GetApplyCuts (const G4String &name) const
 
void RemoveProcessManager ()
 
void AddProcessManager (G4ParticleDefinition *newParticle, G4ProcessManager *newManager=0)
 
void CheckParticleList ()
 
void DisableCheckParticleList ()
 
G4int GetInstanceID () const
 
virtual void InitializeWorker ()
 
virtual void TerminateWorker ()
 

Static Public Member Functions

static const G4VUPLManagerGetSubInstanceManager ()
 

Protected Member Functions

void AddTransportation ()
 
G4bool RegisterProcess (G4VProcess *process, G4ParticleDefinition *particle)
 
void BuildIntegralPhysicsTable (G4VProcess *, G4ParticleDefinition *)
 
virtual void RetrievePhysicsTable (G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)
 
void InitializeProcessManager ()
 
G4ParticleTable::G4PTblDicIteratorGetParticleIterator () const
 

Protected Attributes

G4ParticleTabletheParticleTable
 
G4int verboseLevel
 
G4double defaultCutValue
 
G4bool isSetDefaultCutValue
 
G4ProductionCutsTablefCutsTable
 
G4bool fRetrievePhysicsTable
 
G4bool fStoredInAscii
 
G4bool fIsCheckedForRetrievePhysicsTable
 
G4bool fIsRestoredCutValues
 
G4String directoryPhysicsTable
 
G4bool fDisableCheckParticleList
 
G4int g4vuplInstanceID
 

Static Protected Attributes

static G4RUN_DLL G4VUPLManager subInstanceManager
 

Detailed Description

Definition at line 157 of file G4VUserPhysicsList.hh.

Constructor & Destructor Documentation

◆ G4VUserPhysicsList() [1/2]

G4VUserPhysicsList::G4VUserPhysicsList ( )

Definition at line 108 of file G4VUserPhysicsList.cc.

109 : verboseLevel(1)
110 , defaultCutValue(1.0 * mm)
111 , isSetDefaultCutValue(false)
112 , fRetrievePhysicsTable(false)
113 , fStoredInAscii(true)
115 , fIsRestoredCutValues(false)
117 ,
118 // fDisplayThreshold(0),
119 // fIsPhysicsTableBuilt(false),
121{
123 // default cut value (1.0mm)
124 defaultCutValue = 1.0 * mm;
125
126 // pointer to the particle table
128 // theParticleIterator = theParticleTable->GetIterator();
129
130 // pointer to the cuts table
132
133 // set energy range for SetCut calcuration
134 fCutsTable->SetEnergyRange(0.99 * keV, 100 * TeV);
135
136 // UI Messenger
137 // theMessenger = new G4UserPhysicsListMessenger(this);
139
140 // PhysicsListHelper
141 // thePLHelper = G4PhysicsListHelper::GetPhysicsListHelper();
142 // thePLHelper->SetVerboseLevel(verboseLevel);
143 // G4MT_thePLHelper = G4PhysicsListHelper::GetPhysicsListHelper(); //AND
144 G4MT_thePLHelper->SetVerboseLevel(verboseLevel); // AND
145
146 fIsPhysicsTableBuilt = false;
148}
#define G4MT_theMessenger
#define G4MT_thePLHelper
#define fIsPhysicsTableBuilt
#define fDisplayThreshold
static G4ParticleTable * GetParticleTable()
void SetEnergyRange(G4double lowedge, G4double highedge)
static G4ProductionCutsTable * GetProductionCutsTable()
G4int CreateSubInstance()
G4ProductionCutsTable * fCutsTable
G4ParticleTable * theParticleTable
G4bool fIsCheckedForRetrievePhysicsTable
static G4RUN_DLL G4VUPLManager subInstanceManager

◆ ~G4VUserPhysicsList()

G4VUserPhysicsList::~G4VUserPhysicsList ( )
virtual

Definition at line 165 of file G4VUserPhysicsList.cc.

166{
167 if(G4MT_theMessenger != 0)
168 {
169 delete G4MT_theMessenger;
171 }
173
174 // invoke DeleteAllParticle
176}

◆ G4VUserPhysicsList() [2/2]

G4VUserPhysicsList::G4VUserPhysicsList ( const G4VUserPhysicsList right)

Definition at line 179 of file G4VUserPhysicsList.cc.

188 ,
189 // fDisplayThreshold(right.fDisplayThreshold),
190 // fIsPhysicsTableBuilt(right.fIsPhysicsTableBuilt),
192{
194 // pointer to the particle table
197 // pointer to the cuts table
199
200 // UI Messenger
201 // theMessenger = new G4UserPhysicsListMessenger(this);
203
204 // PhysicsListHelper
205 // thePLHelper = G4PhysicsListHelper::GetPhysicsListHelper();
206 // thePLHelper->SetVerboseLevel(verboseLevel);
208 G4MT_thePLHelper->SetVerboseLevel(verboseLevel); // AND
209
211 .offset[right.GetInstanceID()]
212 ._fIsPhysicsTableBuilt;
214 .offset[right.GetInstanceID()]
215 ._fDisplayThreshold;
216}
#define theParticleIterator
G4PTblDicIterator * GetIterator() const
static G4PhysicsListHelper * GetPhysicsListHelper()
G4RUN_DLL G4ThreadLocalStatic T * offset
G4int GetInstanceID() const
static const G4VUPLManager & GetSubInstanceManager()

Member Function Documentation

◆ AddProcessManager()

void G4VUserPhysicsList::AddProcessManager ( G4ParticleDefinition newParticle,
G4ProcessManager newManager = 0 
)

Definition at line 246 of file G4VUserPhysicsList.cc.

248{
249 if(newParticle == 0)
250 return;
251 G4Exception("G4VUserPhysicsList::AddProcessManager", "Run0252", JustWarning,
252 "This method is obsolete");
253}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ AddTransportation()

void G4VUserPhysicsList::AddTransportation ( )
protected

Definition at line 1063 of file G4VUserPhysicsList.cc.

1064{
1065 G4MT_thePLHelper->AddTransportation();
1066}

Referenced by LBE::AddTransportation(), and G4VModularPhysicsList::ConstructProcess().

◆ BuildIntegralPhysicsTable()

void G4VUserPhysicsList::BuildIntegralPhysicsTable ( G4VProcess process,
G4ParticleDefinition particle 
)
protected

Definition at line 858 of file G4VUserPhysicsList.cc.

860{
861 //*********************************************************************
862 // temporary addition to make the integral schema of electromagnetic
863 // processes work.
864 //
865
866 if((process->GetProcessName() == "Imsc") ||
867 (process->GetProcessName() == "IeIoni") ||
868 (process->GetProcessName() == "IeBrems") ||
869 (process->GetProcessName() == "Iannihil") ||
870 (process->GetProcessName() == "IhIoni") ||
871 (process->GetProcessName() == "IMuIoni") ||
872 (process->GetProcessName() == "IMuBrems") ||
873 (process->GetProcessName() == "IMuPairProd"))
874 {
875#ifdef G4VERBOSE
876 if(verboseLevel > 2)
877 {
878 G4cout << "G4VUserPhysicsList::BuildIntegralPhysicsTable "
879 << " BuildPhysicsTable is invoked for "
880 << process->GetProcessName() << "(" << particle->GetParticleName()
881 << ")" << G4endl;
882 }
883#endif
884 process->BuildPhysicsTable(*particle);
885 }
886}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4String & GetParticleName() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:187
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382

Referenced by RetrievePhysicsTable().

◆ BuildPhysicsTable() [1/2]

void G4VUserPhysicsList::BuildPhysicsTable ( )

Definition at line 575 of file G4VUserPhysicsList.cc.

576{
577 // Prepare Physics table for all particles
578 theParticleIterator->reset();
579 while((*theParticleIterator)())
580 {
581 G4ParticleDefinition* particle = theParticleIterator->value();
582 PreparePhysicsTable(particle);
583 }
584
585 // ask processes to prepare physics table
587 {
590 // check if retrieve Cut Table successfully
592 {
593#ifdef G4VERBOSE
594 if(verboseLevel > 0)
595 {
596 G4cout << "G4VUserPhysicsList::BuildPhysicsTable"
597 << " Retrieve Cut Table failed !!" << G4endl;
598 }
599#endif
600 G4Exception("G4VUserPhysicsList::BuildPhysicsTable", "Run0255",
601 RunMustBeAborted, "Fail to retrieve Production Cut Table");
602 }
603 else
604 {
605#ifdef G4VERBOSE
606 if(verboseLevel > 2)
607 {
608 G4cout << "G4VUserPhysicsList::BuildPhysicsTable"
609 << " Retrieve Cut Table successfully " << G4endl;
610 }
611#endif
612 }
613 }
614 else
615 {
616#ifdef G4VERBOSE
617 if(verboseLevel > 2)
618 {
619 G4cout << "G4VUserPhysicsList::BuildPhysicsTable"
620 << " does not retrieve Cut Table but calculate " << G4endl;
621 }
622#endif
623 }
624
625 // Sets a value to particle
626 // set cut values for gamma at first and for e- and e+
627 G4String particleName;
629 if(GammaP)
630 BuildPhysicsTable(GammaP);
632 if(EMinusP)
633 BuildPhysicsTable(EMinusP);
635 if(EPlusP)
636 BuildPhysicsTable(EPlusP);
638 if(ProtonP)
639 BuildPhysicsTable(ProtonP);
640
641 theParticleIterator->reset();
642 while((*theParticleIterator)())
643 {
644 G4ParticleDefinition* particle = theParticleIterator->value();
645 if(particle != GammaP && particle != EMinusP && particle != EPlusP &&
646 particle != ProtonP)
647 {
648 BuildPhysicsTable(particle);
649 }
650 }
651
652 // Set flag
654}
@ RunMustBeAborted
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4bool RetrieveCutsTable(const G4String &directory, G4bool ascii=false)
void PreparePhysicsTable(G4ParticleDefinition *)

Referenced by BuildPhysicsTable(), G4RunManagerKernel::BuildPhysicsTables(), and G4UserPhysicsListMessenger::SetNewValue().

◆ BuildPhysicsTable() [2/2]

void G4VUserPhysicsList::BuildPhysicsTable ( G4ParticleDefinition particle)

Definition at line 657 of file G4VUserPhysicsList.cc.

658{
659 if(!(particle->GetMasterProcessManager()))
660 {
661 G4cout
662 << "#### G4VUserPhysicsList::BuildPhysicsTable() - BuildPhysicsTable("
663 << particle->GetParticleName() << ") skipped..." << G4endl;
664 return;
665 }
667 {
669 {
670 // fail to retrieve cut tables
671#ifdef G4VERBOSE
672 if(verboseLevel > 0)
673 {
674 G4cout << "G4VUserPhysicsList::BuildPhysicsTable "
675 << "Physics table can not be retrieved and will be calculated "
676 << G4endl;
677 }
678#endif
679 fRetrievePhysicsTable = false;
680 }
681 else
682 {
683#ifdef G4VERBOSE
684 if(verboseLevel > 2)
685 {
686 G4cout << "G4VUserPhysicsList::BuildPhysicsTable "
687 << " Retrieve Physics Table for " << particle->GetParticleName()
688 << G4endl;
689 }
690#endif
691 // Retrieve PhysicsTable from files for proccesses
693 }
694 }
695
696#ifdef G4VERBOSE
697 if(verboseLevel > 2)
698 {
699 G4cout << "G4VUserPhysicsList::BuildPhysicsTable "
700 << "Calculate Physics Table for " << particle->GetParticleName()
701 << G4endl;
702 }
703#endif
704 // Rebuild the physics tables for every process for this particle type
705 // if particle is not ShortLived
706 if(!particle->IsShortLived())
707 {
708 G4ProcessManager* pManager = particle->GetProcessManager();
709 if(!pManager)
710 {
711#ifdef G4VERBOSE
712 if(verboseLevel > 0)
713 {
714 G4cout << "G4VUserPhysicsList::BuildPhysicsTable "
715 << " : No Process Manager for " << particle->GetParticleName()
716 << G4endl;
717 G4cout << particle->GetParticleName()
718 << " should be created in your PhysicsList" << G4endl;
719 }
720#endif
721 G4Exception("G4VUserPhysicsList::BuildPhysicsTable", "Run0271",
722 FatalException, "No process manager");
723 return;
724 }
725
726 // Get processes from master thread;
727 G4ProcessManager* pManagerShadow = particle->GetMasterProcessManager();
728
729 G4ProcessVector* pVector = pManager->GetProcessList();
730 if(!pVector)
731 {
732#ifdef G4VERBOSE
733 if(verboseLevel > 0)
734 {
735 G4cout << "G4VUserPhysicsList::BuildPhysicsTable "
736 << " : No Process Vector for " << particle->GetParticleName()
737 << G4endl;
738 }
739#endif
740 G4Exception("G4VUserPhysicsList::BuildPhysicsTable", "Run0272",
741 FatalException, "No process Vector");
742 return;
743 }
744#ifdef G4VERBOSE
745 if(verboseLevel > 2)
746 {
747 G4cout << "G4VUserPhysicsList::BuildPhysicsTable %%%%%% "
748 << particle->GetParticleName() << G4endl;
749 G4cout << " ProcessManager : " << pManager
750 << " ProcessManagerShadow : " << pManagerShadow << G4endl;
751 for(std::size_t iv1 = 0; iv1 < pVector->size(); ++iv1)
752 {
753 G4cout << " " << iv1 << " - " << (*pVector)[iv1]->GetProcessName()
754 << G4endl;
755 }
756 G4cout << "--------------------------------------------------------------"
757 << G4endl;
758 G4ProcessVector* pVectorShadow = pManagerShadow->GetProcessList();
759
760 for(std::size_t iv2 = 0; iv2 < pVectorShadow->size(); ++iv2)
761 {
762 G4cout << " " << iv2 << " - "
763 << (*pVectorShadow)[iv2]->GetProcessName() << G4endl;
764 }
765 }
766#endif
767 for(std::size_t j = 0; j < pVector->size(); ++j)
768 {
769 // Andrea July 16th 2013 : migration to new interface...
770 // Infer if we are in a worker thread or master thread
771 // Master thread is the one in which the process manager
772 // and process manager shadow pointers are the same
773 if(pManagerShadow == pManager)
774 {
775 (*pVector)[j]->BuildPhysicsTable(*particle);
776 }
777 else
778 {
779 (*pVector)[j]->BuildWorkerPhysicsTable(*particle);
780 }
781
782 } // End loop on processes vector
783 } // End if short-lived
784}
@ FatalException
G4ProcessManager * GetProcessManager() const
G4ProcessManager * GetMasterProcessManager() const
G4ProcessVector * GetProcessList() const
std::size_t size() const
virtual void RetrievePhysicsTable(G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)

◆ CheckParticleList()

void G4VUserPhysicsList::CheckParticleList ( )

Definition at line 1054 of file G4VUserPhysicsList.cc.

1055{
1057 {
1058 G4MT_thePLHelper->CheckParticleList();
1059 }
1060}

Referenced by G4RunManagerKernel::InitializePhysics().

◆ Construct()

void G4VUserPhysicsList::Construct ( )
inline

Definition at line 412 of file G4VUserPhysicsList.hh.

413{
414#ifdef G4VERBOSE
415 if(verboseLevel > 1)
416 G4cout << "G4VUserPhysicsList::Construct()" << G4endl;
417#endif
418
420
421#ifdef G4VERBOSE
422 if(verboseLevel > 1)
423 G4cout << "Construct processes " << G4endl;
424#endif
426}
virtual void ConstructProcess()=0

Referenced by G4RunManagerKernel::InitializePhysics().

◆ ConstructParticle()

virtual void G4VUserPhysicsList::ConstructParticle ( )
pure virtual

◆ ConstructProcess()

virtual void G4VUserPhysicsList::ConstructProcess ( )
pure virtual

Implemented in G4ErrorPhysicsList, LBE, and G4VModularPhysicsList.

Referenced by Construct().

◆ DisableCheckParticleList()

void G4VUserPhysicsList::DisableCheckParticleList ( )
inline

Definition at line 464 of file G4VUserPhysicsList.hh.

465{
467}

◆ DumpCutValuesTable()

void G4VUserPhysicsList::DumpCutValuesTable ( G4int  flag = 1)

◆ DumpCutValuesTableIfRequested()

void G4VUserPhysicsList::DumpCutValuesTableIfRequested ( )

◆ DumpList()

void G4VUserPhysicsList::DumpList ( ) const

Definition at line 889 of file G4VUserPhysicsList.cc.

890{
891 theParticleIterator->reset();
892 G4int idx = 0;
893 while((*theParticleIterator)())
894 {
895 G4ParticleDefinition* particle = theParticleIterator->value();
896 G4cout << particle->GetParticleName();
897 if((idx++ % 4) == 3)
898 {
899 G4cout << G4endl;
900 }
901 else
902 {
903 G4cout << ", ";
904 }
905 }
906 G4cout << G4endl;
907}
int G4int
Definition: G4Types.hh:85

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ GetApplyCuts()

G4bool G4VUserPhysicsList::GetApplyCuts ( const G4String name) const

Definition at line 1048 of file G4VUserPhysicsList.cc.

1049{
1051}
G4bool GetApplyCutsFlag() const

◆ GetCutValue()

G4double G4VUserPhysicsList::GetCutValue ( const G4String pname) const

Definition at line 434 of file G4VUserPhysicsList.cc.

435{
436 size_t nReg = (G4RegionStore::GetInstance())->size();
437 if(nReg == 0)
438 {
439#ifdef G4VERBOSE
440 if(verboseLevel > 0)
441 {
442 G4cout << "G4VUserPhysicsList::GetCutValue "
443 << " : No Default Region " << G4endl;
444 }
445#endif
446 G4Exception("G4VUserPhysicsList::GetCutValue", "Run0253", FatalException,
447 "No Default Region");
448 return -1. * mm;
449 }
450 G4Region* region =
451 G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld", false);
452 return region->GetProductionCuts()->GetProductionCut(name);
453}
G4double GetProductionCut(G4int index) const
static G4RegionStore * GetInstance()
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
G4ProductionCuts * GetProductionCuts() const

Referenced by SetCuts(), and G4UserPhysicsListMessenger::SetNewValue().

◆ GetDefaultCutValue()

G4double G4VUserPhysicsList::GetDefaultCutValue ( ) const
inline

Definition at line 428 of file G4VUserPhysicsList.hh.

429{
430 return defaultCutValue;
431}

Referenced by G4UserPhysicsListMessenger::GetCurrentValue().

◆ GetInstanceID()

G4int G4VUserPhysicsList::GetInstanceID ( ) const
inline

Definition at line 469 of file G4VUserPhysicsList.hh.

470{
471 return g4vuplInstanceID;
472}

Referenced by G4VUserPhysicsList(), and operator=().

◆ GetParticleIterator()

G4ParticleTable::G4PTblDicIterator * G4VUserPhysicsList::GetParticleIterator ( ) const
protected

Definition at line 1082 of file G4VUserPhysicsList.cc.

1084{
1085 return (subInstanceManager.offset[g4vuplInstanceID])._theParticleIterator;
1086}

Referenced by G4ErrorPhysicsList::ConstructEM(), and G4ErrorPhysicsList::ConstructProcess().

◆ GetPhysicsTableDirectory()

const G4String & G4VUserPhysicsList::GetPhysicsTableDirectory ( ) const
inline

Definition at line 448 of file G4VUserPhysicsList.hh.

449{
451}

Referenced by G4UserPhysicsListMessenger::GetCurrentValue().

◆ GetSubInstanceManager()

const G4VUPLManager & G4VUserPhysicsList::GetSubInstanceManager ( )
inlinestatic

◆ GetVerboseLevel()

G4int G4VUserPhysicsList::GetVerboseLevel ( ) const
inline

Definition at line 433 of file G4VUserPhysicsList.hh.

434{
435 return verboseLevel;
436}

Referenced by G4UserPhysicsListMessenger::GetCurrentValue().

◆ InitializeProcessManager()

void G4VUserPhysicsList::InitializeProcessManager ( )
protected

Definition at line 256 of file G4VUserPhysicsList.cc.

257{
258 // Request lock for particle table accesses. Some changes are inside
259 // this critical region.
260#ifdef G4MULTITHREADED
261 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
262 G4ParticleTable::lockCount()++;
263#endif
266
267 // loop over all particles in G4ParticleTable
268 theParticleIterator->reset();
269 while((*theParticleIterator)())
270 {
271 G4ParticleDefinition* particle = theParticleIterator->value();
272 G4ProcessManager* pmanager = particle->GetProcessManager();
273
274 if(pmanager == 0)
275 {
276 // create process manager if the particle does not have its own.
277 pmanager = new G4ProcessManager(particle);
278 particle->SetProcessManager(pmanager);
279 if(particle->GetMasterProcessManager() == 0)
280 particle->SetMasterProcessManager(pmanager);
281#ifdef G4VERBOSE
282 if(verboseLevel > 2)
283 {
284 G4cout << "G4VUserPhysicsList::InitializeProcessManager: creating "
285 "ProcessManager to "
286 << particle->GetParticleName() << G4endl;
287 }
288#endif
289 }
290 }
291
292 if(gion)
293 {
294 G4ProcessManager* gionPM = gion->GetProcessManager();
295 // loop over all particles once again (this time, with all general ions)
296 theParticleIterator->reset(false);
297 while((*theParticleIterator)())
298 {
299 G4ParticleDefinition* particle = theParticleIterator->value();
300 if(particle->IsGeneralIon())
301 {
302 particle->SetProcessManager(gionPM);
303#ifdef G4VERBOSE
304 if(verboseLevel > 2)
305 {
306 G4cout << "G4VUserPhysicsList::InitializeProcessManager: copying "
307 "ProcessManager to "
308 << particle->GetParticleName() << G4endl;
309 }
310#endif
311 }
312 }
313 }
314
315 // release lock for particle table accesses.
316#ifdef G4MULTITHREADED
317 G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex());
318#endif
319 // G4cout << "Particle table is released by
320 // G4VUserPhysicsList::InitializeProcessManager" << G4endl;
321}
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
void SetMasterProcessManager(G4ProcessManager *aNewPM)
G4bool IsGeneralIon() const
void SetProcessManager(G4ProcessManager *aProcessManager)
G4ParticleDefinition * GetGenericIon() const

Referenced by Construct().

◆ InitializeWorker()

void G4VUserPhysicsList::InitializeWorker ( )
virtual

Definition at line 150 of file G4VUserPhysicsList.cc.

151{
152 // Remember messengers are per-thread, so this needs to be done by each worker
153 // and due to the presence of "this" cannot be done in
154 // G4VUPLData::initialize()
156}

Referenced by G4WorkerRunManager::SetUserInitialization().

◆ IsPhysicsTableRetrieved()

G4bool G4VUserPhysicsList::IsPhysicsTableRetrieved ( ) const
inline

Definition at line 438 of file G4VUserPhysicsList.hh.

439{
441}

Referenced by G4UserPhysicsListMessenger::GetCurrentValue().

◆ IsStoredInAscii()

G4bool G4VUserPhysicsList::IsStoredInAscii ( ) const
inline

Definition at line 443 of file G4VUserPhysicsList.hh.

444{
445 return fStoredInAscii;
446}

Referenced by G4UserPhysicsListMessenger::GetCurrentValue().

◆ operator=()

G4VUserPhysicsList & G4VUserPhysicsList::operator= ( const G4VUserPhysicsList right)

Definition at line 219 of file G4VUserPhysicsList.cc.

221{
222 if(this != &right)
223 {
232 // fDisplayThreshold = right.fDisplayThreshold;
234 .offset[right.GetInstanceID()]
235 ._fIsPhysicsTableBuilt;
237 .offset[right.GetInstanceID()]
238 ._fDisplayThreshold;
239 // fIsPhysicsTableBuilt = right.fIsPhysicsTableBuilt;
241 }
242 return *this;
243}

◆ PreparePhysicsTable()

void G4VUserPhysicsList::PreparePhysicsTable ( G4ParticleDefinition particle)

G4cout << "#### G4VUserPhysicsList::BuildPhysicsTable() - BuildPhysicsTable(" / << particle->GetParticleName() << ") skipped..." << G4endl;

Definition at line 787 of file G4VUserPhysicsList.cc.

788{
789 if(!(particle->GetMasterProcessManager()))
790 {
791 //// G4cout << "#### G4VUserPhysicsList::BuildPhysicsTable() -
792 /// BuildPhysicsTable(" / << particle->GetParticleName() << ")
793 /// skipped..." << G4endl;
794 return;
795 }
796 // Prepare the physics tables for every process for this particle type
797 // if particle is not ShortLived
798 if(!particle->IsShortLived())
799 {
800 G4ProcessManager* pManager = particle->GetProcessManager();
801 if(!pManager)
802 {
803#ifdef G4VERBOSE
804 if(verboseLevel > 0)
805 {
806 G4cout << "G4VUserPhysicsList::PreparePhysicsTable "
807 << ": No Process Manager for " << particle->GetParticleName()
808 << G4endl;
809 G4cout << particle->GetParticleName()
810 << " should be created in your PhysicsList" << G4endl;
811 }
812#endif
813 G4Exception("G4VUserPhysicsList::PreparePhysicsTable", "Run0273",
814 FatalException, "No process manager");
815 return;
816 }
817
818 // Get processes from master thread
819 G4ProcessManager* pManagerShadow = particle->GetMasterProcessManager();
820 // Andrea Dotti 15 Jan 2013: Change of interface of MSC
821 // G4ProcessVector* pVectorShadow = pManagerShadow->GetProcessList();
822
823 G4ProcessVector* pVector = pManager->GetProcessList();
824 if(!pVector)
825 {
826#ifdef G4VERBOSE
827 if(verboseLevel > 0)
828 {
829 G4cout << "G4VUserPhysicsList::PreparePhysicsTable "
830 << ": No Process Vector for " << particle->GetParticleName()
831 << G4endl;
832 }
833#endif
834 G4Exception("G4VUserPhysicsList::PreparePhysicsTable", "Run0274",
835 FatalException, "No process Vector");
836 return;
837 }
838 for(std::size_t j = 0; j < pVector->size(); ++j)
839 {
840 // Andrea July 16th 2013 : migration to new interface...
841 // Infer if we are in a worker thread or master thread
842 // Master thread is the one in which the process manager
843 // and process manager shadow pointers are the same
844 if(pManagerShadow == pManager)
845 {
846 (*pVector)[j]->PreparePhysicsTable(*particle);
847 }
848 else
849 {
850 (*pVector)[j]->PrepareWorkerPhysicsTable(*particle);
851 }
852 } // End loop on processes vector
853 } // End if pn ShortLived
854}

Referenced by BuildPhysicsTable(), and G4UserPhysicsListMessenger::SetNewValue().

◆ RegisterProcess()

G4bool G4VUserPhysicsList::RegisterProcess ( G4VProcess process,
G4ParticleDefinition particle 
)
protected

Definition at line 1075 of file G4VUserPhysicsList.cc.

1077{
1078 return G4MT_thePLHelper->RegisterProcess(process, particle);
1079}

◆ RemoveProcessManager()

void G4VUserPhysicsList::RemoveProcessManager ( )

Definition at line 324 of file G4VUserPhysicsList.cc.

325{
326 // Request lock for particle table accesses. Some changes are inside
327 // this critical region.
328#ifdef G4MULTITHREADED
329 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
330 G4ParticleTable::lockCount()++;
331#endif
332 // G4cout << "Particle table is held by
333 // G4VUserPhysicsList::InitializeProcessManager"
334 // << G4endl;
335
336 // loop over all particles in G4ParticleTable
337 theParticleIterator->reset();
338 while((*theParticleIterator)())
339 {
340 G4ParticleDefinition* particle = theParticleIterator->value();
341 if(particle->GetInstanceID() <
343 {
344 if(particle->GetParticleSubType() != "generic" ||
345 particle->GetParticleName() == "GenericIon")
346 {
347 G4ProcessManager* pmanager = particle->GetProcessManager();
348 if(pmanager != 0)
349 delete pmanager;
350#ifdef G4VERBOSE
351 if(verboseLevel > 2)
352 {
353 G4cout << "G4VUserPhysicsList::RemoveProcessManager: ";
354 G4cout << "remove ProcessManager from ";
355 G4cout << particle->GetParticleName() << G4endl;
356 }
357#endif
358 }
359 particle->SetProcessManager(0);
360 }
361 }
362
363 // release lock for particle table accesses.
364#ifdef G4MULTITHREADED
365 G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex());
366#endif
367 // G4cout << "Particle table is released by
368 // G4VUserPhysicsList::InitializeProcessManager" << G4endl;
369}
static G4PART_DLL G4int & slavetotalspace()
G4int GetInstanceID() const
const G4String & GetParticleSubType() const

Referenced by TerminateWorker(), and ~G4VUserPhysicsList().

◆ ResetCuts()

void G4VUserPhysicsList::ResetCuts ( )

obsolete methods

Definition at line 1111 of file G4VUserPhysicsList.cc.

1112{
1113#ifdef G4VERBOSE
1114 if(verboseLevel > 0)
1115 {
1116 G4cout << "G4VUserPhysicsList::ResetCuts() is obsolete."
1117 << " This method gives no effect and you can remove it. " << G4endl;
1118 }
1119#endif
1120}

◆ ResetPhysicsTableRetrieved()

void G4VUserPhysicsList::ResetPhysicsTableRetrieved ( )
inline

Definition at line 455 of file G4VUserPhysicsList.hh.

456{
457 fRetrievePhysicsTable = false;
458 fIsRestoredCutValues = false;
460}

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ ResetStoredInAscii()

void G4VUserPhysicsList::ResetStoredInAscii ( )
inline

Definition at line 462 of file G4VUserPhysicsList.hh.

462{ fStoredInAscii = false; }

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ RetrievePhysicsTable()

void G4VUserPhysicsList::RetrievePhysicsTable ( G4ParticleDefinition particle,
const G4String directory,
G4bool  ascii = false 
)
protectedvirtual

Definition at line 990 of file G4VUserPhysicsList.cc.

993{
994 G4bool success[100];
995 // Retrieve physics tables for every process for this particle type
996 G4ProcessVector* pVector = (particle->GetProcessManager())->GetProcessList();
997 for(std::size_t j = 0; j < pVector->size(); ++j)
998 {
999 success[j] =
1000 (*pVector)[j]->RetrievePhysicsTable(particle, directory, ascii);
1001
1002 if(!success[j])
1003 {
1004#ifdef G4VERBOSE
1005 if(verboseLevel > 2)
1006 {
1007 G4cout << "G4VUserPhysicsList::RetrievePhysicsTable "
1008 << " Fail to retrieve Physics Table for "
1009 << (*pVector)[j]->GetProcessName() << G4endl;
1010 G4cout << "Calculate Physics Table for " << particle->GetParticleName()
1011 << G4endl;
1012 }
1013#endif
1014 (*pVector)[j]->BuildPhysicsTable(*particle);
1015 }
1016 }
1017 for(std::size_t j = 0; j < pVector->size(); ++j)
1018 {
1019 // temporary addition to make the integral schema
1020 if(!success[j])
1021 BuildIntegralPhysicsTable((*pVector)[j], particle);
1022 }
1023}
bool G4bool
Definition: G4Types.hh:86
void BuildIntegralPhysicsTable(G4VProcess *, G4ParticleDefinition *)

Referenced by BuildPhysicsTable().

◆ SetApplyCuts()

void G4VUserPhysicsList::SetApplyCuts ( G4bool  value,
const G4String name 
)

Definition at line 1026 of file G4VUserPhysicsList.cc.

1027{
1028#ifdef G4VERBOSE
1029 if(verboseLevel > 2)
1030 {
1031 G4cout << "G4VUserPhysicsList::SetApplyCuts for " << name << G4endl;
1032 }
1033#endif
1034 if(name == "all")
1035 {
1040 }
1041 else
1042 {
1044 }
1045}
const char * name(G4int ptype)

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ SetCuts()

void G4VUserPhysicsList::SetCuts ( )
virtual

Reimplemented in G4ErrorPhysicsList, FTFP_BERT_HP, LBE, and QGSP_BERT_HP.

Definition at line 372 of file G4VUserPhysicsList.cc.

373{
375 {
377 }
378
379#ifdef G4VERBOSE
380 if(verboseLevel > 1)
381 {
382 G4cout << "G4VUserPhysicsList::SetCuts: " << G4endl;
383 G4cout << "Cut for gamma: " << GetCutValue("gamma") / mm << "[mm]"
384 << G4endl;
385 G4cout << "Cut for e-: " << GetCutValue("e-") / mm << "[mm]" << G4endl;
386 G4cout << "Cut for e+: " << GetCutValue("e+") / mm << "[mm]" << G4endl;
387 G4cout << "Cut for proton: " << GetCutValue("proton") / mm << "[mm]"
388 << G4endl;
389 }
390#endif
391
392 // dump Cut values if verboseLevel==3
393 if(verboseLevel > 2)
394 {
396 }
397}
G4double GetCutValue(const G4String &pname) const
void SetDefaultCutValue(G4double newCutValue)
void DumpCutValuesTable(G4int flag=1)

Referenced by G4RunManagerKernel::InitializePhysics(), SetCutsWithDefault(), and G4UserPhysicsListMessenger::SetNewValue().

◆ SetCutsForRegion()

void G4VUserPhysicsList::SetCutsForRegion ( G4double  aCut,
const G4String rname 
)

Definition at line 491 of file G4VUserPhysicsList.cc.

492{
493 // set cut values for gamma at first and for e- and e+
494 SetCutValue(aCut, "gamma", rname);
495 SetCutValue(aCut, "e-", rname);
496 SetCutValue(aCut, "e+", rname);
497 SetCutValue(aCut, "proton", rname);
498}
void SetCutValue(G4double aCut, const G4String &pname)

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ SetCutsWithDefault()

void G4VUserPhysicsList::SetCutsWithDefault ( )

◆ SetCutValue() [1/2]

void G4VUserPhysicsList::SetCutValue ( G4double  aCut,
const G4String pname 
)

◆ SetCutValue() [2/2]

void G4VUserPhysicsList::SetCutValue ( G4double  aCut,
const G4String pname,
const G4String rname 
)

Definition at line 462 of file G4VUserPhysicsList.cc.

464{
466 if(region != 0)
467 {
468 // set cut value
469 SetParticleCuts(aCut, pname, region);
470 }
471 else
472 {
473#ifdef G4VERBOSE
474 if(verboseLevel > 0)
475 {
476 G4cout << "G4VUserPhysicsList::SetCutValue "
477 << " : No Region of " << rname << G4endl;
478 }
479#endif
480 }
481}

◆ SetDefaultCutValue()

void G4VUserPhysicsList::SetDefaultCutValue ( G4double  newCutValue)

Definition at line 400 of file G4VUserPhysicsList.cc.

401{
402 if(value < 0.0)
403 {
404#ifdef G4VERBOSE
405 if(verboseLevel > 0)
406 {
407 G4cout << "G4VUserPhysicsList::SetDefaultCutValue: negative cut values"
408 << " :" << value / mm << "[mm]" << G4endl;
409 }
410#endif
411 return;
412 }
413
414 defaultCutValue = value;
416
417 // set cut values for gamma at first and for e- and e+
421 SetCutValue(defaultCutValue, "proton");
422
423#ifdef G4VERBOSE
424 if(verboseLevel > 1)
425 {
426 G4cout << "G4VUserPhysicsList::SetDefaultCutValue:"
427 << "default cut value is changed to :" << defaultCutValue / mm
428 << "[mm]" << G4endl;
429 }
430#endif
431}

Referenced by SetCuts(), SetCutsWithDefault(), G4UserPhysicsListMessenger::SetNewValue(), and SetParticleCuts().

◆ SetParticleCuts() [1/2]

void G4VUserPhysicsList::SetParticleCuts ( G4double  cut,
const G4String particleName,
G4Region region = 0 
)

Definition at line 509 of file G4VUserPhysicsList.cc.

512{
513 if(cut < 0.0)
514 {
515#ifdef G4VERBOSE
516 if(verboseLevel > 0)
517 {
518 G4cout << "G4VUserPhysicsList::SetParticleCuts: negative cut values"
519 << " :" << cut / mm << "[mm]"
520 << " for " << particleName << G4endl;
521 }
522#endif
523 return;
524 }
525
526 G4Region* world_region =
527 G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld", false);
528 if(!region)
529 {
530 size_t nReg = (G4RegionStore::GetInstance())->size();
531 if(nReg == 0)
532 {
533#ifdef G4VERBOSE
534 if(verboseLevel > 0)
535 {
536 G4cout << "G4VUserPhysicsList::SetParticleCuts "
537 << " : No Default Region " << G4endl;
538 }
539#endif
540 G4Exception("G4VUserPhysicsList::SetParticleCuts ", "Run0254",
541 FatalException, "No Default Region");
542 return;
543 }
544 region = world_region;
545 }
546
548 {
550 }
551
552 G4ProductionCuts* pcuts = region->GetProductionCuts();
553 if(region != world_region &&
555 ->GetDefaultProductionCuts())
556 { // This region had no unique cuts yet but shares the default cuts.
557 // Need to create a new object before setting the value.
558 pcuts =
560 ->GetDefaultProductionCuts()));
561 region->SetProductionCuts(pcuts);
562 }
563 pcuts->SetProductionCut(cut, particleName);
564#ifdef G4VERBOSE
565 if(verboseLevel > 2)
566 {
567 G4cout << "G4VUserPhysicsList::SetParticleCuts: "
568 << " :" << cut / mm << "[mm]"
569 << " for " << particleName << G4endl;
570 }
571#endif
572}
void SetProductionCut(G4double cut, G4int index=-1)
void SetProductionCuts(G4ProductionCuts *cut)

◆ SetParticleCuts() [2/2]

void G4VUserPhysicsList::SetParticleCuts ( G4double  cut,
G4ParticleDefinition particle,
G4Region region = 0 
)

Definition at line 501 of file G4VUserPhysicsList.cc.

504{
505 SetParticleCuts(cut, particle->GetParticleName(), region);
506}

Referenced by SetCutValue(), and SetParticleCuts().

◆ SetPhysicsTableRetrieved()

void G4VUserPhysicsList::SetPhysicsTableRetrieved ( const G4String directory = "")

Definition at line 978 of file G4VUserPhysicsList.cc.

979{
981 if(!directory.isNull())
982 {
983 directoryPhysicsTable = directory;
984 }
986 fIsRestoredCutValues = false;
987}
G4bool isNull() const

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ SetStoredInAscii()

void G4VUserPhysicsList::SetStoredInAscii ( )
inline

Definition at line 453 of file G4VUserPhysicsList.hh.

453{ fStoredInAscii = true; }

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ SetVerboseLevel()

void G4VUserPhysicsList::SetVerboseLevel ( G4int  value)

Definition at line 1089 of file G4VUserPhysicsList.cc.

1090{
1091 verboseLevel = value;
1092 // set verboseLevel for G4ProductionCutsTable same as one for
1093 // G4VUserPhysicsList:
1095
1096 G4MT_thePLHelper->SetVerboseLevel(verboseLevel);
1097
1098#ifdef G4VERBOSE
1099 if(verboseLevel > 1)
1100 {
1101 G4cout << "G4VUserPhysicsList::SetVerboseLevel :"
1102 << " Verbose level is set to " << verboseLevel << G4endl;
1103 }
1104#endif
1105}
void SetVerboseLevel(G4int value)

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ StorePhysicsTable()

G4bool G4VUserPhysicsList::StorePhysicsTable ( const G4String directory = ".")

Definition at line 925 of file G4VUserPhysicsList.cc.

926{
927 G4bool ascii = fStoredInAscii;
928 G4String dir = directory;
929 if(dir.isNull())
931 else
933
934 // store CutsTable info
935 if(!fCutsTable->StoreCutsTable(dir, ascii))
936 {
937 G4Exception("G4VUserPhysicsList::StorePhysicsTable", "Run0281", JustWarning,
938 "Fail to store Cut Table");
939 return false;
940 }
941#ifdef G4VERBOSE
942 if(verboseLevel > 2)
943 {
944 G4cout << "G4VUserPhysicsList::StorePhysicsTable "
945 << " Store material and cut values successfully" << G4endl;
946 }
947#endif
948
949 G4bool success = true;
950
951 // loop over all particles in G4ParticleTable
952 theParticleIterator->reset();
953 while((*theParticleIterator)())
954 {
955 G4ParticleDefinition* particle = theParticleIterator->value();
956 // Store physics tables for every process for this particle type
957 G4ProcessVector* pVector =
958 (particle->GetProcessManager())->GetProcessList();
959 for(std::size_t j = 0; j < pVector->size(); ++j)
960 {
961 if(!(*pVector)[j]->StorePhysicsTable(particle, dir, ascii))
962 {
963 G4String comment = "Fail to store physics table for ";
964 comment += (*pVector)[j]->GetProcessName();
965 comment += "(" + particle->GetParticleName() + ")";
966 G4Exception("G4VUserPhysicsList::StorePhysicsTable", "Run0282",
967 JustWarning, comment);
968 success = false;
969 }
970 }
971 // end loop over processes
972 }
973 // end loop over particles
974 return success;
975}
G4bool StoreCutsTable(const G4String &directory, G4bool ascii=false)

Referenced by G4UserPhysicsListMessenger::SetNewValue().

◆ TerminateWorker()

void G4VUserPhysicsList::TerminateWorker ( )
virtual

◆ UseCoupledTransportation()

void G4VUserPhysicsList::UseCoupledTransportation ( G4bool  vl = true)

Definition at line 1069 of file G4VUserPhysicsList.cc.

1070{
1071 G4MT_thePLHelper->UseCoupledTransportation(vl);
1072}

Referenced by G4RunManagerKernel::InitializePhysics().

Member Data Documentation

◆ defaultCutValue

◆ directoryPhysicsTable

G4String G4VUserPhysicsList::directoryPhysicsTable
protected

◆ fCutsTable

G4ProductionCutsTable* G4VUserPhysicsList::fCutsTable
protected

◆ fDisableCheckParticleList

G4bool G4VUserPhysicsList::fDisableCheckParticleList
protected

◆ fIsCheckedForRetrievePhysicsTable

G4bool G4VUserPhysicsList::fIsCheckedForRetrievePhysicsTable
protected

◆ fIsRestoredCutValues

G4bool G4VUserPhysicsList::fIsRestoredCutValues
protected

◆ fRetrievePhysicsTable

◆ fStoredInAscii

◆ g4vuplInstanceID

G4int G4VUserPhysicsList::g4vuplInstanceID
protected

◆ isSetDefaultCutValue

G4bool G4VUserPhysicsList::isSetDefaultCutValue
protected

◆ subInstanceManager

G4VUPLManager G4VUserPhysicsList::subInstanceManager
staticprotected

◆ theParticleTable

G4ParticleTable* G4VUserPhysicsList::theParticleTable
protected

◆ verboseLevel


The documentation for this class was generated from the following files: