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