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 // G4VContinuousDiscreteProcess class implemen << 27 // 26 // 28 // Authors: << 27 // $Id: G4VContinuousDiscreteProcess.cc 71231 2013-06-12 13:06:28Z gcosmo $ 29 // - 2 December 1995, G.Cosmo - First implemen << 28 // 30 // - 8 January 1997, H.Kurashige - New Physics << 29 // 31 // ------------------------------------------- << 30 // -------------------------------------------------------------- >> 31 // GEANT 4 class implementation file >> 32 // >> 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 "G4VContinuousDiscreteProcess.hh" 39 #include "G4VContinuousDiscreteProcess.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 G4VContinuousDiscreteProcess::G4VContinuousDis 47 G4VContinuousDiscreteProcess::G4VContinuousDiscreteProcess() 43 : G4VProcess("No Name Discrete Process") << 48 :G4VProcess("No Name Discrete Process"), >> 49 valueGPILSelection(CandidateForSelection) 44 { 50 { 45 G4Exception("G4VContinuousDiscreteProcess::G << 51 G4Exception("G4VContinuousDiscreteProcess::G4VContinuousDiscreteProcess()","ProcMan102", 46 "ProcMan102", JustWarning, "Defa << 52 JustWarning,"Default constructor is called"); 47 } 53 } 48 54 49 // ------------------------------------------- << 55 G4VContinuousDiscreteProcess::G4VContinuousDiscreteProcess(const G4String& aName , G4ProcessType aType) 50 G4VContinuousDiscreteProcess:: << 56 : G4VProcess(aName, aType), 51 G4VContinuousDiscreteProcess(const G4String& a << 57 valueGPILSelection(CandidateForSelection) 52 : G4VProcess(aName, aType) << 53 { 58 { 54 enableAtRestDoIt = false; 59 enableAtRestDoIt = false; 55 } 60 } 56 61 57 // ------------------------------------------- << 58 G4VContinuousDiscreteProcess::~G4VContinuousDi 62 G4VContinuousDiscreteProcess::~G4VContinuousDiscreteProcess() 59 { 63 { 60 } 64 } 61 65 62 // ------------------------------------------- << 66 G4VContinuousDiscreteProcess::G4VContinuousDiscreteProcess(G4VContinuousDiscreteProcess& right) 63 G4VContinuousDiscreteProcess:: << 67 : G4VProcess(right), 64 G4VContinuousDiscreteProcess(G4VContinuousDisc << 68 valueGPILSelection(right.valueGPILSelection) 65 : G4VProcess(right), << 66 valueGPILSelection(right.valueGPILSelectio << 67 { 69 { 68 } 70 } 69 71 70 // ------------------------------------------- << 72 G4double G4VContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength( 71 G4double G4VContinuousDiscreteProcess:: << 73 const G4Track& track, 72 PostStepGetPhysicalInteractionLength( const G4 << 74 G4double previousStepSize, 73 G4double << 75 G4ForceCondition* condition 74 G4ForceC << 76 ) 75 { << 77 { 76 if ( (previousStepSize <=0.0) || (theNumberO << 78 if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) { 77 { << 79 // beggining of tracking (or just after DoIt of this process) 78 // beginning of tracking (or just after Do << 79 ResetNumberOfInteractionLengthLeft(); 80 ResetNumberOfInteractionLengthLeft(); 80 } << 81 } else if ( previousStepSize > 0.0) { 81 else if ( previousStepSize > 0.0) << 82 { << 83 // subtract NumberOfInteractionLengthLeft 82 // subtract NumberOfInteractionLengthLeft 84 SubtractNumberOfInteractionLengthLeft(prev 83 SubtractNumberOfInteractionLengthLeft(previousStepSize); 85 } << 84 } else { 86 else << 87 { << 88 // zero step 85 // zero step 89 // DO NOTHING << 86 // DO NOTHING 90 } 87 } 91 88 92 // condition is set to "Not Forced" 89 // condition is set to "Not Forced" 93 *condition = NotForced; 90 *condition = NotForced; 94 91 95 // get mean free path 92 // get mean free path 96 currentInteractionLength = GetMeanFreePath(t << 93 currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition); 97 94 98 G4double value; 95 G4double value; 99 if (currentInteractionLength < DBL_MAX) << 96 if (currentInteractionLength <DBL_MAX) { 100 { << 101 value = theNumberOfInteractionLengthLeft * 97 value = theNumberOfInteractionLengthLeft * currentInteractionLength; 102 } << 98 } else { 103 else << 104 { << 105 value = DBL_MAX; 99 value = DBL_MAX; 106 } 100 } 107 #ifdef G4VERBOSE 101 #ifdef G4VERBOSE 108 if (verboseLevel>1) << 102 if (verboseLevel>1){ 109 { << 103 G4cout << "G4VContinuousDiscreteProcess::PostStepGetPhysicalInteractionLength "; 110 G4cout << "G4VContinuousDiscreteProcess::P << 104 G4cout << "[ " << GetProcessName() << "]" <<G4endl; 111 G4cout << "[ " << GetProcessName() << "]" << 112 track.GetDynamicParticle()->DumpInfo(); 105 track.GetDynamicParticle()->DumpInfo(); 113 G4cout << " in Material " << track.GetMa << 106 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; 114 G4cout << "InteractionLength= " << value/c << 107 G4cout << "InteractionLength= " << value/cm <<"[cm] " <<G4endl; 115 } 108 } 116 #endif 109 #endif 117 return value; 110 return value; 118 } 111 } 119 112 120 // ------------------------------------------- << 121 G4VParticleChange* << 122 G4VContinuousDiscreteProcess::PostStepDoIt( co << 123 co << 124 { << 125 // clear NumberOfInteractionLengthLeft << 126 ClearNumberOfInteractionLengthLeft(); << 127 113 128 return pParticleChange; << 114 G4VParticleChange* G4VContinuousDiscreteProcess::PostStepDoIt( >> 115 const G4Track& , >> 116 const G4Step& >> 117 ) >> 118 { >> 119 // clear NumberOfInteractionLengthLeft >> 120 ClearNumberOfInteractionLengthLeft(); >> 121 return pParticleChange; 129 } 122 } 130 123 131 // ------------------------------------------- << 124 G4VParticleChange* G4VContinuousDiscreteProcess::AlongStepDoIt( 132 G4VParticleChange* << 125 const G4Track& , 133 G4VContinuousDiscreteProcess::AlongStepDoIt( c << 126 const G4Step& 134 c << 127 ) 135 { 128 { 136 // clear NumberOfInteractionLengthLeft << 129 // clear NumberOfInteractionLengthLeft 137 ClearNumberOfInteractionLengthLeft(); << 130 ClearNumberOfInteractionLengthLeft(); 138 << 131 return pParticleChange; 139 return pParticleChange; << 140 } 132 } 141 133 142 // ------------------------------------------- << 134 G4double G4VContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength( 143 G4double G4VContinuousDiscreteProcess:: << 135 const G4Track& track, 144 AlongStepGetPhysicalInteractionLength( const G << 136 G4double previousStepSize, 145 G4doubl << 137 G4double currentMinimumStep, 146 G4doubl << 138 G4double& currentSafety, 147 G4doubl << 139 G4GPILSelection* selection 148 G4GPILS << 140 ) 149 { 141 { 150 // GPILSelection is set to defaule value of 142 // GPILSelection is set to defaule value of CandidateForSelection 151 valueGPILSelection = CandidateForSelection; 143 valueGPILSelection = CandidateForSelection; 152 144 153 // get Step limit proposed by the process 145 // get Step limit proposed by the process 154 G4double steplength = GetContinuousStepLimit << 146 G4double steplength = GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety); 155 147 156 // set return value for G4GPILSelection 148 // set return value for G4GPILSelection 157 *selection = valueGPILSelection; 149 *selection = valueGPILSelection; 158 150 159 #ifdef G4VERBOSE 151 #ifdef G4VERBOSE 160 if (verboseLevel>1) << 152 if (verboseLevel>1){ 161 { << 153 G4cout << "G4VContinuousDiscreteProcess::AlongStepGetPhysicalInteractionLength "; 162 G4cout << "G4VContinuousDiscreteProcess::A << 154 G4cout << "[ " << GetProcessName() << "]" <<G4endl; 163 G4cout << "[ " << GetProcessName() << "]" << 164 track.GetDynamicParticle()->DumpInfo(); 155 track.GetDynamicParticle()->DumpInfo(); 165 G4cout << " in Material " << track.GetMa << 156 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; 166 G4cout << "IntractionLength= " << stepleng << 157 G4cout << "IntractionLength= " << steplength/cm <<"[cm] " <<G4endl; 167 } 158 } 168 #endif 159 #endif 169 return steplength; << 160 return steplength ; 170 } 161 } 171 162