Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ProcessManager Class Reference

#include <G4ProcessManager.hh>

Public Types

enum  { SizeOfProcVectorArray = 6 }
 

Public Member Functions

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

Detailed Description

Definition at line 94 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
52 theProcessList = new G4ProcessVector();
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 {
62 theProcVector[i] = new G4ProcessVector();
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
71 theAttrVector = new G4ProcessAttrVector();
72
73 // create Process Manager Messenger
74 if (fProcessManagerMessenger == nullptr)
75 {
76 fProcessManagerMessenger = new G4ProcessManagerMessenger();
77 }
78
79 for (G4int i=0; i<NDoit; ++i)
80 {
81 isSetOrderingFirstInvoked[i] = false;
82 isSetOrderingLastInvoked[i] = false;
83 }
84
85 // Increment counter of G4ProcessManager objects
86 ++counterOfObjects;
87}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
@ NDoit
int G4int
Definition G4Types.hh:85

◆ G4ProcessManager() [2/3]

G4ProcessManager::G4ProcessManager ( G4ProcessManager & right)

Definition at line 90 of file G4ProcessManager.cc.

91 : theParticleType(right.theParticleType),
92 verboseLevel(right.verboseLevel)
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
103 theProcessList = new G4ProcessVector();
104 theAttrVector = new G4ProcessAttrVector();
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);
120 ++numberOfProcesses;
121 }
122
123 // fill up theProcVector
124 for (G4int i=0; i<SizeOfProcVectorArray; ++i)
125 {
126 // create i-th ProcessVector in theProcVector
127 theProcVector[i] = new G4ProcessVector();
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 (G4int j=0; j< (G4int)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 {
150 isSetOrderingFirstInvoked[i]= right.isSetOrderingFirstInvoked[i];
151 isSetOrderingLastInvoked[i] = right.isSetOrderingLastInvoked[i];
152 }
153
154 // Increment counter of G4ProcessManager objects
155 ++counterOfObjects;
156}
#define G4endl
Definition G4ios.hh:67
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)

◆ 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 }
169 theProcessList->clear();
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
179 --counterOfObjects;
180
181 // delete messenger if this object is last one
182 if ( counterOfObjects == 0 )
183 {
184 delete fProcessManagerMessenger;
185 fProcessManagerMessenger = nullptr;
186#ifdef G4VERBOSE
187 if (GetVerboseLevel() > 1)
188 {
189 G4cout << "G4ProcessManagerMessenger is deleted" << G4endl;
190 }
191#endif
192 }
193}

Member Function Documentation

◆ AddContinuousProcess()

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

◆ AddDiscreteProcess()

◆ 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 = G4int(theProcessList->entries() - 1);
439
440 // check size of the ProcessVector[0]
441 if (numberOfProcesses != idx)
442 {
443 theProcessList->removeLast();
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
504 numberOfProcesses += 1;
505
506 // check consistencies between ordering parameters and process
507 CheckOrderingParameters(aProcess);
508
509 CreateGPILvectors();
510
511 // inform process manager pointer to the process
512 aProcess->SetProcessManager(this);
513
514 return idx;
515}
const G4String & GetParticleName() const
G4int ordProcVector[G4ProcessManager::SizeOfProcVectorArray]
G4int idxProcVector[G4ProcessManager::SizeOfProcVectorArray]
G4VProcess * removeLast()
virtual G4bool IsApplicable(const G4ParticleDefinition &)
virtual void SetProcessManager(const G4ProcessManager *)
const G4String & GetProcessName() const

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

◆ AddRestProcess()

◆ 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 (G4int idx=0; idx < (G4int)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)

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

◆ EndTracking()

void G4ProcessManager::EndTracking ( )

Definition at line 1174 of file G4ProcessManager.cc.

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

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

◆ GetAlongStepIndex()

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

◆ GetAlongStepProcessVector()

◆ GetAtRestIndex()

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

◆ GetAtRestProcessVector()

◆ GetParticleType()

◆ GetPostStepIndex()

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

◆ GetPostStepProcessVector()

◆ 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}

◆ 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}

◆ 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
G4int GetProcessIndex(G4VProcess *) const

Referenced by GetProcessActivation().

◆ GetProcessIndex()

◆ GetProcessList()

◆ 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

Referenced by G4BiasingHelper::ActivatePhysicsBiasing().

◆ GetProcessVector()

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

◆ 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}

◆ GetVerboseLevel()

◆ 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}

◆ 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["
540 + theParticleType->GetParticleName() + "] ";
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;
575 --numberOfProcesses;
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
584 CreateGPILvectors();
585
586 // remove aProcess from ProcesssTable
588 theProcessTable->Remove(removedProcess, this);
589
590 return removedProcess;
591}
G4int Remove(G4VProcess *aProcess, G4ProcessManager *aProcMgr)
G4VProcess * removeAt(G4int i)

◆ RemoveProcess() [2/2]

◆ SetParticleType()

void G4ProcessManager::SetParticleType ( const G4ParticleDefinition * )
inline

◆ 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}

◆ SetProcessActivation() [2/2]

◆ 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
703 CreateGPILvectors();
704}
@ ordLast

Referenced by G4FastSimulationHelper::ActivateFastSimulation(), LBE::ConstructGeneral(), G4OpticalPhysics::ConstructProcess(), G4ParallelWorldPhysics::ConstructProcess(), G4SpinDecayPhysics::ConstructProcess(), G4RunManager::ConstructScoringWorlds(), G4WorkerRunManager::ConstructScoringWorlds(), 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
779 CreateGPILvectors();
780}
@ JustWarning

Referenced by G4PhysicsListHelper::AddTransportation(), G4ErrorPhysicsList::ConstructProcess(), 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)

Referenced by G4FastSimulationHelper::ActivateFastSimulation(), G4BiasingHelper::AddLimiterProcess(), LBE::ConstructOp(), G4OpticalPhysics::ConstructProcess(), 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 = (G4int)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
882 CreateGPILvectors();
883}
#define INT_MAX
Definition templates.hh:90

Referenced by G4BiasingHelper::AddLimiterProcess(), 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 (G4int idx = 0; idx<(G4int)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)

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


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