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