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.9 2007-11-15 04:10:18 kurasige Exp $ >> 28 // GEANT4 tag $Name: geant4-09-04-patch-01 $ >> 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 &); 52 65 53 virtual ~G4VRestContinuousDiscreteProcess( << 66 virtual ~G4VRestContinuousDiscreteProcess(); 54 67 55 G4VRestContinuousDiscreteProcess& operator << 56 68 57 virtual G4double PostStepGetPhysicalIntera << 69 public :// with description >> 70 virtual G4double PostStepGetPhysicalInteractionLength( 58 const G4Track& tr 71 const G4Track& track, 59 G4double previo << 72 G4double previousStepSize, 60 G4ForceCondition* << 73 G4ForceCondition* condition 61 ); << 74 ); >> 75 >> 76 virtual G4VParticleChange* PostStepDoIt( >> 77 const G4Track& , >> 78 const G4Step& >> 79 ); 62 80 63 virtual G4VParticleChange* PostStepDoIt( << 81 virtual G4double AlongStepGetPhysicalInteractionLength( 64 const G4Track& , << 65 const G4Step& << 66 ); << 67 << 68 virtual G4double AlongStepGetPhysicalInter << 69 const G4Track& tr 82 const G4Track& track, 70 G4double previous << 83 G4double previousStepSize, 71 G4double currentM << 84 G4double currentMinimumStep, 72 G4double& current << 85 G4double& currentSafety, 73 G4GPILSelection* 86 G4GPILSelection* selection 74 ); << 87 ); 75 88 76 virtual G4VParticleChange* AlongStepDoIt( << 89 virtual G4VParticleChange* AlongStepDoIt( 77 const G4Track& , << 90 const G4Track& , 78 const G4Step& << 91 const G4Step& 79 ); << 92 ); 80 93 81 virtual G4double AtRestGetPhysicalInteract << 94 virtual G4double AtRestGetPhysicalInteractionLength( 82 const G4Track& , 95 const G4Track& , 83 G4ForceCondition* << 96 G4ForceCondition* 84 ); << 97 ); 85 98 86 virtual G4VParticleChange* AtRestDoIt( << 99 virtual G4VParticleChange* AtRestDoIt( 87 const G4Track& , << 100 const G4Track& , 88 const G4Step& << 101 const G4Step& 89 ); << 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;}; 90 126 91 protected: << 127 G4GPILSelection GetGPILSelection() const{return valueGPILSelection;}; 92 128 93 virtual G4double GetMeanLifeTime( const G4 << 129 protected: // with description 94 G4ForceC << 130 virtual G4double GetMeanFreePath(const G4Track& aTrack, 95 // Calculates the mean life-time (i.e. f << 131 G4double previousStepSize, 96 // particle at rest due to the occurrenc << 132 G4ForceCondition* condition 97 // or converts the probability of intera << 133 )=0; 98 // annihilation) into the life-time of t << 134 // Calculates from the macroscopic cross section a mean 99 // occurrence of the given process << 135 // free path, the value is returned in units of distance. 100 << 136 101 virtual G4double GetContinuousStepLimit( c << 137 private: 102 G << 138 // hide default constructor and assignment operator as private 103 G << 139 G4VRestContinuousDiscreteProcess(); 104 G << 140 G4VRestContinuousDiscreteProcess & operator=(const G4VRestContinuousDiscreteProcess &right); 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 141 112 inline void SetGPILSelection(G4GPILSelecti << 142 }; 113 { valueGPILSelection = selection; } << 114 143 115 inline G4GPILSelection GetGPILSelection() << 144 // ----------------------------------------- 116 { return valueGPILSelection; } << 145 // inlined function members implementation >> 146 // ----------------------------------------- >> 147 #include "G4Step.hh" >> 148 #include "G4Track.hh" >> 149 #include "G4MaterialTable.hh" >> 150 #include "G4VParticleChange.hh" 117 151 118 private: << 152 inline G4double G4VRestContinuousDiscreteProcess::AtRestGetPhysicalInteractionLength( >> 153 const G4Track& track, >> 154 G4ForceCondition* condition >> 155 ) >> 156 { >> 157 // beggining of tracking >> 158 ResetNumberOfInteractionLengthLeft(); 119 159 120 G4VRestContinuousDiscreteProcess(); << 160 // condition is set to "Not Forced" 121 // Hidden default constructor << 161 *condition = NotForced; 122 162 123 G4GPILSelection valueGPILSelection = Candi << 163 // get mean life time 124 // This is the returned value of G4GPILS << 164 currentInteractionLength = GetMeanLifeTime(track, condition); 125 // the arguments of AlongStepGPIL() << 165 126 }; << 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 } 127 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( >> 192 const G4Track& track, >> 193 G4double previousStepSize, >> 194 G4double currentMinimumStep, >> 195 G4double& currentSafety, >> 196 G4GPILSelection* selection >> 197 ) >> 198 { >> 199 // GPILSelection is set to defaule value of CandidateForSelection >> 200 valueGPILSelection = CandidateForSelection; >> 201 >> 202 // get Step limit proposed by the process >> 203 G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety); >> 204 >> 205 // set return value for G4GPILSelection >> 206 *selection = valueGPILSelection; >> 207 >> 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 } 128 #endif 216 #endif >> 217 return steplength ; >> 218 } >> 219 >> 220 inline G4VParticleChange* G4VRestContinuousDiscreteProcess::AlongStepDoIt( >> 221 const G4Track& , >> 222 const G4Step& >> 223 ) >> 224 { >> 225 return pParticleChange; >> 226 } >> 227 >> 228 inline G4double G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength( >> 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 if ( previousStepSize > 0.0) { >> 238 // subtract NumberOfInteractionLengthLeft >> 239 SubtractNumberOfInteractionLengthLeft(previousStepSize); >> 240 } else { >> 241 // zero step >> 242 // DO NOTHING >> 243 } >> 244 >> 245 // condition is set to "Not Forced" >> 246 *condition = NotForced; >> 247 >> 248 // get mean free path >> 249 currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition); >> 250 >> 251 >> 252 G4double value; >> 253 if (currentInteractionLength <DBL_MAX) { >> 254 value = theNumberOfInteractionLengthLeft * currentInteractionLength; >> 255 } else { >> 256 value = DBL_MAX; >> 257 } >> 258 #ifdef G4VERBOSE >> 259 if (verboseLevel>1){ >> 260 G4cout << "G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 261 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 262 track.GetDynamicParticle()->DumpInfo(); >> 263 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 264 G4cout << "InteractionLength= " << value/cm <<"[cm] " <<G4endl; >> 265 } >> 266 #endif >> 267 return value; >> 268 } >> 269 >> 270 inline G4VParticleChange* G4VRestContinuousDiscreteProcess::PostStepDoIt( >> 271 const G4Track& , >> 272 const G4Step& >> 273 ) >> 274 { >> 275 // clear NumberOfInteractionLengthLeft >> 276 ClearNumberOfInteractionLengthLeft(); >> 277 >> 278 return pParticleChange; >> 279 } >> 280 >> 281 >> 282 #endif >> 283 129 284