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 26 // G4VRestContinuousDiscreteProcess 27 // 27 // 28 // Authors: 28 // Authors: 29 // - 2 December 1995, G.Cosmo - First implemen 29 // - 2 December 1995, G.Cosmo - First implementation, based on object model 30 // - 8 January 1997, H.Kurashige - New Physics 30 // - 8 January 1997, H.Kurashige - New Physics scheme 31 // ------------------------------------------- 31 // -------------------------------------------------------------------- 32 32 33 #include "G4VRestContinuousDiscreteProcess.hh" 33 #include "G4VRestContinuousDiscreteProcess.hh" 34 #include "G4SystemOfUnits.hh" 34 #include "G4SystemOfUnits.hh" 35 35 36 #include "G4Step.hh" 36 #include "G4Step.hh" 37 #include "G4Track.hh" 37 #include "G4Track.hh" 38 #include "G4MaterialTable.hh" 38 #include "G4MaterialTable.hh" 39 #include "G4VParticleChange.hh" 39 #include "G4VParticleChange.hh" 40 40 41 // ------------------------------------------- 41 // -------------------------------------------------------------------- 42 G4VRestContinuousDiscreteProcess::G4VRestConti 42 G4VRestContinuousDiscreteProcess::G4VRestContinuousDiscreteProcess() 43 : G4VProcess("No Name Discrete Process") 43 : G4VProcess("No Name Discrete Process") 44 { 44 { 45 G4Exception("G4VRestContinuousDiscreteProces 45 G4Exception("G4VRestContinuousDiscreteProcess::G4VRestContinuousDiscreteProcess()", 46 "ProcMan102", JustWarning, "Defa 46 "ProcMan102", JustWarning, "Default constructor is called"); 47 } 47 } 48 48 49 // ------------------------------------------- 49 // -------------------------------------------------------------------- 50 G4VRestContinuousDiscreteProcess:: 50 G4VRestContinuousDiscreteProcess:: 51 G4VRestContinuousDiscreteProcess(const G4Strin 51 G4VRestContinuousDiscreteProcess(const G4String& aName, G4ProcessType aType) 52 : G4VProcess(aName, aType) 52 : G4VProcess(aName, aType) 53 { 53 { 54 } 54 } 55 55 56 // ------------------------------------------- 56 // -------------------------------------------------------------------- 57 G4VRestContinuousDiscreteProcess::~G4VRestCont 57 G4VRestContinuousDiscreteProcess::~G4VRestContinuousDiscreteProcess() 58 { 58 { 59 } 59 } 60 60 61 // ------------------------------------------- 61 // -------------------------------------------------------------------- 62 G4VRestContinuousDiscreteProcess:: 62 G4VRestContinuousDiscreteProcess:: 63 G4VRestContinuousDiscreteProcess(G4VRestContin 63 G4VRestContinuousDiscreteProcess(G4VRestContinuousDiscreteProcess& right) 64 : G4VProcess(right), 64 : G4VProcess(right), 65 valueGPILSelection(right.valueGPILSelectio 65 valueGPILSelection(right.valueGPILSelection) 66 { 66 { 67 } 67 } 68 68 69 // ------------------------------------------- 69 // -------------------------------------------------------------------- 70 G4double G4VRestContinuousDiscreteProcess:: 70 G4double G4VRestContinuousDiscreteProcess:: 71 AtRestGetPhysicalInteractionLength( const G4Tr 71 AtRestGetPhysicalInteractionLength( const G4Track& track, 72 G4ForceCon 72 G4ForceCondition* condition ) 73 { 73 { 74 // beginning of tracking 74 // beginning of tracking 75 ResetNumberOfInteractionLengthLeft(); 75 ResetNumberOfInteractionLengthLeft(); 76 76 77 // condition is set to "Not Forced" 77 // condition is set to "Not Forced" 78 *condition = NotForced; 78 *condition = NotForced; 79 79 80 // get mean life time 80 // get mean life time 81 currentInteractionLength = GetMeanLifeTime(t 81 currentInteractionLength = GetMeanLifeTime(track, condition); 82 82 83 G4double time = (currentInteractionLength < << 84 theNumberOfInteractionLengthLeft * current << 85 << 86 #ifdef G4VERBOSE 83 #ifdef G4VERBOSE 87 if ((currentInteractionLength <0.0) || (verb 84 if ((currentInteractionLength <0.0) || (verboseLevel>2)) 88 { 85 { 89 G4double t = (currentInteractionLength < D << 90 currentInteractionLength/ns : DBL_MAX; << 91 G4cout << "G4VRestContinuousDiscreteProces 86 G4cout << "G4VRestContinuousDiscreteProcess::AtRestGetPhysicalInteractionLength() - "; 92 G4cout << "[ " << GetProcessName() << "]" 87 G4cout << "[ " << GetProcessName() << "]" << G4endl; 93 track.GetDynamicParticle()->DumpInfo(); 88 track.GetDynamicParticle()->DumpInfo(); 94 G4cout << " in Material " << track.GetMat 89 G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl; 95 G4cout << "MeanLifeTime = " << t << " [ns] << 90 G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" 96 << G4endl; 91 << G4endl; 97 } 92 } 98 #endif 93 #endif 99 94 100 return time; << 95 return theNumberOfInteractionLengthLeft * currentInteractionLength; 101 } 96 } 102 97 103 // ------------------------------------------- 98 // -------------------------------------------------------------------- 104 G4VParticleChange* 99 G4VParticleChange* 105 G4VRestContinuousDiscreteProcess::AtRestDoIt( 100 G4VRestContinuousDiscreteProcess::AtRestDoIt( const G4Track&, 106 101 const G4Step& ) 107 { 102 { 108 ClearNumberOfInteractionLengthLeft(); 103 ClearNumberOfInteractionLengthLeft(); 109 104 110 return pParticleChange; 105 return pParticleChange; 111 } 106 } 112 107 113 // ------------------------------------------- 108 // -------------------------------------------------------------------- 114 G4double G4VRestContinuousDiscreteProcess:: 109 G4double G4VRestContinuousDiscreteProcess:: 115 AlongStepGetPhysicalInteractionLength( const G 110 AlongStepGetPhysicalInteractionLength( const G4Track& track, 116 G4doubl 111 G4double previousStepSize, 117 G4doubl 112 G4double currentMinimumStep, 118 G4doubl 113 G4double& currentSafety, 119 G4GPILS 114 G4GPILSelection* selection ) 120 { 115 { 121 // GPILSelection is set to defaule value of 116 // GPILSelection is set to defaule value of CandidateForSelection 122 valueGPILSelection = CandidateForSelection; 117 valueGPILSelection = CandidateForSelection; 123 118 124 // get Step limit proposed by the process 119 // get Step limit proposed by the process 125 G4double steplength = GetContinuousStepLimit 120 G4double steplength = GetContinuousStepLimit(track, previousStepSize, 126 currentMi 121 currentMinimumStep, currentSafety); 127 122 128 // set return value for G4GPILSelection 123 // set return value for G4GPILSelection 129 *selection = valueGPILSelection; 124 *selection = valueGPILSelection; 130 125 131 #ifdef G4VERBOSE 126 #ifdef G4VERBOSE 132 if (verboseLevel>1) 127 if (verboseLevel>1) 133 { 128 { 134 G4cout << "G4VRestContinuousDiscreteProces 129 G4cout << "G4VRestContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength() - "; 135 G4cout << "[ " << GetProcessName() << "]" 130 G4cout << "[ " << GetProcessName() << "]" << G4endl; 136 track.GetDynamicParticle()->DumpInfo(); 131 track.GetDynamicParticle()->DumpInfo(); 137 G4cout << " in Material " << track.GetMa 132 G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl; 138 G4cout << "IntractionLength= " << stepleng 133 G4cout << "IntractionLength= " << steplength/cm <<"[cm] " << G4endl; 139 } 134 } 140 #endif 135 #endif 141 return steplength; 136 return steplength; 142 } 137 } 143 138 144 // ------------------------------------------- 139 // -------------------------------------------------------------------- 145 G4VParticleChange* 140 G4VParticleChange* 146 G4VRestContinuousDiscreteProcess::AlongStepDoI 141 G4VRestContinuousDiscreteProcess::AlongStepDoIt( const G4Track& , 147 142 const G4Step& ) 148 { 143 { 149 return pParticleChange; 144 return pParticleChange; 150 } 145 } 151 146 152 // ------------------------------------------- 147 // -------------------------------------------------------------------- 153 G4double G4VRestContinuousDiscreteProcess:: 148 G4double G4VRestContinuousDiscreteProcess:: 154 PostStepGetPhysicalInteractionLength( const G4 149 PostStepGetPhysicalInteractionLength( const G4Track& track, 155 G4double 150 G4double previousStepSize, 156 G4ForceC 151 G4ForceCondition* condition ) 157 { 152 { 158 if ( (previousStepSize < 0.0) || (theNumberO 153 if ( (previousStepSize < 0.0) || (theNumberOfInteractionLengthLeft<=0.0)) 159 { 154 { 160 // beginning of tracking (or just after Do 155 // beginning of tracking (or just after DoIt() of this process) 161 ResetNumberOfInteractionLengthLeft(); 156 ResetNumberOfInteractionLengthLeft(); 162 } 157 } 163 else if ( previousStepSize > 0.0) 158 else if ( previousStepSize > 0.0) 164 { 159 { 165 // subtract NumberOfInteractionLengthLeft 160 // subtract NumberOfInteractionLengthLeft 166 SubtractNumberOfInteractionLengthLeft(prev 161 SubtractNumberOfInteractionLengthLeft(previousStepSize); 167 } 162 } 168 else 163 else 169 { 164 { 170 // zero step 165 // zero step 171 // DO NOTHING 166 // DO NOTHING 172 } 167 } 173 168 174 // condition is set to "Not Forced" 169 // condition is set to "Not Forced" 175 *condition = NotForced; 170 *condition = NotForced; 176 171 177 // get mean free path 172 // get mean free path 178 currentInteractionLength = GetMeanFreePath(t 173 currentInteractionLength = GetMeanFreePath(track,previousStepSize,condition); 179 174 180 175 181 G4double value; 176 G4double value; 182 if (currentInteractionLength < DBL_MAX) 177 if (currentInteractionLength < DBL_MAX) 183 { 178 { 184 value = theNumberOfInteractionLengthLeft * 179 value = theNumberOfInteractionLengthLeft * currentInteractionLength; 185 } 180 } 186 else 181 else 187 { 182 { 188 value = DBL_MAX; 183 value = DBL_MAX; 189 } 184 } 190 #ifdef G4VERBOSE 185 #ifdef G4VERBOSE 191 if (verboseLevel>1) 186 if (verboseLevel>1) 192 { 187 { 193 G4cout << "G4VRestContinuousDiscreteProces 188 G4cout << "G4VRestContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength() - "; 194 G4cout << "[ " << GetProcessName() << "]" 189 G4cout << "[ " << GetProcessName() << "]" << G4endl; 195 track.GetDynamicParticle()->DumpInfo(); 190 track.GetDynamicParticle()->DumpInfo(); 196 G4cout << " in Material " << track.GetMa 191 G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl; 197 G4cout << "InteractionLength= " << value/c 192 G4cout << "InteractionLength= " << value/cm <<"[cm] " << G4endl; 198 } 193 } 199 #endif 194 #endif 200 return value; 195 return value; 201 } 196 } 202 197 203 // ------------------------------------------- 198 // -------------------------------------------------------------------- 204 G4VParticleChange* 199 G4VParticleChange* 205 G4VRestContinuousDiscreteProcess::PostStepDoIt 200 G4VRestContinuousDiscreteProcess::PostStepDoIt( const G4Track& , 206 201 const G4Step& ) 207 { 202 { 208 ClearNumberOfInteractionLengthLeft(); 203 ClearNumberOfInteractionLengthLeft(); 209 204 210 return pParticleChange; 205 return pParticleChange; 211 } 206 } 212 207