Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# $Id: GNUmakefile,v 2.0 1998/07/02 16:39:35 gunter Exp $
|
||||
# --------------------------------------------------------------------
|
||||
# GNUmakefile for process management library. Gabriele Cosmo, 4/4/97.
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
name := G4procman
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/utils/include \
|
||||
-I$(G4BASE)/materials/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -0,0 +1,277 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4IVContinuousDiscreteProcess.hh,v 2.5 1998/10/16 13:21:31 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// $Id:
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 8 Mar. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// modified 26 Mar. 1997 H.Kurashige
|
||||
// modified 16 Apr. 1997 L.Urban
|
||||
// modified AlongStepGPIL etc. 17 Dec. 1997 H.Kurashige
|
||||
// fix bugs in GetGPILSelection() 24 Jan. 1998 H.Kurashige
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
|
||||
#ifndef G4IVContinuousDiscreteProcess_h
|
||||
#define G4IVContinuousDiscreteProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
class G4IVContinuousDiscreteProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// discrete physics interactions.
|
||||
public:
|
||||
|
||||
G4IVContinuousDiscreteProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4IVContinuousDiscreteProcess(G4IVContinuousDiscreteProcess &);
|
||||
|
||||
~G4IVContinuousDiscreteProcess();
|
||||
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
);
|
||||
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
) ;
|
||||
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
// no operation in AtRestDoIt
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
) { return -1.0; };
|
||||
|
||||
// no operation in AtRestDoIt
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
protected:
|
||||
virtual G4double GetContinuousStepLimit(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety
|
||||
)=0;
|
||||
private:
|
||||
// this is the returnd value of G4GPILSelection in
|
||||
// the arguments of AlongStepGPIL()
|
||||
G4GPILSelection valueGPILSelection;
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------
|
||||
virtual void SubtractNumberOfInteractionLengthLeft(
|
||||
G4double previousStepSize) ;
|
||||
|
||||
// these two methods are set/get methods for valueGPILSelection
|
||||
void SetGPILSelection(G4GPILSelection selection)
|
||||
{ valueGPILSelection = selection;};
|
||||
|
||||
G4GPILSelection GetGPILSelection() const{return valueGPILSelection;};
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4IVContinuousDiscreteProcess();
|
||||
G4IVContinuousDiscreteProcess & operator=(const G4IVContinuousDiscreteProcess &right);
|
||||
|
||||
protected:
|
||||
G4PhysicsTable* theNlambdaTable ;
|
||||
G4PhysicsTable* theInverseNlambdaTable ;
|
||||
G4double BIGSTEP ;
|
||||
};
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
|
||||
|
||||
inline void G4IVContinuousDiscreteProcess::
|
||||
SubtractNumberOfInteractionLengthLeft(
|
||||
G4double
|
||||
)
|
||||
{
|
||||
// dummy routine
|
||||
;
|
||||
}
|
||||
|
||||
inline G4double G4IVContinuousDiscreteProcess::
|
||||
PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{// get particle,particle type,kin.energy,material,mat.index
|
||||
G4double nl,nlold,range,rangeold,rangenext,
|
||||
KineticEnergyOld,KineticEnergyNext,value;
|
||||
G4bool isOut;
|
||||
const G4DynamicParticle* particle = track.GetDynamicParticle();
|
||||
const G4ParticleDefinition* particletype = particle->GetDefinition() ;
|
||||
G4double KineticEnergy = particle->GetKineticEnergy();
|
||||
G4Material* material = track.GetMaterial();
|
||||
const G4MaterialTable* theMaterialTable =
|
||||
G4Material::GetMaterialTable();
|
||||
G4int materialindex = material->GetIndex();
|
||||
|
||||
nl = (*theNlambdaTable)[materialindex]->
|
||||
GetValue(KineticEnergy,isOut);
|
||||
range = G4EnergyLossTables::GetPreciseRangeFromEnergy(particletype,
|
||||
KineticEnergy,material) ;
|
||||
|
||||
if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) {
|
||||
// beggining of tracking (or just after DoIt of this process)
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
} else {
|
||||
// subtract NumberOfInteractionLengthLeft
|
||||
|
||||
rangeold = range + previousStepSize ;
|
||||
KineticEnergyOld = G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
particletype,
|
||||
rangeold,material);
|
||||
nlold = (*theNlambdaTable)[materialindex]->
|
||||
GetValue(KineticEnergyOld,isOut);
|
||||
|
||||
if(nlold < nl) {
|
||||
#ifdef G4VERBOSE
|
||||
if(verboseLevel>2) {
|
||||
G4cout << GetProcessName() << " PostStepGPIL : Nlambda has been" <<
|
||||
" increased at update.Nlambda old/new :" << nlold <<
|
||||
" " << nl << endl;
|
||||
G4cout << "(theNumberOfInteractionLengthLeft has been increased!)" << endl;
|
||||
|
||||
G4cout << " correction : Nlambda old=new ........." << endl;
|
||||
}
|
||||
#endif
|
||||
//corr. of num errror
|
||||
nlold = nl ;
|
||||
}
|
||||
|
||||
theNumberOfInteractionLengthLeft -= nlold-nl ;
|
||||
|
||||
if(theNumberOfInteractionLengthLeft<perMillion)
|
||||
theNumberOfInteractionLengthLeft=0.;
|
||||
}
|
||||
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
if(nl <= theNumberOfInteractionLengthLeft){
|
||||
value = BIGSTEP ;
|
||||
} else {
|
||||
KineticEnergyNext = (*theInverseNlambdaTable)[materialindex]->
|
||||
GetValue(nl-theNumberOfInteractionLengthLeft,isOut);
|
||||
rangenext = G4EnergyLossTables::GetPreciseRangeFromEnergy(particletype,
|
||||
KineticEnergyNext,material);
|
||||
|
||||
value = range - rangenext ;
|
||||
|
||||
if(range<rangenext) {
|
||||
#ifdef G4VERBOSE
|
||||
if(verboseLevel>2) {
|
||||
G4cout << GetProcessName() << " PostStepGPIL: Step < 0.!, Step=" <<
|
||||
value << endl;
|
||||
G4cout << "range,rangenext:" << range << " " << rangenext << endl ;
|
||||
G4cout << "correction : rangenext=range ....." << endl;
|
||||
}
|
||||
#endif
|
||||
//corr. of num error
|
||||
rangenext = range ;
|
||||
value = range - rangenext ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline G4VParticleChange* G4IVContinuousDiscreteProcess::PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4VParticleChange* G4IVContinuousDiscreteProcess::AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4double G4IVContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
)
|
||||
{
|
||||
// GPILSelection is set to defaule value of CandidateForSelection
|
||||
valueGPILSelection = CandidateForSelection;
|
||||
|
||||
// get Step limit proposed by the process
|
||||
G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety);
|
||||
|
||||
// set return value for G4GPILSelection
|
||||
*selection = valueGPILSelection;
|
||||
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4IVContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "IntractionLength= " << steplength/cm <<"[cm] " <<endl;
|
||||
}
|
||||
return steplength ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4IVRestDiscreteProcess.hh,v 2.5 1998/10/16 13:21:32 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// $Id:
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 8 Mar. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef G4IVRestDiscreteProcess_h
|
||||
#define G4IVRestDiscreteProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
|
||||
class G4IVRestDiscreteProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// rest + discrete physics interactions.
|
||||
public:
|
||||
|
||||
G4IVRestDiscreteProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4IVRestDiscreteProcess(G4IVRestDiscreteProcess &);
|
||||
|
||||
~G4IVRestDiscreteProcess();
|
||||
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
);
|
||||
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
);
|
||||
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
// no operation in AlongStepDoIt
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double ,
|
||||
G4double ,
|
||||
G4double& ,
|
||||
G4GPILSelection*
|
||||
){ return -1.0; };
|
||||
|
||||
// no operation in AlongStepDoIt
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
protected:
|
||||
virtual void SubtractNumberOfInteractionLengthLeft(
|
||||
G4double previousStepSize) ;
|
||||
|
||||
virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0;
|
||||
// Calculates the mean life-time (i.e. for decays) of the
|
||||
// particle at rest due to the occurence of the given process,
|
||||
// or converts the probability of interaction (i.e. for
|
||||
// annihilation) into the life-time of the particle for the
|
||||
// occurence of the given process.
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4IVRestDiscreteProcess();
|
||||
G4IVRestDiscreteProcess & operator=(const G4IVRestDiscreteProcess &right);
|
||||
|
||||
|
||||
protected:
|
||||
G4PhysicsTable* theNlambdaTable ;
|
||||
G4PhysicsTable* theInverseNlambdaTable ;
|
||||
G4double BIGSTEP ;
|
||||
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "Randomize.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
|
||||
inline
|
||||
void G4IVRestDiscreteProcess::SubtractNumberOfInteractionLengthLeft(
|
||||
G4double )
|
||||
{
|
||||
// dummy routine
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
inline G4double G4IVRestDiscreteProcess::
|
||||
PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{// get particle,particle type,kin.energy,material,mat.index
|
||||
G4double nl,nlold,range,rangeold,rangenext,
|
||||
KineticEnergyOld,KineticEnergyNext,value;
|
||||
G4bool isOut;
|
||||
const G4DynamicParticle* particle = track.GetDynamicParticle();
|
||||
const G4ParticleDefinition* particletype = particle->GetDefinition() ;
|
||||
G4double KineticEnergy = particle->GetKineticEnergy();
|
||||
G4Material* material = track.GetMaterial();
|
||||
const G4MaterialTable* theMaterialTable =
|
||||
G4Material::GetMaterialTable();
|
||||
G4int materialindex = material->GetIndex();
|
||||
|
||||
nl = (*theNlambdaTable)[materialindex]->
|
||||
GetValue(KineticEnergy,isOut);
|
||||
range = G4EnergyLossTables::GetPreciseRangeFromEnergy(particletype,
|
||||
KineticEnergy,material) ;
|
||||
|
||||
if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) {
|
||||
// beggining of tracking (or just after DoIt of this process)
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
} else {
|
||||
// subtract NumberOfInteractionLengthLeft
|
||||
|
||||
rangeold = range + previousStepSize ;
|
||||
KineticEnergyOld = G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
particletype,
|
||||
rangeold,material);
|
||||
nlold = (*theNlambdaTable)[materialindex]->
|
||||
GetValue(KineticEnergyOld,isOut);
|
||||
|
||||
if(nlold < nl) {
|
||||
#ifdef G4VERBOSE
|
||||
if(verboseLevel>2) {
|
||||
G4cout << GetProcessName() << " PostStepGPIL : Nlambda has been" <<
|
||||
" increased at update.Nlambda old/new :" << nlold <<
|
||||
" " << nl << endl;
|
||||
G4cout << "(theNumberOfInteractionLengthLeft has been increased!)" << endl;
|
||||
|
||||
G4cout << " correction : Nlambda old=new ........." << endl;
|
||||
|
||||
}
|
||||
#endif
|
||||
//corr. of num errror
|
||||
nlold = nl ;
|
||||
}
|
||||
|
||||
theNumberOfInteractionLengthLeft -= nlold-nl ;
|
||||
|
||||
if(theNumberOfInteractionLengthLeft<perMillion)
|
||||
theNumberOfInteractionLengthLeft=0.;
|
||||
}
|
||||
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
if(nl <= theNumberOfInteractionLengthLeft){
|
||||
value = BIGSTEP ;
|
||||
} else {
|
||||
KineticEnergyNext = (*theInverseNlambdaTable)[materialindex]->
|
||||
GetValue(nl-theNumberOfInteractionLengthLeft,isOut);
|
||||
rangenext = G4EnergyLossTables::GetPreciseRangeFromEnergy(particletype,
|
||||
KineticEnergyNext,material);
|
||||
|
||||
value = range - rangenext ;
|
||||
|
||||
if(range<rangenext) {
|
||||
#ifdef G4VERBOSE
|
||||
if(verboseLevel>2) {
|
||||
G4cout << GetProcessName() << " PostStepGPIL: Step < 0.!, Step=" <<
|
||||
value << endl;
|
||||
G4cout << "range,rangenext:" << range << " " << rangenext << endl ;
|
||||
G4cout << "correction : rangenext=range ....." << endl;
|
||||
}
|
||||
#endif
|
||||
//corr. of num error
|
||||
rangenext = range ;
|
||||
value = range - rangenext ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
inline G4VParticleChange* G4IVRestDiscreteProcess::PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// reset NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4double G4IVRestDiscreteProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
// beggining of tracking
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean life time
|
||||
currentInteractionLength = GetMeanLifeTime(track, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4IVRestDiscreteProcess::AtRestGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
}
|
||||
|
||||
|
||||
inline G4VParticleChange* G4IVRestDiscreteProcess::AtRestDoIt(
|
||||
const G4Track&,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcTblElement.hh,v 2.3 1998/08/16 02:36:48 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 4th Aug 1998, H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcTblElement_h
|
||||
#define G4ProcTblElement_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <rw/tpordvec.h>
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
class G4ProcTblElement
|
||||
{
|
||||
// this class is used by G4ProcessTable ONLY for booking !!!
|
||||
private:
|
||||
G4ProcTblElement();
|
||||
|
||||
public:
|
||||
G4ProcTblElement(const G4ProcTblElement& right);
|
||||
G4ProcTblElement(G4VProcess* aProcess);
|
||||
// Constructors
|
||||
|
||||
~G4ProcTblElement();
|
||||
// Destructor
|
||||
|
||||
G4ProcTblElement & operator=(G4ProcTblElement &right);
|
||||
// Assignment operator
|
||||
|
||||
G4int operator==(const G4ProcTblElement &right) const;
|
||||
G4int operator!=(const G4ProcTblElement &right) const;
|
||||
// equal / unequal operator
|
||||
|
||||
typedef RWTPtrOrderedVector<G4ProcessManager> G4ProcMgrVector;
|
||||
|
||||
G4int Length() const ;
|
||||
void Insert(G4ProcessManager* aProcMgr);
|
||||
void Remove(G4ProcessManager* aProcMgr);
|
||||
|
||||
G4VProcess* GetProcess() const;
|
||||
G4String GetProcessName() const;
|
||||
|
||||
G4ProcessManager* GetProcessManager(G4int index) const;
|
||||
G4ProcMgrVector* GetProcMgrVector() const;
|
||||
|
||||
G4int GetIndex(const G4ProcessManager* pManager) const ;
|
||||
G4bool Contains(const G4ProcessManager* pManager) const ;
|
||||
|
||||
private:
|
||||
G4VProcess* pProcess;
|
||||
// pointer to G4VProcess
|
||||
|
||||
G4ProcMgrVector* pProcMgrVector;
|
||||
};
|
||||
|
||||
#include "G4ProcTblElement.icc"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//////////////////////////
|
||||
inline
|
||||
G4ProcTblElement::G4ProcMgrVector* G4ProcTblElement::GetProcMgrVector() const
|
||||
{
|
||||
return pProcMgrVector;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4bool G4ProcTblElement::Contains(const G4ProcessManager* pManager) const
|
||||
{
|
||||
return pProcMgrVector->contains(pManager);
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4int G4ProcTblElement::GetIndex(const G4ProcessManager* pManager) const
|
||||
{
|
||||
if ( Contains(pManager) ) return pProcMgrVector->index(pManager);
|
||||
else return -1;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4int G4ProcTblElement::Length() const
|
||||
{
|
||||
if (pProcMgrVector != NULL) return pProcMgrVector->length();
|
||||
else return -1;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4ProcessManager* G4ProcTblElement::GetProcessManager(G4int index) const
|
||||
{
|
||||
if (pProcMgrVector != NULL) {
|
||||
if ((index < pProcMgrVector->length()) && (index>=0)){
|
||||
return (*pProcMgrVector)(index);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4VProcess* G4ProcTblElement::GetProcess() const
|
||||
{
|
||||
return pProcess;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
void G4ProcTblElement::Insert(G4ProcessManager* aProcMgr)
|
||||
{
|
||||
if (pProcMgrVector != NULL) pProcMgrVector->insert(aProcMgr);
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
void G4ProcTblElement::Remove(G4ProcessManager* aProcMgr)
|
||||
{
|
||||
if (pProcMgrVector != NULL) pProcMgrVector->remove(aProcMgr);
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4String G4ProcTblElement::GetProcessName() const
|
||||
{
|
||||
return pProcess->GetProcessName();
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcessAttribute.hh,v 2.1 1998/07/13 17:27:35 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1997, H.Kurashige
|
||||
// ---------------- G4ProcessAttribute -----------------
|
||||
// History:
|
||||
// adds copy constructor 27 June 1998 H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcessAttribute_h
|
||||
#define G4ProcessAttribute_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
class G4ProcessAttribute
|
||||
{
|
||||
// this class is used by G4ProcessManager ONLY for booking !!!
|
||||
public:
|
||||
G4ProcessAttribute();
|
||||
G4ProcessAttribute(const G4VProcess* aProcess);
|
||||
G4ProcessAttribute(const G4ProcessAttribute &right);
|
||||
// Constructors
|
||||
|
||||
~G4ProcessAttribute();
|
||||
// Destructor
|
||||
|
||||
G4ProcessAttribute & operator=(G4ProcessAttribute &right);
|
||||
// Assignment operator
|
||||
|
||||
G4int operator==(const G4ProcessAttribute &right) const;
|
||||
G4int operator!=(const G4ProcessAttribute &right) const;
|
||||
// equal / unequal operator
|
||||
|
||||
G4VProcess* pProcess;
|
||||
// pointer to G4VProcess
|
||||
|
||||
G4bool isActive;
|
||||
// flag for activation/inactivation
|
||||
|
||||
G4int idxProcessList;
|
||||
// index to a ProcessVector for theProcessList and
|
||||
|
||||
G4int idxProcVector[G4ProcessManager::SizeOfProcVectorArray];
|
||||
// index to ProcessVectors for "Doit"s and "GetPhysicalInteractionLength"s
|
||||
// -1 : not applicable
|
||||
|
||||
G4int ordProcVector[G4ProcessManager::SizeOfProcVectorArray];
|
||||
// ordering parameter
|
||||
};
|
||||
|
||||
inline
|
||||
G4ProcessAttribute::G4ProcessAttribute(const G4VProcess* aProcess):
|
||||
pProcess((G4VProcess*)aProcess),
|
||||
isActive(true)
|
||||
{
|
||||
idxProcessList = -1;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessAttribute::operator==(const G4ProcessAttribute &right) const
|
||||
{
|
||||
return this->pProcess == right.pProcess;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessAttribute::operator!=(const G4ProcessAttribute &right) const
|
||||
{
|
||||
return this->pProcess != right.pProcess;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,455 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcessManager.hh,v 2.4 1998/10/17 04:58:56 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// ---------------- G4ProcessManager -----------------
|
||||
// History:
|
||||
// revised by G.Cosmo, 06 May 1996
|
||||
// Added vector of processes at rest, 06 May 1996
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// 20 Apr. 1997 M.Asai
|
||||
// 14 June 1997 H.Kurahige
|
||||
// Add SetProcessOrdering methods 27 Mar 1998 H.Kurahige
|
||||
// Add copy constructor (deep copy) 28 June 1998 H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcessManager_h
|
||||
#define G4ProcessManager_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <rw/tpordvec.h>
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
class G4ProcessManagerMessenger;
|
||||
class G4ProcessAttribute;
|
||||
|
||||
enum G4ProcessVectorTypeIndex
|
||||
{
|
||||
typeGPIL = 0, typeDoIt =1
|
||||
};
|
||||
|
||||
enum G4ProcessVectorDoItIndex
|
||||
{
|
||||
idxAll = -1,
|
||||
idxAtRest = 0, idxAlongStep = 1, idxPostStep =2
|
||||
};
|
||||
|
||||
enum G4ProcessVectorOrdering
|
||||
{
|
||||
ordInActive = -1,
|
||||
ordDefault = INT_MAX/2,
|
||||
ordLast = INT_MAX
|
||||
};
|
||||
|
||||
class G4ProcessManager
|
||||
{
|
||||
// It collects all physics a particle can undertake as seven vectors.
|
||||
// These vectors are
|
||||
// one vector for all processes (called as "process List")
|
||||
// two vectors for processes with AtRestGetPhysicalInteractionLength
|
||||
// and AtRestDoIt
|
||||
// two vectors for processes with AlongStepGetPhysicalInteractionLength
|
||||
// and AlongStepDoIt
|
||||
// two vectors for processes with PostStepGetPhysicalInteractionLength
|
||||
// and PostStepDoIt
|
||||
// The tracking will message three types of GetPhysicalInteractionLength
|
||||
// in order to limit the Step and select the occurence of processes.
|
||||
// It will message the corresponding DoIt() to apply the selected
|
||||
// processes. In addition, the Tracking will limit the Step
|
||||
// and select the occurence of the processes according to
|
||||
// the shortest physical interaction length computed (except for
|
||||
// processes at rest, for which the Tracking will select the
|
||||
// occurence of the process which returns the shortest mean
|
||||
// life-time from the GetPhysicalInteractionLength()).
|
||||
|
||||
public:
|
||||
// copy constructor
|
||||
G4ProcessManager(G4ProcessManager &right);
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator
|
||||
G4ProcessManager & operator=(G4ProcessManager &right);
|
||||
G4ProcessManager();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
G4ProcessManager(const G4ParticleDefinition* aParticleType);
|
||||
// Constructor
|
||||
|
||||
~G4ProcessManager();
|
||||
// Destructor
|
||||
|
||||
G4int operator==(const G4ProcessManager &right) const;
|
||||
G4int operator!=(const G4ProcessManager &right) const;
|
||||
|
||||
G4ProcessVector* GetProcessList() const;
|
||||
// Returns the address of the vector of all processes
|
||||
|
||||
G4int GetProcessListLength() const;
|
||||
// Returns the number of process in the ProcessVector
|
||||
|
||||
G4int GetProcessIndex(G4VProcess *) const;
|
||||
// Returns the index of the process in the process List
|
||||
|
||||
// --------------------------------------
|
||||
|
||||
G4ProcessVector* GetProcessVector(
|
||||
G4ProcessVectorDoItIndex idx,
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL
|
||||
) const;
|
||||
// Returns the address of the vector of processes
|
||||
|
||||
G4ProcessVector* GetAtRestProcessVector(
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL
|
||||
) const;
|
||||
// Returns the address of the vector of processes for
|
||||
// AtRestGetPhysicalInteractionLength idx =0
|
||||
// AtRestGetPhysicalDoIt idx =1
|
||||
G4ProcessVector* GetAlongStepProcessVector(
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL
|
||||
) const;
|
||||
// Returns the address of the vector of processes for
|
||||
// AlongStepGetPhysicalInteractionLength idx =0
|
||||
// AlongStepGetPhysicalDoIt idx =1
|
||||
|
||||
G4ProcessVector* GetPostStepProcessVector(
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL
|
||||
) const;
|
||||
// Returns the address of the vector of processes for
|
||||
// PostStepGetPhysicalInteractionLength idx =0
|
||||
// PostStepGetPhysicalDoIt idx =1
|
||||
|
||||
G4int GetProcessVectorIndex(
|
||||
G4VProcess* aProcess,
|
||||
G4ProcessVectorDoItIndex idx,
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL
|
||||
) const;
|
||||
G4int GetAtRestIndex(
|
||||
G4VProcess* aProcess,
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL
|
||||
) const;
|
||||
G4int GetAlongStepIndex(
|
||||
G4VProcess* aProcess,
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL
|
||||
) const;
|
||||
G4int GetPostStepIndex(
|
||||
G4VProcess* aProcess,
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL
|
||||
) const;
|
||||
// Returns the index for GPIL/DoIt process vector of the process
|
||||
|
||||
G4int AddProcess(
|
||||
G4VProcess *aProcess,
|
||||
G4int ordAtRestDoIt = ordInActive,
|
||||
G4int ordAlongSteptDoIt = ordInActive,
|
||||
G4int ordPostStepDoIt = ordInActive
|
||||
);
|
||||
// Add a process to the process List
|
||||
// return values are index to the List. Negative return value
|
||||
// indicates that the process has not be added due to some errors
|
||||
// The first argument is a pointer to process.
|
||||
// Following arguments are ordering parameters of the process in
|
||||
// process vectors. If value is negative, the process is
|
||||
// not added to the corresponding process vector.
|
||||
|
||||
// following methods are provided for simple processes
|
||||
// AtRestProcess has only AtRestDoIt
|
||||
// ContinuousProcess has only AlongStepDoIt
|
||||
// DiscreteProcess has only PostStepDoIt
|
||||
// if ord is not specified, the process is
|
||||
// added at the end of List of processvectors for
|
||||
// both DoIt and GetPhysicalInteractionLength
|
||||
|
||||
G4int AddRestProcess(G4VProcess *aProcess, G4int ord = ordDefault);
|
||||
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord = ordDefault);
|
||||
G4int AddContinuousProcess(G4VProcess *aProcess, G4int ord = ordDefault);
|
||||
|
||||
// Methods for setting ordering parameters
|
||||
// Altanative methods for setting ordering parameters
|
||||
// Note: AddProcess method should precede these methods
|
||||
|
||||
G4int GetProcessOrdering(
|
||||
G4VProcess *aProcess,
|
||||
G4ProcessVectorDoItIndex idDoIt
|
||||
);
|
||||
|
||||
void SetProcessOrdering(
|
||||
G4VProcess *aProcess,
|
||||
G4ProcessVectorDoItIndex idDoIt,
|
||||
G4int ordDoIt = ordDefault
|
||||
);
|
||||
// Set ordering parameter for DoIt specified by typeDoIt.
|
||||
|
||||
void SetProcessOrderingToFirst(
|
||||
G4VProcess *aProcess,
|
||||
G4ProcessVectorDoItIndex idDoIt
|
||||
);
|
||||
// Set ordering parameter to the first of all processes
|
||||
// for DoIt specified by idDoIt.
|
||||
// Note: If you use this method for two processes,
|
||||
// a process called later will be first.
|
||||
|
||||
void SetProcessOrderingToLast(
|
||||
G4VProcess *aProcess,
|
||||
G4ProcessVectorDoItIndex idDoIt
|
||||
);
|
||||
// Set ordering parameter to the last of all processes
|
||||
// for DoIt specified by idDoIt.
|
||||
// Note: If you use this method for two processes,
|
||||
// a process called later will be the last one.
|
||||
|
||||
G4VProcess* RemoveProcess(G4VProcess *aProcess);
|
||||
G4VProcess* RemoveProcess(G4int index);
|
||||
// Removes a process from the process List.
|
||||
// return value is pointer to the removed process.
|
||||
// (NULL value will be returned in case of errors)
|
||||
|
||||
G4VProcess* SetProcessActivation(G4VProcess *aProcess, G4bool fActive);
|
||||
G4VProcess* SetProcessActivation(G4int index, G4bool fActive);
|
||||
// Set activation flag.
|
||||
// return value is pointer to the applied process.
|
||||
// (NULL value will be returned in case of errors)
|
||||
|
||||
G4ParticleDefinition* GetParticleType() const;
|
||||
// get the particle type
|
||||
void SetParticleType(const G4ParticleDefinition*);
|
||||
// set the particle type
|
||||
|
||||
void StartTracking();
|
||||
void EndTracking();
|
||||
// these two methods are used by G4TrackingManager
|
||||
// in order to inform Start/End of tracking for each track
|
||||
// to the process manager and all physics processes
|
||||
|
||||
private:
|
||||
G4ProcessAttribute* GetAttribute(G4int index) const;
|
||||
G4ProcessAttribute* GetAttribute(G4VProcess *aProcess) const;
|
||||
// get Pointer to ProcessAttribute
|
||||
|
||||
G4VProcess* ActivateProcess(G4int index);
|
||||
G4VProcess* InActivateProcess(G4int index);
|
||||
// Activate/InActivateProcess Process
|
||||
|
||||
private:
|
||||
const G4ParticleDefinition* theParticleType;
|
||||
// particle which has this process manager object
|
||||
|
||||
G4int numberOfProcesses;
|
||||
G4ProcessVector* theProcessList;
|
||||
// vector for all processes (called as "process List")
|
||||
|
||||
public:
|
||||
enum {SizeOfProcVectorArray = 6};
|
||||
private:
|
||||
G4ProcessVector* theProcVector[SizeOfProcVectorArray];
|
||||
// vector for processes with GetPhysicalInteractionLength/DoIt
|
||||
|
||||
typedef RWTPtrOrderedVector<G4ProcessAttribute> G4ProcessAttrVector;
|
||||
G4ProcessAttrVector* theAttrVector;
|
||||
// vector for process attribute
|
||||
|
||||
protected:
|
||||
G4int InsertAt(G4int position, G4VProcess* process, G4int ivec);
|
||||
// insert process at position in theProcVector[ivec]
|
||||
|
||||
G4int RemoveAt(G4int position, G4VProcess* process, G4int ivec);
|
||||
// remove process at position in theProcVector[ivec]
|
||||
|
||||
G4int FindInsertPosition(G4int ord, G4int ivec);
|
||||
// find insert position according to ordering parameter
|
||||
// in theProcVector[ivec]
|
||||
|
||||
G4int GetProcessVectorId(G4ProcessVectorDoItIndex idx,
|
||||
G4ProcessVectorTypeIndex typ = typeGPIL) const;
|
||||
|
||||
private:
|
||||
G4bool duringTracking;
|
||||
void CreateGPILvectors();
|
||||
void SetIndexToProcessVector(G4int ivec);
|
||||
|
||||
public:
|
||||
void DumpInfo();
|
||||
void SetVerboseLevel(G4int value);
|
||||
G4int GetVerboseLevel() const;
|
||||
|
||||
protected:
|
||||
G4int verboseLevel;
|
||||
// controle flag for output message
|
||||
// 0: Silent
|
||||
// 1: Warning message
|
||||
// 2: More
|
||||
|
||||
private:
|
||||
static G4ProcessManagerMessenger* fProcessManagerMessenger;
|
||||
static G4int counterOfObjects;
|
||||
};
|
||||
#include "G4ProcessAttribute.hh"
|
||||
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
inline
|
||||
void G4ProcessManager::SetParticleType(const G4ParticleDefinition* aParticle)
|
||||
{
|
||||
theParticleType = aParticle;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ProcessVector* G4ProcessManager::GetProcessList() const
|
||||
{
|
||||
return theProcessList;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::GetProcessListLength() const
|
||||
{
|
||||
return numberOfProcesses;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::GetProcessIndex(G4VProcess* aProcess) const
|
||||
{
|
||||
G4int idx = theProcessList->index(aProcess);
|
||||
if (idx>=numberOfProcesses) idx = -1;
|
||||
return idx;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::GetProcessVectorId(G4ProcessVectorDoItIndex idx,
|
||||
G4ProcessVectorTypeIndex typ) const
|
||||
{
|
||||
if ( idx == idxAtRest ) {
|
||||
if (typ == typeGPIL) { return 0; }
|
||||
else { return 1; }
|
||||
} else if ( idx == idxAlongStep ) {
|
||||
if (typ == typeGPIL) { return 2; }
|
||||
else { return 3; }
|
||||
} else if ( idx == idxPostStep ) {
|
||||
if (typ == typeGPIL) { return 4; }
|
||||
else { return 5; }
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
G4ProcessVector* G4ProcessManager::GetProcessVector(
|
||||
G4ProcessVectorDoItIndex idx,
|
||||
G4ProcessVectorTypeIndex typ
|
||||
) const
|
||||
{
|
||||
G4int ivec = GetProcessVectorId(idx, typ);
|
||||
if ( ivec >=0 ) {
|
||||
return theProcVector[ivec];
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
G4ProcessVector* G4ProcessManager::GetAtRestProcessVector(G4ProcessVectorTypeIndex typ) const
|
||||
{
|
||||
if (typ == typeGPIL) { return theProcVector[0]; }
|
||||
else { return theProcVector[1]; }
|
||||
}
|
||||
|
||||
inline
|
||||
G4ProcessVector* G4ProcessManager::GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ) const
|
||||
{
|
||||
if (typ == typeGPIL) { return theProcVector[2]; }
|
||||
else { return theProcVector[3]; }
|
||||
}
|
||||
|
||||
inline
|
||||
G4ProcessVector* G4ProcessManager::GetPostStepProcessVector(G4ProcessVectorTypeIndex typ) const
|
||||
{
|
||||
if (typ == typeGPIL) { return theProcVector[4]; }
|
||||
else { return theProcVector[5]; }
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::GetAtRestIndex(
|
||||
G4VProcess* aProcess,
|
||||
G4ProcessVectorTypeIndex typ
|
||||
) const
|
||||
{
|
||||
return GetProcessVectorIndex(aProcess, idxAtRest, typ);
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::GetAlongStepIndex(
|
||||
G4VProcess* aProcess,
|
||||
G4ProcessVectorTypeIndex typ
|
||||
) const
|
||||
{
|
||||
return GetProcessVectorIndex(aProcess, idxAlongStep, typ);
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::GetPostStepIndex(
|
||||
G4VProcess* aProcess,
|
||||
G4ProcessVectorTypeIndex typ
|
||||
) const
|
||||
{
|
||||
return GetProcessVectorIndex(aProcess, idxPostStep, typ);
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::AddRestProcess(G4VProcess *aProcess,G4int ord)
|
||||
{
|
||||
return AddProcess(aProcess, ord, ordInActive, ordInActive);
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::AddContinuousProcess(G4VProcess *aProcess,G4int ord)
|
||||
{
|
||||
return AddProcess(aProcess, ordInActive, ord, ordInActive);
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::AddDiscreteProcess(G4VProcess *aProcess,G4int ord)
|
||||
{
|
||||
return AddProcess(aProcess, ordInActive, ordInActive, ord);
|
||||
}
|
||||
|
||||
inline
|
||||
G4ParticleDefinition* G4ProcessManager::GetParticleType() const
|
||||
{
|
||||
return (G4ParticleDefinition* )theParticleType;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void G4ProcessManager::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessManager::GetVerboseLevel() const
|
||||
{
|
||||
return verboseLevel;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcessManagerMessenger.hh,v 2.2 1998/07/12 03:43:41 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ProcessManagerMessenger.hh
|
||||
//
|
||||
// Description:
|
||||
// This is a messenger class to interface to exchange information
|
||||
// between ProcessManager and UI.
|
||||
//
|
||||
// /particle/process/ Process Manager control commands.
|
||||
// Commands :
|
||||
// dump * dump process manager information.
|
||||
// Verbose * Set Verbose Level for Process Manager and/or process
|
||||
// Activate * Activate process
|
||||
// inactivate * Inctivate process
|
||||
//
|
||||
// History:
|
||||
// 13 June 1997, H. Kurashige : The 1st version created.
|
||||
// 10 Nov. 1997 H. Kurashige : fixed bugs
|
||||
// 08 Jan. 1998, H. Kurashige : new UIcommand
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcessManagerMessenger_h
|
||||
#define G4ProcessManagerMessenger_h 1
|
||||
|
||||
class G4ParticleDefinition;
|
||||
class G4ParticleTable;
|
||||
class G4ProcessManager;
|
||||
class G4ProcessVector;
|
||||
class G4VProcess;
|
||||
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcommand;
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ProcessManagerMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4ProcessManagerMessenger(G4ParticleTable* pTable = NULL);
|
||||
~G4ProcessManagerMessenger();
|
||||
|
||||
void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
G4String GetCurrentValue(G4UIcommand * command);
|
||||
|
||||
private:
|
||||
G4ProcessManagerMessenger(const G4ProcessManagerMessenger&){};
|
||||
|
||||
private:
|
||||
G4ParticleDefinition* SetCurrentParticle();
|
||||
|
||||
private:
|
||||
G4ParticleTable* theParticleTable;
|
||||
G4ParticleDefinition* currentParticle;
|
||||
G4VProcess* currentProcess;
|
||||
G4ProcessManager* theManager;
|
||||
G4ProcessVector* theProcessList;
|
||||
|
||||
G4UIdirectory * thisDirectory;
|
||||
G4UIcmdWithAnInteger * dumpCmd;
|
||||
G4UIcommand * verboseCmd;
|
||||
G4UIcmdWithAnInteger * activateCmd;
|
||||
G4UIcmdWithAnInteger * inactivateCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcessTable.hh,v 2.5 1998/08/17 03:35:36 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 4th Aug 1998, H.Kurashige
|
||||
//
|
||||
// History:
|
||||
// Added G4ProcessTableMesseneger 16 Aug. 1998, H.Kurashige
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcessTable_h
|
||||
#define G4ProcessTable_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <rw/tpordvec.h>
|
||||
#include <rw/tvordvec.h>
|
||||
|
||||
#include "G4ProcTblElement.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
class G4ProcessTableMessenger;
|
||||
|
||||
class G4ProcessTable
|
||||
{
|
||||
// this class is used by G4ProcessTable ONLY for booking !!!
|
||||
public:
|
||||
G4ProcessTable();
|
||||
// Constructors
|
||||
|
||||
~G4ProcessTable();
|
||||
// Destructor
|
||||
|
||||
private:
|
||||
G4ProcessTable(const G4ProcessTable &right);
|
||||
G4ProcessTable & operator=(const G4ProcessTable &right);
|
||||
// Assignment operator
|
||||
G4int operator==(const G4ProcessTable &right) const;
|
||||
G4int operator!=(const G4ProcessTable &right) const;
|
||||
// equal / unequal operator
|
||||
|
||||
public:
|
||||
static G4ProcessTable* GetProcessTable();
|
||||
// return the pointer to G4ProcessTable object
|
||||
// G4ProcessTable is a "singleton" and can get its pointer by this function
|
||||
|
||||
G4int Length() const;
|
||||
G4int Insert(G4VProcess* aProcess, G4ProcessManager* aProcMgr);
|
||||
G4int Remove(G4VProcess* aProcess, G4ProcessManager* aProcMgr);
|
||||
// insert and remove methods
|
||||
// each process object is registered with information of process managers
|
||||
// that use it.
|
||||
|
||||
G4VProcess* FindProcess(const G4String& processName,
|
||||
const G4String& particleName) const;
|
||||
G4VProcess* FindProcess(const G4String& processName,
|
||||
const G4ParticleDefinition* particle) const;
|
||||
G4VProcess* FindProcess(const G4String& processName,
|
||||
const G4ProcessManager* processManager) const;
|
||||
// return the process pointer
|
||||
|
||||
G4ProcessVector* FindProcesses();
|
||||
G4ProcessVector* FindProcesses( const G4ProcessManager* processManager );
|
||||
G4ProcessVector* FindProcesses( const G4String& processName );
|
||||
G4ProcessVector* FindProcesses( G4ProcessType processType );
|
||||
// return pointer of a process vector
|
||||
// which includes processes specified
|
||||
// Note:: User is responsible to delete this process vector object
|
||||
|
||||
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 );
|
||||
|
||||
public:
|
||||
typedef RWTPtrOrderedVector<G4ProcTblElement> G4ProcTableVector;
|
||||
typedef RWTValOrderedVector<G4String> G4ProcNameVector;
|
||||
|
||||
G4ProcNameVector* GetNameList() const;
|
||||
|
||||
|
||||
G4ProcTableVector* GetProcTableVector();
|
||||
|
||||
private:
|
||||
G4ProcTableVector* Find( G4ProcTableVector* procTableVector,
|
||||
const G4String& processName );
|
||||
G4ProcTableVector* Find( G4ProcTableVector* procTableVector,
|
||||
G4ProcessType processType );
|
||||
// return pointer of a ProcTableVector
|
||||
// which includes ProcTbleElement specified
|
||||
|
||||
G4ProcessVector* ExtractProcesses( G4ProcTableVector* procTableVector);
|
||||
|
||||
public:
|
||||
void DumpInfo(G4VProcess* process, G4ParticleDefinition* particle=NULL);
|
||||
|
||||
public:
|
||||
G4UImessenger* CreateMessenger();
|
||||
void DeleteMessenger();
|
||||
|
||||
|
||||
public:
|
||||
void SetVerboseLevel(G4int value);
|
||||
G4int GetVerboseLevel() const;
|
||||
|
||||
|
||||
private:
|
||||
static G4ProcessTable* fProcessTable;
|
||||
G4ProcessTableMessenger* fProcTblMessenger;
|
||||
|
||||
private:
|
||||
G4ProcTableVector* fProcTblVector;
|
||||
G4ProcNameVector* fProcNameVector;
|
||||
// list of G4ProcTblElement
|
||||
|
||||
G4ProcTableVector* tmpTblVector;
|
||||
// used only internaly for temporary buffer.
|
||||
|
||||
private:
|
||||
G4int verboseLevel;
|
||||
// controle flag for output message
|
||||
// 0: Silent
|
||||
// 1: Warning message
|
||||
// 2: More
|
||||
};
|
||||
|
||||
inline
|
||||
void G4ProcessTable::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessTable::GetVerboseLevel() const
|
||||
{
|
||||
return verboseLevel;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ProcessTable::Length() const
|
||||
{
|
||||
return fProcTblVector->length();
|
||||
}
|
||||
|
||||
#include "G4ProcessTable.icc"
|
||||
#endif
|
||||
@@ -0,0 +1,94 @@
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4ProcessTable::G4ProcNameVector* G4ProcessTable::GetNameList() const
|
||||
{
|
||||
return fProcNameVector;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4ProcessTable::G4ProcTableVector* G4ProcessTable::GetProcTableVector()
|
||||
{
|
||||
return fProcTblVector;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4VProcess* G4ProcessTable::FindProcess(const G4String& processName,
|
||||
const G4ParticleDefinition* particle)
|
||||
const
|
||||
{
|
||||
if ( particle == NULL ) return NULL;
|
||||
else return FindProcess(processName, particle->GetProcessManager());
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
G4VProcess* G4ProcessTable::FindProcess(const G4String& processName,
|
||||
const G4String& particleName) const
|
||||
{
|
||||
return FindProcess(processName,
|
||||
G4ParticleTable::GetParticleTable()->FindParticle(particleName));
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
void G4ProcessTable::SetProcessActivation(
|
||||
const G4String& processName,
|
||||
G4ParticleDefinition* particle,
|
||||
G4bool fActive)
|
||||
{
|
||||
if ( particle != NULL ) {
|
||||
SetProcessActivation(processName, particle->GetProcessManager(), fActive);
|
||||
}
|
||||
}
|
||||
//////////////////////////
|
||||
inline
|
||||
void G4ProcessTable::SetProcessActivation(
|
||||
const G4String& processName,
|
||||
const G4String& particleName,
|
||||
G4bool fActive )
|
||||
{
|
||||
if (particleName == "ALL" ) {
|
||||
SetProcessActivation( processName , fActive);
|
||||
} else {
|
||||
SetProcessActivation(
|
||||
processName,
|
||||
G4ParticleTable::GetParticleTable()->FindParticle(particleName),
|
||||
fActive );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
void G4ProcessTable::SetProcessActivation(
|
||||
G4ProcessType processType,
|
||||
G4ParticleDefinition* particle,
|
||||
G4bool fActive)
|
||||
{
|
||||
if ( particle != NULL ) {
|
||||
SetProcessActivation( processType, particle->GetProcessManager(), fActive);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
inline
|
||||
void G4ProcessTable::SetProcessActivation(
|
||||
G4ProcessType processType,
|
||||
const G4String& particleName ,
|
||||
G4bool fActive)
|
||||
{
|
||||
if ((particleName == "ALL" )||(particleName == "all" )) {
|
||||
SetProcessActivation( processType, fActive );
|
||||
} else {
|
||||
SetProcessActivation(
|
||||
processType,
|
||||
G4ParticleTable::GetParticleTable()->FindParticle(particleName),
|
||||
fActive );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcessTableMessenger.hh,v 2.2 1998/08/17 03:35:37 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ProcessTableMessenger.hh
|
||||
//
|
||||
// Description:
|
||||
// This is a messenger class to interface to exchange information
|
||||
// between ProcessTable and UI.
|
||||
//
|
||||
// /process/ Process Table control commands.
|
||||
// Commands :
|
||||
// list * :Dump process name registered.
|
||||
// verbose * :Set Verbose Level for Process Table
|
||||
// activate * :Activate process
|
||||
// inactivate * :Inctivate process
|
||||
// dump * :Dump process information
|
||||
//
|
||||
// History:
|
||||
// 15 Aug. 1998, H. Kurashige
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcessTableMessenger_h
|
||||
#define G4ProcessTableMessenger_h 1
|
||||
|
||||
class G4ProcessTable;
|
||||
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithAString;
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4ProcessType.hh"
|
||||
|
||||
class G4ProcessTableMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4ProcessTableMessenger(G4ProcessTable* pTable);
|
||||
~G4ProcessTableMessenger();
|
||||
|
||||
void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
G4String GetCurrentValue(G4UIcommand * command);
|
||||
|
||||
private:
|
||||
G4String GetProcessTypeName(G4ProcessType aType) const;
|
||||
G4int GetProcessType(const G4String& aTypeName) const;
|
||||
static G4int NumberOfProcessType;
|
||||
void SetNumberOfProcessType();
|
||||
|
||||
private:
|
||||
G4ProcessTableMessenger(const G4ProcessTableMessenger&){};
|
||||
G4ProcessTableMessenger(){};
|
||||
|
||||
private:
|
||||
G4ProcessTable* theProcessTable;
|
||||
|
||||
G4UIdirectory * thisDirectory;
|
||||
G4UIcmdWithAnInteger * verboseCmd;
|
||||
G4UIcmdWithAString * listCmd;
|
||||
G4UIcommand * dumpCmd;
|
||||
G4UIcommand * activateCmd;
|
||||
G4UIcommand * inactivateCmd;
|
||||
|
||||
G4String currentProcessTypeName;
|
||||
G4String currentProcessName;
|
||||
G4String currentParticleName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcessType.hh,v 2.1 1998/08/16 02:36:50 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ProcessType.hh
|
||||
//
|
||||
// Description:
|
||||
// This is an enumerator to define process type
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcessType_h
|
||||
#define G4ProcessType_h 1
|
||||
|
||||
enum G4ProcessType
|
||||
{
|
||||
fNotDefined,
|
||||
fTransportation,
|
||||
fElectromagnetic,
|
||||
fOptical,
|
||||
fHadronic,
|
||||
fPhotolepton_hadron,
|
||||
fDecay,
|
||||
fGeneral,
|
||||
fParameterisation,
|
||||
fUserDefined
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ProcessVector.hh,v 2.1 1998/07/13 17:27:37 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4ProcessVector_h
|
||||
#define G4ProcessVector_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <rw/tpordvec.h>
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
class G4ProcessVector : public RWTPtrOrderedVector<G4VProcess>
|
||||
{
|
||||
// Is a container for pointers to physics process objects. Its
|
||||
// functionality is derived from RWTPtrOrderedVector<T>.
|
||||
|
||||
public:
|
||||
|
||||
G4ProcessVector(size_t capac=RWDEFAULT_CAPACITY)
|
||||
: RWTPtrOrderedVector<G4VProcess>(capac) {;}
|
||||
// Constructor.
|
||||
|
||||
virtual ~G4ProcessVector() {;}
|
||||
// Destructor.
|
||||
|
||||
G4bool operator==(const G4ProcessVector &right) const
|
||||
{
|
||||
return (this == (G4ProcessVector *) &right);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,222 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VContinuousDiscreteProcess.hh,v 2.4 1998/10/16 13:21:35 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 8 Mar. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// modified 26 Mar. 1997 H.Kurashige
|
||||
// modified 16 Apr. 1997 L.Urban
|
||||
// modified AlongStepGPIL etc. 17 Dec. 1997 H.Kurashige
|
||||
// fix bugs in GetGPILSelection() 24 Jan. 1998 H.Kurashige
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
|
||||
#ifndef G4VContinuousDiscreteProcess_h
|
||||
#define G4VContinuousDiscreteProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
class G4VContinuousDiscreteProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// discrete physics interactions.
|
||||
public:
|
||||
|
||||
G4VContinuousDiscreteProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4VContinuousDiscreteProcess(G4VContinuousDiscreteProcess &);
|
||||
|
||||
~G4VContinuousDiscreteProcess();
|
||||
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
);
|
||||
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
);
|
||||
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
// no operation in AtRestDoIt
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
) { return -1.0; };
|
||||
|
||||
// no operation in AtRestDoIt
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
protected:
|
||||
virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)=0;
|
||||
// Calculates from the macroscopic cross section a mean
|
||||
// free path, the value is returned in units of distance.
|
||||
|
||||
protected:
|
||||
virtual G4double GetContinuousStepLimit(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety
|
||||
)=0;
|
||||
private:
|
||||
// this is the returnd value of G4GPILSelection in
|
||||
// the arguments of AlongStepGPIL()
|
||||
G4GPILSelection valueGPILSelection;
|
||||
|
||||
protected:
|
||||
// these two methods are set/get methods for valueGPILSelection
|
||||
void SetGPILSelection(G4GPILSelection selection)
|
||||
{ valueGPILSelection = selection;};
|
||||
|
||||
G4GPILSelection GetGPILSelection() const{return valueGPILSelection;};
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4VContinuousDiscreteProcess();
|
||||
G4VContinuousDiscreteProcess & operator=(const G4VContinuousDiscreteProcess &right);
|
||||
|
||||
};
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
inline G4double G4VContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) {
|
||||
// beggining of tracking (or just after DoIt of this process)
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
} else {
|
||||
// subtract NumberOfInteractionLengthLeft
|
||||
SubtractNumberOfInteractionLengthLeft(previousStepSize);
|
||||
if(theNumberOfInteractionLengthLeft<perMillion)
|
||||
theNumberOfInteractionLengthLeft=0.;
|
||||
}
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean free path
|
||||
currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <=0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4VContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4double value = theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4VContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "InteractionLength= " << value/cm <<"[cm] " <<endl;
|
||||
}
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
inline G4VParticleChange* G4VContinuousDiscreteProcess::PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4VParticleChange* G4VContinuousDiscreteProcess::AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4double G4VContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
)
|
||||
{
|
||||
// GPILSelection is set to defaule value of CandidateForSelection
|
||||
valueGPILSelection = CandidateForSelection;
|
||||
|
||||
// get Step limit proposed by the process
|
||||
G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety);
|
||||
|
||||
// set return value for G4GPILSelection
|
||||
*selection = valueGPILSelection;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4VContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "IntractionLength= " << steplength/cm <<"[cm] " <<endl;
|
||||
}
|
||||
#endif
|
||||
return steplength ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VContinuousProcess.hh,v 2.4 1998/10/16 13:21:35 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// add G4VContinuousProcess(const G4String&) 24 Jul 1996, Hisaya kurashige
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 18 Dec. 1996 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// modified 25 Feb. 1997 H.Kurahige
|
||||
// modified 8 Mar. 1997 H.Kurashige
|
||||
// modified 22 Mar. 1997 H.Kurashige
|
||||
// modified 26 Mar. 1997 H.Kurashige
|
||||
// modified AlongStepGPIL etc. 17 Dec. 1997 H.Kurashige
|
||||
// fix bugs in GetGPILSelection() 24 Jan. 1998 H.Kurashige
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
|
||||
#ifndef G4VContinuousProcess_h
|
||||
#define G4VContinuousProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
class G4VContinuousProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// Continuous physics interactions.
|
||||
public:
|
||||
|
||||
G4VContinuousProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4VContinuousProcess(G4VContinuousProcess &);
|
||||
|
||||
~G4VContinuousProcess();
|
||||
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& proposedSafety,
|
||||
G4GPILSelection* selection
|
||||
);
|
||||
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
// no operation in AtRestDoIt and PostStepDoIt
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double,
|
||||
G4ForceCondition*
|
||||
){ return -1.0; };
|
||||
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
) { return -1.0; };
|
||||
|
||||
// no operation in AtRestDoIt and PostStepDoIt
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
protected:
|
||||
virtual G4double GetContinuousStepLimit(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety
|
||||
)=0;
|
||||
|
||||
private:
|
||||
// this is the returnd value of G4GPILSelection in
|
||||
// the arguments of AlongStepGPIL()
|
||||
G4GPILSelection valueGPILSelection;
|
||||
|
||||
protected:
|
||||
// these two methods are set/get methods for valueGPILSelection
|
||||
// these two methods are set/get methods for valueGPILSelection
|
||||
void SetGPILSelection(G4GPILSelection selection)
|
||||
{ valueGPILSelection = selection;};
|
||||
|
||||
G4GPILSelection GetGPILSelection() const{return valueGPILSelection;};
|
||||
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4VContinuousProcess();
|
||||
G4VContinuousProcess & operator=(const G4VContinuousProcess &right);
|
||||
|
||||
};
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
inline G4double G4VContinuousProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
)
|
||||
{
|
||||
// GPILSelection is set to defaule value of CandidateForSelection
|
||||
valueGPILSelection = CandidateForSelection;
|
||||
|
||||
// get Step limit proposed by the process
|
||||
G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety);
|
||||
|
||||
// set return value for G4GPILSelection
|
||||
*selection = valueGPILSelection;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4VContinuousProcess::AlongStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "IntractionLength= " << steplength/cm <<"[cm] " <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return steplength ;
|
||||
}
|
||||
|
||||
inline G4VParticleChange* G4VContinuousProcess::AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VDiscreteProcess.hh,v 2.5 1998/10/17 07:04:16 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// add G4VDiscreteProcess(const G4String&) 24 Jul 1996, Hisaya kurashige
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 18 Dec. 1996 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// modified 25 Feb. 1997 H.Kurahige
|
||||
// modified 8 Mar. 1997 H.Kurahige
|
||||
// modified 26 Mar. 1997 H.Kurahige
|
||||
// modified 16 Apr. 1997 L.Urban
|
||||
// modified 17 Dec. 1997 L.Urban
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
|
||||
#ifndef G4VDiscreteProcess_h
|
||||
#define G4VDiscreteProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
class G4VDiscreteProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// discrete physics interactions.
|
||||
public:
|
||||
|
||||
G4VDiscreteProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4VDiscreteProcess(G4VDiscreteProcess &);
|
||||
|
||||
~G4VDiscreteProcess();
|
||||
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
);
|
||||
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
// no operation in AtRestDoIt and AlongStepDoIt
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double ,
|
||||
G4double ,
|
||||
G4double& ,
|
||||
G4GPILSelection*
|
||||
){ return -1.0; };
|
||||
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
) { return -1.0; };
|
||||
|
||||
// no operation in AtRestDoIt and AlongStepDoIt
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
protected:
|
||||
virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)=0;
|
||||
// Calculates from the macroscopic cross section a mean
|
||||
// free path, the value is returned in units of distance.
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4VDiscreteProcess();
|
||||
G4VDiscreteProcess & operator=(const G4VDiscreteProcess &right);
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
inline G4double G4VDiscreteProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) {
|
||||
// beggining of tracking (or just after DoIt of this process)
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
} else {
|
||||
// subtract NumberOfInteractionLengthLeft
|
||||
SubtractNumberOfInteractionLengthLeft(previousStepSize);
|
||||
if(theNumberOfInteractionLengthLeft<perMillion)
|
||||
theNumberOfInteractionLengthLeft=0.;
|
||||
}
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean free path
|
||||
currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <=0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4VDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
G4double value = theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4VDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "InteractionLength= " << value/cm <<"[cm] " <<endl;
|
||||
}
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
inline G4VParticleChange* G4VDiscreteProcess::PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VProcess.hh,v 2.4 1998/08/10 13:12:32 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 18 Dec. 1996 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// change DoIt/GetPIL arguments type 20 Mar. 1997 H.Kurashige
|
||||
// modified AlongStepGPIL 17 Dec. 1997 H.Kurashige
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
// Add process trype 27 Mar. 1998 H.Kurashige
|
||||
// Remove thePhysicsTable 2 Aug. 1998 H.Kurashige
|
||||
|
||||
#ifndef G4VProcess_h
|
||||
#define G4VProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
class G4ParticleDefinition;
|
||||
class G4DynamicParticle;
|
||||
class G4Track;
|
||||
class G4Step;
|
||||
|
||||
#include "G4PhysicsTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
#include "G4ForceCondition.hh"
|
||||
#include "G4GPILSelection.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4ProcessType.hh"
|
||||
|
||||
class G4VProcess
|
||||
{
|
||||
// A virtual class for physics process objects. It defines
|
||||
// public methods which describe the behavior of a
|
||||
// physics process.
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
// do not hide default constructor for alpha version
|
||||
// G4VProcess G4VProcess();
|
||||
G4VProcess & operator=(const G4VProcess &right);
|
||||
|
||||
public:
|
||||
// constructor requires the process name and type
|
||||
G4VProcess(const G4String& aName = "NoName",
|
||||
G4ProcessType aType = fNotDefined );
|
||||
|
||||
// copy constructor copys the name but does not copy the
|
||||
// physics table (NULL pointer is assigned)
|
||||
G4VProcess(G4VProcess &right);
|
||||
|
||||
virtual ~G4VProcess();
|
||||
|
||||
G4int operator==(const G4VProcess &right) const;
|
||||
G4int operator!=(const G4VProcess &right) const;
|
||||
|
||||
virtual G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& stepData
|
||||
) = 0;
|
||||
|
||||
virtual G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& stepData
|
||||
) = 0;
|
||||
virtual G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& stepData
|
||||
) = 0;
|
||||
// A virtual base class function that has to be overridden
|
||||
// by any subclass. The DoIt method actually performs the
|
||||
// physics process and determines either momentum change
|
||||
// of the production of secondaries etc.
|
||||
// arguments
|
||||
// const G4Track& track:
|
||||
// reference to the current G4Track information
|
||||
// const G4Step& stepData:
|
||||
// reference to the current G4Step information
|
||||
|
||||
virtual G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& proposedSafety,
|
||||
G4GPILSelection* selection) = 0;
|
||||
|
||||
virtual G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4ForceCondition* condition
|
||||
) = 0;
|
||||
|
||||
virtual G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
) = 0;
|
||||
|
||||
// Returns the Step-size (actual length) which is allowed
|
||||
// by "this" process. (for AtRestGetPhysicalInteractionLength,
|
||||
// return value is Step-time) The NumberOfInteractionLengthLeft is
|
||||
// recalculated by using previousStepSize and the Step-size is
|
||||
// calucalted accoding to the resultant NumberOfInteractionLengthLeft.
|
||||
// using NumberOfInteractionLengthLeft, which is recalculated at
|
||||
// arguments
|
||||
// const G4Track& track:
|
||||
// reference to the current G4Track information
|
||||
// G4double* previousStepSize:
|
||||
// the Step-size (actual length) of the previous Step
|
||||
// of this track. Negative calue indicates that
|
||||
// NumberOfInteractionLengthLeft must be reset.
|
||||
// the current physical interaction legth of this process
|
||||
// G4ForceCondition* condition:
|
||||
// the flag indicates DoIt of this process is forced
|
||||
// to be called
|
||||
// Forced: Corresponding DoIt is forced
|
||||
// NotForced: Corresponding DoIt is called
|
||||
// if the Step size of this Step is determined
|
||||
// by this process
|
||||
// !! AlongStepDoIt is always called !!
|
||||
// G4double& currentMinimumStep:
|
||||
// this value is used for transformation of
|
||||
// true path length to geometrical path length
|
||||
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition&){return true;};
|
||||
// Returns true if this process object is applicable to
|
||||
// the particle type
|
||||
|
||||
virtual void BuildPhysicsTable(const G4ParticleDefinition&){};
|
||||
// Messaged by the Particle definition (via the Process manager)
|
||||
// whenever cross section tables have to be rebuilt (i.e. if new
|
||||
// materials have been defined).
|
||||
// It is overloaded by individual processes when they need physics
|
||||
// tables.
|
||||
|
||||
// Processes which Build (for example in their
|
||||
// constructors) physics tables independent of cuts
|
||||
// should preferably use a
|
||||
// private void BuildThePhysicsTable()
|
||||
// function. Not another BuildPhysicsTable, please.
|
||||
|
||||
G4String GetProcessName() const;
|
||||
// Returns the name of the process.
|
||||
|
||||
G4ProcessType GetProcessType() const;
|
||||
// Returns the process type.
|
||||
|
||||
void SetProcessType(G4ProcessType );
|
||||
// Set the process type.
|
||||
|
||||
static G4String GetProcessTypeName(G4ProcessType );
|
||||
// Returns the process type name
|
||||
|
||||
virtual void StartTracking();
|
||||
virtual void EndTracking();
|
||||
// inform Start/End of tracking for each track to the physics process
|
||||
|
||||
protected:
|
||||
//--- Removed ----//
|
||||
// G4PhysicsTable* thePhysicsTable;
|
||||
// A Physics Table can be either a cross-sections table or
|
||||
// an energy table (or can be used for other specific
|
||||
// purposes).
|
||||
|
||||
G4VParticleChange* pParticleChange;
|
||||
// The pointer to G4VParticleChange object
|
||||
// which is modified and returned by address by the DoIt() method.
|
||||
// This pointer should be set in each physics process
|
||||
// after construction of derived class object.
|
||||
|
||||
G4ParticleChange aParticleChange;
|
||||
// This object is kept for compatibility with old scheme
|
||||
// This will be removed in future
|
||||
|
||||
G4double theNumberOfInteractionLengthLeft;
|
||||
// The flight length left for the current tracking particle
|
||||
// in unit of "Interaction length".
|
||||
|
||||
G4double currentInteractionLength;
|
||||
// The InteractionLength in the current material
|
||||
|
||||
public:
|
||||
virtual void ResetNumberOfInteractionLengthLeft();
|
||||
// reset (determine the value of)NumberOfInteractionLengthLeft
|
||||
|
||||
protected:
|
||||
virtual void SubtractNumberOfInteractionLengthLeft(
|
||||
G4double previousStepSize
|
||||
);
|
||||
// subtract NumberOfInteractionLengthLeft by the value corresponding to
|
||||
// previousStepSize
|
||||
|
||||
virtual void ClearNumberOfInteractionLengthLeft();
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
// !!! This method should be at the end of PostStepDoIt()
|
||||
// !!! and AtRestDoIt
|
||||
|
||||
private:
|
||||
G4String theProcessName;
|
||||
// The name of the process
|
||||
|
||||
G4ProcessType theProcessType;
|
||||
// The type of the process
|
||||
|
||||
public:
|
||||
virtual void DumpInfo() const;
|
||||
|
||||
public:
|
||||
void SetVerboseLevel(G4int value);
|
||||
G4int GetVerboseLevel() const;
|
||||
|
||||
protected:
|
||||
G4int verboseLevel;
|
||||
// controle flag for output message
|
||||
// 0: Silent
|
||||
// 1: Warning message
|
||||
// 2: More
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "Randomize.hh"
|
||||
|
||||
inline G4String G4VProcess::GetProcessName() const
|
||||
{
|
||||
return theProcessName;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ProcessType G4VProcess::GetProcessType() const
|
||||
{
|
||||
return theProcessType;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4VProcess::SetProcessType(G4ProcessType aType)
|
||||
{
|
||||
theProcessType = aType;
|
||||
}
|
||||
|
||||
inline void G4VProcess::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
}
|
||||
|
||||
inline G4int G4VProcess::GetVerboseLevel() const
|
||||
{
|
||||
return verboseLevel;
|
||||
}
|
||||
|
||||
inline void G4VProcess::ResetNumberOfInteractionLengthLeft()
|
||||
{
|
||||
theNumberOfInteractionLengthLeft = -log( G4UniformRand() );
|
||||
}
|
||||
|
||||
inline void G4VProcess::ClearNumberOfInteractionLengthLeft()
|
||||
{
|
||||
theNumberOfInteractionLengthLeft = -1.0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,264 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRestContinuousDiscreteProcess.hh,v 2.4 1998/10/16 13:21:37 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 8 Mar. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// modified 26 Mar. 1997 H.Kurahige
|
||||
// modified 16 Apr. 1997 L.Urban
|
||||
// modified AlongStepGPIL etc. 17 Dec. 1997 H.Kurashige
|
||||
// fix bugs in GetGPILSelection() 24 Jan. 1998 H.Kurashige
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
|
||||
|
||||
#ifndef G4VRestContinuousDiscreteProcess_h
|
||||
#define G4VRestContinuousDiscreteProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
class G4VRestContinuousDiscreteProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// discrete physics interactions.
|
||||
public:
|
||||
|
||||
G4VRestContinuousDiscreteProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4VRestContinuousDiscreteProcess(G4VRestContinuousDiscreteProcess &);
|
||||
|
||||
~G4VRestContinuousDiscreteProcess();
|
||||
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
);
|
||||
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
);
|
||||
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
);
|
||||
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
protected:
|
||||
virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0;
|
||||
// Calculates the mean life-time (i.e. for decays) of the
|
||||
// particle at rest due to the occurence of the given process,
|
||||
// or converts the probability of interaction (i.e. for
|
||||
// annihilation) into the life-time of the particle for the
|
||||
// occurence of the given process.
|
||||
|
||||
virtual G4double GetContinuousStepLimit(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety
|
||||
)=0;
|
||||
private:
|
||||
// this is the returnd value of G4GPILSelection in
|
||||
// the arguments of AlongStepGPIL()
|
||||
G4GPILSelection valueGPILSelection;
|
||||
|
||||
protected:
|
||||
// these two methods are set/get methods for valueGPILSelection
|
||||
// these two methods are set/get methods for valueGPILSelection
|
||||
void SetGPILSelection(G4GPILSelection selection)
|
||||
{ valueGPILSelection = selection;};
|
||||
|
||||
G4GPILSelection GetGPILSelection() const{return valueGPILSelection;};
|
||||
|
||||
protected:
|
||||
virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)=0;
|
||||
// Calculates from the macroscopic cross section a mean
|
||||
// free path, the value is returned in units of distance.
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4VRestContinuousDiscreteProcess();
|
||||
G4VRestContinuousDiscreteProcess & operator=(const G4VRestContinuousDiscreteProcess &right);
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
inline G4double G4VRestContinuousDiscreteProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
// beggining of tracking
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean life time
|
||||
currentInteractionLength = GetMeanLifeTime(track, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4VRestContinuousDiscreteProcess::AtRestGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
}
|
||||
|
||||
|
||||
inline G4VParticleChange* G4VRestContinuousDiscreteProcess::AtRestDoIt(
|
||||
const G4Track&,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4double G4VRestContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
)
|
||||
{
|
||||
// GPILSelection is set to defaule value of CandidateForSelection
|
||||
valueGPILSelection = CandidateForSelection;
|
||||
|
||||
// get Step limit proposed by the process
|
||||
G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety);
|
||||
|
||||
// set return value for G4GPILSelection
|
||||
*selection = valueGPILSelection;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4VRestContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "IntractionLength= " << steplength/cm <<"[cm] " <<endl;
|
||||
}
|
||||
#endif
|
||||
return steplength ;
|
||||
}
|
||||
|
||||
inline G4VParticleChange* G4VRestContinuousDiscreteProcess::AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4double G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) {
|
||||
// beggining of tracking (or just after DoIt of this process)
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
} else {
|
||||
// subtract NumberOfInteractionLengthLeft
|
||||
SubtractNumberOfInteractionLengthLeft(previousStepSize);
|
||||
if(theNumberOfInteractionLengthLeft<perMillion)
|
||||
theNumberOfInteractionLengthLeft=0.;
|
||||
}
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean free path
|
||||
currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <=0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4double value = theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "InteractionLength= " << value/cm <<"[cm] " <<endl;
|
||||
}
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
inline G4VParticleChange* G4VRestContinuousDiscreteProcess::PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRestContinuousProcess.hh,v 2.5 1998/10/16 13:21:38 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 8 Mar. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// modified 26 Mar. 1997 H.Kurahige
|
||||
// modified 16 Apr. 1997 L.Urban
|
||||
// modified 18 Sep. 1997 H.Kurashige
|
||||
// modified AlongStepGPIL etc. 17 Dec. 1997 H.Kurashige
|
||||
// fix bugs in GetGPILSelection() 24 Jan. 1998 H.Kurashige
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
|
||||
#ifndef G4VRestContinuousProcess_h
|
||||
#define G4VRestContinuousProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
class G4VRestContinuousProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// discrete physics interactions.
|
||||
public:
|
||||
|
||||
G4VRestContinuousProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4VRestContinuousProcess(G4VRestContinuousProcess &);
|
||||
|
||||
~G4VRestContinuousProcess();
|
||||
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
);
|
||||
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
);
|
||||
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
// no operation in PostStepDoIt
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4double ,
|
||||
G4ForceCondition*
|
||||
){ return -1.0; };
|
||||
|
||||
// no operation in PostStepDoIt
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
protected:
|
||||
virtual G4double GetContinuousStepLimit(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety
|
||||
)=0;
|
||||
private:
|
||||
// this is the returnd value of G4GPILSelection in
|
||||
// the arguments of AlongStepGPIL()
|
||||
G4GPILSelection valueGPILSelection;
|
||||
|
||||
protected:
|
||||
// these two methods are set/get methods for valueGPILSelection
|
||||
void SetGPILSelection(G4GPILSelection selection)
|
||||
{ valueGPILSelection = selection;};
|
||||
|
||||
G4GPILSelection GetGPILSelection() const{return valueGPILSelection;};
|
||||
|
||||
protected:
|
||||
|
||||
virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0;
|
||||
// Calculates the mean life-time (i.e. for decays) of the
|
||||
// particle at rest due to the occurence of the given process,
|
||||
// or converts the probability of interaction (i.e. for
|
||||
// annihilation) into the life-time of the particle for the
|
||||
// occurence of the given process.
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4VRestContinuousProcess();
|
||||
G4VRestContinuousProcess & operator=(const G4VRestContinuousProcess &right);
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
inline G4double G4VRestContinuousProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection
|
||||
)
|
||||
{
|
||||
// GPILSelection is set to defaule value of CandidateForSelection
|
||||
valueGPILSelection = CandidateForSelection;
|
||||
|
||||
// get Step limit proposed by the process
|
||||
G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety);
|
||||
|
||||
// set return value for G4GPILSelection
|
||||
*selection = valueGPILSelection;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4VRestContinuousProcess::AlongStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "IntractionLength= " << steplength/cm <<"[cm] " <<endl;
|
||||
}
|
||||
#endif
|
||||
return steplength ;
|
||||
}
|
||||
|
||||
inline G4double G4VRestContinuousProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
// beggining of tracking
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean life time
|
||||
currentInteractionLength = GetMeanLifeTime(track, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4VRestContinuousProcess::AtRestGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
}
|
||||
|
||||
|
||||
inline G4VParticleChange* G4VRestContinuousProcess::AtRestDoIt(
|
||||
const G4Track&,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4VParticleChange* G4VRestContinuousProcess::AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRestDiscreteProcess.hh,v 2.4 1998/10/16 13:21:39 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 8 Mar. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// modified 26 Mar. 1997 H.Kurahige
|
||||
// modified 16 Apr. 1997 L.Urban
|
||||
// modified 16 Dec. 1997 L.Urban
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
|
||||
|
||||
#ifndef G4VRestDiscreteProcess_h
|
||||
#define G4VRestDiscreteProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
|
||||
class G4VRestDiscreteProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// rest + discrete physics interactions.
|
||||
public:
|
||||
|
||||
G4VRestDiscreteProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4VRestDiscreteProcess(G4VRestDiscreteProcess &);
|
||||
|
||||
~G4VRestDiscreteProcess();
|
||||
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
);
|
||||
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
);
|
||||
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
// no operation in AlongStepDoIt
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double ,
|
||||
G4double ,
|
||||
G4double& ,
|
||||
G4GPILSelection*
|
||||
){ return -1.0; };
|
||||
|
||||
// no operation in AlongStepDoIt
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
protected:
|
||||
virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)=0;
|
||||
// Calculates from the macroscopic cross section a mean
|
||||
// free path, the value is returned in units of distance.
|
||||
|
||||
virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0;
|
||||
// Calculates the mean life-time (i.e. for decays) of the
|
||||
// particle at rest due to the occurence of the given process,
|
||||
// or converts the probability of interaction (i.e. for
|
||||
// annihilation) into the life-time of the particle for the
|
||||
// occurence of the given process.
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4VRestDiscreteProcess();
|
||||
G4VRestDiscreteProcess & operator=(const G4VRestDiscreteProcess &right);
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "Randomize.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
inline
|
||||
G4double G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) {
|
||||
// beggining of tracking (or just after DoIt of this process)
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
} else {
|
||||
// subtract NumberOfInteractionLengthLeft
|
||||
SubtractNumberOfInteractionLengthLeft(previousStepSize);
|
||||
if(theNumberOfInteractionLengthLeft<perMillion)
|
||||
theNumberOfInteractionLengthLeft=0.;
|
||||
}
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean free path
|
||||
currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <=0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4double value = theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cout << "G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "InteractionLength= " << value/cm <<"[cm] " <<endl;
|
||||
}
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
inline G4VParticleChange* G4VRestDiscreteProcess::PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// reset NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
inline G4double G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
// beggining of tracking
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean life time
|
||||
currentInteractionLength = GetMeanLifeTime(track, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
}
|
||||
|
||||
|
||||
inline G4VParticleChange* G4VRestDiscreteProcess::AtRestDoIt(
|
||||
const G4Track&,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRestProcess.hh,v 2.4 1998/10/16 13:21:40 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 18 Dec. 1996 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// modified 25 Feb. 1997 H.Kurahige
|
||||
// modified 8 Mar. 1997 H.Kurahige
|
||||
// modified 26 Mar. 1997 H.Kurahige
|
||||
// modified 16 Apr. 1997 L.Urban
|
||||
// modified 17 Dec. 1997 L.Urban
|
||||
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
||||
|
||||
|
||||
#ifndef G4VRestProcess_h
|
||||
#define G4VRestProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
|
||||
class G4VRestProcess : public G4VProcess
|
||||
{
|
||||
// Abstract class which defines the public behavior of
|
||||
// physics interactions at rest.
|
||||
|
||||
public:
|
||||
G4VRestProcess(const G4String& ,
|
||||
G4ProcessType aType = fNotDefined );
|
||||
G4VRestProcess(G4VRestProcess& );
|
||||
|
||||
~G4VRestProcess();
|
||||
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4ForceCondition* condition
|
||||
);
|
||||
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
// no operation in PostStepDoIt and AlongStepDoIt
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double ,
|
||||
G4double ,
|
||||
G4double& ,
|
||||
G4GPILSelection*
|
||||
){ return -1.0; };
|
||||
|
||||
G4double PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4double ,
|
||||
G4ForceCondition*
|
||||
) { return -1.0; };
|
||||
|
||||
// no operation in PostStepDoIt and AlongStepDoIt
|
||||
G4VParticleChange* PostStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
) {return NULL;};
|
||||
|
||||
protected:
|
||||
|
||||
virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0;
|
||||
// Calculates the mean life-time (i.e. for decays) of the
|
||||
// particle at rest due to the occurence of the given process,
|
||||
// or converts the probability of interaction (i.e. for
|
||||
// annihilation) into the life-time of the particle for the
|
||||
// occurence of the given process.
|
||||
|
||||
private:
|
||||
// hide default constructor and assignment operator as private
|
||||
G4VRestProcess();
|
||||
G4VRestProcess & operator=(const G4VRestProcess &right);
|
||||
};
|
||||
|
||||
// -----------------------------------------
|
||||
// inlined function members implementation
|
||||
// -----------------------------------------
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
inline G4double G4VRestProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& track,
|
||||
G4ForceCondition* condition
|
||||
)
|
||||
{
|
||||
// beggining of tracking
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean life time
|
||||
currentInteractionLength = GetMeanLifeTime(track, condition);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ((currentInteractionLength <0.0) || (verboseLevel>2)){
|
||||
G4cout << "G4VRestProcess::AtRestGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" <<endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() <<endl;
|
||||
G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return theNumberOfInteractionLengthLeft * currentInteractionLength;
|
||||
}
|
||||
|
||||
|
||||
inline G4VParticleChange* G4VRestProcess::AtRestDoIt(
|
||||
const G4Track&,
|
||||
const G4Step&
|
||||
)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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:
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4IVContinuousDiscreteProcess.hh"
|
||||
G4IVContinuousDiscreteProcess::G4IVContinuousDiscreteProcess()
|
||||
:G4VProcess("No Name Discrete Process")
|
||||
{
|
||||
G4Exception("G4IVContinuousDiscreteProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4IVContinuousDiscreteProcess::G4IVContinuousDiscreteProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4IVContinuousDiscreteProcess::~G4IVContinuousDiscreteProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4IVContinuousDiscreteProcess::G4IVContinuousDiscreteProcess(G4IVContinuousDiscreteProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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:
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4IVRestDiscreteProcess.hh"
|
||||
G4IVRestDiscreteProcess::G4IVRestDiscreteProcess()
|
||||
:G4VProcess("No Name Discrete Process")
|
||||
{
|
||||
G4Exception("G4IVRestDiscreteProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4IVRestDiscreteProcess::G4IVRestDiscreteProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4IVRestDiscreteProcess::~G4IVRestDiscreteProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4IVRestDiscreteProcess::G4IVRestDiscreteProcess(G4IVRestDiscreteProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 4th Aug 1998, H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4ProcTblElement.hh"
|
||||
|
||||
|
||||
// default constructor ////////////////////////
|
||||
G4ProcTblElement::G4ProcTblElement()
|
||||
{
|
||||
pProcess = NULL;
|
||||
pProcMgrVector=NULL;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
G4ProcTblElement::G4ProcTblElement(G4VProcess* aProcess):
|
||||
pProcess(aProcess)
|
||||
{
|
||||
pProcMgrVector = new G4ProcMgrVector();
|
||||
}
|
||||
|
||||
// copy constructor //////////////////////////
|
||||
G4ProcTblElement::G4ProcTblElement(const G4ProcTblElement &right)
|
||||
{
|
||||
pProcess = right.pProcess;
|
||||
// copy all contents in pProcMgrVector
|
||||
pProcMgrVector = new G4ProcMgrVector();
|
||||
for (G4int idx=0; idx<pProcMgrVector->length(); idx++){
|
||||
pProcMgrVector->insert((*(right.pProcMgrVector))[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// destructor ////////////////////////
|
||||
G4ProcTblElement::~G4ProcTblElement()
|
||||
{
|
||||
if (pProcMgrVector != NULL) {
|
||||
pProcMgrVector->clear();
|
||||
delete pProcMgrVector;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
G4ProcTblElement & G4ProcTblElement::operator=(G4ProcTblElement &right)
|
||||
{
|
||||
if (this != &right) {
|
||||
pProcess = right.pProcess;
|
||||
// copy all contents in pProcMgrVector
|
||||
if (pProcMgrVector != NULL) {
|
||||
pProcMgrVector->clear();
|
||||
delete pProcMgrVector;
|
||||
}
|
||||
pProcMgrVector = new G4ProcMgrVector();
|
||||
for (G4int idx=0; idx<pProcMgrVector->length(); idx++){
|
||||
pProcMgrVector->insert((*(right.pProcMgrVector))[idx]);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
G4int G4ProcTblElement::operator==(const G4ProcTblElement &right) const
|
||||
{
|
||||
return (this == &right);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
G4int G4ProcTblElement::operator!=(const G4ProcTblElement &right) const
|
||||
{
|
||||
return (this != &right);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1997, H.Kurashige
|
||||
// ---------------- G4ProcessAttribute -----------------
|
||||
// History:
|
||||
// adds copy constructor 27 June 1998 H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4ProcessAttribute.hh"
|
||||
|
||||
G4ProcessAttribute::G4ProcessAttribute():
|
||||
isActive(true)
|
||||
{
|
||||
pProcess = NULL;
|
||||
idxProcessList = -1;
|
||||
}
|
||||
|
||||
// copy constructor //////////////////////////
|
||||
G4ProcessAttribute::G4ProcessAttribute(const G4ProcessAttribute &right)
|
||||
:isActive(true)
|
||||
{
|
||||
pProcess = right.pProcess;
|
||||
idxProcessList = right.idxProcessList;
|
||||
// copy all contents in idxProcVector[] and ordProcVector[]
|
||||
// deep copy
|
||||
for (G4int idx=0; idx<G4ProcessManager::SizeOfProcVectorArray; idx++){
|
||||
idxProcVector[idx] = right.idxProcVector[idx];
|
||||
ordProcVector[idx] = right.ordProcVector[idx];
|
||||
}
|
||||
}
|
||||
|
||||
G4ProcessAttribute::~G4ProcessAttribute()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
G4ProcessAttribute & G4ProcessAttribute::operator=(G4ProcessAttribute &right)
|
||||
{
|
||||
if (this != &right) {
|
||||
pProcess = right.pProcess;
|
||||
idxProcessList = right.idxProcessList;
|
||||
// copy all contents in idxProcVector[] and ordProcVector[]
|
||||
// deep copy
|
||||
for (G4int idx=0; idx<G4ProcessManager::SizeOfProcVectorArray; idx++){
|
||||
idxProcVector[idx] = right.idxProcVector[idx];
|
||||
ordProcVector[idx] = right.ordProcVector[idx];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,935 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact: public:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// ------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// remove sprintf 14 Nov 1997 H.Kurahige
|
||||
// fixed bugs in FindInsertPosition
|
||||
// 18 July 1998 H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4ProcessManagerMessenger.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include <iomanip.h>
|
||||
#include "G4ProcessTable.hh"
|
||||
|
||||
|
||||
// ---------------------------------
|
||||
// function members implementation
|
||||
// ---------------------------------
|
||||
G4ProcessManagerMessenger* G4ProcessManager::fProcessManagerMessenger = NULL;
|
||||
G4int G4ProcessManager::counterOfObjects = 0;
|
||||
// ///////////////////////////////////////
|
||||
G4ProcessManager::G4ProcessManager(const G4ParticleDefinition* aParticleType):
|
||||
theParticleType(aParticleType),
|
||||
numberOfProcesses(0),
|
||||
duringTracking(false),
|
||||
verboseLevel(1)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
//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);
|
||||
}
|
||||
}
|
||||
theAttrVector = new G4ProcessAttrVector();
|
||||
if (fProcessManagerMessenger == NULL){
|
||||
fProcessManagerMessenger = new G4ProcessManagerMessenger();
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel() > 1) {
|
||||
G4cerr << "G4ProcessManagerMessenger is created" << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// Increment counter of G4ProcessManager objects
|
||||
counterOfObjects+=1;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4ProcessManager::G4ProcessManager(G4ProcessManager &right)
|
||||
:duringTracking(false)
|
||||
{
|
||||
verboseLevel = right.verboseLevel;
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel() > 2) {
|
||||
G4cerr << "G4ProcessManagerMessenger:: copy constructor " <<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
theParticleType = right.theParticleType;
|
||||
numberOfProcesses = right.numberOfProcesses;
|
||||
|
||||
// create the process List
|
||||
theProcessList = new G4ProcessVector();
|
||||
theAttrVector = new G4ProcessAttrVector();
|
||||
if ( ( theProcessList == NULL) || (theAttrVector == NULL) ){
|
||||
G4String aErrorMessage("G4ProcessManager::G4ProcessManager():");
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
}
|
||||
|
||||
for (G4int idx=0; idx < right.numberOfProcesses; idx++) {
|
||||
// copy contents in theProcessList
|
||||
theProcessList->insert((*right.theProcessList)[idx]);
|
||||
// create a G4ProcessAttribute same as source's one
|
||||
G4ProcessAttribute* sAttr = (*right.theAttrVector)[idx];
|
||||
G4ProcessAttribute* dAttr = new G4ProcessAttribute(*sAttr);
|
||||
// adds a G4ProcessAttribute object
|
||||
theAttrVector->insert(dAttr);
|
||||
numberOfProcesses +=1;
|
||||
}
|
||||
|
||||
|
||||
//create theProcVector
|
||||
for (G4int i=0; i<SizeOfProcVectorArray; ++i) {
|
||||
// create i-th ProcessVector in theProcVector
|
||||
theProcVector[i] = new G4ProcessVector();
|
||||
if ( theProcVector[i] == NULL) {
|
||||
G4String aErrorMessage("G4ProcessManager::G4ProcessManager():");
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
}
|
||||
G4ProcessVector* src = right.theProcVector[i];
|
||||
for (G4int j=0; j< src->entries() ; j++){
|
||||
// copy j-th process in i-th ProcessVector
|
||||
theProcVector[i]->insert((*src)[j]);
|
||||
}
|
||||
}
|
||||
// Increment counter of G4ProcessManager objects
|
||||
counterOfObjects+=1;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4ProcessManager::G4ProcessManager():
|
||||
theParticleType(NULL),
|
||||
numberOfProcesses(0)
|
||||
{
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << "G4ProcessManager: default constructor is called !!" <<endl;
|
||||
}
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4ProcessManager & G4ProcessManager::operator=(G4ProcessManager &)
|
||||
{
|
||||
G4Exception("G4ProcessManager: assignment operator is called !!");
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4ProcessManager::~G4ProcessManager()
|
||||
{
|
||||
for (G4int i=0; i<SizeOfProcVectorArray; i++) {
|
||||
if (theProcVector[i]) delete theProcVector[i];
|
||||
}
|
||||
delete theProcessList;
|
||||
|
||||
theAttrVector->clearAndDestroy();
|
||||
delete theAttrVector;
|
||||
|
||||
counterOfObjects-=1;
|
||||
|
||||
if ( counterOfObjects == 0 ){
|
||||
if (fProcessManagerMessenger != NULL){
|
||||
delete fProcessManagerMessenger;
|
||||
fProcessManagerMessenger = NULL;
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel() > 1) {
|
||||
G4cerr << "G4ProcessManagerMessenger is deleted" << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
G4int G4ProcessManager::GetProcessVectorIndex(
|
||||
G4VProcess* aProcess,
|
||||
G4ProcessVectorDoItIndex idx,
|
||||
G4ProcessVectorTypeIndex typ
|
||||
) const
|
||||
{
|
||||
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;
|
||||
if (idxProc <0) {
|
||||
G4cerr << " is not registered yet ";
|
||||
}
|
||||
if (ivec <0) {
|
||||
G4cerr << " illegal DoIt Index [= " << idx << "," << typ << "]";
|
||||
}
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return idxVect;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
G4ProcessAttribute* G4ProcessManager::GetAttribute(G4int index) const
|
||||
{
|
||||
// check index range
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// check process pointer is not NULL
|
||||
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
|
||||
G4String aErrorMessage("G4ProcessManager::GetAttribute():");
|
||||
aErrorMessage += " particle[" + theParticleType->GetParticleName() + "]";
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//find the process attribute
|
||||
if ( ((*theAttrVector)[index])->idxProcessList == index ){
|
||||
return (*theAttrVector)[index];
|
||||
} else {
|
||||
#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;
|
||||
}
|
||||
#endif
|
||||
G4ProcessAttribute *pAttr = NULL;
|
||||
for (G4int i=0; i<theAttrVector->length(); i++){
|
||||
if ( ((*theAttrVector)[i])->idxProcessList == index) {
|
||||
pAttr = (*theAttrVector)[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pAttr;
|
||||
}
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4ProcessAttribute * G4ProcessManager::GetAttribute(G4VProcess *aProcess) const
|
||||
{
|
||||
return GetAttribute( GetProcessIndex(aProcess));
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4int G4ProcessManager::InsertAt(G4int ip, G4VProcess* process, G4int ivec)
|
||||
{
|
||||
G4ProcessVector* pVector = theProcVector[ivec];
|
||||
// check position
|
||||
if ( (ip<0) || (ip > pVector->length()) ) 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->idxProcVector[ivec] >= ip){
|
||||
aAttr->idxProcVector[ivec] += 1;
|
||||
}
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << " G4ProcessManager::InsertAt : No Process Attribute " << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4int G4ProcessManager::RemoveAt(G4int ip, G4VProcess* process, G4int ivec)
|
||||
{
|
||||
G4ProcessVector* pVector = theProcVector[ivec];
|
||||
// check position
|
||||
if ( (ip<0) || (ip >= pVector->length()) ) 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 (ip < aAttr->idxProcVector[ivec]) {
|
||||
aAttr->idxProcVector[ivec] -=1;
|
||||
} else if (ip == aAttr->idxProcVector[ivec]) {
|
||||
aAttr->idxProcVector[ivec] = -1;
|
||||
aAttr->ordProcVector[ivec] = ordInActive;
|
||||
}
|
||||
}else {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << " G4ProcessManager::RemoveAt : No Process Attribute " << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4int G4ProcessManager::FindInsertPosition(G4int ord, G4int ivec)
|
||||
{
|
||||
G4ProcessVector* pVector = theProcVector[ivec];
|
||||
G4int ip = pVector->length();
|
||||
G4int tmp = INT_MAX;
|
||||
// find insert position
|
||||
for (G4int iproc=0; iproc<numberOfProcesses; iproc++) {
|
||||
G4ProcessAttribute* aAttr = (*theAttrVector)[iproc];
|
||||
if ( (aAttr->ordProcVector[ivec] > ord ) && (tmp > aAttr->ordProcVector[ivec])){
|
||||
tmp = aAttr->ordProcVector[ivec] ;
|
||||
if (ip > aAttr->idxProcVector[ivec]) ip = aAttr->idxProcVector[ivec];
|
||||
}
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4int G4ProcessManager::AddProcess(
|
||||
G4VProcess *aProcess,
|
||||
G4int ordAtRestDoIt,
|
||||
G4int ordAlongStepDoIt,
|
||||
G4int ordPostStepDoIt
|
||||
)
|
||||
{
|
||||
G4String aErrorMessage("G4ProcessManager::AddProcess():");
|
||||
aErrorMessage += "process[" + aProcess->GetProcessName() + "]";
|
||||
aErrorMessage += " particle[" + theParticleType->GetParticleName() + "]";
|
||||
|
||||
//check the process is applicable to this particle type
|
||||
if ( !aProcess->IsApplicable(*theParticleType) ) {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << aErrorMessage << endl;
|
||||
G4cerr << "This process is not applicable to this particle";
|
||||
}
|
||||
#endif
|
||||
// --comment out for alpha version ----
|
||||
// G4Exception((const char*)aErrorMessage);
|
||||
// return -1;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>2) {
|
||||
G4cerr << aErrorMessage << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
//add aProcess and this ProcessManager into ProcesssTable
|
||||
G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
|
||||
theProcessTable->Insert(aProcess, this);
|
||||
|
||||
//add aProcess to process List
|
||||
theProcessList->insert(aProcess);
|
||||
G4int idx = (theProcessList->length()) - 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
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// create ProcessAttribute
|
||||
G4ProcessAttribute* pAttr = new G4ProcessAttribute(aProcess);
|
||||
pAttr->idxProcessList = idx;
|
||||
|
||||
// check if ordering parameter is non-zero
|
||||
if (ordAtRestDoIt==0) ordAtRestDoIt = 1;
|
||||
if (ordAlongStepDoIt==0) ordAlongStepDoIt = 1;
|
||||
if (ordPostStepDoIt==0) ordPostStepDoIt = 1;
|
||||
|
||||
// ordering parameter
|
||||
pAttr->ordProcVector[0] = ordAtRestDoIt;
|
||||
pAttr->ordProcVector[1] = ordAtRestDoIt;
|
||||
pAttr->ordProcVector[2] = ordAlongStepDoIt;
|
||||
pAttr->ordProcVector[3] = ordAlongStepDoIt;
|
||||
pAttr->ordProcVector[4] = ordPostStepDoIt;
|
||||
pAttr->ordProcVector[5] = ordPostStepDoIt;
|
||||
|
||||
// add aProccess in Process vectors
|
||||
for (G4int ivec=1; ivec<SizeOfProcVectorArray; ivec+=2) {
|
||||
if (pAttr->ordProcVector[ivec] < 0 ) {
|
||||
// DoIt is inactive if ordering parameter is negative
|
||||
pAttr->idxProcVector[ivec] = -1;
|
||||
|
||||
} else {
|
||||
//add aProcess in ordering of ordProcVector
|
||||
G4ProcessVector* pVector = theProcVector[ivec];
|
||||
// find insert position
|
||||
G4int ip = FindInsertPosition(pAttr->ordProcVector[ivec], ivec);
|
||||
// insert
|
||||
InsertAt(ip, aProcess, ivec);
|
||||
// set index in Process Attribute
|
||||
pAttr->idxProcVector[ivec] = ip;
|
||||
|
||||
#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;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//add ProcessAttribute to ProcessAttrVector
|
||||
theAttrVector->insert(pAttr);
|
||||
|
||||
numberOfProcesses += 1;
|
||||
|
||||
CreateGPILvectors();
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4VProcess* G4ProcessManager::RemoveProcess(G4int index)
|
||||
{
|
||||
//find the process attribute
|
||||
G4ProcessAttribute* pAttr = GetAttribute(index);
|
||||
if (pAttr == NULL) return NULL;
|
||||
|
||||
// remove process
|
||||
G4VProcess* removedProcess = (*theProcessList)[index];
|
||||
|
||||
const G4String aErrorMessage(" G4ProcessManager::RemoveProcess():");
|
||||
|
||||
if (pAttr->isActive) {
|
||||
// remove process from vectors if the process is active
|
||||
for (G4int ivec=0; ivec<SizeOfProcVectorArray; ivec++) {
|
||||
G4ProcessVector* pVector = theProcVector[ivec];
|
||||
G4int idx = pAttr->idxProcVector[ivec];
|
||||
if ((idx >= 0) && (idx < pVector->length())) {
|
||||
//remove
|
||||
if (RemoveAt(idx, removedProcess, ivec) <0) {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << aErrorMessage;
|
||||
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
|
||||
G4cerr << "process["<<removedProcess->GetProcessName()<< "] " ;
|
||||
G4cerr << "bad index in attribute ";
|
||||
G4cerr << idx << "->" << pVector->index(removedProcess) << endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
return NULL;
|
||||
}
|
||||
} else if (idx<0) {
|
||||
// corresponding DoIt is not active
|
||||
} else {
|
||||
// idx is out of range
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << aErrorMessage;
|
||||
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
|
||||
G4cerr << "process["<<removedProcess->GetProcessName()<< "] " ;
|
||||
G4cerr << "index(=" << idx << ") of process vector";
|
||||
G4cerr << "[size:" << pVector->length() << "] out of range" <<endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
pAttr->isActive = false;
|
||||
} else {
|
||||
// the process is inactive
|
||||
}
|
||||
// remove from the process List and delete the attribute
|
||||
theProcessList->removeAt(index);
|
||||
theAttrVector->remove(pAttr);
|
||||
delete pAttr;
|
||||
numberOfProcesses -= 1;
|
||||
|
||||
// correct index
|
||||
for(G4int i=0; i<numberOfProcesses; i++) {
|
||||
G4ProcessAttribute* aAttr = (*theAttrVector)[i];
|
||||
if (index < aAttr->idxProcessList) aAttr->idxProcessList -=1;
|
||||
}
|
||||
|
||||
CreateGPILvectors();
|
||||
|
||||
//remove aProcess from ProcesssTable
|
||||
G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
|
||||
theProcessTable->Remove(removedProcess, this);
|
||||
|
||||
return removedProcess;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4VProcess* G4ProcessManager::RemoveProcess(G4VProcess *aProcess)
|
||||
{
|
||||
return RemoveProcess(GetProcessIndex(aProcess));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
G4int G4ProcessManager::GetProcessOrdering(
|
||||
G4VProcess *aProcess,
|
||||
G4ProcessVectorDoItIndex idDoIt
|
||||
)
|
||||
{
|
||||
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
} else if (pAttr != NULL) {
|
||||
return pAttr->ordProcVector[ivec];
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////////////////////////
|
||||
void G4ProcessManager::SetProcessOrdering(
|
||||
G4VProcess *aProcess,
|
||||
G4ProcessVectorDoItIndex idDoIt,
|
||||
G4int ordDoIt
|
||||
)
|
||||
{
|
||||
const G4String aErrorMessage(" G4ProcessManager::GetProcessVectorIndex:");
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>2) {
|
||||
G4cerr << aErrorMessage ;
|
||||
G4cerr << "particle[" + theParticleType->GetParticleName() +"] " ;
|
||||
G4cerr <<"process[" + aProcess->GetProcessName() + "]"<< endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
} else if (pAttr != NULL) {
|
||||
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
|
||||
ip = FindInsertPosition(pAttr->ordProcVector[ivec], ivec);
|
||||
// insert
|
||||
InsertAt(ip, aProcess, ivec);
|
||||
// set index in Process Attribute
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// create GPIL vectors
|
||||
CreateGPILvectors();
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////////////////////////
|
||||
void G4ProcessManager::SetProcessOrderingToFirst(
|
||||
G4VProcess *aProcess,
|
||||
G4ProcessVectorDoItIndex idDoIt
|
||||
)
|
||||
{
|
||||
G4ProcessAttribute* pAttr = GetAttribute(aProcess);
|
||||
G4int ivec = GetProcessVectorId(idDoIt, typeDoIt);
|
||||
if (ivec <0 ) {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0) {
|
||||
G4cerr << "G4ProcessManager::SetProcessOrdering: ";
|
||||
G4cerr << " illegal DoIt Index [= " << idDoIt << "]";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
} else if (pAttr != NULL) {
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// create GPIL vectors
|
||||
CreateGPILvectors();
|
||||
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
void G4ProcessManager::SetProcessOrderingToLast(
|
||||
G4VProcess *aProcess,
|
||||
G4ProcessVectorDoItIndex idDoIt
|
||||
)
|
||||
{
|
||||
SetProcessOrdering(aProcess, idDoIt, ordLast );
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4VProcess* G4ProcessManager::InActivateProcess(G4int index)
|
||||
{
|
||||
//find the process attribute
|
||||
G4ProcessAttribute* pAttr = GetAttribute(index);
|
||||
if (pAttr == NULL) return NULL;
|
||||
|
||||
// remove process
|
||||
G4VProcess* pProcess = (*theProcessList)[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
|
||||
if ((*pVector)[idx]== pProcess) {
|
||||
(*pVector)[idx]= NULL;
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << aErrorMessage;
|
||||
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
|
||||
G4cerr << "process["<<pProcess->GetProcessName()<<"] " ;
|
||||
G4cerr << "bad index in attribute ";
|
||||
G4cerr << idx << "->" << pVector->index(pProcess) << endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
// idx is out of range
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << aErrorMessage;
|
||||
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
|
||||
G4cerr << "process["<<pProcess->GetProcessName()<<"] " ;
|
||||
G4cerr << "index(=" << idx << ") of process vector";
|
||||
G4cerr << "[size:" << pVector->length() << "] out of range" << endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return pProcess;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4VProcess* G4ProcessManager::ActivateProcess(G4int index)
|
||||
{
|
||||
//find the process attribute
|
||||
G4ProcessAttribute* pAttr = GetAttribute(index);
|
||||
if (pAttr == NULL) return NULL;
|
||||
|
||||
// remove process
|
||||
G4VProcess* pProcess = (*theProcessList)[index];
|
||||
|
||||
const G4String aErrorMessage(" G4ProcessManager::ActivateProcess():");
|
||||
|
||||
if (pAttr->isActive) {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << aErrorMessage << endl;
|
||||
G4cerr << "The process is already active" << endl;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
// 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
|
||||
if ((*pVector)[idx]== NULL) {
|
||||
(*pVector)[idx] = pProcess;
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << aErrorMessage;
|
||||
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
|
||||
G4cerr << "process["<<pProcess->GetProcessName()<<"] " ;
|
||||
G4cerr << "bad index in attribute " << idx << "->";
|
||||
G4cerr << pVector->index(pProcess) << endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
// idx is out of range
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cerr << aErrorMessage;
|
||||
G4cerr << "particle["<<theParticleType->GetParticleName()<<"] " ;
|
||||
G4cerr << "process["<<pProcess->GetProcessName()<<"] " ;
|
||||
G4cerr << "index(=" << idx <<")of process vector";
|
||||
G4cerr << "[size:" << pVector->length() << "] out of range" << endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception((const char*)aErrorMessage);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
pAttr->isActive = true;
|
||||
}
|
||||
return pProcess;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4int G4ProcessManager::operator==(const G4ProcessManager &right) const
|
||||
{
|
||||
return (this == &right);
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
G4int G4ProcessManager::operator!=(const G4ProcessManager &right) const
|
||||
{
|
||||
return (this != &right);
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////
|
||||
void G4ProcessManager::DumpInfo()
|
||||
{
|
||||
// Dump Information
|
||||
|
||||
// particle type
|
||||
G4String* aMessage = new G4String("G4ProcessManager:");
|
||||
*aMessage += "particle[" + theParticleType->GetParticleName() + "]";
|
||||
G4cout << *aMessage << endl;
|
||||
delete aMessage;
|
||||
|
||||
// loop over all processes
|
||||
for (G4int idx=0; idx <theProcessList->length(); idx++){
|
||||
// process name/type
|
||||
G4cout << "[" << idx << "]";
|
||||
G4cout << "=== process[" << ((*theProcessList)(idx))->GetProcessName()<< " :";
|
||||
G4cout << G4VProcess::GetProcessTypeName( ((*theProcessList)(idx))->GetProcessType() )<< "]";
|
||||
|
||||
// process attribute
|
||||
G4ProcessAttribute* pAttr = (*theAttrVector)(idx);
|
||||
// staus
|
||||
if ( pAttr-> isActive ) {
|
||||
G4cout << " Active ";
|
||||
} else {
|
||||
G4cout << " InActive ";
|
||||
}
|
||||
G4cout << endl;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0) {
|
||||
// order parameter
|
||||
G4cout << " Ordering:: ";
|
||||
G4cout << " AtRest AlongStep PostStep ";
|
||||
G4cout << endl;
|
||||
G4cout << " ";
|
||||
G4cout << " GetPIL/ DoIt GetPIL/ DoIt GetPIL/ DoIt ";
|
||||
G4cout << endl;
|
||||
G4cout << " Ordering:: " << endl;
|
||||
G4cout << " index ";
|
||||
for (G4int idx2 = 0; idx2 <6 ; idx2++) {
|
||||
G4cout << setw(8) << pAttr->idxProcVector[idx2] <<":";
|
||||
}
|
||||
G4cout << endl;
|
||||
G4cout << " parameter ";
|
||||
for (G4int idx3 = 0; idx3 <6 ; idx3++) {
|
||||
G4cout << setw(8) << pAttr->ordProcVector[idx3] <<":";
|
||||
}
|
||||
G4cout << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void G4ProcessManager::CreateGPILvectors()
|
||||
{
|
||||
//-- create GetPhysicalInteractionLength process vectors just as the inverse
|
||||
//-- order of DoIt process vector
|
||||
for(G4int k=0; k<theProcessList->length(); 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];
|
||||
G4int nproc = procDoIt->entries();
|
||||
procGPIL->clear();
|
||||
for(G4int j=nproc-1;j>=0;j--) {
|
||||
G4VProcess* aProc = (*procDoIt)[j];
|
||||
procGPIL->insert(aProc);
|
||||
GetAttribute(aProc)->idxProcVector[i] = procGPIL->entries()-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
void G4ProcessManager::StartTracking()
|
||||
{
|
||||
for (G4int idx = 0; idx<theProcessList->length(); idx++){
|
||||
if (GetAttribute(idx)->isActive)
|
||||
((*theProcessList)[idx])->StartTracking();
|
||||
}
|
||||
duringTracking = true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
void G4ProcessManager::EndTracking()
|
||||
{
|
||||
for (G4int idx = 0; idx<theProcessList->length(); idx++){
|
||||
if (GetAttribute(idx)->isActive)
|
||||
((*theProcessList)[idx])->EndTracking();
|
||||
}
|
||||
duringTracking = false;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
G4VProcess* G4ProcessManager::SetProcessActivation(G4VProcess *aProcess,
|
||||
G4bool fActive )
|
||||
{
|
||||
return SetProcessActivation(GetProcessIndex(aProcess), fActive);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
G4VProcess* G4ProcessManager::SetProcessActivation(G4int index, G4bool fActive)
|
||||
{
|
||||
if (fActive) return ActivateProcess(index);
|
||||
else return InActivateProcess(index);
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ProcessManagerMessenger.cc
|
||||
//
|
||||
// Description:
|
||||
// This is a messenger class to interface to exchange information
|
||||
// between ProcessManagerand UI.
|
||||
//
|
||||
// History:
|
||||
// 13 June 1997, H. Kurashige : The 1st version created.
|
||||
// 10 Nov. 1997 H. Kurashige : fixed bugs
|
||||
// 08 jan. 1998 H. Kurashige : new UIcommnds
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
#include "G4ProcessManagerMessenger.hh"
|
||||
#include "G4ios.hh" // Include from 'system'
|
||||
#include <iomanip.h> // Include from 'system'
|
||||
|
||||
#ifdef WIN32
|
||||
# include <Strstrea.h>
|
||||
#else
|
||||
# include <strstream.h>
|
||||
#endif
|
||||
|
||||
G4ProcessManagerMessenger::G4ProcessManagerMessenger(G4ParticleTable* pTable)
|
||||
:theParticleTable(pTable),
|
||||
currentParticle(NULL),
|
||||
currentProcess(NULL),
|
||||
theManager(NULL),
|
||||
theProcessList(NULL)
|
||||
{
|
||||
if ( theParticleTable == NULL) theParticleTable = G4ParticleTable::GetParticleTable();
|
||||
|
||||
//Commnad /particle/process
|
||||
thisDirectory = new G4UIdirectory("/particle/process/");
|
||||
thisDirectory->SetGuidance("Process Manager control commands.");
|
||||
|
||||
//Commnad /particle/process/dump
|
||||
dumpCmd = new G4UIcmdWithAnInteger("/particle/process/dump",this);
|
||||
dumpCmd->SetGuidance("dump process manager or process information");
|
||||
dumpCmd->SetGuidance(" dump [process index]");
|
||||
dumpCmd->SetGuidance(" process index: -1 for process manager");
|
||||
dumpCmd->SetParameterName("index", true);
|
||||
dumpCmd->SetDefaultValue(-1);
|
||||
|
||||
//Commnad /particle/process/Verbose
|
||||
verboseCmd = new G4UIcommand("/particle/process/verbose",this);
|
||||
verboseCmd->SetGuidance("Set Verbose Level for Process or Process Manager");
|
||||
verboseCmd->SetGuidance(" Verbose [Verbose] [process index]");
|
||||
verboseCmd->SetGuidance(" process index: -1 for process manager");
|
||||
G4UIparameter* param = new G4UIparameter("Verbose",'i',true);
|
||||
param->SetDefaultValue(1);
|
||||
verboseCmd->SetParameter(param);
|
||||
param = new G4UIparameter("index",'i',true);
|
||||
param->SetDefaultValue(-1);
|
||||
verboseCmd->SetParameter(param);
|
||||
|
||||
//Commnad /particle/process/Activate
|
||||
activateCmd = new G4UIcmdWithAnInteger("/particle/process/activate",this);
|
||||
activateCmd->SetGuidance("Activate process ");
|
||||
activateCmd->SetGuidance(" Activate [process index]");
|
||||
activateCmd->SetParameterName("index", false);
|
||||
activateCmd->SetDefaultValue(0);
|
||||
activateCmd->SetRange("index >=0");
|
||||
|
||||
//Commnad /particle/process/inactivate
|
||||
inactivateCmd = new G4UIcmdWithAnInteger("/particle/process/inactivate",this);
|
||||
inactivateCmd->SetGuidance("Inactivate process ");
|
||||
inactivateCmd->SetGuidance(" inactivate [process index]");
|
||||
inactivateCmd->SetParameterName("index", false);
|
||||
inactivateCmd->SetDefaultValue(0);
|
||||
inactivateCmd->SetRange("index >=0");
|
||||
}
|
||||
|
||||
G4ProcessManagerMessenger::~G4ProcessManagerMessenger()
|
||||
{
|
||||
delete activateCmd;
|
||||
delete inactivateCmd;
|
||||
delete verboseCmd;
|
||||
delete dumpCmd;
|
||||
delete thisDirectory;
|
||||
}
|
||||
|
||||
G4ParticleDefinition* G4ProcessManagerMessenger::SetCurrentParticle()
|
||||
{
|
||||
// set currentParticle pointer
|
||||
// get particle name by asking G4ParticleMessenger
|
||||
G4String particleName = G4UImanager::GetUIpointer()->GetCurrentStringValue("/particle/select");
|
||||
|
||||
currentParticle = theParticleTable->FindParticle(particleName);
|
||||
if (currentParticle == NULL) {
|
||||
theManager = NULL;
|
||||
G4cout << "G4ProcessManagerMessenger::SetCurrentParticle() ";
|
||||
G4cout << particleName << " not found " << endl;
|
||||
} else {
|
||||
theManager = currentParticle->GetProcessManager();
|
||||
theProcessList = theManager->GetProcessList();
|
||||
}
|
||||
return currentParticle;
|
||||
}
|
||||
|
||||
void G4ProcessManagerMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if (SetCurrentParticle()==NULL) {
|
||||
G4cout << "Particle is not selected yet !! Command ignored." << endl;
|
||||
return;
|
||||
}
|
||||
if( command == dumpCmd ){
|
||||
//Commnad /particle/process/dump
|
||||
G4int index = dumpCmd->GetNewIntValue(newValue);
|
||||
if (index <0) {
|
||||
theManager->DumpInfo();
|
||||
} else if ( index < theManager->GetProcessListLength()){
|
||||
currentProcess = (*theProcessList)(index);
|
||||
if (currentProcess == NULL) {
|
||||
G4cout << " no process at index of " << index;
|
||||
G4cout << "in the Process Vector" << endl;
|
||||
} else {
|
||||
currentProcess->DumpInfo();
|
||||
}
|
||||
} else {
|
||||
G4cout << " illegal index !!! " << endl;
|
||||
currentProcess = NULL;
|
||||
}
|
||||
|
||||
} else if( command==activateCmd ) {
|
||||
//Commnad /particle/process/Activate
|
||||
theManager->SetProcessActivation(activateCmd->GetNewIntValue(newValue), true);
|
||||
|
||||
} else if( command==inactivateCmd ) {
|
||||
//Commnad /particle/process/inactivate
|
||||
theManager->SetProcessActivation(inactivateCmd->GetNewIntValue(newValue), false);
|
||||
} else if( command==verboseCmd ) {
|
||||
//Commnad /particle/process/Verbose
|
||||
// inputstream for newValues
|
||||
const char* temp = newValue;
|
||||
istrstream is((char*)temp);
|
||||
G4int Verbose, index;
|
||||
is >>Verbose >>index;
|
||||
if (index <0) {
|
||||
theManager->SetVerboseLevel(Verbose);
|
||||
|
||||
} else if ( index < theManager->GetProcessListLength()){
|
||||
currentProcess = (*theProcessList)(index);
|
||||
if (currentProcess == NULL) {
|
||||
G4cout << " no process at index of " << index;
|
||||
G4cout << "in the Process Vector" << endl;
|
||||
} else {
|
||||
currentProcess->SetVerboseLevel(Verbose);
|
||||
}
|
||||
} else {
|
||||
G4cout << " illegal index !!! " << endl;
|
||||
currentProcess = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
G4String G4ProcessManagerMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
{
|
||||
G4String returnValue('\0');
|
||||
if(SetCurrentParticle() == NULL) {
|
||||
// no particle is selected. return null strings
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
char line[255];
|
||||
ostrstream os(line,255);
|
||||
|
||||
if( command==verboseCmd ){
|
||||
//Commnad /particle/process/Verbose
|
||||
os << theManager->GetVerboseLevel() << '\0';
|
||||
returnValue = G4String(line);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,614 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division, ASD group
|
||||
// History: first implementation, based on object model of
|
||||
// 4th Aug 1998, H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4ProcessTableMessenger.hh"
|
||||
#include "G4ProcessTable.hh"
|
||||
|
||||
// constructor //////////////////////////
|
||||
G4ProcessTable::G4ProcessTable():verboseLevel(1)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << "-- G4ProcessTable constructor --" << endl;
|
||||
}
|
||||
#endif
|
||||
fProcTblVector = new G4ProcTableVector();
|
||||
fProcNameVector = new G4ProcNameVector();
|
||||
tmpTblVector = new G4ProcTableVector();
|
||||
fProcTblMessenger = NULL;
|
||||
}
|
||||
|
||||
// copy constructor //////////////////////////
|
||||
G4ProcessTable::G4ProcessTable(const G4ProcessTable &right)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0){
|
||||
G4cerr << "-- G4ProcessTable copy constructor --" << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// destructor //////////////////////////
|
||||
G4ProcessTable::~G4ProcessTable()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << "-- G4ProcessTable destructor --" << endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
// delete all processes
|
||||
for (G4int idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
delete ((*fProcTblVector)(idxTbl))->GetProcess();
|
||||
}
|
||||
|
||||
if ( tmpTblVector != NULL) {
|
||||
tmpTblVector ->clear();
|
||||
delete tmpTblVector;
|
||||
}
|
||||
if ( fProcTblVector != NULL) {
|
||||
fProcTblVector ->clearAndDestroy();
|
||||
delete fProcTblVector;
|
||||
}
|
||||
if ( fProcNameVector != NULL) {
|
||||
fProcNameVector ->clear();
|
||||
delete fProcNameVector;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
G4UImessenger* G4ProcessTable::CreateMessenger()
|
||||
{
|
||||
if (fProcTblMessenger == NULL) {
|
||||
fProcTblMessenger = new G4ProcessTableMessenger(this);
|
||||
}
|
||||
return fProcTblMessenger;
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
void G4ProcessTable::DeleteMessenger()
|
||||
{
|
||||
if (fProcTblMessenger != NULL) {
|
||||
delete fProcTblMessenger;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
G4ProcessTable & G4ProcessTable::operator=(const G4ProcessTable &right)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0){
|
||||
G4cerr << "-- G4ProcessTable assignment operator --" << endl;
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
G4int G4ProcessTable::operator==(const G4ProcessTable &right) const
|
||||
{
|
||||
return (this == &right);
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
G4int G4ProcessTable::operator!=(const G4ProcessTable &right) const
|
||||
{
|
||||
return (this != &right);
|
||||
}
|
||||
|
||||
// Static class variable: ptr to single instance of class
|
||||
G4ProcessTable* G4ProcessTable::fProcessTable =0;
|
||||
|
||||
|
||||
//////////////////////////
|
||||
G4ProcessTable* G4ProcessTable::GetProcessTable()
|
||||
{
|
||||
static G4ProcessTable theProcessTable;
|
||||
if (!fProcessTable){
|
||||
fProcessTable = &theProcessTable;
|
||||
}
|
||||
return fProcessTable;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
G4int G4ProcessTable::Insert(G4VProcess* aProcess,
|
||||
G4ProcessManager* aProcMgr)
|
||||
{
|
||||
if ( (aProcess == NULL) || ( aProcMgr == NULL ) ){
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0){
|
||||
G4cerr << "G4ProcessTable::Insert : arguments are NULL pointer "<<endl;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << "G4ProcessTable::Insert ";
|
||||
G4cerr << " Process[" << aProcess->GetProcessName() << "]";
|
||||
G4cerr << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4int idxTbl;
|
||||
G4ProcTblElement* anElement;
|
||||
G4bool isFoundInTbl = false;
|
||||
// loop over all elements
|
||||
for (idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
anElement = (*fProcTblVector)(idxTbl);
|
||||
G4int idx;
|
||||
// check if this process is included
|
||||
if (aProcess == anElement->GetProcess()) {
|
||||
isFoundInTbl = true;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cerr << " This Process has been already registered !! ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#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){
|
||||
G4cerr << " This Process Manager has been already registered !! ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
// add the process manager into the element
|
||||
if (!isFound) {
|
||||
anElement->Insert(aProcMgr);
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cerr << " This Process Manager is registered !! ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// add this process into the table
|
||||
if (!isFoundInTbl) {
|
||||
G4ProcTblElement* newElement = new G4ProcTblElement(aProcess);
|
||||
newElement->Insert(aProcMgr);
|
||||
fProcTblVector->insert(newElement);
|
||||
// add into name vector
|
||||
if (!fProcNameVector->contains(aProcess->GetProcessName()) ){
|
||||
fProcNameVector->insert(aProcess->GetProcessName() );
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cerr << " This Process is registered !! ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return idxTbl;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
G4int G4ProcessTable::Remove( G4VProcess* aProcess,
|
||||
G4ProcessManager* aProcMgr)
|
||||
{
|
||||
if ( (aProcess == NULL) || ( aProcMgr == NULL ) ){
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0){
|
||||
G4cerr << "G4ProcessTable::Remove : arguments are NULL pointer "<<endl;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << "G4ProcessTable::Remove ";
|
||||
G4cerr << " Process[" << aProcess->GetProcessName() << "]";
|
||||
G4cerr << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4int idxTbl;
|
||||
G4ProcTblElement* anElement;
|
||||
G4bool isFoundInTbl = false;
|
||||
G4bool isFound = false;
|
||||
// loop over all elements
|
||||
for (idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
anElement = (*fProcTblVector)(idxTbl);
|
||||
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);
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cerr << " This Process Manager is removed !! ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// remove from name vector
|
||||
if (!isSameName ) {
|
||||
fProcNameVector->remove(aProcess->GetProcessName() );
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " This Process is removed !! ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return idxTbl;
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0){
|
||||
G4cerr << " This Process is not registered !! ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
G4VProcess* G4ProcessTable::FindProcess(const G4String& processName,
|
||||
const G4ProcessManager* processManager)
|
||||
const
|
||||
{
|
||||
G4int idxTblVec;
|
||||
G4bool isFound = false;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < fProcTblVector->length(); idxTblVec++){
|
||||
anElement = (*fProcTblVector)(idxTblVec);
|
||||
// check name
|
||||
if ( anElement->GetProcessName() == processName ) {
|
||||
// check if the processManage is included
|
||||
if ( anElement->Contains(processManager) ) {
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if (!isFound && verboseLevel>1){
|
||||
G4cerr << " G4ProcessTable::FindProcess :" ;
|
||||
G4cerr << " The Process[" << processName << "] is not found ";
|
||||
G4cerr << " for " << processManager->GetParticleType()->GetParticleName();
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isFound) return anElement->GetProcess();
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
///////////////
|
||||
G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find(
|
||||
G4ProcTableVector* procTblVector,
|
||||
const G4String& processName )
|
||||
{
|
||||
tmpTblVector-> clear();
|
||||
|
||||
G4int idxTblVec;
|
||||
G4bool isFound = false;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < procTblVector->length(); idxTblVec++){
|
||||
anElement = (*procTblVector)(idxTblVec);
|
||||
// check name
|
||||
if ( anElement->GetProcessName() == processName ) {
|
||||
isFound = true;
|
||||
tmpTblVector->insert(anElement);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (!isFound && verboseLevel>0){
|
||||
G4cerr << " G4ProcessTable::Find :" ;
|
||||
G4cerr << " The Process[" << processName << "] is not found ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return tmpTblVector;
|
||||
|
||||
}
|
||||
///////////////
|
||||
G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find(
|
||||
G4ProcTableVector* procTblVector,
|
||||
G4ProcessType processType )
|
||||
{
|
||||
tmpTblVector->clear();
|
||||
|
||||
G4int idxTblVec;
|
||||
G4bool isFound = false;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < procTblVector->length(); idxTblVec++){
|
||||
anElement = (*procTblVector)(idxTblVec);
|
||||
// check name
|
||||
if ( anElement->GetProcess()->GetProcessType() == processType ) {
|
||||
isFound = true;
|
||||
tmpTblVector->insert(anElement);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (!isFound && verboseLevel>0){
|
||||
G4cerr << " G4ProcessTable::Find :" ;
|
||||
G4cerr << " The Process[" << anElement->GetProcessName() << "] is not found ";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return tmpTblVector;
|
||||
|
||||
}
|
||||
|
||||
///////////////
|
||||
G4ProcessVector* G4ProcessTable::ExtractProcesses( G4ProcTableVector* procTblVector)
|
||||
{
|
||||
G4ProcessVector* procList = new G4ProcessVector();
|
||||
G4int idxTblVec;
|
||||
for ( idxTblVec = 0; idxTblVec < procTblVector->length(); idxTblVec++){
|
||||
G4ProcTblElement* anElement = (*procTblVector)(idxTblVec);
|
||||
procList->insert( anElement->GetProcess() );
|
||||
}
|
||||
return procList;
|
||||
}
|
||||
|
||||
///////////////
|
||||
G4ProcessVector* G4ProcessTable::FindProcesses()
|
||||
{
|
||||
return ExtractProcesses(fProcTblVector);
|
||||
}
|
||||
|
||||
///////////////
|
||||
G4ProcessVector* G4ProcessTable::FindProcesses( const G4ProcessManager* pManager )
|
||||
{
|
||||
G4ProcessVector* procList = pManager->GetProcessList();
|
||||
return new G4ProcessVector(*procList);
|
||||
}
|
||||
|
||||
///////////////
|
||||
G4ProcessVector* G4ProcessTable::FindProcesses( const G4String& processName )
|
||||
{
|
||||
G4ProcTableVector* pTblVector = Find(fProcTblVector, processName);
|
||||
return ExtractProcesses(pTblVector);
|
||||
}
|
||||
|
||||
///////////////
|
||||
G4ProcessVector* G4ProcessTable::FindProcesses( G4ProcessType processType)
|
||||
{
|
||||
G4ProcTableVector* pTblVector = Find(fProcTblVector, processType);
|
||||
return ExtractProcesses(pTblVector);
|
||||
}
|
||||
|
||||
///////////////
|
||||
void G4ProcessTable::SetProcessActivation( const G4String& processName,
|
||||
G4bool fActive )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " G4ProcessTable::SetProcessActivation:" ;
|
||||
G4cerr << " The Process[" << processName << "] "<< endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4ProcTableVector* pTblVector = Find(fProcTblVector, processName);
|
||||
G4int idxTblVec;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < pTblVector->length(); idxTblVec++){
|
||||
anElement = (*pTblVector)(idxTblVec);
|
||||
G4VProcess* process = anElement->GetProcess();
|
||||
for (G4int idx = 0 ; idx < anElement->Length(); idx++) {
|
||||
G4ProcessManager* manager = anElement->GetProcessManager(idx);
|
||||
manager->SetProcessActivation(process, fActive);
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " for " << manager->GetParticleType()->GetParticleName();
|
||||
G4cerr << " Index = " << manager->GetProcessIndex(process);
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////
|
||||
void G4ProcessTable::SetProcessActivation(
|
||||
const G4String& processName,
|
||||
G4ProcessManager* processManager,
|
||||
G4bool fActive )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " G4ProcessTable::SetProcessActivation:" ;
|
||||
G4cerr << " The Process[" << processName << "] "<< endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4VProcess* process = FindProcess( processName, processManager);
|
||||
if ( process != NULL) {
|
||||
processManager->SetProcessActivation(process, fActive);
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " for " << processManager->GetParticleType()->GetParticleName();
|
||||
G4cerr << " Index = " << processManager->GetProcessIndex(process);
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
void G4ProcessTable::SetProcessActivation( G4ProcessType processType,
|
||||
G4bool fActive )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " G4ProcessTable::SetProcessActivation:" ;
|
||||
G4cerr << " The ProcessType[" << processType << "] "<< endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4ProcTableVector* pTblVector = Find(fProcTblVector, processType);
|
||||
G4int idxTblVec;
|
||||
G4ProcTblElement* anElement;
|
||||
for ( idxTblVec = 0; idxTblVec < pTblVector->length(); idxTblVec++){
|
||||
anElement = (*pTblVector)(idxTblVec);
|
||||
G4VProcess* process = anElement->GetProcess();
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " The Process[" << process->GetProcessName()<< "] "<< endl;
|
||||
}
|
||||
#endif
|
||||
for (G4int idx = 0 ; idx < anElement->Length(); idx++) {
|
||||
G4ProcessManager* manager = anElement->GetProcessManager(idx);
|
||||
manager->SetProcessActivation(process, fActive);
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " for " << manager->GetParticleType()->GetParticleName();
|
||||
G4cerr << " Index = " << manager->GetProcessIndex(process);
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////
|
||||
void G4ProcessTable::SetProcessActivation(
|
||||
G4ProcessType processType,
|
||||
G4ProcessManager* processManager,
|
||||
G4bool fActive )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>1){
|
||||
G4cerr << " G4ProcessTable::SetProcessActivation:" ;
|
||||
G4cerr << " The ProcessType[" << processType << "] "<< endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4ProcessVector* procList = processManager->GetProcessList();
|
||||
for (G4int idx = 0; idx < procList->length(); idx++) {
|
||||
G4VProcess* process = (*procList)(idx);
|
||||
if ( process->GetProcessType() == processType) {
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////
|
||||
void G4ProcessTable::DumpInfo(G4VProcess* process,
|
||||
G4ParticleDefinition* particle)
|
||||
{
|
||||
G4int idxTbl;
|
||||
G4ProcTblElement* anElement;
|
||||
G4bool isFoundInTbl = false;
|
||||
G4ProcessManager* manager;
|
||||
G4int idx;
|
||||
// loop over all elements
|
||||
for (idxTbl =0; idxTbl <fProcTblVector->length(); idxTbl++){
|
||||
anElement = (*fProcTblVector)(idxTbl);
|
||||
if (process == anElement->GetProcess() ){
|
||||
if (particle==NULL) {
|
||||
isFoundInTbl = true;
|
||||
break;
|
||||
} else {
|
||||
for (idx=0; idx<anElement->Length(); idx++){
|
||||
manager = anElement->GetProcessManager(idx);
|
||||
if (particle == manager->GetParticleType()) {
|
||||
isFoundInTbl = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isFoundInTbl ) return;
|
||||
|
||||
G4int tmpVerbose = process->GetVerboseLevel();
|
||||
process->SetVerboseLevel(verboseLevel);
|
||||
process->DumpInfo();
|
||||
process->SetVerboseLevel(tmpVerbose);
|
||||
if (particle==NULL) {
|
||||
for (idx=0; idx<anElement->Length(); idx++){
|
||||
manager = anElement->GetProcessManager(idx);
|
||||
G4cout << " for " << manager->GetParticleType()->GetParticleName();
|
||||
G4cout << endl;
|
||||
if (verboseLevel >2) manager->DumpInfo();
|
||||
}
|
||||
} else {
|
||||
G4cout << " for " << manager->GetParticleType()->GetParticleName();
|
||||
G4cout << endl;
|
||||
if (verboseLevel >2) manager->DumpInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ProcessTableMessenger.cc
|
||||
//
|
||||
// Description:
|
||||
// This is a messenger class to interface to exchange information
|
||||
// between ProcessTable and UI.
|
||||
//
|
||||
//
|
||||
// History:
|
||||
// 15 Aug. 1998, H. Kurashige
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#include "G4ProcessTableMessenger.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ProcessTable.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include <iomanip.h>
|
||||
#include <rw/ctoken.h>
|
||||
#include <rw/rstream.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <Strstrea.h>
|
||||
#else
|
||||
# include <strstream.h>
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////
|
||||
G4int G4ProcessTableMessenger::NumberOfProcessType = 10;
|
||||
|
||||
//////////////////////////
|
||||
G4ProcessTableMessenger::G4ProcessTableMessenger(G4ProcessTable* pTable)
|
||||
:theProcessTable(pTable)
|
||||
{
|
||||
currentProcessTypeName = "all";
|
||||
currentProcessName = "all";
|
||||
currentParticleName = "all";
|
||||
|
||||
//Commnad /particle/process
|
||||
thisDirectory = new G4UIdirectory("/process/");
|
||||
thisDirectory->SetGuidance("Process Table control commands.");
|
||||
|
||||
|
||||
//Commnad /particle/process/list
|
||||
listCmd = new G4UIcmdWithAString("/process/list",this);
|
||||
listCmd->SetGuidance("List up process names");
|
||||
listCmd->SetGuidance(" list [type] ");
|
||||
listCmd->SetGuidance(" type: process type [all:for all proceeses]");
|
||||
listCmd->SetParameterName("type", true);
|
||||
listCmd->SetDefaultValue("all");
|
||||
SetNumberOfProcessType();
|
||||
|
||||
G4String candidates = "all";
|
||||
for (G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) {
|
||||
candidates += " " +
|
||||
G4VProcess::GetProcessTypeName(G4ProcessType(idx));
|
||||
}
|
||||
listCmd->SetCandidates(candidates);
|
||||
|
||||
//Commnad /particle/process/Verbose
|
||||
verboseCmd = new G4UIcmdWithAnInteger("/process/verbose",this);
|
||||
verboseCmd->SetGuidance("Set Verbose Level for Process Table");
|
||||
verboseCmd->SetGuidance(" verbose [level]");
|
||||
verboseCmd->SetGuidance(" level: verbose level");
|
||||
verboseCmd->SetParameterName("verbose", true);
|
||||
verboseCmd->SetDefaultValue(1);
|
||||
verboseCmd->SetRange("verbose >=0");
|
||||
|
||||
//Commnad /particle/process/dump
|
||||
dumpCmd = new G4UIcommand("/process/dump",this);
|
||||
dumpCmd->SetGuidance("Dump process information");
|
||||
dumpCmd->SetGuidance(" dump name [particle]");
|
||||
dumpCmd->SetGuidance(" name: process name or type name");
|
||||
dumpCmd->SetGuidance(" particle: particle name [all: for all particles]");
|
||||
G4UIparameter* param = new G4UIparameter("procName",'s',false);
|
||||
dumpCmd->SetParameter(param);
|
||||
param = new G4UIparameter("particle",'s',true);
|
||||
param->SetDefaultValue("all");
|
||||
dumpCmd->SetParameter(param);
|
||||
|
||||
//Commnad /particle/process/activate
|
||||
activateCmd = new G4UIcommand("/process/activate",this);
|
||||
activateCmd->SetGuidance("Activate processes ");
|
||||
activateCmd->SetGuidance(" Activate name [particle]");
|
||||
activateCmd->SetGuidance(" name: process name or type name");
|
||||
activateCmd->SetGuidance(" particle: particle name [all: for all particles]");
|
||||
param = new G4UIparameter("procName",'s',false);
|
||||
activateCmd->SetParameter(param);
|
||||
param = new G4UIparameter("particle",'s',true);
|
||||
param->SetDefaultValue("all");
|
||||
activateCmd->SetParameter(param);
|
||||
|
||||
//Commnad /particle/process/inactivate
|
||||
inactivateCmd = new G4UIcommand("/process/inactivate",this);
|
||||
inactivateCmd->SetGuidance("Inactivate process ");
|
||||
inactivateCmd->SetGuidance("Inactivate processes ");
|
||||
inactivateCmd->SetGuidance(" Inactivate name [particle]");
|
||||
inactivateCmd->SetGuidance(" name: process name or type name");
|
||||
inactivateCmd->SetGuidance(" particle: particle name [all: for all particles]");
|
||||
param = new G4UIparameter("procName",'s',false);
|
||||
inactivateCmd->SetParameter(param);
|
||||
param = new G4UIparameter("particle",'s',true);
|
||||
param->SetDefaultValue("all");
|
||||
inactivateCmd->SetParameter(param);
|
||||
}
|
||||
|
||||
//////////////////
|
||||
G4ProcessTableMessenger::~G4ProcessTableMessenger()
|
||||
{
|
||||
delete activateCmd;
|
||||
delete inactivateCmd;
|
||||
delete verboseCmd;
|
||||
delete dumpCmd;
|
||||
delete listCmd;
|
||||
delete thisDirectory;
|
||||
}
|
||||
|
||||
///////////////
|
||||
void G4ProcessTableMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
G4ProcessTable::G4ProcNameVector* procNameVector
|
||||
= theProcessTable->GetNameList();
|
||||
G4ProcessTable::G4ProcTableVector* pTblVector
|
||||
= theProcessTable->GetProcTableVector();
|
||||
G4int idx;
|
||||
|
||||
G4ProcessVector* tmpVector;
|
||||
G4int type = -1;
|
||||
|
||||
if( command == listCmd ){
|
||||
//Commnad /process/list
|
||||
type = -1;
|
||||
if (newValue == "all") {
|
||||
currentProcessTypeName = newValue;
|
||||
} else {
|
||||
type = GetProcessType(newValue);
|
||||
if (type <0) {
|
||||
G4cout << " illegal type !!! " << endl;
|
||||
} else {
|
||||
currentProcessTypeName = newValue;
|
||||
}
|
||||
}
|
||||
G4int counter = 0;
|
||||
for (idx = 0; idx < procNameVector->length(); idx++) {
|
||||
G4String name = (*procNameVector)(idx);
|
||||
tmpVector = theProcessTable->FindProcesses(name);
|
||||
if ( (type <0) || ( ((*tmpVector)(0)->GetProcessType()) == type) ) {
|
||||
if ( counter%4 != 0) G4cout << ",";
|
||||
G4cout << setw(19) << name;
|
||||
if ((counter++)%4 == 3) {
|
||||
G4cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
G4cout << endl;
|
||||
delete tmpVector;
|
||||
//Commnad /process/list
|
||||
|
||||
} else if( command==verboseCmd ) {
|
||||
//Commnad /process/verbose
|
||||
theProcessTable->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
|
||||
//Commnad /process/verbose
|
||||
|
||||
} else {
|
||||
RWCTokenizer next( newValue );
|
||||
|
||||
// check 1st argument
|
||||
currentProcessName = next();
|
||||
G4bool isNameFound = false;
|
||||
G4bool isProcName = false;
|
||||
if ( procNameVector->contains(currentProcessName) ){
|
||||
isNameFound = true;
|
||||
isProcName = true;
|
||||
} else {
|
||||
type = GetProcessType(currentProcessName);
|
||||
if (type >=0) {
|
||||
isNameFound = true;
|
||||
} else {
|
||||
// no processes with specifed name
|
||||
G4cout << " illegal process (or type) name " << endl;
|
||||
currentProcessName = "";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// check 2nd argument
|
||||
currentParticleName = next();
|
||||
G4bool isParticleFound = false;
|
||||
G4ParticleDefinition* currentParticle = NULL;
|
||||
if ( currentParticleName == "all" ) {
|
||||
isParticleFound = true;
|
||||
|
||||
} else {
|
||||
isParticleFound = G4ParticleTable::GetParticleTable()->contains(currentParticleName);
|
||||
if (isParticleFound) {
|
||||
currentParticle = G4ParticleTable::GetParticleTable()->FindParticle(currentParticleName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( !isParticleFound ) {
|
||||
// no particle with specifed name
|
||||
G4cout << " illegal particle name " << endl;
|
||||
currentParticleName = "";
|
||||
return;
|
||||
}
|
||||
|
||||
if( command==dumpCmd ) {
|
||||
// process/dump
|
||||
if (isProcName) {
|
||||
tmpVector = theProcessTable->FindProcesses(currentProcessName);
|
||||
} else {
|
||||
tmpVector = theProcessTable->FindProcesses(G4ProcessType(type));
|
||||
}
|
||||
for (G4int i=0; i<tmpVector->length(); i++) {
|
||||
theProcessTable->DumpInfo( (*tmpVector)(i), currentParticle );
|
||||
}
|
||||
delete tmpVector;
|
||||
// process/dump
|
||||
|
||||
} else if ( (command==activateCmd) || (command==inactivateCmd)) {
|
||||
// process/activate , inactivate
|
||||
G4bool fActive = (command==activateCmd);
|
||||
if (isProcName) {
|
||||
if ( currentParticle == NULL ) {
|
||||
theProcessTable->SetProcessActivation(currentProcessName,
|
||||
fActive);
|
||||
} else {
|
||||
theProcessTable->SetProcessActivation(currentProcessName,
|
||||
currentParticle,
|
||||
fActive);
|
||||
}
|
||||
} else {
|
||||
if ( currentParticle == NULL ) {
|
||||
theProcessTable->SetProcessActivation(G4ProcessType(type),
|
||||
fActive);
|
||||
} else {
|
||||
theProcessTable->SetProcessActivation(G4ProcessType(type),
|
||||
currentParticle,
|
||||
fActive);
|
||||
}
|
||||
}
|
||||
// process/activate , inactivate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
G4String G4ProcessTableMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
{
|
||||
G4ProcessTable::G4ProcNameVector* procNameVector
|
||||
= theProcessTable->GetNameList();
|
||||
|
||||
G4String candidates;
|
||||
G4String returnValue('\0');
|
||||
|
||||
char line[255];
|
||||
ostrstream os(line,255);
|
||||
G4UIparameter * param;
|
||||
|
||||
G4int idx;
|
||||
|
||||
if( command==verboseCmd ){
|
||||
//Commnad /process/verbose
|
||||
os << theProcessTable->GetVerboseLevel() << '\0';
|
||||
returnValue = G4String(line);
|
||||
|
||||
} else if ( command==listCmd ){
|
||||
//Commnad /process/list
|
||||
candidates = "all";
|
||||
for (idx = 0; idx < NumberOfProcessType ; idx ++ ) {
|
||||
candidates += " " +
|
||||
G4VProcess::GetProcessTypeName(G4ProcessType(idx));
|
||||
}
|
||||
listCmd->SetCandidates(candidates);
|
||||
returnValue = currentProcessTypeName;
|
||||
|
||||
} else {
|
||||
//Commnad /process/dump, activate, inactivate
|
||||
// process name
|
||||
param = command->GetParameter(0);
|
||||
candidates = "";
|
||||
for (idx = 0; idx < procNameVector->length() ; idx ++ ) {
|
||||
candidates += " " + (*procNameVector)(idx);
|
||||
}
|
||||
param->SetParameterCandidates(candidates);
|
||||
// particle name
|
||||
param = command->GetParameter(1);
|
||||
candidates = "all";
|
||||
G4ParticleTable::G4PTblDicIterator *piter
|
||||
= G4ParticleTable::GetParticleTable()->GetIterator();
|
||||
piter -> reset();
|
||||
while( (*piter)() ){
|
||||
G4ParticleDefinition *particle = piter->value();
|
||||
candidates += " " + particle->GetParticleName();
|
||||
}
|
||||
param->SetParameterCandidates(candidates);
|
||||
|
||||
returnValue = currentProcessName + " " + currentParticleName;
|
||||
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/////////////////
|
||||
G4String G4ProcessTableMessenger::GetProcessTypeName(G4ProcessType aType) const
|
||||
{
|
||||
return G4VProcess::GetProcessTypeName(aType);
|
||||
}
|
||||
|
||||
/////////////////
|
||||
G4int G4ProcessTableMessenger::GetProcessType(const G4String& aTypeName) const
|
||||
{
|
||||
G4int type = -1;
|
||||
for (G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) {
|
||||
if (aTypeName == G4VProcess::GetProcessTypeName(G4ProcessType(idx)) ) {
|
||||
type = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/////////////////
|
||||
void G4ProcessTableMessenger::SetNumberOfProcessType()
|
||||
{
|
||||
G4bool isFoundEndMark = false;
|
||||
G4int idx;
|
||||
for (idx = 0; idx < 1000 ; idx ++ ) {
|
||||
G4String typeName = G4VProcess::GetProcessTypeName(G4ProcessType(idx));
|
||||
if ( isFoundEndMark = typeName.contains("---")) break;
|
||||
}
|
||||
if ( isFoundEndMark ) {
|
||||
NumberOfProcessType = idx;
|
||||
} else {
|
||||
G4Exception("G4ProcessTableMessenger::SetNumberOfProcessType(): No End Mark for G4VProcess::GetProcessTypeName() ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VContinuousDiscreteProcess.hh"
|
||||
G4VContinuousDiscreteProcess::G4VContinuousDiscreteProcess()
|
||||
:G4VProcess("No Name Discrete Process")
|
||||
{
|
||||
G4Exception("G4VContinuousDiscreteProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4VContinuousDiscreteProcess::G4VContinuousDiscreteProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4VContinuousDiscreteProcess::~G4VContinuousDiscreteProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VContinuousDiscreteProcess::G4VContinuousDiscreteProcess(G4VContinuousDiscreteProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VContinuousProcess.hh"
|
||||
G4VContinuousProcess::G4VContinuousProcess()
|
||||
:G4VProcess("No Name Continuous Process")
|
||||
{
|
||||
G4Exception("G4VContinuousProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4VContinuousProcess::G4VContinuousProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4VContinuousProcess::~G4VContinuousProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VContinuousProcess::G4VContinuousProcess(G4VContinuousProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VDiscreteProcess.hh"
|
||||
G4VDiscreteProcess::G4VDiscreteProcess()
|
||||
:G4VProcess("No Name Discrete Process")
|
||||
{
|
||||
G4Exception("G4VDiscreteProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4VDiscreteProcess::G4VDiscreteProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4VDiscreteProcess::~G4VDiscreteProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VDiscreteProcess::G4VDiscreteProcess(G4VDiscreteProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
// removed thePhysicsTable 02 Aug. 1998 H.Kurashige
|
||||
// Modified DumpInfo 15 Aug. 1998 H.Kurashige
|
||||
|
||||
#include "G4PhysicsTable.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4ElementTable.hh"
|
||||
#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),
|
||||
theNumberOfInteractionLengthLeft(-1.0),
|
||||
currentInteractionLength(-1.0),
|
||||
verboseLevel(0)
|
||||
{
|
||||
pParticleChange = &aParticleChange;
|
||||
}
|
||||
|
||||
G4VProcess::~G4VProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VProcess::G4VProcess(G4VProcess& right):
|
||||
pParticleChange(NULL),
|
||||
theProcessName(right.theProcessName),
|
||||
theProcessType(right.theProcessType),
|
||||
theNumberOfInteractionLengthLeft(-1.0),
|
||||
currentInteractionLength(-1.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void G4VProcess::SubtractNumberOfInteractionLengthLeft(
|
||||
G4double previousStepSize )
|
||||
{
|
||||
if (currentInteractionLength>0.0) {
|
||||
theNumberOfInteractionLengthLeft -= previousStepSize/currentInteractionLength;
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0) {
|
||||
G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()";
|
||||
G4cerr << " [" << theProcessName << "]" <<endl;
|
||||
G4cerr << " currentInteractionLength = " << currentInteractionLength/cm << " [cm]";
|
||||
G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]";
|
||||
G4cerr << endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft() negative currentInteractionLength" );
|
||||
}
|
||||
}
|
||||
|
||||
void G4VProcess::StartTracking()
|
||||
{
|
||||
currentInteractionLength = -1.0;
|
||||
theNumberOfInteractionLengthLeft = -1.0;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2) {
|
||||
G4cerr << "G4VProcess::StartTracking() [" << theProcessName << "]" <<endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VProcess::EndTracking()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2) {
|
||||
G4cerr << "G4VProcess::EndTracking() [" << theProcessName << "]" <<endl;
|
||||
}
|
||||
#endif
|
||||
theNumberOfInteractionLengthLeft = -1.0;
|
||||
currentInteractionLength = -1.0;
|
||||
}
|
||||
|
||||
|
||||
G4String G4VProcess::GetProcessTypeName(G4ProcessType aType )
|
||||
{
|
||||
if (aType == fNotDefined) {
|
||||
return "NotDefined";
|
||||
} else if (aType == fTransportation ) {
|
||||
return "Transportation";
|
||||
} else if (aType == fElectromagnetic ) {
|
||||
return "Electromagnetic";
|
||||
} else if (aType == fOptical ) {
|
||||
return "Optical";
|
||||
} else if (aType == fHadronic ) {
|
||||
return "Hadronic";
|
||||
} else if (aType == fPhotolepton_hadron ) {
|
||||
return "Photolepton_hadron";
|
||||
} else if (aType == fDecay ) {
|
||||
return "Decay";
|
||||
} else if (aType == fGeneral ) {
|
||||
return "General";
|
||||
} else if (aType == fParameterisation ) {
|
||||
return "Parameterisation";
|
||||
} else if (aType == fUserDefined ) {
|
||||
return "UserDefined";
|
||||
} else {
|
||||
return "------"; // Do not modify this end mark !!!!
|
||||
}
|
||||
}
|
||||
|
||||
G4VProcess & G4VProcess::operator=(const G4VProcess &)
|
||||
{
|
||||
G4Exception("G4VProcess::assignment operator is called");
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4int G4VProcess::operator==(const G4VProcess &right) const
|
||||
{
|
||||
return (this == (G4VProcess *) &right);
|
||||
}
|
||||
|
||||
G4int G4VProcess::operator!=(const G4VProcess &right) const
|
||||
{
|
||||
return (this != (G4VProcess *) &right);
|
||||
}
|
||||
|
||||
void G4VProcess::DumpInfo() const
|
||||
{
|
||||
G4cout << "Process Name " << theProcessName ;
|
||||
G4cout << " : Type[" << GetProcessTypeName(theProcessType) << "]"<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VRestContinuousDiscreteProcess.hh"
|
||||
G4VRestContinuousDiscreteProcess::G4VRestContinuousDiscreteProcess()
|
||||
:G4VProcess("No Name Discrete Process")
|
||||
{
|
||||
G4Exception("G4VRestContinuousDiscreteProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4VRestContinuousDiscreteProcess::G4VRestContinuousDiscreteProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4VRestContinuousDiscreteProcess::~G4VRestContinuousDiscreteProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VRestContinuousDiscreteProcess::G4VRestContinuousDiscreteProcess(G4VRestContinuousDiscreteProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VRestContinuousProcess.hh"
|
||||
G4VRestContinuousProcess::G4VRestContinuousProcess()
|
||||
:G4VProcess("No Name Discrete Process")
|
||||
{
|
||||
G4Exception("G4VRestContinuousProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4VRestContinuousProcess::G4VRestContinuousProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4VRestContinuousProcess::~G4VRestContinuousProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VRestContinuousProcess::G4VRestContinuousProcess(G4VRestContinuousProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VRestDiscreteProcess.hh"
|
||||
G4VRestDiscreteProcess::G4VRestDiscreteProcess()
|
||||
:G4VProcess("No Name Discrete Process")
|
||||
{
|
||||
G4Exception("G4VRestDiscreteProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4VRestDiscreteProcess::G4VRestDiscreteProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4VRestDiscreteProcess::~G4VRestDiscreteProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VRestDiscreteProcess::G4VRestDiscreteProcess(G4VRestDiscreteProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// 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 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VRestProcess.hh"
|
||||
G4VRestProcess::G4VRestProcess()
|
||||
:G4VProcess("No Name Rest Process")
|
||||
{
|
||||
G4Exception("G4VRestProcess:: default constructor is called");
|
||||
}
|
||||
|
||||
G4VRestProcess::G4VRestProcess(const G4String& aName , G4ProcessType aType)
|
||||
: G4VProcess(aName, aType)
|
||||
{
|
||||
}
|
||||
|
||||
G4VRestProcess::~G4VRestProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VRestProcess::G4VRestProcess(G4VRestProcess& right)
|
||||
: G4VProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user