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.9 2007/11/15 04:10:18 kurasige Exp $ >> 28 // GEANT4 tag $Name: geant4-09-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 if ( previousStepSize > 0.0) { >> 147 // subtract NumberOfInteractionLengthLeft >> 148 SubtractNumberOfInteractionLengthLeft(previousStepSize); >> 149 } else { >> 150 // zero step >> 151 // DO NOTHING >> 152 } >> 153 >> 154 // condition is set to "Not Forced" >> 155 *condition = NotForced; >> 156 >> 157 // get mean free path >> 158 currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition); >> 159 >> 160 G4double value; >> 161 if (currentInteractionLength <DBL_MAX) { >> 162 value = theNumberOfInteractionLengthLeft * currentInteractionLength; >> 163 } else { >> 164 value = DBL_MAX; >> 165 } >> 166 #ifdef G4VERBOSE >> 167 if (verboseLevel>1){ >> 168 G4cout << "G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 169 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 170 track.GetDynamicParticle()->DumpInfo(); >> 171 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 172 G4cout << "InteractionLength= " << value/cm <<"[cm] " <<G4endl; >> 173 } >> 174 #endif >> 175 return value; >> 176 } >> 177 >> 178 inline G4VParticleChange* G4VRestDiscreteProcess::PostStepDoIt( >> 179 const G4Track& , >> 180 const G4Step& >> 181 ) >> 182 { >> 183 // reset NumberOfInteractionLengthLeft >> 184 ClearNumberOfInteractionLengthLeft(); >> 185 >> 186 return pParticleChange; >> 187 } >> 188 >> 189 inline G4double G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength( >> 190 const G4Track& track, >> 191 G4ForceCondition* condition >> 192 ) >> 193 { >> 194 // beggining of tracking >> 195 ResetNumberOfInteractionLengthLeft(); >> 196 >> 197 // condition is set to "Not Forced" >> 198 *condition = NotForced; >> 199 >> 200 // get mean life time >> 201 currentInteractionLength = GetMeanLifeTime(track, condition); >> 202 >> 203 #ifdef G4VERBOSE >> 204 if ((currentInteractionLength <0.0) || (verboseLevel>2)){ >> 205 G4cout << "G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength "; >> 206 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 207 track.GetDynamicParticle()->DumpInfo(); >> 208 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 209 G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<G4endl; >> 210 } 115 #endif 211 #endif >> 212 >> 213 return theNumberOfInteractionLengthLeft * currentInteractionLength; >> 214 } >> 215 >> 216 >> 217 inline G4VParticleChange* G4VRestDiscreteProcess::AtRestDoIt( >> 218 const G4Track&, >> 219 const G4Step& >> 220 ) >> 221 { >> 222 // clear NumberOfInteractionLengthLeft >> 223 ClearNumberOfInteractionLengthLeft(); >> 224 >> 225 return pParticleChange; >> 226 } >> 227 >> 228 >> 229 >> 230 #endif >> 231 116 232