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 class implementation 26 // G4VRestDiscreteProcess class implementation 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 "G4VRestDiscreteProcess.hh" 33 #include "G4VRestDiscreteProcess.hh" 34 #include "G4SystemOfUnits.hh" 34 #include "G4SystemOfUnits.hh" 35 35 36 #include "Randomize.hh" 36 #include "Randomize.hh" 37 #include "G4Step.hh" 37 #include "G4Step.hh" 38 #include "G4Track.hh" 38 #include "G4Track.hh" 39 #include "G4MaterialTable.hh" 39 #include "G4MaterialTable.hh" 40 #include "G4VParticleChange.hh" 40 #include "G4VParticleChange.hh" 41 41 42 // ------------------------------------------- 42 // -------------------------------------------------------------------- 43 G4VRestDiscreteProcess::G4VRestDiscreteProcess 43 G4VRestDiscreteProcess::G4VRestDiscreteProcess() 44 : G4VProcess("No Name Discrete Process") 44 : G4VProcess("No Name Discrete Process") 45 { 45 { 46 G4Exception("G4VRestDiscreteProcess::G4VRest 46 G4Exception("G4VRestDiscreteProcess::G4VRestDiscreteProcess", "ProcMan102", 47 JustWarning, "Default constructo 47 JustWarning, "Default constructor is called"); 48 } 48 } 49 49 50 // ------------------------------------------- 50 // -------------------------------------------------------------------- 51 G4VRestDiscreteProcess:: 51 G4VRestDiscreteProcess:: 52 G4VRestDiscreteProcess(const G4String& aName, 52 G4VRestDiscreteProcess(const G4String& aName, G4ProcessType aType) 53 : G4VProcess(aName, aType) 53 : G4VProcess(aName, aType) 54 { 54 { 55 enableAlongStepDoIt = false; 55 enableAlongStepDoIt = false; 56 } 56 } 57 57 58 // ------------------------------------------- 58 // -------------------------------------------------------------------- 59 G4VRestDiscreteProcess::~G4VRestDiscreteProces 59 G4VRestDiscreteProcess::~G4VRestDiscreteProcess() 60 { 60 { 61 } 61 } 62 62 63 // ------------------------------------------- 63 // -------------------------------------------------------------------- 64 G4VRestDiscreteProcess:: 64 G4VRestDiscreteProcess:: 65 G4VRestDiscreteProcess(G4VRestDiscreteProcess& 65 G4VRestDiscreteProcess(G4VRestDiscreteProcess& right) 66 : G4VProcess(right) 66 : G4VProcess(right) 67 { 67 { 68 } 68 } 69 69 70 // ------------------------------------------- 70 // -------------------------------------------------------------------- 71 G4double G4VRestDiscreteProcess:: 71 G4double G4VRestDiscreteProcess:: 72 PostStepGetPhysicalInteractionLength( const G4 72 PostStepGetPhysicalInteractionLength( const G4Track& track, 73 G4double 73 G4double previousStepSize, 74 G4ForceC 74 G4ForceCondition* condition ) 75 { 75 { 76 if ( (previousStepSize < 0.0) || (theNumberO 76 if ( (previousStepSize < 0.0) || (theNumberOfInteractionLengthLeft<=0.0)) 77 { 77 { 78 // beginning of tracking (or just after Do 78 // beginning of tracking (or just after DoIt() of this process) 79 ResetNumberOfInteractionLengthLeft(); 79 ResetNumberOfInteractionLengthLeft(); 80 } 80 } 81 else if ( previousStepSize > 0.0) 81 else if ( previousStepSize > 0.0) 82 { 82 { 83 // subtract NumberOfInteractionLengthLeft 83 // subtract NumberOfInteractionLengthLeft 84 SubtractNumberOfInteractionLengthLeft(prev 84 SubtractNumberOfInteractionLengthLeft(previousStepSize); 85 } 85 } 86 else 86 else 87 { 87 { 88 // zero step 88 // zero step 89 // DO NOTHING 89 // DO NOTHING 90 } 90 } 91 91 92 // condition is set to "Not Forced" 92 // condition is set to "Not Forced" 93 *condition = NotForced; 93 *condition = NotForced; 94 94 95 // get mean free path 95 // get mean free path 96 currentInteractionLength = GetMeanFreePath(t 96 currentInteractionLength = GetMeanFreePath(track,previousStepSize,condition); 97 97 98 G4double value; 98 G4double value; 99 if (currentInteractionLength < DBL_MAX) 99 if (currentInteractionLength < DBL_MAX) 100 { 100 { 101 value = theNumberOfInteractionLengthLeft * 101 value = theNumberOfInteractionLengthLeft * currentInteractionLength; 102 } 102 } 103 else 103 else 104 { 104 { 105 value = DBL_MAX; 105 value = DBL_MAX; 106 } 106 } 107 #ifdef G4VERBOSE 107 #ifdef G4VERBOSE 108 if (verboseLevel>1) 108 if (verboseLevel>1) 109 { 109 { 110 G4double length = (value < DBL_MAX) ? valu << 111 G4cout << "G4VRestDiscreteProcess::PostSte 110 G4cout << "G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength() - "; 112 G4cout << "[ " << GetProcessName() << "]" 111 G4cout << "[ " << GetProcessName() << "]" << G4endl; 113 track.GetDynamicParticle()->DumpInfo(); 112 track.GetDynamicParticle()->DumpInfo(); 114 G4cout << " in Material " << track.GetMa 113 G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl; 115 G4cout << "InteractionLength= " << length << 114 G4cout << "InteractionLength= " << value/cm <<"[cm] " << G4endl; 116 } 115 } 117 #endif 116 #endif 118 return value; 117 return value; 119 } 118 } 120 119 121 // ------------------------------------------- 120 // -------------------------------------------------------------------- 122 G4VParticleChange* 121 G4VParticleChange* 123 G4VRestDiscreteProcess::PostStepDoIt( const G4 122 G4VRestDiscreteProcess::PostStepDoIt( const G4Track& , 124 const G4 123 const G4Step& ) 125 { 124 { 126 ClearNumberOfInteractionLengthLeft(); 125 ClearNumberOfInteractionLengthLeft(); 127 126 128 return pParticleChange; 127 return pParticleChange; 129 } 128 } 130 129 131 // ------------------------------------------- 130 // -------------------------------------------------------------------- 132 G4double G4VRestDiscreteProcess:: 131 G4double G4VRestDiscreteProcess:: 133 AtRestGetPhysicalInteractionLength( const G4Tr 132 AtRestGetPhysicalInteractionLength( const G4Track& track, 134 G4ForceCon 133 G4ForceCondition* condition ) 135 { 134 { 136 // beginning of tracking 135 // beginning of tracking 137 ResetNumberOfInteractionLengthLeft(); 136 ResetNumberOfInteractionLengthLeft(); 138 137 139 // condition is set to "Not Forced" 138 // condition is set to "Not Forced" 140 *condition = NotForced; 139 *condition = NotForced; 141 140 142 // get mean life time 141 // get mean life time 143 currentInteractionLength = GetMeanLifeTime(t 142 currentInteractionLength = GetMeanLifeTime(track, condition); 144 143 145 G4double time = (currentInteractionLength < << 146 theNumberOfInteractionLengthLeft * current << 147 << 148 #ifdef G4VERBOSE 144 #ifdef G4VERBOSE 149 if ((currentInteractionLength <0.0) || (verb 145 if ((currentInteractionLength <0.0) || (verboseLevel>2)) 150 { 146 { 151 G4double t = (currentInteractionLength < D << 152 currentInteractionLength/ns : DBL_MAX; << 153 G4cout << "G4VRestDiscreteProcess::AtRestG 147 G4cout << "G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength() - "; 154 G4cout << "[ " << GetProcessName() << "]" 148 G4cout << "[ " << GetProcessName() << "]" << G4endl; 155 track.GetDynamicParticle()->DumpInfo(); 149 track.GetDynamicParticle()->DumpInfo(); 156 G4cout << " in Material " << track.GetMat 150 G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl; 157 G4cout << "MeanLifeTime = " << t << " [ns] << 151 G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" 158 << G4endl; 152 << G4endl; 159 } 153 } 160 #endif 154 #endif 161 155 162 return time; << 156 return theNumberOfInteractionLengthLeft * currentInteractionLength; 163 } 157 } 164 158 165 // ------------------------------------------- 159 // -------------------------------------------------------------------- 166 G4VParticleChange* 160 G4VParticleChange* 167 G4VRestDiscreteProcess::AtRestDoIt( const G4Tr 161 G4VRestDiscreteProcess::AtRestDoIt( const G4Track&, 168 const G4St 162 const G4Step& ) 169 { 163 { 170 ClearNumberOfInteractionLengthLeft(); 164 ClearNumberOfInteractionLengthLeft(); 171 165 172 return pParticleChange; 166 return pParticleChange; 173 } 167 } 174 168