Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4VRestContinuousDiscreteProcess << 27 // 23 // 28 // Class description: << 24 // $Id: G4VRestContinuousDiscreteProcess.hh,v 1.7 2003/03/25 06:22:23 kurasige Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-cand-01 $ >> 26 // >> 27 // >> 28 // ------------------------------------------------------------ >> 29 // GEANT 4 class header file >> 30 // >> 31 // >> 32 // Class Description >> 33 // Abstract class which defines the public behavior of >> 34 // continuous and discrete physics interactions. >> 35 // >> 36 // ------------------------------------------------------------ >> 37 // New Physics scheme 8 Mar. 1997 H.Kurahige >> 38 // ------------------------------------------------------------ >> 39 // fix bugs in GetGPILSelection() 24 Jan. 1998 H.Kurashige >> 40 // modified for new ParticleChange 12 Mar. 1998 H.Kurashige >> 41 // Fixed a bug in PostStepGetPhysicalInteractionLength >> 42 // 15 Apr. 2002 H.Kurashige 29 // 43 // 30 // Abstract class which defines the public beh << 31 // continuous and discrete physics interaction << 32 44 33 // Authors: << 45 #ifndef G4VRestContinuousDiscreteProcess_h 34 // - 2 December 1995, G.Cosmo - First implemen << 46 #define G4VRestContinuousDiscreteProcess_h 1 35 // - 8 January 1997, H.Kurashige - New Physics << 36 // ------------------------------------------- << 37 #ifndef G4VRestContinuousDiscreteProcess_hh << 38 #define G4VRestContinuousDiscreteProcess_hh 1 << 39 47 40 #include "globals.hh" 48 #include "globals.hh" 41 #include "G4ios.hh" 49 #include "G4ios.hh" 42 50 43 #include "G4VProcess.hh" 51 #include "G4VProcess.hh" 44 52 45 class G4VRestContinuousDiscreteProcess : publi 53 class G4VRestContinuousDiscreteProcess : public G4VProcess 46 { 54 { >> 55 // Abstract class which defines the public behavior of >> 56 // discrete physics interactions. 47 public: 57 public: 48 58 49 G4VRestContinuousDiscreteProcess(const G4S << 59 G4VRestContinuousDiscreteProcess(const G4String& , 50 G4Process << 60 G4ProcessType aType = fNotDefined ); 51 G4VRestContinuousDiscreteProcess(G4VRestCo << 61 G4VRestContinuousDiscreteProcess(G4VRestContinuousDiscreteProcess &); >> 62 >> 63 virtual ~G4VRestContinuousDiscreteProcess(); 52 64 53 virtual ~G4VRestContinuousDiscreteProcess( << 54 65 55 G4VRestContinuousDiscreteProcess& operator << 66 public :// with description >> 67 virtual G4double PostStepGetPhysicalInteractionLength( >> 68 const G4Track& track, >> 69 G4double previousStepSize, >> 70 G4ForceCondition* condition >> 71 ); >> 72 >> 73 virtual G4VParticleChange* PostStepDoIt( >> 74 const G4Track& , >> 75 const G4Step& >> 76 ); 56 77 57 virtual G4double PostStepGetPhysicalIntera << 78 virtual G4double AlongStepGetPhysicalInteractionLength( 58 const G4Track& tr 79 const G4Track& track, >> 80 G4double previousStepSize, >> 81 G4double currentMinimumStep, >> 82 G4double& currentSafety, >> 83 G4GPILSelection* selection >> 84 ); >> 85 >> 86 virtual G4VParticleChange* AlongStepDoIt( >> 87 const G4Track& , >> 88 const G4Step& >> 89 ); >> 90 >> 91 virtual G4double AtRestGetPhysicalInteractionLength( >> 92 const G4Track& , >> 93 G4ForceCondition* >> 94 ); >> 95 >> 96 virtual G4VParticleChange* AtRestDoIt( >> 97 const G4Track& , >> 98 const G4Step& >> 99 ); >> 100 >> 101 protected: // with description >> 102 virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0; >> 103 // Calculates the mean life-time (i.e. for decays) of the >> 104 // particle at rest due to the occurence of the given process, >> 105 // or converts the probability of interaction (i.e. for >> 106 // annihilation) into the life-time of the particle for the >> 107 // occurence of the given process. >> 108 >> 109 virtual G4double GetContinuousStepLimit(const G4Track& aTrack, >> 110 G4double previousStepSize, >> 111 G4double currentMinimumStep, >> 112 G4double& currentSafety >> 113 )=0; >> 114 private: >> 115 // this is the returnd value of G4GPILSelection in >> 116 // the arguments of AlongStepGPIL() >> 117 G4GPILSelection valueGPILSelection; >> 118 >> 119 protected: // with description >> 120 // these two methods are set/get methods for valueGPILSelection >> 121 void SetGPILSelection(G4GPILSelection selection) >> 122 { valueGPILSelection = selection;}; >> 123 >> 124 G4GPILSelection GetGPILSelection() const{return valueGPILSelection;}; >> 125 >> 126 protected: // with description >> 127 virtual G4double GetMeanFreePath(const G4Track& aTrack, 59 G4double previo 128 G4double previousStepSize, 60 G4ForceCondition* 129 G4ForceCondition* condition 61 ); << 130 )=0; >> 131 // Calculates from the macroscopic cross section a mean >> 132 // free path, the value is returned in units of distance. >> 133 >> 134 private: >> 135 // hide default constructor and assignment operator as private >> 136 G4VRestContinuousDiscreteProcess(); >> 137 G4VRestContinuousDiscreteProcess & operator=(const G4VRestContinuousDiscreteProcess &right); 62 138 63 virtual G4VParticleChange* PostStepDoIt( << 139 }; 64 const G4Track& , << 140 65 const G4Step& << 141 // ----------------------------------------- 66 ); << 142 // inlined function members implementation >> 143 // ----------------------------------------- >> 144 #include "G4Step.hh" >> 145 #include "G4Track.hh" >> 146 #include "G4MaterialTable.hh" >> 147 #include "G4VParticleChange.hh" >> 148 >> 149 inline G4double G4VRestContinuousDiscreteProcess::AtRestGetPhysicalInteractionLength( >> 150 const G4Track& track, >> 151 G4ForceCondition* condition >> 152 ) >> 153 { >> 154 // beggining of tracking >> 155 ResetNumberOfInteractionLengthLeft(); >> 156 >> 157 // condition is set to "Not Forced" >> 158 *condition = NotForced; 67 159 68 virtual G4double AlongStepGetPhysicalInter << 160 // get mean life time >> 161 currentInteractionLength = GetMeanLifeTime(track, condition); >> 162 >> 163 #ifdef G4VERBOSE >> 164 if ((currentInteractionLength <0.0) || (verboseLevel>2)){ >> 165 G4cout << "G4VRestContinuousDiscreteProcess::AtRestGetPhysicalInteractionLength "; >> 166 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 167 track.GetDynamicParticle()->DumpInfo(); >> 168 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 169 G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<G4endl; >> 170 } >> 171 #endif >> 172 >> 173 return theNumberOfInteractionLengthLeft * currentInteractionLength; >> 174 } >> 175 >> 176 >> 177 inline G4VParticleChange* G4VRestContinuousDiscreteProcess::AtRestDoIt( >> 178 const G4Track&, >> 179 const G4Step& >> 180 ) >> 181 { >> 182 // clear NumberOfInteractionLengthLeft >> 183 ClearNumberOfInteractionLengthLeft(); >> 184 >> 185 return pParticleChange; >> 186 } >> 187 >> 188 inline G4double G4VRestContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength( 69 const G4Track& tr 189 const G4Track& track, 70 G4double previous << 190 G4double previousStepSize, 71 G4double currentM << 191 G4double currentMinimumStep, 72 G4double& current << 192 G4double& currentSafety, 73 G4GPILSelection* 193 G4GPILSelection* selection 74 ); << 194 ) >> 195 { >> 196 // GPILSelection is set to defaule value of CandidateForSelection >> 197 valueGPILSelection = CandidateForSelection; 75 198 76 virtual G4VParticleChange* AlongStepDoIt( << 199 // get Step limit proposed by the process 77 const G4Track& , << 200 G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety); 78 const G4Step& << 79 ); << 80 << 81 virtual G4double AtRestGetPhysicalInteract << 82 const G4Track& , << 83 G4ForceCondition* << 84 ); << 85 201 86 virtual G4VParticleChange* AtRestDoIt( << 202 // set return value for G4GPILSelection 87 const G4Track& , << 203 *selection = valueGPILSelection; 88 const G4Step& << 89 ); << 90 204 91 protected: << 205 #ifdef G4VERBOSE >> 206 if (verboseLevel>1){ >> 207 G4cout << "G4VRestContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength "; >> 208 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 209 track.GetDynamicParticle()->DumpInfo(); >> 210 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 211 G4cout << "IntractionLength= " << steplength/cm <<"[cm] " <<G4endl; >> 212 } >> 213 #endif >> 214 return steplength ; >> 215 } 92 216 93 virtual G4double GetMeanLifeTime( const G4 << 217 inline G4VParticleChange* G4VRestContinuousDiscreteProcess::AlongStepDoIt( 94 G4ForceC << 218 const G4Track& , 95 // Calculates the mean life-time (i.e. f << 219 const G4Step& 96 // particle at rest due to the occurrenc << 220 ) 97 // or converts the probability of intera << 221 { 98 // annihilation) into the life-time of t << 222 return pParticleChange; 99 // occurrence of the given process << 223 } 100 << 101 virtual G4double GetContinuousStepLimit( c << 102 G << 103 G << 104 G << 105 << 106 virtual G4double GetMeanFreePath( const G4 << 107 G4double << 108 G4ForceC << 109 // Calculates from the macroscopic cross << 110 // free path, the value is returned in u << 111 224 112 inline void SetGPILSelection(G4GPILSelecti << 225 inline G4double G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength( 113 { valueGPILSelection = selection; } << 226 const G4Track& track, >> 227 G4double previousStepSize, >> 228 G4ForceCondition* condition >> 229 ) >> 230 { >> 231 if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) { >> 232 // beggining of tracking (or just after DoIt of this process) >> 233 ResetNumberOfInteractionLengthLeft(); >> 234 } else { >> 235 // subtract NumberOfInteractionLengthLeft >> 236 SubtractNumberOfInteractionLengthLeft(previousStepSize); >> 237 if(theNumberOfInteractionLengthLeft<0.) >> 238 theNumberOfInteractionLengthLeft=perMillion; >> 239 } >> 240 >> 241 // condition is set to "Not Forced" >> 242 *condition = NotForced; >> 243 >> 244 // get mean free path >> 245 currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition); >> 246 >> 247 #ifdef G4VERBOSE >> 248 if ((currentInteractionLength <=0.0) || (verboseLevel>2)){ >> 249 G4cout << "G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 250 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 251 track.GetDynamicParticle()->DumpInfo(); >> 252 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 253 G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<G4endl; >> 254 } >> 255 #endif 114 256 115 inline G4GPILSelection GetGPILSelection() << 257 G4double value; 116 { return valueGPILSelection; } << 258 if (currentInteractionLength <DBL_MAX) { >> 259 value = theNumberOfInteractionLengthLeft * currentInteractionLength; >> 260 } else { >> 261 value = DBL_MAX; >> 262 } >> 263 #ifdef G4VERBOSE >> 264 if (verboseLevel>1){ >> 265 G4cout << "G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 266 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 267 track.GetDynamicParticle()->DumpInfo(); >> 268 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 269 G4cout << "InteractionLength= " << value/cm <<"[cm] " <<G4endl; >> 270 } >> 271 #endif >> 272 return value; >> 273 } 117 274 118 private: << 275 inline G4VParticleChange* G4VRestContinuousDiscreteProcess::PostStepDoIt( >> 276 const G4Track& , >> 277 const G4Step& >> 278 ) >> 279 { >> 280 // clear NumberOfInteractionLengthLeft >> 281 ClearNumberOfInteractionLengthLeft(); 119 282 120 G4VRestContinuousDiscreteProcess(); << 283 return pParticleChange; 121 // Hidden default constructor << 284 } 122 285 123 G4GPILSelection valueGPILSelection = Candi << 124 // This is the returned value of G4GPILS << 125 // the arguments of AlongStepGPIL() << 126 }; << 127 286 128 #endif 287 #endif >> 288 129 289