00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef G4VITRESTDISCRETEPROCESS_H
00042 #define G4VITRESTDISCRETEPROCESS_H
00043
00044 #include <CLHEP/Units/SystemOfUnits.h>
00045
00046 #include "G4VITProcess.hh"
00047
00052 class G4VITRestDiscreteProcess : public G4VITProcess
00053 {
00054
00055
00056 public:
00057
00058 G4VITRestDiscreteProcess(const G4String& ,
00059 G4ProcessType aType = fNotDefined );
00060 G4VITRestDiscreteProcess(G4VITRestDiscreteProcess &);
00061
00062 virtual ~G4VITRestDiscreteProcess();
00063
00064 public :
00065 virtual G4double PostStepGetPhysicalInteractionLength(
00066 const G4Track& track,
00067 G4double previousStepSize,
00068 G4ForceCondition* condition
00069 );
00070
00071 virtual G4VParticleChange* PostStepDoIt(
00072 const G4Track& ,
00073 const G4Step&
00074 );
00075
00076 virtual G4double AtRestGetPhysicalInteractionLength(
00077 const G4Track& ,
00078 G4ForceCondition*
00079 );
00080
00081 virtual G4VParticleChange* AtRestDoIt(
00082 const G4Track& ,
00083 const G4Step&
00084 );
00085
00086
00087 virtual G4double AlongStepGetPhysicalInteractionLength(
00088 const G4Track&,
00089 G4double ,
00090 G4double ,
00091 G4double& ,
00092 G4GPILSelection*
00093 ){ return -1.0; }
00094
00095
00096 virtual G4VParticleChange* AlongStepDoIt(
00097 const G4Track& ,
00098 const G4Step&
00099 ) {return 0;}
00100
00101 protected:
00102 virtual G4double GetMeanFreePath(const G4Track& aTrack,
00103 G4double previousStepSize,
00104 G4ForceCondition* condition
00105 )=0;
00106
00107
00108
00109 virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0;
00110
00111
00112
00113
00114
00115
00116 private:
00117
00118 G4VITRestDiscreteProcess();
00119 G4VITRestDiscreteProcess & operator=(const G4VITRestDiscreteProcess &right);
00120
00121 };
00122
00123
00124
00125
00126 inline
00127 G4double G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength(
00128 const G4Track& track,
00129 G4double previousStepSize,
00130 G4ForceCondition* condition
00131 )
00132 {
00133 if ( (previousStepSize < 0.0) || (fpState->theNumberOfInteractionLengthLeft<=0.0)) {
00134
00135 ResetNumberOfInteractionLengthLeft();
00136 } else if ( previousStepSize > 0.0) {
00137
00138 SubtractNumberOfInteractionLengthLeft(previousStepSize);
00139 } else {
00140
00141
00142 }
00143
00144
00145 *condition = NotForced;
00146
00147
00148 fpState->currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
00149
00150 G4double value;
00151 if (fpState->currentInteractionLength <DBL_MAX) {
00152 value = fpState->theNumberOfInteractionLengthLeft * (fpState->currentInteractionLength);
00153 } else {
00154 value = DBL_MAX;
00155 }
00156 #ifdef G4VERBOSE
00157 if (verboseLevel>1){
00158 G4cout << "G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength ";
00159 G4cout << "[ " << GetProcessName() << "]" <<G4endl;
00160 track.GetDynamicParticle()->DumpInfo();
00161 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
00162 G4cout << "InteractionLength= " << value/CLHEP::cm <<"[cm] " <<G4endl;
00163 }
00164 #endif
00165 return value;
00166 }
00167
00168 inline G4VParticleChange* G4VITRestDiscreteProcess::PostStepDoIt(
00169 const G4Track& ,
00170 const G4Step&
00171 )
00172 {
00173
00174 ClearNumberOfInteractionLengthLeft();
00175
00176 return pParticleChange;
00177 }
00178
00179 inline G4double G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength(
00180 const G4Track& track,
00181 G4ForceCondition* condition
00182 )
00183 {
00184
00185 ResetNumberOfInteractionLengthLeft();
00186
00187
00188 *condition = NotForced;
00189
00190
00191 fpState->currentInteractionLength = GetMeanLifeTime(track, condition);
00192
00193 #ifdef G4VERBOSE
00194 if ((fpState->currentInteractionLength <0.0) || (verboseLevel>2)){
00195 G4cout << "G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength ";
00196 G4cout << "[ " << GetProcessName() << "]" <<G4endl;
00197 track.GetDynamicParticle()->DumpInfo();
00198 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
00199 G4cout << "MeanLifeTime = " << fpState->currentInteractionLength/CLHEP::ns << "[ns]" <<G4endl;
00200 }
00201 #endif
00202
00203 return fpState->theNumberOfInteractionLengthLeft * (fpState->currentInteractionLength);
00204 }
00205
00206
00207 inline G4VParticleChange* G4VITRestDiscreteProcess::AtRestDoIt(
00208 const G4Track&,
00209 const G4Step&
00210 )
00211 {
00212
00213 ClearNumberOfInteractionLengthLeft();
00214
00215 return pParticleChange;
00216 }
00217
00218
00219
00220 #endif
00221
00222