Import Geant4 2.0.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcessTable.cc,v 1.3.8.1.2.1 1999/12/08 17:35:13 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: G4ProcessTable.cc,v 1.5 2000/03/02 01:16:06 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -17,6 +17,9 @@
|
||||
// History: first implementation, based on object model of
|
||||
// 4th Aug 1998, H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
// History:
|
||||
// Use STL vector instead of RW vector 1. Mar 00 H.Kurashige
|
||||
//
|
||||
|
||||
#include "G4ProcessTableMessenger.hh"
|
||||
#include "G4ProcessTable.hh"
|
||||
@@ -54,19 +57,22 @@ G4ProcessTable::~G4ProcessTable()
|
||||
}
|
||||
|
||||
#endif
|
||||
// delete all processes
|
||||
for (G4int idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
delete ((*fProcTblVector)(idxTbl))->GetProcess();
|
||||
}
|
||||
|
||||
if ( tmpTblVector != 0) {
|
||||
tmpTblVector ->clear();
|
||||
delete tmpTblVector;
|
||||
}
|
||||
|
||||
if ( fProcTblVector != 0) {
|
||||
fProcTblVector ->clearAndDestroy();
|
||||
G4ProcTableVector::iterator idx;
|
||||
for (idx=fProcTblVector->begin(); idx!=fProcTblVector->end(); ++idx) {
|
||||
// delete all processes
|
||||
delete (*idx)->GetProcess();
|
||||
delete (*idx);
|
||||
}
|
||||
fProcTblVector ->clear();
|
||||
delete fProcTblVector;
|
||||
}
|
||||
|
||||
if ( fProcNameVector != 0) {
|
||||
fProcNameVector ->clear();
|
||||
delete fProcNameVector;
|
||||
@@ -151,37 +157,20 @@ G4int G4ProcessTable::Insert(G4VProcess* aProcess,
|
||||
}
|
||||
#endif
|
||||
|
||||
G4int idxTbl;
|
||||
G4ProcTableVector::iterator itr;
|
||||
G4int idxTbl=0;
|
||||
G4ProcTblElement* anElement;
|
||||
G4bool isFoundInTbl = false;
|
||||
// loop over all elements
|
||||
for (idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
anElement = (*fProcTblVector)(idxTbl);
|
||||
G4int idx;
|
||||
for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) {
|
||||
anElement = (*itr);
|
||||
// check if this process is included
|
||||
if (aProcess == anElement->GetProcess()) {
|
||||
isFoundInTbl = true;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << " This Process has been already registered !! " << G4endl;
|
||||
}
|
||||
#endif
|
||||
//
|
||||
G4bool isFound = false;
|
||||
// check if this process manager is included
|
||||
for (idx=0; idx<anElement->Length(); idx++){
|
||||
if ( aProcMgr == anElement->GetProcessManager(idx) ){
|
||||
isFound = true;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << " This Process Manager has been already registered !! " << G4endl;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
// add the process manager into the element
|
||||
if (!isFound) {
|
||||
|
||||
// add the process manager into the element
|
||||
// unless this process manager is included
|
||||
if (!anElement->Contains(aProcMgr)) {
|
||||
anElement->Insert(aProcMgr);
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
@@ -192,20 +181,25 @@ G4int G4ProcessTable::Insert(G4VProcess* aProcess,
|
||||
break;
|
||||
}
|
||||
}
|
||||
// add this process into the table
|
||||
// add this process into the table by creating a new element
|
||||
if (!isFoundInTbl) {
|
||||
G4ProcTblElement* newElement = new G4ProcTblElement(aProcess);
|
||||
newElement->Insert(aProcMgr);
|
||||
fProcTblVector->insert(newElement);
|
||||
fProcTblVector->push_back(newElement);
|
||||
// add into name vector
|
||||
if (!fProcNameVector->contains(aProcess->GetProcessName()) ){
|
||||
fProcNameVector->insert(aProcess->GetProcessName() );
|
||||
G4ProcNameVector::iterator ip;
|
||||
G4bool isFound = false;
|
||||
for (ip=fProcNameVector->begin(); ip!=fProcNameVector->end(); ++ip) {
|
||||
isFound |= (aProcess->GetProcessName() == (*ip));
|
||||
}
|
||||
if (!isFound) {
|
||||
fProcNameVector->push_back(aProcess->GetProcessName() );
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << " This Process is registered !! " << G4endl;
|
||||
}
|
||||
if (verboseLevel>2){
|
||||
G4cout << " This Process is registered !! " << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return idxTbl;
|
||||
}
|
||||
@@ -231,69 +225,66 @@ G4int G4ProcessTable::Remove( G4VProcess* aProcess,
|
||||
}
|
||||
#endif
|
||||
|
||||
G4int idxTbl;
|
||||
G4ProcTableVector::iterator itr;
|
||||
G4int idxTbl=0;
|
||||
G4ProcTblElement* anElement;
|
||||
G4bool isFoundInTbl = false;
|
||||
G4bool isFound = false;
|
||||
// loop over all elements
|
||||
for (idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
anElement = (*fProcTblVector)(idxTbl);
|
||||
for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) {
|
||||
anElement = (*itr);
|
||||
G4int idx;
|
||||
// check if this process is included
|
||||
if (aProcess == anElement->GetProcess()) {
|
||||
isFoundInTbl = true;
|
||||
|
||||
// check if this process manager is included
|
||||
for (idx=0; idx<anElement->Length(); idx++){
|
||||
if ( aProcMgr == anElement->GetProcessManager(idx) ){
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// add the process manager into the element
|
||||
if (isFound) {
|
||||
anElement->Remove(aProcMgr);
|
||||
isFound = anElement->Contains(aProcMgr);
|
||||
// remove the process manager from the element
|
||||
anElement->Remove(aProcMgr);
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << " This Process Manager is removed !! " << G4endl;
|
||||
}
|
||||
#endif
|
||||
if (verboseLevel>2){
|
||||
G4cout << " This Process Manager is removed !! " << G4endl;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isFound) {
|
||||
if (anElement->Length() == 0){
|
||||
fProcTblVector->remove(anElement);
|
||||
delete anElement;
|
||||
// check other prcesses with same name exist or not
|
||||
G4bool isSameName = false;
|
||||
for (idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
anElement = (*fProcTblVector)(idxTbl);
|
||||
if (anElement->GetProcessName() == aProcess->GetProcessName()) {
|
||||
isSameName = true;
|
||||
//
|
||||
if (!isFound) {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0){
|
||||
G4cout << " This Process Manager is not registered !! " << G4endl;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
// remove the element if it has no entry
|
||||
if (anElement->Length() == 0){
|
||||
fProcTblVector->erase(itr);
|
||||
delete anElement;
|
||||
// check other prcesses with same name exist or not
|
||||
G4bool isSameName = false;
|
||||
for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr) {
|
||||
anElement = (*itr);
|
||||
if (anElement->GetProcessName() == aProcess->GetProcessName()) {
|
||||
isSameName = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// remove from name vector
|
||||
if (!isSameName ) {
|
||||
G4ProcNameVector::iterator i;
|
||||
for (i=fProcNameVector->begin(); i!=fProcNameVector->end(); ++i) {
|
||||
if ( *i == aProcess->GetProcessName() ) {
|
||||
fProcNameVector->erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// remove from name vector
|
||||
if (!isSameName ) {
|
||||
fProcNameVector->remove(aProcess->GetProcessName() );
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << " This Process is removed !! " << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return idxTbl;
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0){
|
||||
G4cout << " This Process is not registered !! " << G4endl;
|
||||
if (verboseLevel>1){
|
||||
G4cout << " This Process is removed !! " << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return -1;
|
||||
return idxTbl;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
@@ -301,11 +292,12 @@ G4VProcess* G4ProcessTable::FindProcess(const G4String& processName,
|
||||
const G4ProcessManager* processManager)
|
||||
const
|
||||
{
|
||||
G4int idxTblVec;
|
||||
G4ProcTableVector::iterator itr;
|
||||
G4int idxTbl = 0;
|
||||
G4bool isFound = false;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < fProcTblVector->length(); idxTblVec++){
|
||||
anElement = (*fProcTblVector)(idxTblVec);
|
||||
for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) {
|
||||
anElement = (*itr);
|
||||
// check name
|
||||
if ( anElement->GetProcessName() == processName ) {
|
||||
// check if the processManage is included
|
||||
@@ -332,17 +324,17 @@ G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find(
|
||||
G4ProcTableVector* procTblVector,
|
||||
const G4String& processName )
|
||||
{
|
||||
tmpTblVector-> clear();
|
||||
tmpTblVector->clear();
|
||||
|
||||
G4int idxTblVec;
|
||||
G4ProcTableVector::iterator itr;
|
||||
G4bool isFound = false;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < procTblVector->length(); idxTblVec++){
|
||||
anElement = (*procTblVector)(idxTblVec);
|
||||
for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr) {
|
||||
anElement = (*itr);
|
||||
// check name
|
||||
if ( anElement->GetProcessName() == processName ) {
|
||||
isFound = true;
|
||||
tmpTblVector->insert(anElement);
|
||||
tmpTblVector->push_back(anElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,15 +355,15 @@ G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find(
|
||||
{
|
||||
tmpTblVector->clear();
|
||||
|
||||
G4int idxTblVec;
|
||||
G4ProcTableVector::iterator itr;
|
||||
G4bool isFound = false;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < procTblVector->length(); idxTblVec++){
|
||||
anElement = (*procTblVector)(idxTblVec);
|
||||
for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr) {
|
||||
anElement = (*itr);
|
||||
// check name
|
||||
if ( anElement->GetProcess()->GetProcessType() == processType ) {
|
||||
isFound = true;
|
||||
tmpTblVector->insert(anElement);
|
||||
tmpTblVector->push_back(anElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,9 +382,10 @@ G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find(
|
||||
G4ProcessVector* G4ProcessTable::ExtractProcesses( G4ProcTableVector* procTblVector)
|
||||
{
|
||||
G4ProcessVector* procList = new G4ProcessVector();
|
||||
G4int idxTblVec;
|
||||
for ( idxTblVec = 0; idxTblVec < procTblVector->length(); idxTblVec++){
|
||||
G4ProcTblElement* anElement = (*procTblVector)(idxTblVec);
|
||||
G4ProcTableVector::iterator itr;
|
||||
// loop over all elements
|
||||
for (itr=procTblVector->begin(); itr!=procTblVector->end(); ++itr) {
|
||||
G4ProcTblElement* anElement = (*itr);
|
||||
procList->insert( anElement->GetProcess() );
|
||||
}
|
||||
return procList;
|
||||
@@ -437,10 +430,11 @@ void G4ProcessTable::SetProcessActivation( const G4String& processName,
|
||||
#endif
|
||||
|
||||
G4ProcTableVector* pTblVector = Find(fProcTblVector, processName);
|
||||
G4int idxTblVec;
|
||||
G4ProcTableVector::iterator itr;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < pTblVector->length(); idxTblVec++){
|
||||
anElement = (*pTblVector)(idxTblVec);
|
||||
// loop over all elements
|
||||
for (itr=pTblVector->begin(); itr!=pTblVector->end(); ++itr) {
|
||||
anElement = (*itr);
|
||||
G4VProcess* process = anElement->GetProcess();
|
||||
for (G4int idx = 0 ; idx < anElement->Length(); idx++) {
|
||||
G4ProcessManager* manager = anElement->GetProcessManager(idx);
|
||||
@@ -494,10 +488,11 @@ void G4ProcessTable::SetProcessActivation( G4ProcessType processType,
|
||||
#endif
|
||||
|
||||
G4ProcTableVector* pTblVector = Find(fProcTblVector, processType);
|
||||
G4int idxTblVec;
|
||||
G4ProcTableVector::iterator itr;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < pTblVector->length(); idxTblVec++){
|
||||
anElement = (*pTblVector)(idxTblVec);
|
||||
// loop over all elements
|
||||
for (itr=pTblVector->begin(); itr!=pTblVector->end(); ++itr) {
|
||||
anElement = (*itr);
|
||||
G4VProcess* process = anElement->GetProcess();
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
@@ -551,19 +546,17 @@ void G4ProcessTable::SetProcessActivation(
|
||||
void G4ProcessTable::DumpInfo(G4VProcess* process,
|
||||
G4ParticleDefinition* particle)
|
||||
{
|
||||
G4int idxTbl;
|
||||
G4ProcTableVector::iterator itr;
|
||||
G4int idxTbl=0;
|
||||
G4ProcTblElement* anElement;
|
||||
G4bool isFoundInTbl = false;
|
||||
G4ProcessManager* manager;
|
||||
G4int idx;
|
||||
// loop over all elements
|
||||
for (idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
anElement = (*fProcTblVector)(idxTbl);
|
||||
for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) {
|
||||
anElement = (*itr);
|
||||
if (process == anElement->GetProcess() ){
|
||||
if (particle==0) {
|
||||
isFoundInTbl = true;
|
||||
break;
|
||||
} else {
|
||||
if (particle!=0) {
|
||||
for (idx=0; idx<anElement->Length(); idx++){
|
||||
manager = anElement->GetProcessManager(idx);
|
||||
if (particle == manager->GetParticleType()) {
|
||||
@@ -571,7 +564,10 @@ void G4ProcessTable::DumpInfo(G4VProcess* process,
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isFoundInTbl = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isFoundInTbl ) return;
|
||||
|
||||
Reference in New Issue
Block a user