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.4.4.2 2001/06/28 20:20:11 gunter Exp $ >> 25 // GEANT4 tag $Name: $ 29 // 26 // 30 // Abstract class which defines the public beh << 27 // 31 // continuous and discrete physics interaction << 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 // modified 26 Mar. 1997 H.Kurahige >> 40 // modified 16 Apr. 1997 L.Urban >> 41 // modified AlongStepGPIL etc. 17 Dec. 1997 H.Kurashige >> 42 // fix bugs in GetGPILSelection() 24 Jan. 1998 H.Kurashige >> 43 // modified for new ParticleChange 12 Mar. 1998 H.Kurashige 32 44 33 // Authors: << 45 34 // - 2 December 1995, G.Cosmo - First implemen << 46 #ifndef G4VRestContinuousDiscreteProcess_h 35 // - 8 January 1997, H.Kurashige - New Physics << 47 #define G4VRestContinuousDiscreteProcess_h 1 36 // ------------------------------------------- << 37 #ifndef G4VRestContinuousDiscreteProcess_hh << 38 #define G4VRestContinuousDiscreteProcess_hh 1 << 39 48 40 #include "globals.hh" 49 #include "globals.hh" 41 #include "G4ios.hh" 50 #include "G4ios.hh" 42 51 43 #include "G4VProcess.hh" 52 #include "G4VProcess.hh" 44 53 45 class G4VRestContinuousDiscreteProcess : publi 54 class G4VRestContinuousDiscreteProcess : public G4VProcess 46 { 55 { >> 56 // Abstract class which defines the public behavior of >> 57 // discrete physics interactions. 47 public: 58 public: 48 59 49 G4VRestContinuousDiscreteProcess(const G4S << 60 G4VRestContinuousDiscreteProcess(const G4String& , 50 G4Process << 61 G4ProcessType aType = fNotDefined ); 51 G4VRestContinuousDiscreteProcess(G4VRestCo << 62 G4VRestContinuousDiscreteProcess(G4VRestContinuousDiscreteProcess &); >> 63 >> 64 virtual ~G4VRestContinuousDiscreteProcess(); 52 65 53 virtual ~G4VRestContinuousDiscreteProcess( << 54 66 55 G4VRestContinuousDiscreteProcess& operator << 67 public :// with description >> 68 virtual G4double PostStepGetPhysicalInteractionLength( >> 69 const G4Track& track, >> 70 G4double previousStepSize, >> 71 G4ForceCondition* condition >> 72 ); >> 73 >> 74 virtual G4VParticleChange* PostStepDoIt( >> 75 const G4Track& , >> 76 const G4Step& >> 77 ); 56 78 57 virtual G4double PostStepGetPhysicalIntera << 79 virtual G4double AlongStepGetPhysicalInteractionLength( 58 const G4Track& tr 80 const G4Track& track, >> 81 G4double previousStepSize, >> 82 G4double currentMinimumStep, >> 83 G4double& currentSafety, >> 84 G4GPILSelection* selection >> 85 ); >> 86 >> 87 virtual G4VParticleChange* AlongStepDoIt( >> 88 const G4Track& , >> 89 const G4Step& >> 90 ); >> 91 >> 92 virtual G4double AtRestGetPhysicalInteractionLength( >> 93 const G4Track& , >> 94 G4ForceCondition* >> 95 ); >> 96 >> 97 virtual G4VParticleChange* AtRestDoIt( >> 98 const G4Track& , >> 99 const G4Step& >> 100 ); >> 101 >> 102 protected: // with description >> 103 virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0; >> 104 // Calculates the mean life-time (i.e. for decays) of the >> 105 // particle at rest due to the occurence of the given process, >> 106 // or converts the probability of interaction (i.e. for >> 107 // annihilation) into the life-time of the particle for the >> 108 // occurence of the given process. >> 109 >> 110 virtual G4double GetContinuousStepLimit(const G4Track& aTrack, >> 111 G4double previousStepSize, >> 112 G4double currentMinimumStep, >> 113 G4double& currentSafety >> 114 )=0; >> 115 private: >> 116 // this is the returnd value of G4GPILSelection in >> 117 // the arguments of AlongStepGPIL() >> 118 G4GPILSelection valueGPILSelection; >> 119 >> 120 protected: // with description >> 121 // these two methods are set/get methods for valueGPILSelection >> 122 void SetGPILSelection(G4GPILSelection selection) >> 123 { valueGPILSelection = selection;}; >> 124 >> 125 G4GPILSelection GetGPILSelection() const{return valueGPILSelection;}; >> 126 >> 127 protected: // with description >> 128 virtual G4double GetMeanFreePath(const G4Track& aTrack, 59 G4double previo 129 G4double previousStepSize, 60 G4ForceCondition* 130 G4ForceCondition* condition 61 ); << 131 )=0; >> 132 // Calculates from the macroscopic cross section a mean >> 133 // free path, the value is returned in units of distance. >> 134 >> 135 private: >> 136 // hide default constructor and assignment operator as private >> 137 G4VRestContinuousDiscreteProcess(); >> 138 G4VRestContinuousDiscreteProcess & operator=(const G4VRestContinuousDiscreteProcess &right); 62 139 63 virtual G4VParticleChange* PostStepDoIt( << 140 }; 64 const G4Track& , << 141 65 const G4Step& << 142 // ----------------------------------------- 66 ); << 143 // inlined function members implementation >> 144 // ----------------------------------------- >> 145 #include "G4Step.hh" >> 146 #include "G4Track.hh" >> 147 #include "G4MaterialTable.hh" >> 148 #include "G4VParticleChange.hh" >> 149 >> 150 inline G4double G4VRestContinuousDiscreteProcess::AtRestGetPhysicalInteractionLength( >> 151 const G4Track& track, >> 152 G4ForceCondition* condition >> 153 ) >> 154 { >> 155 // beggining of tracking >> 156 ResetNumberOfInteractionLengthLeft(); >> 157 >> 158 // condition is set to "Not Forced" >> 159 *condition = NotForced; 67 160 68 virtual G4double AlongStepGetPhysicalInter << 161 // get mean life time >> 162 currentInteractionLength = GetMeanLifeTime(track, condition); >> 163 >> 164 #ifdef G4VERBOSE >> 165 if ((currentInteractionLength <0.0) || (verboseLevel>2)){ >> 166 G4cout << "G4VRestContinuousDiscreteProcess::AtRestGetPhysicalInteractionLength "; >> 167 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 168 track.GetDynamicParticle()->DumpInfo(); >> 169 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 170 G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<G4endl; >> 171 } >> 172 #endif >> 173 >> 174 return theNumberOfInteractionLengthLeft * currentInteractionLength; >> 175 } >> 176 >> 177 >> 178 inline G4VParticleChange* G4VRestContinuousDiscreteProcess::AtRestDoIt( >> 179 const G4Track&, >> 180 const G4Step& >> 181 ) >> 182 { >> 183 // clear NumberOfInteractionLengthLeft >> 184 ClearNumberOfInteractionLengthLeft(); >> 185 >> 186 return pParticleChange; >> 187 } >> 188 >> 189 inline G4double G4VRestContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength( 69 const G4Track& tr 190 const G4Track& track, 70 G4double previous << 191 G4double previousStepSize, 71 G4double currentM << 192 G4double currentMinimumStep, 72 G4double& current << 193 G4double& currentSafety, 73 G4GPILSelection* 194 G4GPILSelection* selection 74 ); << 195 ) >> 196 { >> 197 // GPILSelection is set to defaule value of CandidateForSelection >> 198 valueGPILSelection = CandidateForSelection; 75 199 76 virtual G4VParticleChange* AlongStepDoIt( << 200 // get Step limit proposed by the process 77 const G4Track& , << 201 G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety); 78 const G4Step& << 79 ); << 80 << 81 virtual G4double AtRestGetPhysicalInteract << 82 const G4Track& , << 83 G4ForceCondition* << 84 ); << 85 202 86 virtual G4VParticleChange* AtRestDoIt( << 203 // set return value for G4GPILSelection 87 const G4Track& , << 204 *selection = valueGPILSelection; 88 const G4Step& << 89 ); << 90 205 91 protected: << 206 #ifdef G4VERBOSE >> 207 if (verboseLevel>1){ >> 208 G4cout << "G4VRestContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength "; >> 209 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 210 track.GetDynamicParticle()->DumpInfo(); >> 211 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 212 G4cout << "IntractionLength= " << steplength/cm <<"[cm] " <<G4endl; >> 213 } >> 214 #endif >> 215 return steplength ; >> 216 } 92 217 93 virtual G4double GetMeanLifeTime( const G4 << 218 inline G4VParticleChange* G4VRestContinuousDiscreteProcess::AlongStepDoIt( 94 G4ForceC << 219 const G4Track& , 95 // Calculates the mean life-time (i.e. f << 220 const G4Step& 96 // particle at rest due to the occurrenc << 221 ) 97 // or converts the probability of intera << 222 { 98 // annihilation) into the life-time of t << 223 return pParticleChange; 99 // occurrence of the given process << 224 } 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 225 112 inline void SetGPILSelection(G4GPILSelecti << 226 inline G4double G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength( 113 { valueGPILSelection = selection; } << 227 const G4Track& track, >> 228 G4double previousStepSize, >> 229 G4ForceCondition* condition >> 230 ) >> 231 { >> 232 if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) { >> 233 // beggining of tracking (or just after DoIt of this process) >> 234 ResetNumberOfInteractionLengthLeft(); >> 235 } else { >> 236 // subtract NumberOfInteractionLengthLeft >> 237 SubtractNumberOfInteractionLengthLeft(previousStepSize); >> 238 if(theNumberOfInteractionLengthLeft<perMillion) >> 239 theNumberOfInteractionLengthLeft=0.; >> 240 } >> 241 >> 242 // condition is set to "Not Forced" >> 243 *condition = NotForced; >> 244 >> 245 // get mean free path >> 246 currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition); >> 247 >> 248 #ifdef G4VERBOSE >> 249 if ((currentInteractionLength <=0.0) || (verboseLevel>2)){ >> 250 G4cout << "G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 251 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 252 track.GetDynamicParticle()->DumpInfo(); >> 253 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 254 G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<G4endl; >> 255 } >> 256 #endif 114 257 115 inline G4GPILSelection GetGPILSelection() << 258 G4double value = theNumberOfInteractionLengthLeft * currentInteractionLength; 116 { return valueGPILSelection; } << 259 #ifdef G4VERBOSE >> 260 if (verboseLevel>1){ >> 261 G4cout << "G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 262 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 263 track.GetDynamicParticle()->DumpInfo(); >> 264 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 265 G4cout << "InteractionLength= " << value/cm <<"[cm] " <<G4endl; >> 266 } >> 267 #endif >> 268 return value; >> 269 } 117 270 118 private: << 271 inline G4VParticleChange* G4VRestContinuousDiscreteProcess::PostStepDoIt( >> 272 const G4Track& , >> 273 const G4Step& >> 274 ) >> 275 { >> 276 // clear NumberOfInteractionLengthLeft >> 277 ClearNumberOfInteractionLengthLeft(); 119 278 120 G4VRestContinuousDiscreteProcess(); << 279 return pParticleChange; 121 // Hidden default constructor << 280 } 122 281 123 G4GPILSelection valueGPILSelection = Candi << 124 // This is the returned value of G4GPILS << 125 // the arguments of AlongStepGPIL() << 126 }; << 127 282 128 #endif 283 #endif >> 284 129 285