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