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

#include <G4ProcessTable.hh>

Public Types

typedef std::vector< G4ProcTblElement * > G4ProcTableVector
 
typedef std::vector< G4StringG4ProcNameVector
 

Public Member Functions

 G4ProcessTable ()
 
 ~G4ProcessTable ()
 
G4int Length () const
 
G4int Insert (G4VProcess *aProcess, G4ProcessManager *aProcMgr)
 
G4int Remove (G4VProcess *aProcess, G4ProcessManager *aProcMgr)
 
G4VProcessFindProcess (const G4String &processName, const G4String &particleName) const
 
G4VProcessFindProcess (const G4String &processName, const G4ParticleDefinition *particle) const
 
G4VProcessFindProcess (const G4String &processName, const G4ProcessManager *processManager) const
 
G4ProcessVectorFindProcesses ()
 
G4ProcessVectorFindProcesses (const G4ProcessManager *processManager)
 
G4ProcessVectorFindProcesses (const G4String &processName)
 
G4ProcessVectorFindProcesses (G4ProcessType processType)
 
void SetProcessActivation (const G4String &processName, G4bool fActive)
 
void SetProcessActivation (const G4String &processName, const G4String &particleName, G4bool fActive)
 
void SetProcessActivation (const G4String &processName, G4ParticleDefinition *particle, G4bool fActive)
 
void SetProcessActivation (const G4String &processName, G4ProcessManager *processManager, G4bool fActive)
 
void SetProcessActivation (G4ProcessType processType, G4bool fActive)
 
void SetProcessActivation (G4ProcessType processType, const G4String &particleName, G4bool fActive)
 
void SetProcessActivation (G4ProcessType processType, G4ParticleDefinition *particle, G4bool fActive)
 
void SetProcessActivation (G4ProcessType processType, G4ProcessManager *processManager, G4bool fActive)
 
G4ProcNameVectorGetNameList ()
 
G4ProcTableVectorGetProcTableVector ()
 
void DumpInfo (G4VProcess *process, G4ParticleDefinition *particle=0)
 
G4UImessengerCreateMessenger ()
 
void DeleteMessenger ()
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 

Static Public Member Functions

static G4ProcessTableGetProcessTable ()
 

Detailed Description

Definition at line 59 of file G4ProcessTable.hh.

Member Typedef Documentation

◆ G4ProcNameVector

Definition at line 133 of file G4ProcessTable.hh.

◆ G4ProcTableVector

Definition at line 132 of file G4ProcessTable.hh.

Constructor & Destructor Documentation

◆ G4ProcessTable()

G4ProcessTable::G4ProcessTable ( )

Definition at line 44 of file G4ProcessTable.cc.

44 :verboseLevel(1)
45{
46#ifdef G4VERBOSE
47 if (verboseLevel>1){
48 G4cout << "-- G4ProcessTable constructor --" << G4endl;
49 }
50#endif
51 fProcTblVector = new G4ProcTableVector();
52 fProcNameVector = new G4ProcNameVector();
53 tmpTblVector = new G4ProcTableVector();
54 fProcTblMessenger = 0;
55}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
std::vector< G4ProcTblElement * > G4ProcTableVector
std::vector< G4String > G4ProcNameVector

◆ ~G4ProcessTable()

G4ProcessTable::~G4ProcessTable ( )

Definition at line 73 of file G4ProcessTable.cc.

74{
75#ifdef G4VERBOSE
76 if (verboseLevel>1){
77 G4cout << "-- G4ProcessTable destructor --" << G4endl;
78 }
79#endif
80
81 if ( tmpTblVector != 0) {
82 tmpTblVector ->clear();
83 delete tmpTblVector;
84 }
85
86 if ( fProcTblVector != 0) {
87 G4ProcTableVector::iterator idx;
88
89 // destruction of processes has moved to G4VUserPhysicsList
90 for (idx=fProcTblVector->begin(); idx!=fProcTblVector->end(); ++idx) {
91 // delete all processes
92 // delete (*idx)->GetProcess();
93 delete (*idx);
94 }
95 fProcTblVector ->clear();
96 delete fProcTblVector;
97 }
98
99 if ( fProcNameVector != 0) {
100 fProcNameVector ->clear();
101 delete fProcNameVector;
102 }
103 fProcessTable =0;
104}

Member Function Documentation

◆ CreateMessenger()

G4UImessenger * G4ProcessTable::CreateMessenger ( )

Definition at line 107 of file G4ProcessTable.cc.

108{
109 if (fProcTblMessenger == 0) {
110 fProcTblMessenger = new G4ProcessTableMessenger(this);
111 }
112 return fProcTblMessenger;
113}

Referenced by G4RunManager::G4RunManager().

◆ DeleteMessenger()

void G4ProcessTable::DeleteMessenger ( )

Definition at line 116 of file G4ProcessTable.cc.

117{
118 if (fProcTblMessenger != 0) {
119 delete fProcTblMessenger;
120 }
121}

Referenced by G4RunManager::~G4RunManager().

◆ DumpInfo()

void G4ProcessTable::DumpInfo ( G4VProcess process,
G4ParticleDefinition particle = 0 
)

Definition at line 572 of file G4ProcessTable.cc.

574{
575 G4ProcTableVector::iterator itr;
576 G4int idxTbl=0;
577 G4ProcTblElement* anElement=0;
578 G4bool isFoundInTbl = false;
579 G4ProcessManager* manager=0;
580 G4int idx;
581 // loop over all elements
582 for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) {
583 anElement = (*itr);
584 if (process == anElement->GetProcess() ){
585 if (particle!=0) {
586 for (idx=0; idx<anElement->Length(); idx++){
587 manager = anElement->GetProcessManager(idx);
588 if (particle == manager->GetParticleType()) {
589 isFoundInTbl = true;
590 break;
591 }
592 }
593 } else {
594 isFoundInTbl = true;
595 }
596 break;
597 }
598 }
599 if (!isFoundInTbl ) return;
600
601 G4int tmpVerbose = process->GetVerboseLevel();
602 process->SetVerboseLevel(verboseLevel);
603 process->DumpInfo();
604 process->SetVerboseLevel(tmpVerbose);
605 if (particle==0) {
606 for (idx=0; idx<anElement->Length(); idx++){
607 manager = anElement->GetProcessManager(idx);
608 G4cout << " for " << manager->GetParticleType()->GetParticleName();
609 G4cout << G4endl;
610#ifdef G4VERBOSE
611 if (verboseLevel >2){
612 tmpVerbose = manager->GetVerboseLevel();
613 manager->SetVerboseLevel(verboseLevel);
614 manager->DumpInfo();
615 manager->SetVerboseLevel(tmpVerbose);
616 }
617#endif
618 }
619 } else {
620 G4cout << " for " << manager->GetParticleType()->GetParticleName();
621 G4cout << G4endl;
622#ifdef G4VERBOSE
623 if (verboseLevel >2){
624 tmpVerbose = manager->GetVerboseLevel();
625 manager->SetVerboseLevel(verboseLevel);
626 manager->DumpInfo();
627 manager->SetVerboseLevel(tmpVerbose);
628 }
629#endif
630 }
631}
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
const G4String & GetParticleName() const
G4VProcess * GetProcess() const
G4int Length() const
G4ProcessManager * GetProcessManager(G4int index) const
G4ParticleDefinition * GetParticleType() const
void SetVerboseLevel(G4int value)
G4int GetVerboseLevel() const
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:408
G4int GetVerboseLevel() const
Definition: G4VProcess.hh:413
virtual void DumpInfo() const
Definition: G4VProcess.cc:206

Referenced by G4ProcessTableMessenger::SetNewValue().

◆ FindProcess() [1/3]

G4VProcess * G4ProcessTable::FindProcess ( const G4String processName,
const G4ParticleDefinition particle 
) const

◆ FindProcess() [2/3]

G4VProcess * G4ProcessTable::FindProcess ( const G4String processName,
const G4ProcessManager processManager 
) const

Definition at line 317 of file G4ProcessTable.cc.

320{
321 G4ProcTableVector::iterator itr;
322 G4int idxTbl = 0;
323 G4bool isFound = false;
324 G4ProcTblElement* anElement=0;
325 for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) {
326 anElement = (*itr);
327 // check name
328 if ( anElement->GetProcessName() == processName ) {
329 // check if the processManage is included
330 if ( anElement->Contains(processManager) ) {
331 isFound = true;
332 break;
333 }
334 }
335 }
336#ifdef G4VERBOSE
337 if (!isFound && verboseLevel>1){
338 G4cout << " G4ProcessTable::FindProcess :" ;
339 G4cout << " The Process[" << processName << "] is not found ";
340 G4cout << " for " << processManager->GetParticleType()->GetParticleName() << G4endl;
341 }
342#endif
343
344 if (isFound) return anElement->GetProcess();
345 else return 0;
346}
const G4String & GetProcessName() const
G4bool Contains(const G4ProcessManager *pManager) const

◆ FindProcess() [3/3]

G4VProcess * G4ProcessTable::FindProcess ( const G4String processName,
const G4String particleName 
) const

Referenced by SetProcessActivation().

◆ FindProcesses() [1/4]

G4ProcessVector * G4ProcessTable::FindProcesses ( )

Definition at line 421 of file G4ProcessTable.cc.

422{
423 return ExtractProcesses(fProcTblVector);
424}

Referenced by G4ProcessTableMessenger::SetNewValue().

◆ FindProcesses() [2/4]

G4ProcessVector * G4ProcessTable::FindProcesses ( const G4ProcessManager processManager)

Definition at line 427 of file G4ProcessTable.cc.

428{
429 G4ProcessVector* procList = pManager->GetProcessList();
430 return new G4ProcessVector(*procList);
431}

◆ FindProcesses() [3/4]

G4ProcessVector * G4ProcessTable::FindProcesses ( const G4String processName)

Definition at line 434 of file G4ProcessTable.cc.

435{
436 G4ProcTableVector* pTblVector = Find(fProcTblVector, processName);
437 return ExtractProcesses(pTblVector);
438}

◆ FindProcesses() [4/4]

G4ProcessVector * G4ProcessTable::FindProcesses ( G4ProcessType  processType)

Definition at line 441 of file G4ProcessTable.cc.

442{
443 G4ProcTableVector* pTblVector = Find(fProcTblVector, processType);
444 return ExtractProcesses(pTblVector);
445}

◆ GetNameList()

◆ GetProcessTable()

G4ProcessTable * G4ProcessTable::GetProcessTable ( )
static

Definition at line 154 of file G4ProcessTable.cc.

155{
156 static G4ProcessTable theProcessTable;
157 if (!fProcessTable){
158 fProcessTable = &theProcessTable;
159 }
160 return fProcessTable;
161}

Referenced by G4ProcessManager::AddProcess(), G4ProcessManager::G4ProcessManager(), G4RunManager::G4RunManager(), G4ProcessManager::RemoveProcess(), and G4RunManager::~G4RunManager().

◆ GetProcTableVector()

G4ProcTableVector * G4ProcessTable::GetProcTableVector ( )

◆ GetVerboseLevel()

G4int G4ProcessTable::GetVerboseLevel ( ) const

◆ Insert()

G4int G4ProcessTable::Insert ( G4VProcess aProcess,
G4ProcessManager aProcMgr 
)

Definition at line 164 of file G4ProcessTable.cc.

166{
167 if ( (aProcess == 0) || ( aProcMgr == 0 ) ){
168#ifdef G4VERBOSE
169 if (verboseLevel>0){
170 G4cout << "G4ProcessTable::Insert : arguments are 0 pointer "
171 <<aProcess <<","<< aProcMgr << G4endl;
172 }
173#endif
174 return -1;
175 }
176
177#ifdef G4VERBOSE
178 if (verboseLevel>1){
179 G4cout << "G4ProcessTable::Insert ";
180 G4cout << " Process[" << aProcess->GetProcessName() << "]";
181 G4cout << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]";
182 G4cout << G4endl;
183 }
184#endif
185
186 G4ProcTableVector::iterator itr;
187 G4int idxTbl=0;
188 G4ProcTblElement* anElement;
189 G4bool isFoundInTbl = false;
190 // loop over all elements
191 for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) {
192 anElement = (*itr);
193 // check if this process is included
194 if (aProcess == anElement->GetProcess()) {
195 isFoundInTbl = true;
196
197 // add the process manager into the element
198 // unless this process manager is included
199 if (!anElement->Contains(aProcMgr)) {
200 anElement->Insert(aProcMgr);
201#ifdef G4VERBOSE
202 if (verboseLevel>2){
203 G4cout << " This Process Manager is registered !! " << G4endl;
204 }
205#endif
206 }
207 break;
208 }
209 }
210 // add this process into the table by creating a new element
211 if (!isFoundInTbl) {
212 G4ProcTblElement* newElement = new G4ProcTblElement(aProcess);
213 newElement->Insert(aProcMgr);
214 fProcTblVector->push_back(newElement);
215 // add into name vector
216 G4ProcNameVector::iterator ip;
217 G4bool isFound = false;
218 for (ip=fProcNameVector->begin(); ip!=fProcNameVector->end(); ++ip) {
219 isFound |= (aProcess->GetProcessName() == (*ip));
220 }
221 if (!isFound) {
222 fProcNameVector->push_back(aProcess->GetProcessName() );
223#ifdef G4VERBOSE
224 if (verboseLevel>2){
225 G4cout << " This Process is registered !! " << G4endl;
226 }
227#endif
228 }
229 }
230 return idxTbl;
231}
void Insert(G4ProcessManager *aProcMgr)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:379

Referenced by G4ProcessManager::AddProcess(), and G4ProcessManager::G4ProcessManager().

◆ Length()

G4int G4ProcessTable::Length ( ) const

◆ Remove()

G4int G4ProcessTable::Remove ( G4VProcess aProcess,
G4ProcessManager aProcMgr 
)

Definition at line 234 of file G4ProcessTable.cc.

236{
237 if ( (aProcess == 0) || ( aProcMgr == 0 ) ){
238#ifdef G4VERBOSE
239 if (verboseLevel>0){
240 G4cout << "G4ProcessTable::Remove : arguments are 0 pointer "<< G4endl;
241 }
242#endif
243 return -1;
244 }
245
246#ifdef G4VERBOSE
247 if (verboseLevel>1){
248 G4cout << "G4ProcessTable::Remove ";
249 G4cout << " Process[" << aProcess->GetProcessName() << "]";
250 G4cout << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]" << G4endl;
251 }
252#endif
253
254 G4ProcTableVector::iterator itr;
255 G4int idxTbl=0;
256 G4ProcTblElement* anElement=0;
257 G4bool isFound = false;
258 // loop over all elements
259 for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) {
260 anElement = (*itr);
261
262 // check if this process is included
263 if (aProcess == anElement->GetProcess()) {
264 isFound = anElement->Contains(aProcMgr);
265 // remove the process manager from the element
266 anElement->Remove(aProcMgr);
267#ifdef G4VERBOSE
268 if (verboseLevel>2){
269 G4cout << " This Process Manager is removed !! " << G4endl;
270 }
271#endif
272 break;
273 }
274 }
275 //
276 if (!isFound) {
277#ifdef G4VERBOSE
278 if (verboseLevel>0){
279 G4cout << " This Process Manager is not registered !! " << G4endl;
280 }
281#endif
282 return -1;
283 }
284 // remove the element if it has no entry
285 if (anElement->Length() == 0){
286 fProcTblVector->erase(itr);
287 delete anElement;
288 // check other prcesses with same name exist or not
289 G4bool isSameName = false;
290 for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr) {
291 anElement = (*itr);
292 if (anElement->GetProcessName() == aProcess->GetProcessName()) {
293 isSameName = true;
294 break;
295 }
296 }
297 // remove from name vector
298 if (!isSameName ) {
299 G4ProcNameVector::iterator i;
300 for (i=fProcNameVector->begin(); i!=fProcNameVector->end(); ++i) {
301 if ( *i == aProcess->GetProcessName() ) {
302 fProcNameVector->erase(i);
303 break;
304 }
305 }
306 }
307#ifdef G4VERBOSE
308 if (verboseLevel>1){
309 G4cout << " This Process is removed !! " << G4endl;
310 }
311#endif
312 }
313 return idxTbl;
314}
void Remove(G4ProcessManager *aProcMgr)

Referenced by G4ProcessManager::RemoveProcess().

◆ SetProcessActivation() [1/8]

void G4ProcessTable::SetProcessActivation ( const G4String processName,
const G4String particleName,
G4bool  fActive 
)

◆ SetProcessActivation() [2/8]

void G4ProcessTable::SetProcessActivation ( const G4String processName,
G4bool  fActive 
)

Definition at line 448 of file G4ProcessTable.cc.

450{
451#ifdef G4VERBOSE
452 if (verboseLevel>1){
453 G4cout << " G4ProcessTable::SetProcessActivation:" ;
454 G4cout << " The Process[" << processName << "] "<< G4endl;
455 }
456#endif
457
458 G4ProcTableVector* pTblVector = Find(fProcTblVector, processName);
459 G4ProcTableVector::iterator itr;
460 G4ProcTblElement* anElement;
461 // loop over all elements
462 for (itr=pTblVector->begin(); itr!=pTblVector->end(); ++itr) {
463 anElement = (*itr);
464 G4VProcess* process = anElement->GetProcess();
465 for (G4int idx = 0 ; idx < anElement->Length(); idx++) {
466 G4ProcessManager* manager = anElement->GetProcessManager(idx);
467 manager->SetProcessActivation(process, fActive);
468#ifdef G4VERBOSE
469 if (verboseLevel>1){
470 G4cout << " for " << manager->GetParticleType()->GetParticleName();
471 G4cout << " Index = " << manager->GetProcessIndex(process);
472 G4cout << G4endl;
473 }
474#endif
475 }
476 }
477}
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
G4int GetProcessIndex(G4VProcess *) const

Referenced by G4ProcessTableMessenger::SetNewValue().

◆ SetProcessActivation() [3/8]

void G4ProcessTable::SetProcessActivation ( const G4String processName,
G4ParticleDefinition particle,
G4bool  fActive 
)

◆ SetProcessActivation() [4/8]

void G4ProcessTable::SetProcessActivation ( const G4String processName,
G4ProcessManager processManager,
G4bool  fActive 
)

Definition at line 480 of file G4ProcessTable.cc.

484{
485#ifdef G4VERBOSE
486 if (verboseLevel>1){
487 G4cout << " G4ProcessTable::SetProcessActivation:" ;
488 G4cout << " The Process[" << processName << "] "<< G4endl;
489 }
490#endif
491
492 G4VProcess* process = FindProcess( processName, processManager);
493 if ( process != 0) {
494 processManager->SetProcessActivation(process, fActive);
495#ifdef G4VERBOSE
496 if (verboseLevel>1){
497 G4cout << " for " << processManager->GetParticleType()->GetParticleName();
498 G4cout << " Index = " << processManager->GetProcessIndex(process) << G4endl;
499 }
500#endif
501 }
502}
G4VProcess * FindProcess(const G4String &processName, const G4String &particleName) const

◆ SetProcessActivation() [5/8]

void G4ProcessTable::SetProcessActivation ( G4ProcessType  processType,
const G4String particleName,
G4bool  fActive 
)

◆ SetProcessActivation() [6/8]

void G4ProcessTable::SetProcessActivation ( G4ProcessType  processType,
G4bool  fActive 
)

Definition at line 506 of file G4ProcessTable.cc.

508{
509#ifdef G4VERBOSE
510 if (verboseLevel>1){
511 G4cout << " G4ProcessTable::SetProcessActivation:" ;
512 G4cout << " The ProcessType[" << G4int(processType) << "] "<< G4endl;
513 }
514#endif
515
516 G4ProcTableVector* pTblVector = Find(fProcTblVector, processType);
517 G4ProcTableVector::iterator itr;
518 G4ProcTblElement* anElement;
519 // loop over all elements
520 for (itr=pTblVector->begin(); itr!=pTblVector->end(); ++itr) {
521 anElement = (*itr);
522 G4VProcess* process = anElement->GetProcess();
523#ifdef G4VERBOSE
524 if (verboseLevel>1){
525 G4cout << " The Process[" << process->GetProcessName()<< "] "<< G4endl;
526 }
527#endif
528 for (G4int idx = 0 ; idx < anElement->Length(); idx++) {
529 G4ProcessManager* manager = anElement->GetProcessManager(idx);
530 manager->SetProcessActivation(process, fActive);
531#ifdef G4VERBOSE
532 if (verboseLevel>1){
533 G4cout << " for " << manager->GetParticleType()->GetParticleName();
534 G4cout << " Index = " << manager->GetProcessIndex(process) << G4endl;
535 }
536#endif
537 }
538 }
539}

◆ SetProcessActivation() [7/8]

void G4ProcessTable::SetProcessActivation ( G4ProcessType  processType,
G4ParticleDefinition particle,
G4bool  fActive 
)

◆ SetProcessActivation() [8/8]

void G4ProcessTable::SetProcessActivation ( G4ProcessType  processType,
G4ProcessManager processManager,
G4bool  fActive 
)

Definition at line 542 of file G4ProcessTable.cc.

546{
547#ifdef G4VERBOSE
548 if (verboseLevel>1){
549 G4cout << " G4ProcessTable::SetProcessActivation:" ;
550 G4cout << " The ProcessType[" << G4int(processType) << "] "<< G4endl;
551 }
552#endif
553
554 G4ProcessVector* procList = processManager->GetProcessList();
555 for (G4int idx = 0; idx < procList->length(); idx++) {
556 G4VProcess* process = (*procList)(idx);
557 if ( process->GetProcessType() == processType) {
558 processManager->SetProcessActivation(process, fActive);
559#ifdef G4VERBOSE
560 if (verboseLevel>1){
561 G4cout << " The Process[" << process->GetProcessName()<< "] "<< G4endl;
562 G4cout << " for " << processManager->GetParticleType()->GetParticleName();
563 G4cout << " Index = " << idx << G4endl;
564 }
565#endif
566 }
567 }
568}
G4ProcessVector * GetProcessList() const
G4int length() const
G4ProcessType GetProcessType() const
Definition: G4VProcess.hh:385

◆ SetVerboseLevel()

void G4ProcessTable::SetVerboseLevel ( G4int  value)

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