Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IVContinuousDiscreteProcess.cc,v 2.0 1998/07/02 16:39:38 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IVContinuousDiscreteProcess.cc,v 1.4 1999/04/30 08:02:30 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -22,13 +22,13 @@
#include "G4IVContinuousDiscreteProcess.hh"
G4IVContinuousDiscreteProcess::G4IVContinuousDiscreteProcess()
:G4VProcess("No Name Discrete Process")
:G4VProcess("No Name Discrete Process"), BIGSTEP(1.e10)
{
G4Exception("G4IVContinuousDiscreteProcess:: default constructor is called");
}
G4IVContinuousDiscreteProcess::G4IVContinuousDiscreteProcess(const G4String& aName , G4ProcessType aType)
: G4VProcess(aName, aType)
: G4VProcess(aName, aType),BIGSTEP(1.e10)
{
}
@@ -37,17 +37,26 @@ G4IVContinuousDiscreteProcess::~G4IVContinuousDiscreteProcess()
}
G4IVContinuousDiscreteProcess::G4IVContinuousDiscreteProcess(G4IVContinuousDiscreteProcess& right)
: G4VProcess(right)
: G4VProcess(right),BIGSTEP(1.e10)
{
}
G4double G4IVContinuousDiscreteProcess::
PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
)
{
G4double value = DBL_MAX ;
return value;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IVRestDiscreteProcess.cc,v 2.0 1998/07/02 16:39:41 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IVRestDiscreteProcess.cc,v 1.4 1999/04/30 08:02:31 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -22,13 +22,14 @@
#include "G4IVRestDiscreteProcess.hh"
G4IVRestDiscreteProcess::G4IVRestDiscreteProcess()
:G4VProcess("No Name Discrete Process")
:G4VProcess("No Name Discrete Process"),BIGSTEP(1.e10)
{
G4Exception("G4IVRestDiscreteProcess:: default constructor is called");
}
G4IVRestDiscreteProcess::G4IVRestDiscreteProcess(const G4String& aName , G4ProcessType aType)
: G4VProcess(aName, aType)
: G4VProcess(aName, aType),BIGSTEP(1.e10)
{
}
@@ -37,17 +38,17 @@ G4IVRestDiscreteProcess::~G4IVRestDiscreteProcess()
}
G4IVRestDiscreteProcess::G4IVRestDiscreteProcess(G4IVRestDiscreteProcess& right)
: G4VProcess(right)
: G4VProcess(right),BIGSTEP(1.e10)
{
}
G4double G4IVRestDiscreteProcess::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
)
{
G4double value = DBL_MAX ;
return value;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ProcTblElement.cc,v 2.3 1998/08/16 02:36:56 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ProcTblElement.cc,v 1.2 1999/04/13 09:47:57 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -24,8 +24,8 @@
// default constructor ////////////////////////
G4ProcTblElement::G4ProcTblElement()
{
pProcess = NULL;
pProcMgrVector=NULL;
pProcess = 0;
pProcMgrVector=0;
}
//////////////////////////
@@ -50,7 +50,7 @@ G4ProcTblElement::G4ProcTblElement(const G4ProcTblElement &right)
// destructor ////////////////////////
G4ProcTblElement::~G4ProcTblElement()
{
if (pProcMgrVector != NULL) {
if (pProcMgrVector != 0) {
pProcMgrVector->clear();
delete pProcMgrVector;
}
@@ -63,7 +63,7 @@ G4ProcTblElement & G4ProcTblElement::operator=(G4ProcTblElement &right)
if (this != &right) {
pProcess = right.pProcess;
// copy all contents in pProcMgrVector
if (pProcMgrVector != NULL) {
if (pProcMgrVector != 0) {
pProcMgrVector->clear();
delete pProcMgrVector;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ProcessAttribute.cc,v 2.0 1998/07/02 16:39:43 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ProcessAttribute.cc,v 1.2 1999/04/13 09:47:58 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -26,7 +26,7 @@
G4ProcessAttribute::G4ProcessAttribute():
isActive(true)
{
pProcess = NULL;
pProcess = 0;
idxProcessList = -1;
}
@@ -54,6 +54,7 @@ G4ProcessAttribute & G4ProcessAttribute::operator=(G4ProcessAttribute &right)
if (this != &right) {
pProcess = right.pProcess;
idxProcessList = right.idxProcessList;
isActive = right.isActive;
// copy all contents in idxProcVector[] and ordProcVector[]
// deep copy
for (G4int idx=0; idx<G4ProcessManager::SizeOfProcVectorArray; idx++){
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ProcessManager.cc,v 2.11 1998/10/17 14:17:29 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ProcessManager.cc,v 1.8 1999/06/17 09:02:12 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -25,14 +25,23 @@
#include "G4ProcessManagerMessenger.hh"
#include "G4ProcessManager.hh"
#include "G4StateManager.hh"
#include <iomanip.h>
#include "G4ProcessTable.hh"
#include "G4ios.hh"
#ifdef WIN32
# include <Strstrea.h>
#else
# include <strstream.h>
#endif
// ---------------------------------
// function members implementation
// ---------------------------------
G4ProcessManagerMessenger* G4ProcessManager::fProcessManagerMessenger = NULL;
G4ProcessManagerMessenger* G4ProcessManager::fProcessManagerMessenger = 0;
G4int G4ProcessManager::counterOfObjects = 0;
// ///////////////////////////////////////
G4ProcessManager::G4ProcessManager(const G4ParticleDefinition* aParticleType):
@@ -41,41 +50,34 @@ G4ProcessManager::G4ProcessManager(const G4ParticleDefinition* aParticleType):
duringTracking(false),
verboseLevel(1)
{
char errMsg[1024];
ostrstream errOs(errMsg,1024);
// create the process List
theProcessList = new G4ProcessVector();
if ( theProcessList == NULL) {
const G4String aErrorMessage("G4ProcessManager::G4ProcessManager():");
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage;
G4cerr << " can not create G4ProcessVector " << endl;
}
#endif
G4Exception((const char*)aErrorMessage);
if ( theProcessList == 0) {
errOs << "G4ProcessManager::G4ProcessManager():";
errOs << " can not create G4ProcessVector " << endl;
G4Exception(errMsg);
}
//create process vector
for (G4int i=0; i<SizeOfProcVectorArray; ++i) {
theProcVector[i] = new G4ProcessVector();
if ( theProcVector[i] == NULL) {
G4String aErrorMessage("G4ProcessManager::G4ProcessManager():");
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage;
G4cerr << " can not create G4ProcessVector " << endl;
}
#endif
G4Exception((const char*)aErrorMessage);
if ( theProcVector[i] == 0) {
errOs << "G4ProcessManager::G4ProcessManager():";
errOs << " can not create G4ProcessVector " << endl;
G4Exception(errMsg);
}
}
// create Process Attribute vector
theAttrVector = new G4ProcessAttrVector();
if (fProcessManagerMessenger == NULL){
// create Process Manager Messenger
if (fProcessManagerMessenger == 0){
fProcessManagerMessenger = new G4ProcessManagerMessenger();
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1) {
G4cerr << "G4ProcessManagerMessenger is created" << endl;
}
#endif
}
// Increment counter of G4ProcessManager objects
counterOfObjects+=1;
}
@@ -87,19 +89,18 @@ G4ProcessManager::G4ProcessManager(G4ProcessManager &right)
verboseLevel = right.verboseLevel;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 2) {
G4cerr << "G4ProcessManagerMessenger:: copy constructor " <<endl;
G4cout << "G4ProcessManagerMessenger:: copy constructor " <<endl;
}
#endif
theParticleType = right.theParticleType;
numberOfProcesses = right.numberOfProcesses;
// create the process List
// create the process List and ProcessAttr Vector
theProcessList = new G4ProcessVector();
theAttrVector = new G4ProcessAttrVector();
if ( ( theProcessList == NULL) || (theAttrVector == NULL) ){
G4String aErrorMessage("G4ProcessManager::G4ProcessManager():");
G4Exception((const char*)aErrorMessage);
if ( ( theProcessList == 0) || (theAttrVector == 0) ){
G4Exception("G4ProcessManager : can not create ProcessVector");
}
for (G4int idx=0; idx < right.numberOfProcesses; idx++) {
@@ -114,13 +115,13 @@ G4ProcessManager::G4ProcessManager(G4ProcessManager &right)
}
//create theProcVector
// fill up theProcVector
for (G4int i=0; i<SizeOfProcVectorArray; ++i) {
// create i-th ProcessVector in theProcVector
theProcVector[i] = new G4ProcessVector();
if ( theProcVector[i] == NULL) {
if ( theProcVector[i] == 0) {
G4String aErrorMessage("G4ProcessManager::G4ProcessManager():");
G4Exception((const char*)aErrorMessage);
G4Exception((const char*)(aErrorMessage));
}
G4ProcessVector* src = right.theProcVector[i];
for (G4int j=0; j< src->entries() ; j++){
@@ -128,17 +129,18 @@ G4ProcessManager::G4ProcessManager(G4ProcessManager &right)
theProcVector[i]->insert((*src)[j]);
}
}
// Increment counter of G4ProcessManager objects
counterOfObjects+=1;
}
// ///////////////////////////////////////
G4ProcessManager::G4ProcessManager():
theParticleType(NULL),
theParticleType(0),
numberOfProcesses(0)
{
if (GetVerboseLevel()>0) {
G4cerr << "G4ProcessManager: default constructor is called !!" <<endl;
G4cout << "G4ProcessManager: default constructor is called !!" <<endl;
}
}
@@ -153,8 +155,12 @@ G4ProcessManager & G4ProcessManager::operator=(G4ProcessManager &)
G4ProcessManager::~G4ProcessManager()
{
for (G4int i=0; i<SizeOfProcVectorArray; i++) {
if (theProcVector[i]) delete theProcVector[i];
if (theProcVector[i]) {
theProcVector[i]->clear();
delete theProcVector[i];
}
}
theProcessList->clear();
delete theProcessList;
theAttrVector->clearAndDestroy();
@@ -162,13 +168,14 @@ G4ProcessManager::~G4ProcessManager()
counterOfObjects-=1;
// delete messenger if this object is last one
if ( counterOfObjects == 0 ){
if (fProcessManagerMessenger != NULL){
if (fProcessManagerMessenger != 0){
delete fProcessManagerMessenger;
fProcessManagerMessenger = NULL;
fProcessManagerMessenger = 0;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1) {
G4cerr << "G4ProcessManagerMessenger is deleted" << endl;
G4cout << "G4ProcessManagerMessenger is deleted" << endl;
}
#endif
}
@@ -184,22 +191,23 @@ G4int G4ProcessManager::GetProcessVectorIndex(
G4int idxVect = -1;
G4int idxProc = GetProcessIndex(aProcess);
G4int ivec = GetProcessVectorId(idx, typ);
if ( ( idxProc >=0) && (ivec >=0) ){
idxVect = GetAttribute(idxProc)->idxProcVector[ivec];
} else {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << " G4ProcessManager::GetProcessVectorIndex:";
G4cerr << "particle[" << theParticleType->GetParticleName() << "] " ;
G4cerr << "process[" << aProcess->GetProcessName() << "]" ;
G4cerr << endl;
G4cout << " G4ProcessManager::GetProcessVectorIndex:";
G4cout << "particle[" << theParticleType->GetParticleName() << "] " ;
G4cout << "process[" << aProcess->GetProcessName() << "]" ;
G4cout << endl;
if (idxProc <0) {
G4cerr << " is not registered yet ";
G4cout << " is not registered yet ";
}
if (ivec <0) {
G4cerr << " illegal DoIt Index [= " << idx << "," << typ << "]";
G4cout << " illegal DoIt Index [= " << idx << "," << typ << "]";
}
G4cerr << endl;
G4cout << endl;
}
#endif
}
@@ -213,48 +221,43 @@ G4ProcessAttribute* G4ProcessManager::GetAttribute(G4int index) const
if ((index<0) || (index>=numberOfProcesses)) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4ProcessManager::GetAttribute():";
G4cerr << " particle[" << theParticleType->GetParticleName() << "]";
G4cerr << endl;
G4cerr << " index out of range " << endl;
G4cerr << " #processes[" << numberOfProcesses << "]";
G4cerr << " index [" << index << "]" << endl;
G4cout << "G4ProcessManager::GetAttribute():";
G4cout << " particle[" << theParticleType->GetParticleName() << "]";
G4cout << endl;
G4cout << " index out of range " << endl;
G4cout << " #processes[" << numberOfProcesses << "]";
G4cout << " index [" << index << "]" << endl;
}
#endif
return NULL;
return 0;
}
// check process pointer is not NULL
// check process pointer is not 0
G4VProcess* aProcess = (*theProcessList)[index];
if (aProcess == NULL) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4ProcessManager::GetAttribute():";
G4cerr << " particle[" << theParticleType->GetParticleName() << "]";
G4cerr << endl;
G4cerr << "process is not defined at " << index << endl;
}
#endif
if (aProcess == 0) {
G4String aErrorMessage("G4ProcessManager::GetAttribute():");
aErrorMessage += " particle[" + theParticleType->GetParticleName() + "]";
G4Exception((const char*)aErrorMessage);
return NULL;
G4Exception((const char*)(aErrorMessage));
return 0;
}
//find the process attribute
if ( ((*theAttrVector)[index])->idxProcessList == index ){
return (*theAttrVector)[index];
} else {
// !! Error !!
// attribute vector index is inconsistent with process List index
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4ProcessManager::GetAttribute():";
G4cerr << " particle[" << theParticleType->GetParticleName() << "]";
G4cerr << endl;
G4cerr << "Warning:: attribute vector index is inconsistent with process List index" << endl;
G4cout << "G4ProcessManager::GetAttribute():";
G4cout << " particle[" << theParticleType->GetParticleName() << "]";
G4cout << endl;
G4cout << "Warning:: attribute vector index is inconsistent with process List index" << endl;
}
#endif
G4ProcessAttribute *pAttr = NULL;
for (G4int i=0; i<theAttrVector->length(); i++){
// re-ordering attribute vector
G4ProcessAttribute *pAttr = 0;
for (G4int i=0; i<theAttrVector->entries(); i++){
if ( ((*theAttrVector)[i])->idxProcessList == index) {
pAttr = (*theAttrVector)[i];
break;
@@ -275,20 +278,22 @@ G4int G4ProcessManager::InsertAt(G4int ip, G4VProcess* process, G4int ivec)
{
G4ProcessVector* pVector = theProcVector[ivec];
// check position
if ( (ip<0) || (ip > pVector->length()) ) return -1;
if ( (ip<0) || (ip > pVector->entries()) ) return -1;
// insert in pVector
pVector->insertAt(ip, process);
//correct index in ProcessAttributes of processes
for (G4int iproc=0; iproc<numberOfProcesses; iproc++) {
G4ProcessAttribute* aAttr = (*theAttrVector)[iproc];
if (aAttr != NULL) {
if (aAttr != 0) {
if (aAttr->idxProcVector[ivec] >= ip){
aAttr->idxProcVector[ivec] += 1;
}
} else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << " G4ProcessManager::InsertAt : No Process Attribute " << endl;
G4cout << " G4ProcessManager::InsertAt : No Process Attribute " << endl;
}
#endif
}
@@ -301,17 +306,19 @@ G4int G4ProcessManager::RemoveAt(G4int ip, G4VProcess* process, G4int ivec)
{
G4ProcessVector* pVector = theProcVector[ivec];
// check position
if ( (ip<0) || (ip >= pVector->length()) ) return -1;
if ( (ip<0) || (ip >= pVector->entries()) ) return -1;
//check pointer and remove
if ((*pVector)[ip]== process) {
pVector->removeAt(ip);
} else {
return -1;
}
// correct index
for(G4int iproc=0; iproc<numberOfProcesses; iproc++) {
G4ProcessAttribute* aAttr = (*theAttrVector)[iproc];
if (aAttr != NULL) {
if (aAttr != 0) {
if (ip < aAttr->idxProcVector[ivec]) {
aAttr->idxProcVector[ivec] -=1;
} else if (ip == aAttr->idxProcVector[ivec]) {
@@ -321,7 +328,7 @@ G4int G4ProcessManager::RemoveAt(G4int ip, G4VProcess* process, G4int ivec)
}else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << " G4ProcessManager::RemoveAt : No Process Attribute " << endl;
G4cout << " G4ProcessManager::RemoveAt : No Process Attribute " << endl;
}
#endif
}
@@ -333,8 +340,9 @@ G4int G4ProcessManager::RemoveAt(G4int ip, G4VProcess* process, G4int ivec)
G4int G4ProcessManager::FindInsertPosition(G4int ord, G4int ivec)
{
G4ProcessVector* pVector = theProcVector[ivec];
G4int ip = pVector->length();
G4int ip = pVector->entries();
G4int tmp = INT_MAX;
// find insert position
for (G4int iproc=0; iproc<numberOfProcesses; iproc++) {
G4ProcessAttribute* aAttr = (*theAttrVector)[iproc];
@@ -359,11 +367,12 @@ G4int G4ProcessManager::AddProcess(
aErrorMessage += " particle[" + theParticleType->GetParticleName() + "]";
//check the process is applicable to this particle type
if ( !aProcess->IsApplicable(*theParticleType) ) {
if ( ( !aProcess->IsApplicable(*theParticleType) ) ||
(theParticleType->IsShortLived() ) ){
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage << endl;
G4cerr << "This process is not applicable to this particle";
G4cout << aErrorMessage << endl;
G4cout << "This process is not applicable to this particle";
}
#endif
// --comment out for alpha version ----
@@ -373,7 +382,7 @@ G4int G4ProcessManager::AddProcess(
#ifdef G4VERBOSE
if (GetVerboseLevel()>2) {
G4cerr << aErrorMessage << endl;
G4cout << aErrorMessage << endl;
}
#endif
@@ -383,17 +392,12 @@ G4int G4ProcessManager::AddProcess(
//add aProcess to process List
theProcessList->insert(aProcess);
G4int idx = (theProcessList->length()) - 1;
G4int idx = (theProcessList->entries()) - 1;
// check size of the ProcessVector[0]
if (numberOfProcesses != idx){
theProcessList->removeLast();
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage << endl;
G4cerr << "inconsistent process List size" << numberOfProcesses << endl;
}
#endif
aErrorMessage += "inconsistent process List size";
G4Exception((const char*)aErrorMessage);
return -1;
}
@@ -433,11 +437,11 @@ G4int G4ProcessManager::AddProcess(
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << aErrorMessage << endl;
G4cerr << aProcess->GetProcessName() << " is inserted at "<< ip;
G4cerr << " in ProcessVetor[" << ivec<< "]";
G4cerr << " with Ordering parameter = " << pAttr->ordProcVector[ivec] ;
G4cerr << endl;
G4cout << aErrorMessage << endl;
G4cout << aProcess->GetProcessName() << " is inserted at "<< ip;
G4cout << " in ProcessVetor[" << ivec<< "]";
G4cout << " with Ordering parameter = " ;
G4cout << pAttr->ordProcVector[ivec] << endl;
}
#endif
}
@@ -459,7 +463,7 @@ G4VProcess* G4ProcessManager::RemoveProcess(G4int index)
{
//find the process attribute
G4ProcessAttribute* pAttr = GetAttribute(index);
if (pAttr == NULL) return NULL;
if (pAttr == 0) return 0;
// remove process
G4VProcess* removedProcess = (*theProcessList)[index];
@@ -471,7 +475,7 @@ G4VProcess* G4ProcessManager::RemoveProcess(G4int index)
for (G4int ivec=0; ivec<SizeOfProcVectorArray; ivec++) {
G4ProcessVector* pVector = theProcVector[ivec];
G4int idx = pAttr->idxProcVector[ivec];
if ((idx >= 0) && (idx < pVector->length())) {
if ((idx >= 0) && (idx < pVector->entries())) {
//remove
if (RemoveAt(idx, removedProcess, ivec) <0) {
#ifdef G4VERBOSE
@@ -483,8 +487,8 @@ G4VProcess* G4ProcessManager::RemoveProcess(G4int index)
G4cerr << idx << "->" << pVector->index(removedProcess) << endl;
}
#endif
G4Exception((const char*)aErrorMessage);
return NULL;
G4Exception((const char*)(aErrorMessage));
return 0;
}
} else if (idx<0) {
// corresponding DoIt is not active
@@ -496,11 +500,11 @@ G4VProcess* G4ProcessManager::RemoveProcess(G4int index)
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
G4cerr << "process["<<removedProcess->GetProcessName()<< "] " ;
G4cerr << "index(=" << idx << ") of process vector";
G4cerr << "[size:" << pVector->length() << "] out of range" <<endl;
G4cerr << "[size:" << pVector->entries() << "] out of range" <<endl;
}
#endif
G4Exception((const char*)aErrorMessage);
return NULL;
G4Exception((const char*)(aErrorMessage));
return 0;
}
}
pAttr->isActive = false;
@@ -540,18 +544,22 @@ G4int G4ProcessManager::GetProcessOrdering(
G4ProcessVectorDoItIndex idDoIt
)
{
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
// get Process Vector Id
G4int ivec = GetProcessVectorId(idDoIt, typeDoIt);
if (ivec <0 ) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4ProcessManager::SetProcessOrdering: ";
G4cerr << " illegal DoIt Index [= " << idDoIt << "]";
G4cerr << endl;
return -1;
G4cout << "G4ProcessManager::SetProcessOrdering: ";
G4cout << " illegal DoIt Index [= " << idDoIt << "]";
G4cout << endl;
}
#endif
} else if (pAttr != NULL) {
return -1;
}
// get attribute
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
if (pAttr != 0) {
return pAttr->ordProcVector[ivec];
} else {
return -1;
@@ -571,35 +579,45 @@ void G4ProcessManager::SetProcessOrdering(
#ifdef G4VERBOSE
if (GetVerboseLevel()>2) {
G4cerr << aErrorMessage ;
G4cerr << "particle[" + theParticleType->GetParticleName() +"] " ;
G4cerr <<"process[" + aProcess->GetProcessName() + "]"<< endl;
G4cout << aErrorMessage ;
G4cout << "particle[" + theParticleType->GetParticleName() +"] " ;
G4cout <<"process[" + aProcess->GetProcessName() + "]"<< endl;
}
#endif
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
// get Process Vector Id
G4int ivec = GetProcessVectorId(idDoIt, typeDoIt);
if (ivec <0 ) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << aErrorMessage << endl;
G4cerr << "particle[" + theParticleType->GetParticleName() +"] " ;
G4cerr << "process[" + aProcess->GetProcessName() + "]"<< endl;
G4cerr << " illegal DoIt Index [= " << idDoIt << "]";
G4cerr << endl;
G4cout << aErrorMessage << endl;
G4cout << "particle[" + theParticleType->GetParticleName() +"] " ;
G4cout << "process[" + aProcess->GetProcessName() + "]"<< endl;
G4cout << " illegal DoIt Index [= " << idDoIt << "]";
G4cout << endl;
}
#endif
} else if (pAttr != NULL) {
return;
}
// get attribute
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
if (pAttr == 0) {
// can not get process attribute
return;
} else {
G4int ip = pAttr->idxProcVector[ivec];
// remove a process from the process vector
if ( ip >=0 ) {
RemoveAt(ip, aProcess, ivec);
}
// set ordering parameter to non-zero
if (ordDoIt == 0) ordDoIt = 1;
pAttr->ordProcVector[ivec-1] = ordDoIt;
pAttr->ordProcVector[ivec] = ordDoIt;
// insert in process vector if ordDoIt >0
if (ordDoIt >0) {
// find insert position
@@ -610,16 +628,17 @@ void G4ProcessManager::SetProcessOrdering(
pAttr->idxProcVector[ivec] = ip;
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << aErrorMessage << endl;
G4cerr << "particle[" + theParticleType->GetParticleName() +"] " ;
G4cerr <<"process[" + aProcess->GetProcessName() + "]"<< endl;
G4cerr << aProcess->GetProcessName() << " is inserted at "<< ip;
G4cerr << " in ProcessVetor[" << ivec<< "]";
G4cerr << " with Ordering parameter = " << ordDoIt ;
G4cerr << endl;
G4cout << aErrorMessage << endl;
G4cout << "particle[" + theParticleType->GetParticleName() +"] " ;
G4cout <<"process[" + aProcess->GetProcessName() + "]"<< endl;
G4cout << aProcess->GetProcessName() << " is inserted at "<< ip;
G4cout << " in ProcessVetor[" << ivec<< "]";
G4cout << " with Ordering parameter = " << ordDoIt ;
G4cout << endl;
}
#endif
}
}
// create GPIL vectors
CreateGPILvectors();
@@ -632,38 +651,51 @@ void G4ProcessManager::SetProcessOrderingToFirst(
G4ProcessVectorDoItIndex idDoIt
)
{
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
// get Process Vector Id(
G4int ivec = GetProcessVectorId(idDoIt, typeDoIt);
if (ivec <0 ) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4ProcessManager::SetProcessOrdering: ";
G4cerr << " illegal DoIt Index [= " << idDoIt << "]";
G4cerr << endl;
G4cout << "G4ProcessManager::SetProcessOrdering: ";
G4cout << " illegal DoIt Index [= " << idDoIt << "]";
G4cout << endl;
}
#endif
} else if (pAttr != NULL) {
return;
}
// get attribute
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
if (pAttr == 0) {
return;
} else {
G4int ip = pAttr->idxProcVector[ivec];
// remove a process from the process vector
if ( ip >=0 ) {
RemoveAt(ip, aProcess, ivec);
}
// set ordering parameter to zero
pAttr->ordProcVector[ivec] = 0;
pAttr->ordProcVector[ivec-1] = 0;
// insert
InsertAt(0, aProcess, ivec);
// set index in Process Attribute
pAttr->idxProcVector[ivec] = 0;
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ProcessManager::SetProcessOrdering: ";
G4cerr << aProcess->GetProcessName() << " is inserted at top ";
G4cerr << " in ProcessVetor[" << ivec<< "]";
G4cerr << endl;
G4cout << "G4ProcessManager::SetProcessOrdering: ";
G4cout << aProcess->GetProcessName() << " is inserted at top ";
G4cout << " in ProcessVetor[" << ivec<< "]";
G4cout << endl;
}
#endif
}
// create GPIL vectors
CreateGPILvectors();
@@ -681,9 +713,26 @@ void G4ProcessManager::SetProcessOrderingToLast(
// ///////////////////////////////////////
G4VProcess* G4ProcessManager::InActivateProcess(G4int index)
{
G4ApplicationState currentState
= G4StateManager::GetStateManager()->GetCurrentState();
if ( (currentState == PreInit) || (currentState == Init) ) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cout << "G4ProcessManager::InActivateProcess is not valid in ";
if (currentState == PreInit ) {
G4cout << "PreInit ";
} else if (currentState == Init ) {
G4cout << "Init ";
}
G4cout << "state !" << endl;
}
#endif
return 0;
}
//find the process attribute
G4ProcessAttribute* pAttr = GetAttribute(index);
if (pAttr == NULL) return NULL;
if (pAttr == 0) return 0;
// remove process
G4VProcess* pProcess = (*theProcessList)[index];
@@ -691,16 +740,18 @@ G4VProcess* G4ProcessManager::InActivateProcess(G4int index)
const G4String aErrorMessage(" G4ProcessManager::InactivateProcess():");
if (pAttr->isActive) {
// remove process from vectors if the process is active
for (G4int i=0; i<SizeOfProcVectorArray; i++) {
G4ProcessVector* pVector = theProcVector[i];
G4int idx = pAttr->idxProcVector[i];
if (idx<0) {
// corresponding DoIt is not active
} else if ((idx >= 0) && (idx < pVector->length())) {
//check pointer and set to NULL
} else if ((idx >= 0) && (idx < pVector->entries())) {
//check pointer and set to 0
if ((*pVector)[idx]== pProcess) {
(*pVector)[idx]= NULL;
(*pVector)[idx]= 0;
} else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
@@ -712,7 +763,7 @@ G4VProcess* G4ProcessManager::InActivateProcess(G4int index)
}
#endif
G4Exception((const char*)aErrorMessage);
return NULL;
return 0;
}
} else {
// idx is out of range
@@ -722,21 +773,22 @@ G4VProcess* G4ProcessManager::InActivateProcess(G4int index)
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
G4cerr << "process["<<pProcess->GetProcessName()<<"] " ;
G4cerr << "index(=" << idx << ") of process vector";
G4cerr << "[size:" << pVector->length() << "] out of range" << endl;
G4cerr << "[size:" << pVector->entries() << "] out of range" << endl;
}
#endif
G4Exception((const char*)aErrorMessage);
return NULL;
return 0;
}
}
pAttr->isActive = false;
} else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage;
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
G4cerr << "process["<<pProcess->GetProcessName()<<"] " ;
G4cerr << "The process is already inactive" << endl;
G4cout << aErrorMessage;
G4cout << "particle["<<theParticleType->GetParticleName()<<"] " ;
G4cout << "process["<<pProcess->GetProcessName()<<"] " ;
G4cout << "The process is already inactive" << endl;
}
#endif
}
@@ -746,9 +798,26 @@ G4VProcess* G4ProcessManager::InActivateProcess(G4int index)
// ///////////////////////////////////////
G4VProcess* G4ProcessManager::ActivateProcess(G4int index)
{
G4ApplicationState currentState
= G4StateManager::GetStateManager()->GetCurrentState();
if ( (currentState == PreInit) || (currentState == Init) ) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cout << "G4ProcessManager::ActivateProcess is not valid in ";
if (currentState == PreInit ) {
G4cout << "PreInit ";
} else if (currentState == Init ) {
G4cout << "Init ";
}
G4cout << "state !" << endl;
}
#endif
return 0;
}
//find the process attribute
G4ProcessAttribute* pAttr = GetAttribute(index);
if (pAttr == NULL) return NULL;
if (pAttr == 0) return 0;
// remove process
G4VProcess* pProcess = (*theProcessList)[index];
@@ -758,8 +827,8 @@ G4VProcess* G4ProcessManager::ActivateProcess(G4int index)
if (pAttr->isActive) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage << endl;
G4cerr << "The process is already active" << endl;
G4cout << aErrorMessage << endl;
G4cout << "The process is already active" << endl;
}
#endif
} else {
@@ -769,9 +838,9 @@ G4VProcess* G4ProcessManager::ActivateProcess(G4int index)
G4int idx = pAttr->idxProcVector[i];
if (idx<0) {
// corresponding DoIt is not active
} else if ((idx >= 0) && (idx < pVector->length())) {
} else if ((idx >= 0) && (idx < pVector->entries())) {
//check pointer and set
if ((*pVector)[idx]== NULL) {
if ((*pVector)[idx]== 0) {
(*pVector)[idx] = pProcess;
} else {
#ifdef G4VERBOSE
@@ -784,7 +853,7 @@ G4VProcess* G4ProcessManager::ActivateProcess(G4int index)
}
#endif
G4Exception((const char*)aErrorMessage);
return NULL;
return 0;
}
} else {
// idx is out of range
@@ -794,11 +863,11 @@ G4VProcess* G4ProcessManager::ActivateProcess(G4int index)
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
G4cerr << "process["<<pProcess->GetProcessName()<<"] " ;
G4cerr << "index(=" << idx <<")of process vector";
G4cerr << "[size:" << pVector->length() << "] out of range" << endl;
G4cerr << "[size:" << pVector->entries() << "] out of range" << endl;
}
#endif
G4Exception((const char*)aErrorMessage);
return NULL;
return 0;
}
}
pAttr->isActive = true;
@@ -830,7 +899,7 @@ void G4ProcessManager::DumpInfo()
delete aMessage;
// loop over all processes
for (G4int idx=0; idx <theProcessList->length(); idx++){
for (G4int idx=0; idx <theProcessList->entries(); idx++){
// process name/type
G4cout << "[" << idx << "]";
G4cout << "=== process[" << ((*theProcessList)(idx))->GetProcessName()<< " :";
@@ -838,7 +907,7 @@ void G4ProcessManager::DumpInfo()
// process attribute
G4ProcessAttribute* pAttr = (*theAttrVector)(idx);
// staus
// status
if ( pAttr-> isActive ) {
G4cout << " Active ";
} else {
@@ -875,11 +944,12 @@ void G4ProcessManager::CreateGPILvectors()
{
//-- create GetPhysicalInteractionLength process vectors just as the inverse
//-- order of DoIt process vector
for(G4int k=0; k<theProcessList->length(); k++) {
for(G4int k=0; k<theProcessList->entries(); k++) {
GetAttribute((*theProcessList)(k))->idxProcVector[0]=-1;
GetAttribute((*theProcessList)(k))->idxProcVector[2]=-1;
GetAttribute((*theProcessList)(k))->idxProcVector[4]=-1;
}
for(G4int i=0; i<SizeOfProcVectorArray; i += 2) {
G4ProcessVector* procGPIL = theProcVector[i];
G4ProcessVector* procDoIt = theProcVector[i+1];
@@ -891,6 +961,7 @@ void G4ProcessManager::CreateGPILvectors()
GetAttribute(aProc)->idxProcVector[i] = procGPIL->entries()-1;
}
}
}
@@ -901,7 +972,7 @@ void G4ProcessManager::CreateGPILvectors()
//////////////////////////////////////////
void G4ProcessManager::StartTracking()
{
for (G4int idx = 0; idx<theProcessList->length(); idx++){
for (G4int idx = 0; idx<theProcessList->entries(); idx++){
if (GetAttribute(idx)->isActive)
((*theProcessList)[idx])->StartTracking();
}
@@ -911,7 +982,7 @@ void G4ProcessManager::StartTracking()
/////////////////////////////////////////////
void G4ProcessManager::EndTracking()
{
for (G4int idx = 0; idx<theProcessList->length(); idx++){
for (G4int idx = 0; idx<theProcessList->entries(); idx++){
if (GetAttribute(idx)->isActive)
((*theProcessList)[idx])->EndTracking();
}
@@ -933,3 +1004,40 @@ void G4ProcessManager::EndTracking()
if (fActive) return ActivateProcess(index);
else return InActivateProcess(index);
}
/////////////////////////////////////////////
G4bool G4ProcessManager::GetProcessActivation(G4VProcess *aProcess) const
{
return GetProcessActivation(GetProcessIndex(aProcess));
}
/////////////////////////////////////////////
G4bool G4ProcessManager::GetProcessActivation(G4int index) const
{
if (index <0) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout << "G4ProcessManager::GetProcessActivation ";
G4cout << " process (or its index) not found ";
}
#endif
return false;
}
// process attribute
G4ProcessAttribute* pAttr = (*theAttrVector)(index);
// status
return pAttr-> isActive;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ProcessManagerMessenger.cc,v 2.4 1998/07/17 06:20:06 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ProcessManagerMessenger.cc,v 1.3 1999/06/17 09:02:14 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//---------------------------------------------------------------
@@ -46,12 +46,12 @@
G4ProcessManagerMessenger::G4ProcessManagerMessenger(G4ParticleTable* pTable)
:theParticleTable(pTable),
currentParticle(NULL),
currentProcess(NULL),
theManager(NULL),
theProcessList(NULL)
currentParticle(0),
currentProcess(0),
theManager(0),
theProcessList(0)
{
if ( theParticleTable == NULL) theParticleTable = G4ParticleTable::GetParticleTable();
if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
//Commnad /particle/process
thisDirectory = new G4UIdirectory("/particle/process/");
@@ -76,6 +76,7 @@ G4ProcessManagerMessenger::G4ProcessManagerMessenger(G4ParticleTable* pTable)
param = new G4UIparameter("index",'i',true);
param->SetDefaultValue(-1);
verboseCmd->SetParameter(param);
verboseCmd->AvailableForStates(PreInit,Init,Idle,GeomClosed,EventProc);
//Commnad /particle/process/Activate
activateCmd = new G4UIcmdWithAnInteger("/particle/process/activate",this);
@@ -84,6 +85,7 @@ G4ProcessManagerMessenger::G4ProcessManagerMessenger(G4ParticleTable* pTable)
activateCmd->SetParameterName("index", false);
activateCmd->SetDefaultValue(0);
activateCmd->SetRange("index >=0");
activateCmd->AvailableForStates(Idle,GeomClosed,EventProc);
//Commnad /particle/process/inactivate
inactivateCmd = new G4UIcmdWithAnInteger("/particle/process/inactivate",this);
@@ -92,6 +94,8 @@ G4ProcessManagerMessenger::G4ProcessManagerMessenger(G4ParticleTable* pTable)
inactivateCmd->SetParameterName("index", false);
inactivateCmd->SetDefaultValue(0);
inactivateCmd->SetRange("index >=0");
inactivateCmd->AvailableForStates(Idle,GeomClosed,EventProc);
}
G4ProcessManagerMessenger::~G4ProcessManagerMessenger()
@@ -110,8 +114,8 @@ G4ParticleDefinition* G4ProcessManagerMessenger::SetCurrentParticle()
G4String particleName = G4UImanager::GetUIpointer()->GetCurrentStringValue("/particle/select");
currentParticle = theParticleTable->FindParticle(particleName);
if (currentParticle == NULL) {
theManager = NULL;
if (currentParticle == 0) {
theManager = 0;
G4cout << "G4ProcessManagerMessenger::SetCurrentParticle() ";
G4cout << particleName << " not found " << endl;
} else {
@@ -123,7 +127,7 @@ G4ParticleDefinition* G4ProcessManagerMessenger::SetCurrentParticle()
void G4ProcessManagerMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if (SetCurrentParticle()==NULL) {
if (SetCurrentParticle()==0) {
G4cout << "Particle is not selected yet !! Command ignored." << endl;
return;
}
@@ -134,7 +138,7 @@ void G4ProcessManagerMessenger::SetNewValue(G4UIcommand * command,G4String newVa
theManager->DumpInfo();
} else if ( index < theManager->GetProcessListLength()){
currentProcess = (*theProcessList)(index);
if (currentProcess == NULL) {
if (currentProcess == 0) {
G4cout << " no process at index of " << index;
G4cout << "in the Process Vector" << endl;
} else {
@@ -142,7 +146,7 @@ void G4ProcessManagerMessenger::SetNewValue(G4UIcommand * command,G4String newVa
}
} else {
G4cout << " illegal index !!! " << endl;
currentProcess = NULL;
currentProcess = 0;
}
} else if( command==activateCmd ) {
@@ -155,7 +159,7 @@ void G4ProcessManagerMessenger::SetNewValue(G4UIcommand * command,G4String newVa
} else if( command==verboseCmd ) {
//Commnad /particle/process/Verbose
// inputstream for newValues
const char* temp = newValue;
const char* temp = (const char*)(newValue);
istrstream is((char*)temp);
G4int Verbose, index;
is >>Verbose >>index;
@@ -164,7 +168,7 @@ void G4ProcessManagerMessenger::SetNewValue(G4UIcommand * command,G4String newVa
} else if ( index < theManager->GetProcessListLength()){
currentProcess = (*theProcessList)(index);
if (currentProcess == NULL) {
if (currentProcess == 0) {
G4cout << " no process at index of " << index;
G4cout << "in the Process Vector" << endl;
} else {
@@ -172,7 +176,7 @@ void G4ProcessManagerMessenger::SetNewValue(G4UIcommand * command,G4String newVa
}
} else {
G4cout << " illegal index !!! " << endl;
currentProcess = NULL;
currentProcess = 0;
}
}
}
@@ -181,7 +185,7 @@ void G4ProcessManagerMessenger::SetNewValue(G4UIcommand * command,G4String newVa
G4String G4ProcessManagerMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String returnValue('\0');
if(SetCurrentParticle() == NULL) {
if(SetCurrentParticle() == 0) {
// no particle is selected. return null strings
return returnValue;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ProcessTable.cc,v 2.5 1998/09/14 12:02:57 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ProcessTable.cc,v 1.3 1999/04/14 10:50:45 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -26,13 +26,13 @@ G4ProcessTable::G4ProcessTable():verboseLevel(1)
{
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << "-- G4ProcessTable constructor --" << endl;
G4cout << "-- G4ProcessTable constructor --" << endl;
}
#endif
fProcTblVector = new G4ProcTableVector();
fProcNameVector = new G4ProcNameVector();
tmpTblVector = new G4ProcTableVector();
fProcTblMessenger = NULL;
fProcTblMessenger = 0;
}
// copy constructor //////////////////////////
@@ -40,7 +40,7 @@ G4ProcessTable::G4ProcessTable(const G4ProcessTable &right)
{
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cerr << "-- G4ProcessTable copy constructor --" << endl;
G4cout << "-- G4ProcessTable copy constructor --" << endl;
}
#endif
}
@@ -50,7 +50,7 @@ G4ProcessTable::~G4ProcessTable()
{
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << "-- G4ProcessTable destructor --" << endl;
G4cout << "-- G4ProcessTable destructor --" << endl;
}
#endif
@@ -59,15 +59,15 @@ G4ProcessTable::~G4ProcessTable()
delete ((*fProcTblVector)(idxTbl))->GetProcess();
}
if ( tmpTblVector != NULL) {
if ( tmpTblVector != 0) {
tmpTblVector ->clear();
delete tmpTblVector;
}
if ( fProcTblVector != NULL) {
if ( fProcTblVector != 0) {
fProcTblVector ->clearAndDestroy();
delete fProcTblVector;
}
if ( fProcNameVector != NULL) {
if ( fProcNameVector != 0) {
fProcNameVector ->clear();
delete fProcNameVector;
}
@@ -76,7 +76,7 @@ G4ProcessTable::~G4ProcessTable()
/////////////////////////
G4UImessenger* G4ProcessTable::CreateMessenger()
{
if (fProcTblMessenger == NULL) {
if (fProcTblMessenger == 0) {
fProcTblMessenger = new G4ProcessTableMessenger(this);
}
return fProcTblMessenger;
@@ -85,7 +85,7 @@ G4UImessenger* G4ProcessTable::CreateMessenger()
/////////////////////////
void G4ProcessTable::DeleteMessenger()
{
if (fProcTblMessenger != NULL) {
if (fProcTblMessenger != 0) {
delete fProcTblMessenger;
}
}
@@ -96,10 +96,11 @@ G4ProcessTable & G4ProcessTable::operator=(const G4ProcessTable &right)
{
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cerr << "-- G4ProcessTable assignment operator --" << endl;
G4cout << "-- G4ProcessTable assignment operator --" << endl;
}
#endif
return *this;
if (&right == this) return *this;
else return *this;
}
//////////////////////////
@@ -132,10 +133,10 @@ G4ProcessTable* G4ProcessTable::GetProcessTable()
G4int G4ProcessTable::Insert(G4VProcess* aProcess,
G4ProcessManager* aProcMgr)
{
if ( (aProcess == NULL) || ( aProcMgr == NULL ) ){
if ( (aProcess == 0) || ( aProcMgr == 0 ) ){
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cerr << "G4ProcessTable::Insert : arguments are NULL pointer "<<endl;
G4cout << "G4ProcessTable::Insert : arguments are 0 pointer "<<endl;
}
#endif
return -1;
@@ -143,10 +144,10 @@ G4int G4ProcessTable::Insert(G4VProcess* aProcess,
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << "G4ProcessTable::Insert ";
G4cerr << " Process[" << aProcess->GetProcessName() << "]";
G4cerr << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]";
G4cerr << endl;
G4cout << "G4ProcessTable::Insert ";
G4cout << " Process[" << aProcess->GetProcessName() << "]";
G4cout << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]";
G4cout << endl;
}
#endif
@@ -162,8 +163,7 @@ G4int G4ProcessTable::Insert(G4VProcess* aProcess,
isFoundInTbl = true;
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cerr << " This Process has been already registered !! ";
G4cerr << endl;
G4cout << " This Process has been already registered !! " << endl;
}
#endif
//
@@ -174,8 +174,7 @@ G4int G4ProcessTable::Insert(G4VProcess* aProcess,
isFound = true;
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " This Process Manager has been already registered !! ";
G4cerr << endl;
G4cout << " This Process Manager has been already registered !! " << endl;
}
#endif
break;
@@ -186,8 +185,7 @@ G4int G4ProcessTable::Insert(G4VProcess* aProcess,
anElement->Insert(aProcMgr);
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cerr << " This Process Manager is registered !! ";
G4cerr << endl;
G4cout << " This Process Manager is registered !! " << endl;
}
#endif
}
@@ -205,8 +203,7 @@ G4int G4ProcessTable::Insert(G4VProcess* aProcess,
}
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cerr << " This Process is registered !! ";
G4cerr << endl;
G4cout << " This Process is registered !! " << endl;
}
#endif
}
@@ -217,10 +214,10 @@ G4int G4ProcessTable::Insert(G4VProcess* aProcess,
G4int G4ProcessTable::Remove( G4VProcess* aProcess,
G4ProcessManager* aProcMgr)
{
if ( (aProcess == NULL) || ( aProcMgr == NULL ) ){
if ( (aProcess == 0) || ( aProcMgr == 0 ) ){
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cerr << "G4ProcessTable::Remove : arguments are NULL pointer "<<endl;
G4cout << "G4ProcessTable::Remove : arguments are 0 pointer "<< endl;
}
#endif
return -1;
@@ -228,10 +225,9 @@ G4int G4ProcessTable::Remove( G4VProcess* aProcess,
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << "G4ProcessTable::Remove ";
G4cerr << " Process[" << aProcess->GetProcessName() << "]";
G4cerr << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]";
G4cerr << endl;
G4cout << "G4ProcessTable::Remove ";
G4cout << " Process[" << aProcess->GetProcessName() << "]";
G4cout << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]" << endl;
}
#endif
@@ -259,8 +255,7 @@ G4int G4ProcessTable::Remove( G4VProcess* aProcess,
anElement->Remove(aProcMgr);
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cerr << " This Process Manager is removed !! ";
G4cerr << endl;
G4cout << " This Process Manager is removed !! " << endl;
}
#endif
}
@@ -286,8 +281,7 @@ G4int G4ProcessTable::Remove( G4VProcess* aProcess,
}
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " This Process is removed !! ";
G4cerr << endl;
G4cout << " This Process is removed !! " << endl;
}
#endif
}
@@ -295,8 +289,7 @@ G4int G4ProcessTable::Remove( G4VProcess* aProcess,
} else {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cerr << " This Process is not registered !! ";
G4cerr << endl;
G4cout << " This Process is not registered !! " << endl;
}
#endif
}
@@ -324,15 +317,14 @@ G4VProcess* G4ProcessTable::FindProcess(const G4String& processName,
}
#ifdef G4VERBOSE
if (!isFound && verboseLevel>1){
G4cerr << " G4ProcessTable::FindProcess :" ;
G4cerr << " The Process[" << processName << "] is not found ";
G4cerr << " for " << processManager->GetParticleType()->GetParticleName();
G4cerr << endl;
G4cout << " G4ProcessTable::FindProcess :" ;
G4cout << " The Process[" << processName << "] is not found ";
G4cout << " for " << processManager->GetParticleType()->GetParticleName() << endl;
}
#endif
if (isFound) return anElement->GetProcess();
else return NULL;
else return 0;
}
///////////////
@@ -356,9 +348,8 @@ G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find(
#ifdef G4VERBOSE
if (!isFound && verboseLevel>0){
G4cerr << " G4ProcessTable::Find :" ;
G4cerr << " The Process[" << processName << "] is not found ";
G4cerr << endl;
G4cout << " G4ProcessTable::Find :" ;
G4cout << " The Process[" << processName << "] is not found " << endl;
}
#endif
@@ -386,9 +377,8 @@ G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find(
#ifdef G4VERBOSE
if (!isFound && verboseLevel>0){
G4cerr << " G4ProcessTable::Find :" ;
G4cerr << " The Process[" << anElement->GetProcessName() << "] is not found ";
G4cerr << endl;
G4cout << " G4ProcessTable::Find :" ;
G4cout << " The Process[" << anElement->GetProcessName() << "] is not found " << endl;
}
#endif
@@ -441,8 +431,8 @@ void G4ProcessTable::SetProcessActivation( const G4String& processName,
{
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " G4ProcessTable::SetProcessActivation:" ;
G4cerr << " The Process[" << processName << "] "<< endl;
G4cout << " G4ProcessTable::SetProcessActivation:" ;
G4cout << " The Process[" << processName << "] "<< endl;
}
#endif
@@ -457,9 +447,9 @@ void G4ProcessTable::SetProcessActivation( const G4String& processName,
manager->SetProcessActivation(process, fActive);
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " for " << manager->GetParticleType()->GetParticleName();
G4cerr << " Index = " << manager->GetProcessIndex(process);
G4cerr << endl;
G4cout << " for " << manager->GetParticleType()->GetParticleName();
G4cout << " Index = " << manager->GetProcessIndex(process);
G4cout << endl;
}
#endif
}
@@ -474,19 +464,18 @@ void G4ProcessTable::SetProcessActivation(
{
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " G4ProcessTable::SetProcessActivation:" ;
G4cerr << " The Process[" << processName << "] "<< endl;
G4cout << " G4ProcessTable::SetProcessActivation:" ;
G4cout << " The Process[" << processName << "] "<< endl;
}
#endif
G4VProcess* process = FindProcess( processName, processManager);
if ( process != NULL) {
if ( process != 0) {
processManager->SetProcessActivation(process, fActive);
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " for " << processManager->GetParticleType()->GetParticleName();
G4cerr << " Index = " << processManager->GetProcessIndex(process);
G4cerr << endl;
G4cout << " for " << processManager->GetParticleType()->GetParticleName();
G4cout << " Index = " << processManager->GetProcessIndex(process) << endl;
}
#endif
}
@@ -499,8 +488,8 @@ void G4ProcessTable::SetProcessActivation( G4ProcessType processType,
{
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " G4ProcessTable::SetProcessActivation:" ;
G4cerr << " The ProcessType[" << processType << "] "<< endl;
G4cout << " G4ProcessTable::SetProcessActivation:" ;
G4cout << " The ProcessType[" << processType << "] "<< endl;
}
#endif
@@ -512,7 +501,7 @@ void G4ProcessTable::SetProcessActivation( G4ProcessType processType,
G4VProcess* process = anElement->GetProcess();
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " The Process[" << process->GetProcessName()<< "] "<< endl;
G4cout << " The Process[" << process->GetProcessName()<< "] "<< endl;
}
#endif
for (G4int idx = 0 ; idx < anElement->Length(); idx++) {
@@ -520,9 +509,8 @@ void G4ProcessTable::SetProcessActivation( G4ProcessType processType,
manager->SetProcessActivation(process, fActive);
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " for " << manager->GetParticleType()->GetParticleName();
G4cerr << " Index = " << manager->GetProcessIndex(process);
G4cerr << endl;
G4cout << " for " << manager->GetParticleType()->GetParticleName();
G4cout << " Index = " << manager->GetProcessIndex(process) << endl;
}
#endif
}
@@ -537,8 +525,8 @@ void G4ProcessTable::SetProcessActivation(
{
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " G4ProcessTable::SetProcessActivation:" ;
G4cerr << " The ProcessType[" << processType << "] "<< endl;
G4cout << " G4ProcessTable::SetProcessActivation:" ;
G4cout << " The ProcessType[" << processType << "] "<< endl;
}
#endif
@@ -549,10 +537,9 @@ void G4ProcessTable::SetProcessActivation(
processManager->SetProcessActivation(process, fActive);
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << " The Process[" << process->GetProcessName()<< "] "<< endl;
G4cerr << " for " << processManager->GetParticleType()->GetParticleName();
G4cerr << " Index = " << idx;
G4cerr << endl;
G4cout << " The Process[" << process->GetProcessName()<< "] "<< endl;
G4cout << " for " << processManager->GetParticleType()->GetParticleName();
G4cout << " Index = " << idx << endl;
}
#endif
}
@@ -573,7 +560,7 @@ void G4ProcessTable::DumpInfo(G4VProcess* process,
for (idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
anElement = (*fProcTblVector)(idxTbl);
if (process == anElement->GetProcess() ){
if (particle==NULL) {
if (particle==0) {
isFoundInTbl = true;
break;
} else {
@@ -593,7 +580,7 @@ void G4ProcessTable::DumpInfo(G4VProcess* process,
process->SetVerboseLevel(verboseLevel);
process->DumpInfo();
process->SetVerboseLevel(tmpVerbose);
if (particle==NULL) {
if (particle==0) {
for (idx=0; idx<anElement->Length(); idx++){
manager = anElement->GetProcessManager(idx);
G4cout << " for " << manager->GetParticleType()->GetParticleName();
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ProcessTableMessenger.cc,v 2.3 1998/08/17 03:35:44 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ProcessTableMessenger.cc,v 1.3 1999/06/17 09:02:15 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//---------------------------------------------------------------
@@ -51,12 +51,11 @@ G4int G4ProcessTableMessenger::NumberOfProcessType = 10;
//////////////////////////
G4ProcessTableMessenger::G4ProcessTableMessenger(G4ProcessTable* pTable)
:theProcessTable(pTable)
{
currentProcessTypeName = "all";
currentProcessName = "all";
currentParticleName = "all";
:theProcessTable(pTable),
currentProcessTypeName("all"),
currentProcessName("all"),
currentParticleName("all")
{
//Commnad /particle/process
thisDirectory = new G4UIdirectory("/process/");
thisDirectory->SetGuidance("Process Table control commands.");
@@ -71,12 +70,12 @@ G4ProcessTableMessenger::G4ProcessTableMessenger(G4ProcessTable* pTable)
listCmd->SetDefaultValue("all");
SetNumberOfProcessType();
G4String candidates = "all";
G4String candidates("all");
for (G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) {
candidates += " " +
G4VProcess::GetProcessTypeName(G4ProcessType(idx));
}
listCmd->SetCandidates(candidates);
listCmd->SetCandidates((const char*)(candidates));
//Commnad /particle/process/Verbose
verboseCmd = new G4UIcmdWithAnInteger("/process/verbose",this);
@@ -86,6 +85,7 @@ G4ProcessTableMessenger::G4ProcessTableMessenger(G4ProcessTable* pTable)
verboseCmd->SetParameterName("verbose", true);
verboseCmd->SetDefaultValue(1);
verboseCmd->SetRange("verbose >=0");
verboseCmd->AvailableForStates(PreInit,Init,Idle,GeomClosed,EventProc);
//Commnad /particle/process/dump
dumpCmd = new G4UIcommand("/process/dump",this);
@@ -98,6 +98,7 @@ G4ProcessTableMessenger::G4ProcessTableMessenger(G4ProcessTable* pTable)
param = new G4UIparameter("particle",'s',true);
param->SetDefaultValue("all");
dumpCmd->SetParameter(param);
dumpCmd->AvailableForStates(Init,Idle,GeomClosed,EventProc);
//Commnad /particle/process/activate
activateCmd = new G4UIcommand("/process/activate",this);
@@ -110,6 +111,7 @@ G4ProcessTableMessenger::G4ProcessTableMessenger(G4ProcessTable* pTable)
param = new G4UIparameter("particle",'s',true);
param->SetDefaultValue("all");
activateCmd->SetParameter(param);
activateCmd->AvailableForStates(Idle,GeomClosed,EventProc);
//Commnad /particle/process/inactivate
inactivateCmd = new G4UIcommand("/process/inactivate",this);
@@ -123,6 +125,7 @@ G4ProcessTableMessenger::G4ProcessTableMessenger(G4ProcessTable* pTable)
param = new G4UIparameter("particle",'s',true);
param->SetDefaultValue("all");
inactivateCmd->SetParameter(param);
inactivateCmd->AvailableForStates(Idle,GeomClosed,EventProc);
}
//////////////////
@@ -186,7 +189,7 @@ void G4ProcessTableMessenger::SetNewValue(G4UIcommand * command,G4String newValu
RWCTokenizer next( newValue );
// check 1st argument
currentProcessName = next();
currentProcessName = G4String(next());
G4bool isNameFound = false;
G4bool isProcName = false;
if ( procNameVector->contains(currentProcessName) ){
@@ -205,9 +208,9 @@ void G4ProcessTableMessenger::SetNewValue(G4UIcommand * command,G4String newValu
}
// check 2nd argument
currentParticleName = next();
currentParticleName = G4String(next());
G4bool isParticleFound = false;
G4ParticleDefinition* currentParticle = NULL;
G4ParticleDefinition* currentParticle = 0;
if ( currentParticleName == "all" ) {
isParticleFound = true;
@@ -243,7 +246,7 @@ void G4ProcessTableMessenger::SetNewValue(G4UIcommand * command,G4String newValu
// process/activate , inactivate
G4bool fActive = (command==activateCmd);
if (isProcName) {
if ( currentParticle == NULL ) {
if ( currentParticle == 0 ) {
theProcessTable->SetProcessActivation(currentProcessName,
fActive);
} else {
@@ -252,7 +255,7 @@ void G4ProcessTableMessenger::SetNewValue(G4UIcommand * command,G4String newValu
fActive);
}
} else {
if ( currentParticle == NULL ) {
if ( currentParticle == 0 ) {
theProcessTable->SetProcessActivation(G4ProcessType(type),
fActive);
} else {
@@ -294,7 +297,7 @@ G4String G4ProcessTableMessenger::GetCurrentValue(G4UIcommand * command)
candidates += " " +
G4VProcess::GetProcessTypeName(G4ProcessType(idx));
}
listCmd->SetCandidates(candidates);
listCmd->SetCandidates((const char*)(candidates));
returnValue = currentProcessTypeName;
} else {
@@ -305,7 +308,7 @@ G4String G4ProcessTableMessenger::GetCurrentValue(G4UIcommand * command)
for (idx = 0; idx < procNameVector->length() ; idx ++ ) {
candidates += " " + (*procNameVector)(idx);
}
param->SetParameterCandidates(candidates);
param->SetParameterCandidates((const char*)(candidates));
// particle name
param = command->GetParameter(1);
candidates = "all";
@@ -316,7 +319,7 @@ G4String G4ProcessTableMessenger::GetCurrentValue(G4UIcommand * command)
G4ParticleDefinition *particle = piter->value();
candidates += " " + particle->GetParticleName();
}
param->SetParameterCandidates(candidates);
param->SetParameterCandidates((const char*)(candidates));
returnValue = currentProcessName + " " + currentParticleName;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VContinuousDiscreteProcess.cc,v 2.0 1998/07/02 16:39:50 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VContinuousDiscreteProcess.cc,v 1.1 1999/01/07 16:13:59 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VContinuousProcess.cc,v 2.0 1998/07/02 16:39:51 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VContinuousProcess.cc,v 1.1 1999/01/07 16:13:59 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VDiscreteProcess.cc,v 2.0 1998/07/02 16:39:53 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VDiscreteProcess.cc,v 1.1 1999/01/07 16:13:59 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
+32 -25
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VProcess.cc,v 2.5 1998/08/16 02:36:58 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VProcess.cc,v 1.3 1999/04/14 10:50:46 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -28,15 +28,10 @@
#include "G4ElementVector.hh"
#include "G4VProcess.hh"
//G4VProcess::G4VProcess()
//{
// G4Exception("G4VProcess:: default constructor is called");
//}
G4VProcess::G4VProcess(const G4String& aName, G4ProcessType aType )
: theProcessName(aName),
theProcessType(aType),
pParticleChange(NULL),
pParticleChange(0),
theNumberOfInteractionLengthLeft(-1.0),
currentInteractionLength(-1.0),
verboseLevel(0)
@@ -49,7 +44,7 @@ G4VProcess::~G4VProcess()
}
G4VProcess::G4VProcess(G4VProcess& right):
pParticleChange(NULL),
pParticleChange(0),
theProcessName(right.theProcessName),
theProcessType(right.theProcessType),
theNumberOfInteractionLengthLeft(-1.0),
@@ -83,7 +78,7 @@ void G4VProcess::StartTracking()
theNumberOfInteractionLengthLeft = -1.0;
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4VProcess::StartTracking() [" << theProcessName << "]" <<endl;
G4cout << "G4VProcess::StartTracking() [" << theProcessName << "]" <<endl;
}
#endif
}
@@ -92,7 +87,7 @@ void G4VProcess::EndTracking()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4VProcess::EndTracking() [" << theProcessName << "]" <<endl;
G4cout << "G4VProcess::EndTracking() [" << theProcessName << "]" <<endl;
}
#endif
theNumberOfInteractionLengthLeft = -1.0;
@@ -100,30 +95,42 @@ void G4VProcess::EndTracking()
}
G4String G4VProcess::GetProcessTypeName(G4ProcessType aType )
const G4String& G4VProcess::GetProcessTypeName(G4ProcessType aType )
{
static G4String typeNotDefined= "NotDefined";
static G4String typeTransportation = "Transportation";
static G4String typeElectromagnetic = "Electromagnetic";
static G4String typeOptical = "Optical";
static G4String typeHadronic = "Hadronic";
static G4String typePhotolepton_hadron = "Photolepton_hadron";
static G4String typeDecay = "Decay";
static G4String typeGeneral = "General";
static G4String typeParameterisation = "Parameterisation";
static G4String typeUserDefined = "UserDefined";
static G4String noType = "------"; // Do not modify this !!!!
if (aType == fNotDefined) {
return "NotDefined";
return typeNotDefined;
} else if (aType == fTransportation ) {
return "Transportation";
return typeTransportation;
} else if (aType == fElectromagnetic ) {
return "Electromagnetic";
return typeElectromagnetic;
} else if (aType == fOptical ) {
return "Optical";
return typeOptical;
} else if (aType == fHadronic ) {
return "Hadronic";
return typeHadronic;
} else if (aType == fPhotolepton_hadron ) {
return "Photolepton_hadron";
return typePhotolepton_hadron;
} else if (aType == fDecay ) {
return "Decay";
return typeDecay;
} else if (aType == fGeneral ) {
return "General";
return typeGeneral;
} else if (aType == fParameterisation ) {
return "Parameterisation";
return typeParameterisation;
} else if (aType == fUserDefined ) {
return "UserDefined";
return typeUserDefined;
} else {
return "------"; // Do not modify this end mark !!!!
return noType;
}
}
@@ -135,12 +142,12 @@ G4VProcess & G4VProcess::operator=(const G4VProcess &)
G4int G4VProcess::operator==(const G4VProcess &right) const
{
return (this == (G4VProcess *) &right);
return (this == &right);
}
G4int G4VProcess::operator!=(const G4VProcess &right) const
{
return (this != (G4VProcess *) &right);
return (this != &right);
}
void G4VProcess::DumpInfo() const
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VRestContinuousDiscreteProcess.cc,v 2.0 1998/07/02 16:39:56 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VRestContinuousDiscreteProcess.cc,v 1.1 1999/01/07 16:14:00 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VRestContinuousProcess.cc,v 2.0 1998/07/02 16:39:58 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VRestContinuousProcess.cc,v 1.1 1999/01/07 16:14:00 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VRestDiscreteProcess.cc,v 2.0 1998/07/02 16:40:01 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VRestDiscreteProcess.cc,v 1.1 1999/01/07 16:14:00 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VRestProcess.cc,v 2.0 1998/07/02 16:40:24 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VRestProcess.cc,v 1.1 1999/01/07 16:14:00 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------