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 // G4VRestDiscreteProcess << 27 // 26 // 28 // Class description: << 27 // $Id: G4VRestDiscreteProcess.hh,v 1.8 2006/06/29 21:07:56 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-03-patch-02 $ >> 29 // >> 30 // >> 31 // ------------------------------------------------------------ >> 32 // GEANT 4 class header file >> 33 // >> 34 // >> 35 // Class Description >> 36 // Abstract class which defines the public behavior of >> 37 // rest + discrete physics interactions. >> 38 // >> 39 // ------------------------------------------------------------ >> 40 // New Physics scheme 8 Mar. 1997 H.Kurahige >> 41 // ------------------------------------------------------------ >> 42 // modified for new ParticleChange 12 Mar. 1998 H.Kurashige >> 43 // Fixed a bug in PostStepGetPhysicalInteractionLength >> 44 // 15 Apr. 2002 H.Kurashige 29 // 45 // 30 // Abstract class which defines the public beh << 31 // rest + discrete physics interactions. << 32 46 33 // Authors: << 47 #ifndef G4VRestDiscreteProcess_h 34 // - 2 December 1995, G.Cosmo - First implemen << 48 #define G4VRestDiscreteProcess_h 1 35 // - 8 January 1997, H.Kurashige - New Physics << 36 // ------------------------------------------- << 37 #ifndef G4VRestDiscreteProcess_hh << 38 #define G4VRestDiscreteProcess_hh 1 << 39 49 40 #include "globals.hh" 50 #include "globals.hh" 41 #include "G4ios.hh" 51 #include "G4ios.hh" 42 52 43 #include "G4VProcess.hh" 53 #include "G4VProcess.hh" 44 54 >> 55 45 class G4VRestDiscreteProcess : public G4VProce 56 class G4VRestDiscreteProcess : public G4VProcess 46 { 57 { >> 58 // Abstract class which defines the public behavior of >> 59 // rest + discrete physics interactions. 47 public: 60 public: 48 61 49 G4VRestDiscreteProcess(const G4String& , << 62 G4VRestDiscreteProcess(const G4String& , 50 G4ProcessType aType = fNotDefined); << 63 G4ProcessType aType = fNotDefined ); 51 G4VRestDiscreteProcess(G4VRestDiscreteProc << 64 G4VRestDiscreteProcess(G4VRestDiscreteProcess &); 52 65 53 virtual ~G4VRestDiscreteProcess(); << 66 virtual ~G4VRestDiscreteProcess(); 54 67 55 G4VRestDiscreteProcess& operator=(const G4 << 68 public :// with description 56 << 69 virtual G4double PostStepGetPhysicalInteractionLength( 57 virtual G4double PostStepGetPhysicalIntera << 58 const G4Track& tr 70 const G4Track& track, 59 G4double previousStepSize, << 71 G4double previousStepSize, 60 G4ForceCondition* condition 72 G4ForceCondition* condition 61 ); 73 ); 62 74 63 virtual G4VParticleChange* PostStepDoIt( << 75 virtual G4VParticleChange* PostStepDoIt( 64 const G4Track& , 76 const G4Track& , 65 const G4Step& 77 const G4Step& 66 ); 78 ); 67 79 68 virtual G4double AtRestGetPhysicalInteract << 80 virtual G4double AtRestGetPhysicalInteractionLength( 69 const G4Track& , 81 const G4Track& , 70 G4ForceCondition* 82 G4ForceCondition* 71 ); 83 ); 72 84 73 virtual G4VParticleChange* AtRestDoIt( << 85 virtual G4VParticleChange* AtRestDoIt( 74 const G4Track& , 86 const G4Track& , 75 const G4Step& 87 const G4Step& 76 ); 88 ); 77 89 78 virtual G4double AlongStepGetPhysicalInter << 90 // no operation in AlongStepDoIt >> 91 virtual G4double AlongStepGetPhysicalInteractionLength( 79 const G4Track&, 92 const G4Track&, 80 G4double , 93 G4double , 81 G4double , 94 G4double , 82 G4double& , 95 G4double& , 83 G4GPILSelection* 96 G4GPILSelection* 84 ) { return -1.0; } << 97 ){ return -1.0; }; 85 // No operation in AlongStepDoIt << 86 98 87 virtual G4VParticleChange* AlongStepDoIt( << 99 // no operation in AlongStepDoIt >> 100 virtual G4VParticleChange* AlongStepDoIt( 88 const G4Track& , 101 const G4Track& , 89 const G4Step& 102 const G4Step& 90 ) { return 0; } << 103 ) {return 0;}; 91 // No operation in AlongStepDoIt << 92 104 93 protected: << 105 protected:// with description 94 << 106 virtual G4double GetMeanFreePath(const G4Track& aTrack, 95 virtual G4double GetMeanFreePath(const G4T << 107 G4double previousStepSize, 96 G4double << 108 G4ForceCondition* condition 97 G4ForceCo << 109 )=0; 98 // Calculates from the macroscopic cross << 110 // Calculates from the macroscopic cross section a mean 99 // free path, the value is returned in u << 111 // free path, the value is returned in units of distance. 100 << 112 101 virtual G4double GetMeanLifeTime(const G4T << 113 virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0; 102 G4ForceCo << 114 // Calculates the mean life-time (i.e. for decays) of the 103 // Calculates the mean life-time (i.e. f << 115 // particle at rest due to the occurence of the given process, 104 // particle at rest due to the occurrenc << 116 // or converts the probability of interaction (i.e. for 105 // or converts the probability of intera << 117 // annihilation) into the life-time of the particle for the 106 // annihilation) into the life-time of t << 118 // occurence of the given process. 107 // occurrence of the given process << 108 119 109 private: 120 private: >> 121 // hide default constructor and assignment operator as private >> 122 G4VRestDiscreteProcess(); >> 123 G4VRestDiscreteProcess & operator=(const G4VRestDiscreteProcess &right); 110 124 111 G4VRestDiscreteProcess(); << 112 // Hidden default constructor << 113 }; 125 }; 114 126 >> 127 // ----------------------------------------- >> 128 // inlined function members implementation >> 129 // ----------------------------------------- >> 130 #include "Randomize.hh" >> 131 #include "G4Step.hh" >> 132 #include "G4Track.hh" >> 133 #include "G4MaterialTable.hh" >> 134 #include "G4VParticleChange.hh" >> 135 >> 136 inline >> 137 G4double G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength( >> 138 const G4Track& track, >> 139 G4double previousStepSize, >> 140 G4ForceCondition* condition >> 141 ) >> 142 { >> 143 if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) { >> 144 // beggining of tracking (or just after DoIt of this process) >> 145 ResetNumberOfInteractionLengthLeft(); >> 146 } else { >> 147 // subtract NumberOfInteractionLengthLeft >> 148 SubtractNumberOfInteractionLengthLeft(previousStepSize); >> 149 if(theNumberOfInteractionLengthLeft<0.) >> 150 theNumberOfInteractionLengthLeft=perMillion; >> 151 } >> 152 >> 153 // condition is set to "Not Forced" >> 154 *condition = NotForced; >> 155 >> 156 // get mean free path >> 157 currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition); >> 158 >> 159 #ifdef G4VERBOSE >> 160 if ((currentInteractionLength <=0.0) || (verboseLevel>2)){ >> 161 G4cout << "G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 162 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 163 track.GetDynamicParticle()->DumpInfo(); >> 164 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 165 G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<G4endl; >> 166 } >> 167 #endif >> 168 >> 169 G4double value; >> 170 if (currentInteractionLength <DBL_MAX) { >> 171 value = theNumberOfInteractionLengthLeft * currentInteractionLength; >> 172 } else { >> 173 value = DBL_MAX; >> 174 } >> 175 #ifdef G4VERBOSE >> 176 if (verboseLevel>1){ >> 177 G4cout << "G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 178 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 179 track.GetDynamicParticle()->DumpInfo(); >> 180 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 181 G4cout << "InteractionLength= " << value/cm <<"[cm] " <<G4endl; >> 182 } >> 183 #endif >> 184 return value; >> 185 } >> 186 >> 187 inline G4VParticleChange* G4VRestDiscreteProcess::PostStepDoIt( >> 188 const G4Track& , >> 189 const G4Step& >> 190 ) >> 191 { >> 192 // reset NumberOfInteractionLengthLeft >> 193 ClearNumberOfInteractionLengthLeft(); >> 194 >> 195 return pParticleChange; >> 196 } >> 197 >> 198 inline G4double G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength( >> 199 const G4Track& track, >> 200 G4ForceCondition* condition >> 201 ) >> 202 { >> 203 // beggining of tracking >> 204 ResetNumberOfInteractionLengthLeft(); >> 205 >> 206 // condition is set to "Not Forced" >> 207 *condition = NotForced; >> 208 >> 209 // get mean life time >> 210 currentInteractionLength = GetMeanLifeTime(track, condition); >> 211 >> 212 #ifdef G4VERBOSE >> 213 if ((currentInteractionLength <0.0) || (verboseLevel>2)){ >> 214 G4cout << "G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength "; >> 215 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 216 track.GetDynamicParticle()->DumpInfo(); >> 217 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 218 G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<G4endl; >> 219 } >> 220 #endif >> 221 >> 222 return theNumberOfInteractionLengthLeft * currentInteractionLength; >> 223 } >> 224 >> 225 >> 226 inline G4VParticleChange* G4VRestDiscreteProcess::AtRestDoIt( >> 227 const G4Track&, >> 228 const G4Step& >> 229 ) >> 230 { >> 231 // clear NumberOfInteractionLengthLeft >> 232 ClearNumberOfInteractionLengthLeft(); >> 233 >> 234 return pParticleChange; >> 235 } >> 236 >> 237 >> 238 115 #endif 239 #endif >> 240 116 241