Geant4-11
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
G4ProcessManager Class Reference

#include <G4ProcessManager.hh>

Public Types

enum  { SizeOfProcVectorArray = 6 }
 

Public Member Functions

G4int AddContinuousProcess (G4VProcess *aProcess, G4int ord=ordDefault)
 
G4int AddDiscreteProcess (G4VProcess *aProcess, G4int ord=ordDefault)
 
G4int AddProcess (G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
 
G4int AddRestProcess (G4VProcess *aProcess, G4int ord=ordDefault)
 
void DumpInfo ()
 
void EndTracking ()
 
 G4ProcessManager ()=delete
 
 G4ProcessManager (const G4ParticleDefinition *aParticleType)
 
 G4ProcessManager (G4ProcessManager &right)
 
G4int GetAlongStepIndex (G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4ProcessVectorGetAlongStepProcessVector (G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4int GetAtRestIndex (G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4ProcessVectorGetAtRestProcessVector (G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4ParticleDefinitionGetParticleType () const
 
G4int GetPostStepIndex (G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4ProcessVectorGetPostStepProcessVector (G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4VProcessGetProcess (const G4String &) const
 
G4bool GetProcessActivation (G4int index) const
 
G4bool GetProcessActivation (G4VProcess *aProcess) const
 
G4int GetProcessIndex (G4VProcess *) const
 
G4ProcessVectorGetProcessList () const
 
G4int GetProcessListLength () const
 
G4int GetProcessOrdering (G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
 
G4ProcessVectorGetProcessVector (G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4int GetProcessVectorIndex (G4VProcess *aProcess, G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4int GetVerboseLevel () const
 
G4bool operator!= (const G4ProcessManager &right) const
 
G4ProcessManageroperator= (const G4ProcessManager &)=delete
 
G4bool operator== (const G4ProcessManager &right) const
 
G4VProcessRemoveProcess (G4int index)
 
G4VProcessRemoveProcess (G4VProcess *aProcess)
 
void SetParticleType (const G4ParticleDefinition *)
 
G4VProcessSetProcessActivation (G4int index, G4bool fActive)
 
G4VProcessSetProcessActivation (G4VProcess *aProcess, G4bool fActive)
 
void SetProcessOrdering (G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
 
void SetProcessOrderingToFirst (G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
 
void SetProcessOrderingToLast (G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
 
void SetProcessOrderingToSecond (G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
 
void SetVerboseLevel (G4int value)
 
void StartTracking (G4Track *aTrack=nullptr)
 
 ~G4ProcessManager ()
 

Private Types

using G4ProcessAttrVector = std::vector< G4ProcessAttribute * >
 

Private Member Functions

G4VProcessActivateProcess (G4int index)
 
void CheckOrderingParameters (G4VProcess *) const
 
void CreateGPILvectors ()
 
G4int FindInsertPosition (G4int ord, G4int ivec)
 
G4ProcessAttributeGetAttribute (G4int index) const
 
G4ProcessAttributeGetAttribute (G4VProcess *aProcess) const
 
G4int GetProcessVectorId (G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
 
G4VProcessInActivateProcess (G4int index)
 
G4int InsertAt (G4int position, G4VProcess *process, G4int ivec)
 
G4int RemoveAt (G4int position, G4VProcess *process, G4int ivec)
 
void SetIndexToProcessVector (G4int ivec)
 

Private Attributes

G4bool duringTracking = false
 
G4bool isSetOrderingFirstInvoked [NDoit]
 
G4bool isSetOrderingLastInvoked [NDoit]
 
G4int numberOfProcesses = 0
 
G4ProcessAttrVectortheAttrVector = nullptr
 
const G4ParticleDefinitiontheParticleType = nullptr
 
G4ProcessVectortheProcessList = nullptr
 
G4ProcessVectortheProcVector [SizeOfProcVectorArray]
 
G4int verboseLevel = 1
 

Static Private Attributes

static G4ThreadLocal G4int counterOfObjects = 0
 
static G4ThreadLocal G4ProcessManagerMessengerfProcessManagerMessenger = nullptr
 

Detailed Description

Definition at line 94 of file G4ProcessManager.hh.

Member Typedef Documentation

◆ G4ProcessAttrVector

Definition at line 96 of file G4ProcessManager.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
SizeOfProcVectorArray 

Definition at line 291 of file G4ProcessManager.hh.

Constructor & Destructor Documentation

◆ G4ProcessManager() [1/3]

G4ProcessManager::G4ProcessManager ( const G4ParticleDefinition aParticleType)

Definition at line 48 of file G4ProcessManager.cc.

49 : theParticleType(aParticleType)
50{
51 // create the process List
53 if ( theProcessList == nullptr)
54 {
55 G4Exception( "G4ProcessManager::G4ProcessManager()","ProcMan012",
56 FatalException, "Can not create G4ProcessList ");
57 }
58
59 // create process vector
60 for (G4int i=0; i<SizeOfProcVectorArray; ++i)
61 {
63 if ( theProcVector[i] == nullptr)
64 {
65 G4Exception( "G4ProcessManager::G4ProcessManager()","ProcMan012",
66 FatalException, "Can not create G4ProcessVector ");
67 }
68 }
69
70 // create Process Attribute vector
72
73 // create Process Manager Messenger
74 if (fProcessManagerMessenger == nullptr)
75 {
77 }
78
79 for (G4int i=0; i<NDoit; ++i)
80 {
82 isSetOrderingLastInvoked[i] = false;
83 }
84
85 // Increment counter of G4ProcessManager objects
87}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
@ NDoit
int G4int
Definition: G4Types.hh:85
std::vector< G4ProcessAttribute * > G4ProcessAttrVector
G4ProcessVector * theProcessList
G4ProcessAttrVector * theAttrVector
static G4ThreadLocal G4ProcessManagerMessenger * fProcessManagerMessenger
G4bool isSetOrderingFirstInvoked[NDoit]
const G4ParticleDefinition * theParticleType
G4bool isSetOrderingLastInvoked[NDoit]
static G4ThreadLocal G4int counterOfObjects
G4ProcessVector * theProcVector[SizeOfProcVectorArray]

References counterOfObjects, FatalException, fProcessManagerMessenger, G4Exception(), isSetOrderingFirstInvoked, isSetOrderingLastInvoked, NDoit, SizeOfProcVectorArray, theAttrVector, theProcessList, and theProcVector.

◆ G4ProcessManager() [2/3]

G4ProcessManager::G4ProcessManager ( G4ProcessManager right)

Definition at line 90 of file G4ProcessManager.cc.

93{
94#ifdef G4VERBOSE
95 if (GetVerboseLevel() > 2)
96 {
97 G4cout << "G4ProcessManager::G4ProcessManager() [copy constructor]"
98 << G4endl;
99 }
100#endif
101
102 // create the process List and ProcessAttr Vector
105 if ( ( theProcessList == nullptr) || (theAttrVector == nullptr) )
106 {
107 G4Exception( "G4ProcessManager::G4ProcessManager() [copy constructor]",
108 "ProcMan011",FatalException, "Cannot create G4ProcessList");
109 }
110
111 for (G4int idx=0; idx < right.numberOfProcesses; ++idx)
112 {
113 // copy contents in theProcessList
114 theProcessList->insert((*right.theProcessList)[idx]);
115 // create a G4ProcessAttribute same as source's one
116 G4ProcessAttribute* sAttr = (*right.theAttrVector)[idx];
117 G4ProcessAttribute* dAttr = new G4ProcessAttribute(*sAttr);
118 // adds a G4ProcessAttribute object
119 theAttrVector->push_back(dAttr);
121 }
122
123 // fill up theProcVector
124 for (G4int i=0; i<SizeOfProcVectorArray; ++i)
125 {
126 // create i-th ProcessVector in theProcVector
128 if ( theProcVector[i] == nullptr )
129 {
130 G4Exception("G4ProcessManager::G4ProcessManager() [copy constructor]",
131 "ProcMan011",FatalException, "Cannot create G4ProcessVector");
132 }
133
135 G4ProcessVector* src = right.theProcVector[i];
136 for (std::size_t j=0; j< src->entries() ; ++j)
137 {
138 // copy j-th process in i-th ProcessVector
139 theProcVector[i]->insert((*src)[j]);
140 //add aProcess and this ProcessManager into ProcesssTable
141 if ( (*src)[j] != nullptr )
142 {
143 theProcessTable->Insert((*src)[j], this);
144 }
145 }
146 }
147
148 for (G4int i=0; i<NDoit; ++i)
149 {
152 }
153
154 // Increment counter of G4ProcessManager objects
156}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4int GetVerboseLevel() const
static G4ProcessTable * GetProcessTable()
G4int Insert(G4VProcess *aProcess, G4ProcessManager *aProcMgr)
std::size_t entries() const
G4bool insert(G4VProcess *aProcess)

References counterOfObjects, G4ProcessVector::entries(), FatalException, G4cout, G4endl, G4Exception(), G4ProcessTable::GetProcessTable(), GetVerboseLevel(), G4ProcessVector::insert(), G4ProcessTable::Insert(), isSetOrderingFirstInvoked, isSetOrderingLastInvoked, NDoit, numberOfProcesses, SizeOfProcVectorArray, theAttrVector, theProcessList, and theProcVector.

◆ G4ProcessManager() [3/3]

G4ProcessManager::G4ProcessManager ( )
delete

◆ ~G4ProcessManager()

G4ProcessManager::~G4ProcessManager ( )

Definition at line 159 of file G4ProcessManager.cc.

160{
161 for (G4int i=0; i<SizeOfProcVectorArray; ++i)
162 {
163 if (theProcVector[i])
164 {
165 theProcVector[i]->clear();
166 delete theProcVector[i];
167 }
168 }
170 delete theProcessList;
171
172 for (auto itr = theAttrVector->cbegin(); itr!= theAttrVector->cend(); ++itr)
173 {
174 delete (*itr);
175 }
176 theAttrVector->clear();
177 delete theAttrVector;
178
180
181 // delete messenger if this object is last one
182 if ( counterOfObjects == 0 )
183 {
185 fProcessManagerMessenger = nullptr;
186#ifdef G4VERBOSE
187 if (GetVerboseLevel() > 1)
188 {
189 G4cout << "G4ProcessManagerMessenger is deleted" << G4endl;
190 }
191#endif
192 }
193}

References G4ProcessVector::clear(), counterOfObjects, fProcessManagerMessenger, G4cout, G4endl, GetVerboseLevel(), SizeOfProcVectorArray, theAttrVector, theProcessList, and theProcVector.

Member Function Documentation

◆ ActivateProcess()

G4VProcess * G4ProcessManager::ActivateProcess ( G4int  index)
private

Definition at line 985 of file G4ProcessManager.cc.

986{
987 G4ApplicationState currentState
989 if ( (currentState == G4State_PreInit) || (currentState == G4State_Init) )
990 {
991#ifdef G4VERBOSE
992 if (GetVerboseLevel()>1)
993 {
994 G4cout << "G4ProcessManager::ActivateProcess() is not valid in ";
995 if (currentState == G4State_PreInit )
996 {
997 G4cout << "PreInit ";
998 }
999 else if (currentState == G4State_Init )
1000 {
1001 G4cout << "Init ";
1002 }
1003 G4cout << "state !" << G4endl;
1004 }
1005#endif
1006 return nullptr;
1007 }
1008
1009 //find the process attribute
1010 G4ProcessAttribute* pAttr = GetAttribute(index);
1011 if (pAttr == nullptr) return nullptr;
1012
1013 // remove process
1014 G4VProcess* pProcess = (*theProcessList)[index];
1015
1016 if (!pAttr->isActive)
1017 {
1018 // remove process from vectors if the process is active
1019 for (G4int i=0; i<SizeOfProcVectorArray; ++i)
1020 {
1021 G4ProcessVector* pVector = theProcVector[i];
1022 G4int idx = pAttr->idxProcVector[i];
1023 if (idx<0)
1024 {
1025 // corresponding DoIt is not active
1026 }
1027 else if ((idx >= 0) && (idx < G4int(pVector->entries())))
1028 {
1029 // check pointer and set
1030 if ((*pVector)[idx] == nullptr)
1031 {
1032 (*pVector)[idx] = pProcess;
1033 }
1034 else
1035 {
1036 G4String anErrorMessage("Bad ProcessList: Bad index in attribute");
1037 anErrorMessage += "for particle[" + theParticleType->GetParticleName() + "] ";
1038 anErrorMessage += "process[" + pProcess->GetProcessName() + "] " ;
1039 G4Exception("G4ProcessManager::ActivateProcess()", "ProcMan012",
1040 FatalException, anErrorMessage);
1041 return nullptr;
1042 }
1043 }
1044 else
1045 {
1046 // idx is out of range
1047 G4String anErrorMessage("bad ProcessList: Index is out of range");
1048 anErrorMessage += "for particle["
1049 + theParticleType->GetParticleName() + "] ";
1050 anErrorMessage += "process[" + pProcess->GetProcessName() + "] " ;
1051 G4Exception("G4ProcessManager::ActivateProcess()", "ProcMan012",
1052 FatalException, anErrorMessage);
1053 return nullptr;
1054 }
1055 }
1056 pAttr->isActive = true;
1057 }
1058 return pProcess;
1059}
G4ApplicationState
@ G4State_Init
@ G4State_PreInit
const G4String & GetParticleName() const
G4int idxProcVector[G4ProcessManager::SizeOfProcVectorArray]
G4ProcessAttribute * GetAttribute(G4int index) const
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382

References G4ProcessVector::entries(), FatalException, G4cout, G4endl, G4Exception(), G4State_Init, G4State_PreInit, GetAttribute(), G4StateManager::GetCurrentState(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), G4StateManager::GetStateManager(), GetVerboseLevel(), G4ProcessAttribute::idxProcVector, G4ProcessAttribute::isActive, SizeOfProcVectorArray, theParticleType, and theProcVector.

Referenced by RemoveProcess(), and SetProcessActivation().

◆ AddContinuousProcess()

G4int G4ProcessManager::AddContinuousProcess ( G4VProcess aProcess,
G4int  ord = ordDefault 
)
inline

◆ AddDiscreteProcess()

G4int G4ProcessManager::AddDiscreteProcess ( G4VProcess aProcess,
G4int  ord = ordDefault 
)
inline

◆ AddProcess()

G4int G4ProcessManager::AddProcess ( G4VProcess aProcess,
G4int  ordAtRestDoIt = ordInActive,
G4int  ordAlongSteptDoIt = ordInActive,
G4int  ordPostStepDoIt = ordInActive 
)

Definition at line 405 of file G4ProcessManager.cc.

411{
412 // check the process is applicable to this particle type
413 if ( !aProcess->IsApplicable(*theParticleType) )
414 {
415#ifdef G4VERBOSE
416 if (GetVerboseLevel()>1)
417 {
418 G4cout << "G4ProcessManager::AddProcess()" << G4endl;
419 G4cout << "This process is not applicable to this particle" << G4endl;
420 }
421#endif
422 return -1;
423 }
424
425#ifdef G4VERBOSE
426 if (GetVerboseLevel()>2)
427 {
428 G4cout << "G4ProcessManager::AddProcess()" << G4endl;
429 }
430#endif
431
432 // add aProcess and this ProcessManager into ProcesssTable
434 theProcessTable->Insert(aProcess, this);
435
436 // add aProcess to process List
437 theProcessList->insert(aProcess);
438 G4int idx = (theProcessList->entries()) - 1;
439
440 // check size of the ProcessVector[0]
441 if (numberOfProcesses != idx)
442 {
444 G4String anErrorMessage("Inconsistent process List size for ");
445 anErrorMessage += "process[" + aProcess->GetProcessName() + "]";
446 anErrorMessage += " particle[" + theParticleType->GetParticleName() + "]";
447 G4Exception("G4ProcessManager::AddProcess()", "ProcMan012",
448 FatalException, anErrorMessage);
449 return -1;
450 }
451
452 // create ProcessAttribute
453 G4ProcessAttribute* pAttr = new G4ProcessAttribute(aProcess);
454 pAttr->idxProcessList = idx;
455
456 // check if ordering parameter is non-zero
457 if (ordAtRestDoIt==0) ordAtRestDoIt = 1;
458 if (ordAlongStepDoIt==0) ordAlongStepDoIt = 1;
459 if (ordPostStepDoIt==0) ordPostStepDoIt = 1;
460
461 // ordering parameter
462 pAttr->ordProcVector[0] = ordAtRestDoIt;
463 pAttr->ordProcVector[1] = ordAtRestDoIt;
464 pAttr->ordProcVector[2] = ordAlongStepDoIt;
465 pAttr->ordProcVector[3] = ordAlongStepDoIt;
466 pAttr->ordProcVector[4] = ordPostStepDoIt;
467 pAttr->ordProcVector[5] = ordPostStepDoIt;
468
469 // add aProccess in Process vectors
470 for (G4int ivec=1; ivec<SizeOfProcVectorArray; ivec+=2)
471 {
472 if (pAttr->ordProcVector[ivec] < 0 )
473 {
474 // DoIt is inactive if ordering parameter is negative
475 pAttr->idxProcVector[ivec] = -1;
476 }
477 else
478 {
479 // add aProcess in ordering of ordProcVector
480 // G4ProcessVector* pVector = theProcVector[ivec];
481 // find insert position
482 G4int ip = FindInsertPosition(pAttr->ordProcVector[ivec], ivec);
483 // insert
484 InsertAt(ip, aProcess, ivec);
485 // set index in Process Attribute
486 pAttr->idxProcVector[ivec] = ip;
487
488#ifdef G4VERBOSE
489 if (verboseLevel>2)
490 {
491 G4cout << "G4ProcessManager::AddProcess()" << G4endl;
492 G4cout << aProcess->GetProcessName() << " is inserted at "<< ip;
493 G4cout << " in ProcessVetor[" << ivec<< "]";
494 G4cout << " with Ordering parameter = " ;
495 G4cout << pAttr->ordProcVector[ivec] << G4endl;
496 }
497#endif
498 }
499 }
500
501 // add ProcessAttribute to ProcessAttrVector
502 theAttrVector->push_back(pAttr);
503
505
506 // check consistencies between ordering parameters and process
507 CheckOrderingParameters(aProcess);
508
510
511 // inform process manager pointer to the process
512 aProcess->SetProcessManager(this);
513
514 return idx;
515}
G4int ordProcVector[G4ProcessManager::SizeOfProcVectorArray]
void CheckOrderingParameters(G4VProcess *) const
G4int FindInsertPosition(G4int ord, G4int ivec)
G4int InsertAt(G4int position, G4VProcess *process, G4int ivec)
G4VProcess * removeLast()
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:182
virtual void SetProcessManager(const G4ProcessManager *)
Definition: G4VProcess.hh:488

References CheckOrderingParameters(), CreateGPILvectors(), G4ProcessVector::entries(), FatalException, FindInsertPosition(), G4cout, G4endl, G4Exception(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), G4ProcessTable::GetProcessTable(), GetVerboseLevel(), G4ProcessAttribute::idxProcessList, G4ProcessAttribute::idxProcVector, G4ProcessVector::insert(), G4ProcessTable::Insert(), InsertAt(), G4VProcess::IsApplicable(), numberOfProcesses, G4ProcessAttribute::ordProcVector, G4ProcessVector::removeLast(), G4VProcess::SetProcessManager(), SizeOfProcVectorArray, theAttrVector, theParticleType, theProcessList, and verboseLevel.

Referenced by G4FastSimulationHelper::ActivateFastSimulation(), G4BiasingHelper::ActivateNonPhysicsBiasing(), G4BiasingHelper::ActivatePhysicsBiasing(), G4BiasingHelper::AddLimiterProcess(), G4ProcessPlacer::AddProcessAs(), G4PhysicsListHelper::AddTransportation(), LBE::ConstructEM(), LBE::ConstructGeneral(), LBE::ConstructOp(), PhysListEmStandard::ConstructProcess(), G4ErrorPhysicsList::ConstructProcess(), G4ParallelWorldPhysics::ConstructProcess(), G4SpinDecayPhysics::ConstructProcess(), G4OpticalPhysics::ConstructProcess(), G4RunManager::ConstructScoringWorlds(), G4WorkerRunManager::ConstructScoringWorlds(), export_G4ProcessManager(), and G4PhysicsListHelper::RegisterProcess().

◆ AddRestProcess()

G4int G4ProcessManager::AddRestProcess ( G4VProcess aProcess,
G4int  ord = ordDefault 
)
inline

◆ CheckOrderingParameters()

void G4ProcessManager::CheckOrderingParameters ( G4VProcess aProcess) const
private

Definition at line 1236 of file G4ProcessManager.cc.

1237{
1238 if (aProcess == nullptr) return;
1239 G4ProcessAttribute* pAttr = GetAttribute(aProcess);
1240 if (pAttr == nullptr)
1241 {
1242#ifdef G4VERBOSE
1243 if (GetVerboseLevel()>0)
1244 {
1245 G4cout << "G4ProcessManager::CheckOrderingParameters()" << G4endl;
1246 G4cout << " process " << aProcess->GetProcessName()
1247 << " has no attribute" << G4endl;
1248 }
1249#endif
1250 return;
1251 }
1252
1253 // check consistencies between ordering parameters and
1254 // validity of DoIt of the Process
1255 G4bool isOK =true;
1256 if ( (pAttr->ordProcVector[0]>=0) && (!aProcess->isAtRestDoItIsEnabled()) )
1257 {
1258 #ifdef G4VERBOSE
1259 if (GetVerboseLevel()>0)
1260 {
1261 G4cerr << "G4ProcessManager::CheckOrderingParameters()" << G4endl;
1262 G4cerr << "You cannot set ordering parameter ["
1263 << pAttr->ordProcVector[0]
1264 << "] for AtRest DoIt to the process "
1265 << aProcess->GetProcessName() << G4endl;
1266 }
1267#endif
1268 isOK = false;
1269 }
1270
1271 if ((pAttr->ordProcVector[2]>=0) && (!aProcess->isAlongStepDoItIsEnabled()))
1272 {
1273#ifdef G4VERBOSE
1274 if (GetVerboseLevel()>0)
1275 {
1276 G4cerr << "G4ProcessManager::CheckOrderingParameters()" << G4endl;
1277 G4cerr << "You cannot set ordering parameter ["
1278 << pAttr->ordProcVector[2]
1279 << "] for AlongStep DoIt to the process "
1280 << aProcess->GetProcessName() << G4endl;
1281
1282 }
1283#endif
1284 isOK = false;
1285 }
1286
1287 if ((pAttr->ordProcVector[4]>=0) && (!aProcess->isPostStepDoItIsEnabled()))
1288 {
1289#ifdef G4VERBOSE
1290 if (GetVerboseLevel()>0)
1291 {
1292 G4cerr << "G4ProcessManager::CheckOrderingParameters()" << G4endl;
1293 G4cerr << "You cannot set ordering parameter ["
1294 << pAttr->ordProcVector[4]
1295 << "] for PostStep DoIt to the process"
1296 << aProcess->GetProcessName() << G4endl;
1297 }
1298#endif
1299 isOK = false;
1300 }
1301
1302 if (!isOK)
1303 {
1304 G4String msg;
1305 msg = "Invalid ordering parameters are set for ";
1306 msg += aProcess->GetProcessName();
1307 G4Exception( "G4ProcessManager::CheckOrderingParameters()",
1308 "ProcMan013", FatalException, msg);
1309 }
1310
1311 return;
1312}
bool G4bool
Definition: G4Types.hh:86
G4GLOB_DLL std::ostream G4cerr
G4bool isAtRestDoItIsEnabled() const
Definition: G4VProcess.hh:500
G4bool isPostStepDoItIsEnabled() const
Definition: G4VProcess.hh:512
G4bool isAlongStepDoItIsEnabled() const
Definition: G4VProcess.hh:506

References FatalException, G4cerr, G4cout, G4endl, G4Exception(), GetAttribute(), G4VProcess::GetProcessName(), GetVerboseLevel(), G4VProcess::isAlongStepDoItIsEnabled(), G4VProcess::isAtRestDoItIsEnabled(), G4VProcess::isPostStepDoItIsEnabled(), and G4ProcessAttribute::ordProcVector.

Referenced by AddProcess(), SetProcessOrdering(), SetProcessOrderingToFirst(), and SetProcessOrderingToSecond().

◆ CreateGPILvectors()

void G4ProcessManager::CreateGPILvectors ( )
private

Definition at line 1135 of file G4ProcessManager.cc.

1136{
1137 // Create GetPhysicalInteractionLength process vectors just as the inverse
1138 // order of DoIt() process vector
1139
1140 for(std::size_t k=0; k<theProcessList->entries(); ++k)
1141 {
1145 }
1146
1147 for(G4int i=0; i<SizeOfProcVectorArray; i += 2)
1148 {
1149 G4ProcessVector* procGPIL = theProcVector[i];
1150 G4ProcessVector* procDoIt = theProcVector[i+1];
1151 G4int nproc = procDoIt->entries();
1152 procGPIL->clear();
1153 for(G4int j=nproc-1;j>=0;--j)
1154 {
1155 G4VProcess* aProc = (*procDoIt)[j];
1156 procGPIL->insert(aProc);
1157 GetAttribute(aProc)->idxProcVector[i] = procGPIL->entries()-1;
1158 }
1159 }
1160}

References G4ProcessVector::clear(), G4ProcessVector::entries(), GetAttribute(), G4ProcessAttribute::idxProcVector, G4ProcessVector::insert(), SizeOfProcVectorArray, theProcessList, and theProcVector.

Referenced by AddProcess(), RemoveProcess(), SetProcessOrdering(), SetProcessOrderingToFirst(), and SetProcessOrderingToSecond().

◆ DumpInfo()

void G4ProcessManager::DumpInfo ( )

Definition at line 1074 of file G4ProcessManager.cc.

1075{
1076 // Dump Information
1077
1078 // particle type
1079 G4cout << "G4ProcessManager: particle["
1080 << theParticleType->GetParticleName() << "]"
1081 << G4endl;
1082
1083 // loop over all processes
1084 for (std::size_t idx=0; idx < theProcessList->entries(); ++idx)
1085 {
1086 // process name/type
1087 G4cout << "[" << idx << "]";
1088 G4cout << "=== process[" << ((*theProcessList)(idx))->GetProcessName()
1089 << " :";
1090 G4cout << G4VProcess::GetProcessTypeName( ((*theProcessList)(idx))->GetProcessType() )
1091 << "]";
1092
1093 // process attribute
1094 G4ProcessAttribute* pAttr = (*theAttrVector)[idx];
1095 // status
1096 if ( pAttr-> isActive )
1097 {
1098 G4cout << " Active ";
1099 }
1100 else
1101 {
1102 G4cout << " InActive ";
1103 }
1104 G4cout << G4endl;
1105
1106#ifdef G4VERBOSE
1107 if (verboseLevel>0)
1108 {
1109 // order parameter
1110 G4cout << " Ordering:: ";
1111 G4cout << " AtRest AlongStep PostStep ";
1112 G4cout << G4endl;
1113 G4cout << " ";
1114 G4cout << " GetPIL/ DoIt GetPIL/ DoIt GetPIL/ DoIt ";
1115 G4cout << G4endl;
1116 G4cout << " Ordering:: " << G4endl;
1117 G4cout << " index ";
1118 for (G4int idx2 = 0; idx2 <6 ; ++idx2)
1119 {
1120 G4cout << std::setw(8) << pAttr->idxProcVector[idx2] << ":";
1121 }
1122 G4cout << G4endl;
1123 G4cout << " parameter ";
1124 for (G4int idx3 = 0; idx3 <6 ; ++idx3)
1125 {
1126 G4cout << std::setw(8) << pAttr->ordProcVector[idx3] << ":";
1127 }
1128 G4cout << G4endl;
1129 }
1130#endif
1131 }
1132}
static const G4String & GetProcessTypeName(G4ProcessType)
Definition: G4VProcess.cc:134

References G4ProcessVector::entries(), G4cout, G4endl, G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessTypeName(), G4ProcessAttribute::idxProcVector, G4ProcessAttribute::ordProcVector, theParticleType, theProcessList, and verboseLevel.

Referenced by G4ProcessTable::DumpInfo(), export_G4ProcessManager(), and G4ProcessManagerMessenger::SetNewValue().

◆ EndTracking()

void G4ProcessManager::EndTracking ( )

Definition at line 1174 of file G4ProcessManager.cc.

1175{
1176 for (std::size_t idx = 0; idx<theProcessList->entries(); ++idx)
1177 {
1178 if (GetAttribute(idx)->isActive)
1179 ((*theProcessList)[idx])->EndTracking();
1180 }
1181 duringTracking = false;
1182}

References duringTracking, EndTracking(), G4ProcessVector::entries(), GetAttribute(), and theProcessList.

Referenced by EndTracking(), G4TrackingManager::ProcessOneTrack(), and G4ErrorPropagator::Propagate().

◆ FindInsertPosition()

G4int G4ProcessManager::FindInsertPosition ( G4int  ord,
G4int  ivec 
)
private

Definition at line 383 of file G4ProcessManager.cc.

384{
385 G4ProcessVector* pVector = theProcVector[ivec];
386 G4int ip = pVector->entries();
387 G4int tmp = INT_MAX;
388 if (ord == ordLast) return ip;
389
390 // find insert position
391 for (G4int iproc=0; iproc<numberOfProcesses; ++iproc)
392 {
393 G4ProcessAttribute* aAttr = (*theAttrVector)[iproc];
394 if ( (aAttr->ordProcVector[ivec] > ord )
395 && (tmp > aAttr->ordProcVector[ivec]))
396 {
397 tmp = aAttr->ordProcVector[ivec] ;
398 if (ip > aAttr->idxProcVector[ivec]) ip = aAttr->idxProcVector[ivec];
399 }
400 }
401 return ip;
402}
@ ordLast
#define INT_MAX
Definition: templates.hh:90

References G4ProcessVector::entries(), G4ProcessAttribute::idxProcVector, INT_MAX, numberOfProcesses, ordLast, G4ProcessAttribute::ordProcVector, and theProcVector.

Referenced by AddProcess(), and SetProcessOrdering().

◆ GetAlongStepIndex()

G4int G4ProcessManager::GetAlongStepIndex ( G4VProcess aProcess,
G4ProcessVectorTypeIndex  typ = typeGPIL 
) const
inline

Referenced by export_G4ProcessManager().

◆ GetAlongStepProcessVector()

G4ProcessVector * G4ProcessManager::GetAlongStepProcessVector ( G4ProcessVectorTypeIndex  typ = typeGPIL) const
inline

◆ GetAtRestIndex()

G4int G4ProcessManager::GetAtRestIndex ( G4VProcess aProcess,
G4ProcessVectorTypeIndex  typ = typeGPIL 
) const
inline

Referenced by export_G4ProcessManager().

◆ GetAtRestProcessVector()

G4ProcessVector * G4ProcessManager::GetAtRestProcessVector ( G4ProcessVectorTypeIndex  typ = typeGPIL) const
inline

◆ GetAttribute() [1/2]

G4ProcessAttribute * G4ProcessManager::GetAttribute ( G4int  index) const
private

Definition at line 236 of file G4ProcessManager.cc.

237{
238 // check index range
239 if ((index<0) || (index>=numberOfProcesses))
240 {
241#ifdef G4VERBOSE
242 if (GetVerboseLevel()>0)
243 {
244 G4cout << "G4ProcessManager::GetAttribute():";
245 G4cout << " particle[" << theParticleType->GetParticleName() << "]";
246 G4cout << G4endl;
247 G4cout << " index out of range " << G4endl;
248 G4cout << " #processes[" << numberOfProcesses << "]";
249 G4cout << " index [" << index << "]" << G4endl;
250 }
251#endif
252 return nullptr;
253 }
254
255 // check process pointer is not null
256 G4VProcess* aProcess = (*theProcessList)[index];
257 if (aProcess == nullptr)
258 {
259 G4String aErrorMessage("Bad ProcessList: Null Pointer for ");
260 aErrorMessage += theParticleType->GetParticleName() ;
261 G4Exception("G4ProcessManager::GetAttribute()","ProcMan012",
262 FatalException, aErrorMessage);
263 return nullptr;
264 }
265
266 // find the process attribute
267 if ( ((*theAttrVector)[index])->idxProcessList == index )
268 {
269 return (*theAttrVector)[index];
270 }
271 else
272 {
273 // !! Error !!
274 // attribute vector index is inconsistent with process List index
275#ifdef G4VERBOSE
276 if (GetVerboseLevel()>0)
277 {
278 G4cout << "G4ProcessManager::GetAttribute():";
279 G4cout << " particle[" << theParticleType->GetParticleName() << "]"
280 << G4endl;
281 G4cout << "Warning: attribute vector index is inconsistent"
282 << " with process List index"
283 << G4endl;
284 }
285#endif
286 // re-ordering attribute vector
287 G4ProcessAttribute* pAttr = nullptr;
288 for (auto itr = theAttrVector->cbegin(); itr!= theAttrVector->cend(); ++itr)
289 {
290 if ( (*itr)->idxProcessList == index)
291 {
292 pAttr = (*itr);
293 break;
294 }
295 }
296 return pAttr;
297 }
298}

References FatalException, G4cout, G4endl, G4Exception(), G4ParticleDefinition::GetParticleName(), GetVerboseLevel(), numberOfProcesses, theAttrVector, and theParticleType.

Referenced by ActivateProcess(), CheckOrderingParameters(), CreateGPILvectors(), EndTracking(), GetAttribute(), GetProcessOrdering(), GetProcessVectorIndex(), InActivateProcess(), RemoveProcess(), SetProcessOrdering(), SetProcessOrderingToFirst(), SetProcessOrderingToSecond(), and StartTracking().

◆ GetAttribute() [2/2]

G4ProcessAttribute * G4ProcessManager::GetAttribute ( G4VProcess aProcess) const
private

Definition at line 301 of file G4ProcessManager.cc.

302{
303 return GetAttribute( GetProcessIndex(aProcess));
304}
G4int GetProcessIndex(G4VProcess *) const

References GetAttribute(), and GetProcessIndex().

◆ GetParticleType()

G4ParticleDefinition * G4ProcessManager::GetParticleType ( ) const
inline

◆ GetPostStepIndex()

G4int G4ProcessManager::GetPostStepIndex ( G4VProcess aProcess,
G4ProcessVectorTypeIndex  typ = typeGPIL 
) const
inline

Referenced by export_G4ProcessManager().

◆ GetPostStepProcessVector()

G4ProcessVector * G4ProcessManager::GetPostStepProcessVector ( G4ProcessVectorTypeIndex  typ = typeGPIL) const
inline

◆ GetProcess()

G4VProcess * G4ProcessManager::GetProcess ( const G4String processName) const

Definition at line 1185 of file G4ProcessManager.cc.

1186{
1187 for (G4int k=0; k<numberOfProcesses; ++k)
1188 {
1189 G4VProcess* process = (*theProcessList)[k];
1190 if (process->GetProcessName() == processName) return process;
1191 }
1192 return nullptr;
1193}

References G4VProcess::GetProcessName(), and numberOfProcesses.

Referenced by G4ProcessTable::FindProcess().

◆ GetProcessActivation() [1/2]

G4bool G4ProcessManager::GetProcessActivation ( G4int  index) const

Definition at line 1216 of file G4ProcessManager.cc.

1217{
1218 if (index <0)
1219 {
1220#ifdef G4VERBOSE
1221 if (GetVerboseLevel()>0)
1222 {
1223 G4cout << "G4ProcessManager::GetProcessActivation ";
1224 G4cout << " process (or its index) not found ";
1225 }
1226#endif
1227 return false;
1228 }
1229 // process attribute
1230 G4ProcessAttribute* pAttr = (*theAttrVector)[index];
1231 // status
1232 return pAttr->isActive;
1233}

References G4cout, GetVerboseLevel(), and G4ProcessAttribute::isActive.

◆ GetProcessActivation() [2/2]

G4bool G4ProcessManager::GetProcessActivation ( G4VProcess aProcess) const

Definition at line 1210 of file G4ProcessManager.cc.

1211{
1212 return GetProcessActivation(GetProcessIndex(aProcess));
1213}
G4bool GetProcessActivation(G4VProcess *aProcess) const

References GetProcessActivation(), and GetProcessIndex().

Referenced by G4EmCalculator::ActiveForParticle(), and GetProcessActivation().

◆ GetProcessIndex()

G4int G4ProcessManager::GetProcessIndex ( G4VProcess ) const
inline

◆ GetProcessList()

G4ProcessVector * G4ProcessManager::GetProcessList ( ) const
inline

◆ GetProcessListLength()

G4int G4ProcessManager::GetProcessListLength ( ) const
inline

◆ GetProcessOrdering()

G4int G4ProcessManager::GetProcessOrdering ( G4VProcess aProcess,
G4ProcessVectorDoItIndex  idDoIt 
)

Definition at line 600 of file G4ProcessManager.cc.

604{
605 // get Process Vector Id
606 G4int ivec = GetProcessVectorId(idDoIt, typeDoIt);
607 if (ivec >=0 )
608 {
609 // get attribute
610 G4ProcessAttribute* pAttr = GetAttribute(aProcess);
611 if (pAttr != nullptr)
612 {
613 return pAttr->ordProcVector[ivec];
614 }
615 }
616 return -1;
617}
@ typeDoIt
G4int GetProcessVectorId(G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const

References GetAttribute(), GetProcessVectorId(), G4ProcessAttribute::ordProcVector, and typeDoIt.

Referenced by G4BiasingHelper::ActivatePhysicsBiasing(), and export_G4ProcessManager().

◆ GetProcessVector()

G4ProcessVector * G4ProcessManager::GetProcessVector ( G4ProcessVectorDoItIndex  idx,
G4ProcessVectorTypeIndex  typ = typeGPIL 
) const
inline

◆ GetProcessVectorId()

G4int G4ProcessManager::GetProcessVectorId ( G4ProcessVectorDoItIndex  idx,
G4ProcessVectorTypeIndex  typ = typeGPIL 
) const
inlineprivate

◆ GetProcessVectorIndex()

G4int G4ProcessManager::GetProcessVectorIndex ( G4VProcess aProcess,
G4ProcessVectorDoItIndex  idx,
G4ProcessVectorTypeIndex  typ = typeGPIL 
) const

Definition at line 196 of file G4ProcessManager.cc.

201{
202 G4int idxVect = -1;
203 G4int idxProc = GetProcessIndex(aProcess);
204 G4int ivec = GetProcessVectorId(idx, typ);
205
206 if ( ( idxProc >=0) && (ivec >=0) )
207 {
208 idxVect = GetAttribute(idxProc)->idxProcVector[ivec];
209 }
210 else
211 {
212#ifdef G4VERBOSE
213 if (verboseLevel>0)
214 {
215 G4cout << " G4ProcessManager::GetProcessVectorIndex:";
216 G4cout << "particle[" << theParticleType->GetParticleName() << "] " ;
217 G4cout << "process[" << aProcess->GetProcessName() << "]" ;
218 G4cout << G4endl;
219 if (idxProc <0)
220 {
221 G4cout << " is not registered yet ";
222 }
223 if (ivec <0)
224 {
225 G4cout << " illegal DoIt Index [= " << G4int(idx) << ","
226 << G4int(typ) << "]";
227 }
228 G4cout << G4endl;
229 }
230#endif
231 }
232 return idxVect;
233}
G4ProcessVectorTypeIndex typ

References G4cout, G4endl, GetAttribute(), G4ParticleDefinition::GetParticleName(), GetProcessIndex(), G4VProcess::GetProcessName(), GetProcessVectorId(), G4ProcessAttribute::idxProcVector, theParticleType, pyG4ProcessManager::typ, and verboseLevel.

Referenced by export_G4ProcessManager().

◆ GetVerboseLevel()

G4int G4ProcessManager::GetVerboseLevel ( ) const
inline

◆ InActivateProcess()

G4VProcess * G4ProcessManager::InActivateProcess ( G4int  index)
private

Definition at line 906 of file G4ProcessManager.cc.

907{
908 G4ApplicationState currentState
910 if ( (currentState == G4State_PreInit) || (currentState == G4State_Init) )
911 {
912#ifdef G4VERBOSE
913 if (GetVerboseLevel()>1)
914 {
915 G4cout << "G4ProcessManager::InActivateProcess is not valid in ";
916 if (currentState == G4State_PreInit )
917 {
918 G4cout << "PreInit ";
919 }
920 else if (currentState == G4State_Init )
921 {
922 G4cout << "Init ";
923 }
924 G4cout << "state !" << G4endl;
925 }
926#endif
927 return nullptr;
928 }
929
930 // find the process attribute
931 G4ProcessAttribute* pAttr = GetAttribute(index);
932 if (pAttr == nullptr) return nullptr;
933
934 // remove process
935 G4VProcess* pProcess = (*theProcessList)[index];
936
937 const G4String aErrorMessage("G4ProcessManager::InactivateProcess() - ");
938
939 if (pAttr->isActive)
940 {
941 // remove process from vectors if the process is active
942 for (G4int i=0; i<SizeOfProcVectorArray; ++i)
943 {
944 G4ProcessVector* pVector = theProcVector[i];
945 G4int idx = pAttr->idxProcVector[i];
946
947 if (idx<0)
948 {
949 // corresponding DoIt is not active
950 }
951 else if ((idx >= 0) && (idx < G4int(pVector->entries())))
952 {
953 //check pointer and set to 0
954 if ((*pVector)[idx]== pProcess)
955 {
956 (*pVector)[idx]= nullptr;
957 }
958 else
959 {
960 G4String anErrorMessage("Bad ProcessList: Bad index in attribute");
961 anErrorMessage += "for particle[" + theParticleType->GetParticleName() + "] ";
962 anErrorMessage += "process[" + pProcess->GetProcessName() + "] " ;
963 G4Exception( "G4ProcessManager::InactivateProcess()", "ProcMan012",
964 FatalException, anErrorMessage);
965 return nullptr;
966 }
967 }
968 else
969 {
970 // idx is out of range
971 G4String anErrorMessage("Bad ProcessList: Index is out of range");
972 anErrorMessage += "for particle[" + theParticleType->GetParticleName() + "] ";
973 anErrorMessage += "process[" + pProcess->GetProcessName() + "] " ;
974 G4Exception( "G4ProcessManager::InactivateProcess()", "ProcMan012",
975 FatalException, anErrorMessage);
976 return nullptr;
977 }
978 }
979 pAttr->isActive = false;
980 }
981 return pProcess;
982}

References G4ProcessVector::entries(), FatalException, G4cout, G4endl, G4Exception(), G4State_Init, G4State_PreInit, GetAttribute(), G4StateManager::GetCurrentState(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), G4StateManager::GetStateManager(), GetVerboseLevel(), G4ProcessAttribute::idxProcVector, G4ProcessAttribute::isActive, SizeOfProcVectorArray, theParticleType, and theProcVector.

Referenced by SetProcessActivation().

◆ InsertAt()

G4int G4ProcessManager::InsertAt ( G4int  position,
G4VProcess process,
G4int  ivec 
)
private

Definition at line 307 of file G4ProcessManager.cc.

308{
309 G4ProcessVector* pVector = theProcVector[ivec];
310 // check position
311 if ( (ip<0) || (ip > G4int(pVector->entries())) ) return -1;
312
313 // insert in pVector
314 pVector->insertAt(ip, process);
315
316 // correct index in ProcessAttributes of processes
317 for (G4int iproc=0; iproc<numberOfProcesses; ++iproc)
318 {
319 G4ProcessAttribute* aAttr = (*theAttrVector)[iproc];
320 if (aAttr != nullptr)
321 {
322 if (aAttr->idxProcVector[ivec] >= ip)
323 {
324 aAttr->idxProcVector[ivec] += 1;
325 }
326 }
327 else
328 {
329#ifdef G4VERBOSE
330 if (GetVerboseLevel()>0)
331 {
332 G4cout << " G4ProcessManager::InsertAt : No Process Attribute "
333 << G4endl;
334 }
335#endif
336 }
337 }
338 return ip;
339}
G4bool insertAt(G4int i, G4VProcess *aProcess)

References G4ProcessVector::entries(), G4cout, G4endl, GetVerboseLevel(), G4ProcessAttribute::idxProcVector, G4ProcessVector::insertAt(), numberOfProcesses, and theProcVector.

Referenced by AddProcess(), SetProcessOrdering(), SetProcessOrderingToFirst(), and SetProcessOrderingToSecond().

◆ operator!=()

G4bool G4ProcessManager::operator!= ( const G4ProcessManager right) const

Definition at line 1068 of file G4ProcessManager.cc.

1069{
1070 return (this != &right);
1071}

◆ operator=()

G4ProcessManager & G4ProcessManager::operator= ( const G4ProcessManager )
delete

◆ operator==()

G4bool G4ProcessManager::operator== ( const G4ProcessManager right) const

Definition at line 1062 of file G4ProcessManager.cc.

1063{
1064 return (this == &right);
1065}

◆ RemoveAt()

G4int G4ProcessManager::RemoveAt ( G4int  position,
G4VProcess process,
G4int  ivec 
)
private

Definition at line 342 of file G4ProcessManager.cc.

343{
344 G4ProcessVector* pVector = theProcVector[ivec];
345
346 // check position
347 if ( (ip<0) || (ip >= G4int(pVector->entries())) ) return -1;
348
349 // remove process
350 pVector->removeAt(ip);
351
352 // correct index
353 for(G4int iproc=0; iproc<numberOfProcesses; ++iproc)
354 {
355 G4ProcessAttribute* aAttr = (*theAttrVector)[iproc];
356 if (aAttr != nullptr)
357 {
358 if (ip < aAttr->idxProcVector[ivec])
359 {
360 aAttr->idxProcVector[ivec] -=1;
361 }
362 else if (ip == aAttr->idxProcVector[ivec])
363 {
364 aAttr->idxProcVector[ivec] = -1;
365 aAttr->ordProcVector[ivec] = ordInActive;
366 }
367 }
368 else
369 {
370#ifdef G4VERBOSE
371 if (GetVerboseLevel()>0)
372 {
373 G4cout << " G4ProcessManager::RemoveAt(): No Process Attribute "
374 << G4endl;
375 }
376#endif
377 }
378 }
379 return ip;
380}
@ ordInActive
G4VProcess * removeAt(G4int i)

References G4ProcessVector::entries(), G4cout, G4endl, GetVerboseLevel(), G4ProcessAttribute::idxProcVector, numberOfProcesses, ordInActive, G4ProcessAttribute::ordProcVector, G4ProcessVector::removeAt(), and theProcVector.

Referenced by RemoveProcess(), SetProcessOrdering(), SetProcessOrderingToFirst(), and SetProcessOrderingToSecond().

◆ RemoveProcess() [1/2]

G4VProcess * G4ProcessManager::RemoveProcess ( G4int  index)

Definition at line 518 of file G4ProcessManager.cc.

519{
520 //find the process attribute
521 G4ProcessAttribute* pAttr = GetAttribute(index);
522 if (pAttr == nullptr) return nullptr;
523
524 // remove process
525 G4VProcess* removedProcess = (*theProcessList)[index];
526
527 if (!(pAttr->isActive)) { ActivateProcess(index);}
528 // remove process from vectors if the process is active
529 for (G4int ivec=0; ivec<SizeOfProcVectorArray; ++ivec)
530 {
531 G4ProcessVector* pVector = theProcVector[ivec];
532 G4int idx = pAttr->idxProcVector[ivec];
533 if ((idx >= 0) && (idx < G4int(pVector->entries())))
534 {
535 // remove
536 if (RemoveAt(idx, removedProcess, ivec) <0)
537 {
538 G4String anErrorMessage("Bad index in attribute");
539 anErrorMessage += "for particle["
541 anErrorMessage += "process["
542 + removedProcess->GetProcessName() + "] " ;
543 G4Exception( "G4ProcessManager::RemoveProcess()","Fatal Error",
544 FatalException,anErrorMessage);
545 return nullptr;
546 }
547 }
548 else if (idx<0)
549 {
550 // corresponding DoIt is not active
551 }
552 else
553 {
554 // idx is out of range
555 G4String anErrorMessage("Bad ProcessList: Index is out of range ");
556 anErrorMessage += "for particle[" + theParticleType->GetParticleName() + "] ";
557 anErrorMessage += "process[" + removedProcess->GetProcessName() + "] " ;
558 G4Exception( "G4ProcessManager::RemoveProcess()","ProcMan012",
559 FatalException,anErrorMessage);
560 return nullptr;
561 }
562 }
563 pAttr->isActive = false;
564 // remove from the process List and delete the attribute
565 theProcessList->removeAt(index);
566 for (auto itr = theAttrVector->cbegin(); itr!= theAttrVector->cend(); ++itr)
567 {
568 if ( (*itr) == pAttr)
569 {
570 theAttrVector->erase(itr);
571 break;
572 }
573 }
574 delete pAttr;
576
577 // correct index
578 for(G4int i=0; i<numberOfProcesses; ++i)
579 {
580 G4ProcessAttribute* aAttr = (*theAttrVector)[i];
581 if (index < aAttr->idxProcessList) aAttr->idxProcessList -=1;
582 }
583
585
586 // remove aProcess from ProcesssTable
588 theProcessTable->Remove(removedProcess, this);
589
590 return removedProcess;
591}
G4VProcess * ActivateProcess(G4int index)
G4int RemoveAt(G4int position, G4VProcess *process, G4int ivec)
G4int Remove(G4VProcess *aProcess, G4ProcessManager *aProcMgr)

References ActivateProcess(), CreateGPILvectors(), G4ProcessVector::entries(), FatalException, G4Exception(), GetAttribute(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), G4ProcessTable::GetProcessTable(), G4ProcessAttribute::idxProcessList, G4ProcessAttribute::idxProcVector, G4ProcessAttribute::isActive, numberOfProcesses, G4ProcessTable::Remove(), G4ProcessVector::removeAt(), RemoveAt(), SizeOfProcVectorArray, theAttrVector, theParticleType, theProcessList, and theProcVector.

◆ RemoveProcess() [2/2]

G4VProcess * G4ProcessManager::RemoveProcess ( G4VProcess aProcess)

◆ SetIndexToProcessVector()

void G4ProcessManager::SetIndexToProcessVector ( G4int  ivec)
private

◆ SetParticleType()

void G4ProcessManager::SetParticleType ( const G4ParticleDefinition )
inline

Referenced by export_G4ProcessManager().

◆ SetProcessActivation() [1/2]

G4VProcess * G4ProcessManager::SetProcessActivation ( G4int  index,
G4bool  fActive 
)

Definition at line 1203 of file G4ProcessManager.cc.

1204{
1205 if (fActive) return ActivateProcess(index);
1206 else return InActivateProcess(index);
1207}
G4VProcess * InActivateProcess(G4int index)

References ActivateProcess(), and InActivateProcess().

◆ SetProcessActivation() [2/2]

G4VProcess * G4ProcessManager::SetProcessActivation ( G4VProcess aProcess,
G4bool  fActive 
)

Definition at line 1196 of file G4ProcessManager.cc.

1198{
1199 return SetProcessActivation(GetProcessIndex(aProcess), fActive);
1200}
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)

References GetProcessIndex(), and SetProcessActivation().

Referenced by G4ITStepProcessor::ActiveOnlyITProcess(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTable::SetProcessActivation(), and SetProcessActivation().

◆ SetProcessOrdering()

void G4ProcessManager::SetProcessOrdering ( G4VProcess aProcess,
G4ProcessVectorDoItIndex  idDoIt,
G4int  ordDoIt = ordDefault 
)

Definition at line 620 of file G4ProcessManager.cc.

625{
626 const G4String aErrorMessage("G4ProcessManager::SetProcessOrdering() - ");
627
628#ifdef G4VERBOSE
629 if (GetVerboseLevel()>2)
630 {
631 G4cout << aErrorMessage ;
632 G4cout << "particle[" + theParticleType->GetParticleName() +"] " ;
633 G4cout <<"process[" + aProcess->GetProcessName() + "]"<< G4endl;
634 }
635#endif
636
637 // get Process Vector Id
638 G4int ivec = GetProcessVectorId(idDoIt, typeDoIt);
639 if (ivec <0 )
640 {
641#ifdef G4VERBOSE
642 if (verboseLevel>0)
643 {
644 G4cout << aErrorMessage << G4endl;
645 G4cout << "particle[" << theParticleType->GetParticleName() << "] " ;
646 G4cout << "process[" << aProcess->GetProcessName() << "]"<< G4endl;
647 G4cout << " illegal DoIt Index [= " << G4int(idDoIt) << "]";
648 G4cout << G4endl;
649 }
650#endif
651 return;
652 }
653
654 if (ordDoIt>ordLast) ordDoIt = ordLast;
655 // get attribute
656 G4ProcessAttribute* pAttr = GetAttribute(aProcess);
657 if (pAttr == nullptr)
658 {
659 // can not get process attribute
660 return;
661 }
662 else
663 {
664 G4int ip = pAttr->idxProcVector[ivec];
665 // remove a process from the process vector
666 if ( ip >=0 )
667 {
668 RemoveAt(ip, aProcess, ivec);
669 }
670
671 // set ordering parameter to non-zero
672 if (ordDoIt == 0) ordDoIt = 1;
673 pAttr->ordProcVector[ivec-1] = ordDoIt;
674 pAttr->ordProcVector[ivec] = ordDoIt;
675
676 // insert in process vector if ordDoIt >0
677 if (ordDoIt >0)
678 {
679 // find insert position
680 ip = FindInsertPosition(pAttr->ordProcVector[ivec], ivec);
681 // insert
682 InsertAt(ip, aProcess, ivec);
683 // set index in Process Attribute
684 pAttr->idxProcVector[ivec] = ip;
685#ifdef G4VERBOSE
686 if (verboseLevel>2)
687 {
688 G4cout << aErrorMessage << G4endl;
689 G4cout << "particle[" << theParticleType->GetParticleName() << "] " ;
690 G4cout <<"process[" << aProcess->GetProcessName() << "]"<< G4endl;
691 G4cout << aProcess->GetProcessName() << " is inserted at "<< ip;
692 G4cout << " in ProcessVetor[" << ivec<< "]";
693 G4cout << " with Ordering parameter = " << ordDoIt ;
694 G4cout << G4endl;
695 }
696#endif
697 }
698 }
699 // check consistencies between ordering parameters and process
700 CheckOrderingParameters(aProcess);
701
702 // create GPIL vectors
704}

References CheckOrderingParameters(), CreateGPILvectors(), FindInsertPosition(), G4cout, G4endl, GetAttribute(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), GetProcessVectorId(), GetVerboseLevel(), G4ProcessAttribute::idxProcVector, InsertAt(), ordLast, G4ProcessAttribute::ordProcVector, RemoveAt(), theParticleType, typeDoIt, and verboseLevel.

Referenced by G4FastSimulationHelper::ActivateFastSimulation(), LBE::ConstructGeneral(), G4ParallelWorldPhysics::ConstructProcess(), G4SpinDecayPhysics::ConstructProcess(), G4OpticalPhysics::ConstructProcess(), G4RunManager::ConstructScoringWorlds(), G4WorkerRunManager::ConstructScoringWorlds(), export_G4ProcessManager(), G4PhysicsListHelper::RegisterProcess(), and SetProcessOrderingToLast().

◆ SetProcessOrderingToFirst()

void G4ProcessManager::SetProcessOrderingToFirst ( G4VProcess aProcess,
G4ProcessVectorDoItIndex  idDoIt 
)

Definition at line 707 of file G4ProcessManager.cc.

711{
712 // get Process Vector Id
713 G4int ivec = GetProcessVectorId(idDoIt, typeDoIt);
714 if (ivec <0 )
715 {
716#ifdef G4VERBOSE
717 if (verboseLevel>0)
718 {
719 G4cout << "G4ProcessManager::SetProcessOrderingToFirst(): ";
720 G4cout << " illegal DoIt Index [= " << G4int(idDoIt) << "]";
721 G4cout << G4endl;
722 }
723#endif
724 return;
725 }
726
727 // get attribute
728 G4ProcessAttribute* pAttr = GetAttribute(aProcess);
729 if (pAttr == nullptr)
730 {
731 return;
732 }
733 else
734 {
735 G4int ip = pAttr->idxProcVector[ivec];
736
737 // remove a process from the process vector
738 if ( ip >=0 )
739 {
740 RemoveAt(ip, aProcess, ivec);
741 }
742
743 // set ordering parameter to zero
744 pAttr->ordProcVector[ivec] = 0;
745 pAttr->ordProcVector[ivec-1] = 0;
746
747 // insert
748 InsertAt(0, aProcess, ivec);
749
750 // set index in Process Attribute
751 pAttr->idxProcVector[ivec] = 0;
752
753#ifdef G4VERBOSE
754 if (verboseLevel>2)
755 {
756 G4cout << "G4ProcessManager::SetProcessOrderingToFirst(): ";
757 G4cout << aProcess->GetProcessName() << " is inserted at top ";
758 G4cout << " in ProcessVetor[" << ivec<< "]";
759 G4cout << G4endl;
760 }
761#endif
762 }
763
764 if (isSetOrderingFirstInvoked[idDoIt])
765 {
766 G4String anErrMsg = "Set Ordering First is invoked twice for ";
767 anErrMsg += aProcess->GetProcessName();
768 anErrMsg += " to ";
769 anErrMsg += theParticleType->GetParticleName();
770 G4Exception("G4ProcessManager::SetProcessOrderingToFirst()",
771 "ProcMan113", JustWarning, anErrMsg);
772 }
773 isSetOrderingFirstInvoked[idDoIt] = true;
774
775 // check consistencies between ordering parameters and process
776 CheckOrderingParameters(aProcess);
777
778 // create GPIL vectors
780}
@ JustWarning

References CheckOrderingParameters(), CreateGPILvectors(), G4cout, G4endl, G4Exception(), GetAttribute(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), GetProcessVectorId(), G4ProcessAttribute::idxProcVector, InsertAt(), isSetOrderingFirstInvoked, JustWarning, G4ProcessAttribute::ordProcVector, RemoveAt(), theParticleType, typeDoIt, and verboseLevel.

Referenced by G4PhysicsListHelper::AddTransportation(), G4ErrorPhysicsList::ConstructProcess(), export_G4ProcessManager(), and G4PhysicsListHelper::RegisterProcess().

◆ SetProcessOrderingToLast()

void G4ProcessManager::SetProcessOrderingToLast ( G4VProcess aProcess,
G4ProcessVectorDoItIndex  idDoIt 
)

Definition at line 886 of file G4ProcessManager.cc.

890{
891 SetProcessOrdering(aProcess, idDoIt, ordLast );
892
893 if (isSetOrderingLastInvoked[idDoIt])
894 {
895 G4String anErrMsg = "Set Ordering Last is invoked twice for ";
896 anErrMsg += aProcess->GetProcessName();
897 anErrMsg += " to ";
898 anErrMsg += theParticleType->GetParticleName();
899 G4Exception( "G4ProcessManager::SetProcessOrderingToLast()","ProcMan114",
900 JustWarning,anErrMsg);
901 }
902 isSetOrderingLastInvoked[idDoIt] = true;
903}
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)

References G4Exception(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), isSetOrderingLastInvoked, JustWarning, ordLast, SetProcessOrdering(), and theParticleType.

Referenced by G4FastSimulationHelper::ActivateFastSimulation(), G4BiasingHelper::AddLimiterProcess(), LBE::ConstructOp(), G4OpticalPhysics::ConstructProcess(), export_G4ProcessManager(), and G4PhysicsListHelper::RegisterProcess().

◆ SetProcessOrderingToSecond()

void G4ProcessManager::SetProcessOrderingToSecond ( G4VProcess aProcess,
G4ProcessVectorDoItIndex  idDoIt 
)

Definition at line 783 of file G4ProcessManager.cc.

787{
788 const G4String aErrorMessage("G4ProcessManager::SetProcessOrderingToSecond() - ");
789
790#ifdef G4VERBOSE
791 if (GetVerboseLevel()>2)
792 {
793 G4cout << aErrorMessage ;
794 G4cout << "particle[" << theParticleType->GetParticleName() << "] " ;
795 G4cout <<"process[" << aProcess->GetProcessName() << "]"<< G4endl;
796 }
797#endif
798
799 // get Process Vector Id
800 G4int ivec = GetProcessVectorId(idDoIt, typeDoIt);
801 if (ivec <0 )
802 {
803#ifdef G4VERBOSE
804 if (verboseLevel>0)
805 {
806 G4cout << aErrorMessage << G4endl;
807 G4cout << "particle[" << theParticleType->GetParticleName() << "] " ;
808 G4cout << "process[" << aProcess->GetProcessName() << "]"<< G4endl;
809 G4cout << " illegal DoIt Index [= " << G4int(idDoIt) << "]";
810 G4cout << G4endl;
811 }
812#endif
813 return;
814 }
815
816 // get attribute
817 G4ProcessAttribute* pAttr = GetAttribute(aProcess);
818 if (pAttr == nullptr)
819 {
820 // can not get process attribute
821 return;
822 }
823 else
824 {
825 G4int ip = pAttr->idxProcVector[ivec];
826 // remove a process from the process vector
827 if ( ip >=0 )
828 {
829 RemoveAt(ip, aProcess, ivec);
830 }
831 }
832
833 // set ordering parameter
834 pAttr->ordProcVector[ivec-1] = 0;
835 pAttr->ordProcVector[ivec] = 0;
836
837 // find insert position
838 G4ProcessVector* pVector = theProcVector[ivec];
839 G4int ip = pVector->entries();
840 G4int tmp = INT_MAX;
841
842 // find insert position
843 for (G4int iproc=0; iproc<numberOfProcesses; ++iproc)
844 {
845 G4ProcessAttribute* aAttr = (*theAttrVector)[iproc];
846 if ( aAttr->idxProcVector[ivec] >= 0 )
847 {
848 if ( (aAttr->ordProcVector[ivec] !=0 ) &&
849 (tmp >= aAttr->ordProcVector[ivec]) )
850 {
851 tmp = aAttr->ordProcVector[ivec];
852 if ( ip > aAttr->idxProcVector[ivec] )
853 {
854 ip = aAttr->idxProcVector[ivec] ;
855 }
856 }
857 }
858 }
859
860 // insert
861 InsertAt(ip, aProcess, ivec);
862
863 // set index in Process Attribute
864 pAttr->idxProcVector[ivec] = ip;
865#ifdef G4VERBOSE
866 if (verboseLevel>2)
867 {
868 G4cout << aErrorMessage << G4endl;
869 G4cout << "particle[" << theParticleType->GetParticleName() << "] " ;
870 G4cout <<"process[" << aProcess->GetProcessName() << "]"<< G4endl;
871 G4cout << aProcess->GetProcessName() << " is inserted at "<< ip;
872 G4cout << " in ProcessVetor[" << ivec<< "]";
873 G4cout << " with Ordering parameter = 1 ";
874 G4cout << G4endl;
875 }
876#endif
877
878 // check consistencies between ordering parameters and process
879 CheckOrderingParameters(aProcess);
880
881 // create GPIL vectors
883}

References CheckOrderingParameters(), CreateGPILvectors(), G4ProcessVector::entries(), G4cout, G4endl, GetAttribute(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), GetProcessVectorId(), GetVerboseLevel(), G4ProcessAttribute::idxProcVector, InsertAt(), INT_MAX, numberOfProcesses, G4ProcessAttribute::ordProcVector, RemoveAt(), theParticleType, theProcVector, typeDoIt, and verboseLevel.

Referenced by G4BiasingHelper::AddLimiterProcess(), G4ProcessPlacer::AddProcessAs(), G4ParallelWorldPhysics::ConstructProcess(), G4RunManager::ConstructScoringWorlds(), and G4WorkerRunManager::ConstructScoringWorlds().

◆ SetVerboseLevel()

void G4ProcessManager::SetVerboseLevel ( G4int  value)
inline

◆ StartTracking()

void G4ProcessManager::StartTracking ( G4Track aTrack = nullptr)

Definition at line 1163 of file G4ProcessManager.cc.

1164{
1165 for (std::size_t idx = 0; idx<theProcessList->entries(); ++idx)
1166 {
1167 if (GetAttribute(idx)->isActive)
1168 ((*theProcessList)[idx])->StartTracking(aTrack);
1169 }
1170 if(aTrack) duringTracking = true;
1171}
void StartTracking(G4Track *aTrack=nullptr)

References duringTracking, G4ProcessVector::entries(), GetAttribute(), StartTracking(), and theProcessList.

Referenced by G4ErrorPropagator::InitG4Track(), G4TrackingManager::ProcessOneTrack(), G4ITTrackingManager::StartTracking(), and StartTracking().

Field Documentation

◆ counterOfObjects

G4ThreadLocal G4int G4ProcessManager::counterOfObjects = 0
staticprivate

Definition at line 346 of file G4ProcessManager.hh.

Referenced by G4ProcessManager(), and ~G4ProcessManager().

◆ duringTracking

G4bool G4ProcessManager::duringTracking = false
private

Definition at line 338 of file G4ProcessManager.hh.

Referenced by EndTracking(), and StartTracking().

◆ fProcessManagerMessenger

G4ThreadLocal G4ProcessManagerMessenger * G4ProcessManager::fProcessManagerMessenger = nullptr
staticprivate

Definition at line 345 of file G4ProcessManager.hh.

Referenced by G4ProcessManager(), and ~G4ProcessManager().

◆ isSetOrderingFirstInvoked

G4bool G4ProcessManager::isSetOrderingFirstInvoked[NDoit]
private

Definition at line 340 of file G4ProcessManager.hh.

Referenced by G4ProcessManager(), and SetProcessOrderingToFirst().

◆ isSetOrderingLastInvoked

G4bool G4ProcessManager::isSetOrderingLastInvoked[NDoit]
private

Definition at line 341 of file G4ProcessManager.hh.

Referenced by G4ProcessManager(), and SetProcessOrderingToLast().

◆ numberOfProcesses

G4int G4ProcessManager::numberOfProcesses = 0
private

◆ theAttrVector

G4ProcessAttrVector* G4ProcessManager::theAttrVector = nullptr
private

◆ theParticleType

const G4ParticleDefinition* G4ProcessManager::theParticleType = nullptr
private

◆ theProcessList

G4ProcessVector* G4ProcessManager::theProcessList = nullptr
private

◆ theProcVector

G4ProcessVector* G4ProcessManager::theProcVector[SizeOfProcVectorArray]
private

◆ verboseLevel

G4int G4ProcessManager::verboseLevel = 1
private

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