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 // $Id: G4LowEWentzelVIModel.cc 74528 2013-10-12 17:24:24Z vnivanch $ 26 // 27 // 27 // ------------------------------------------- 28 // ------------------------------------------------------------------- 28 // 29 // 29 // GEANT4 Class file 30 // GEANT4 Class file 30 // 31 // 31 // 32 // 32 // File name: G4LowEWentzelVIModel 33 // File name: G4LowEWentzelVIModel 33 // 34 // 34 // Author: V.Ivanchenko 35 // Author: V.Ivanchenko 35 // 36 // 36 // Creation date: 11.02.2014 from G4WentzelVIM 37 // Creation date: 11.02.2014 from G4WentzelVIModel 37 // 38 // 38 // Modifications: 39 // Modifications: 39 // 40 // 40 // Class Description: 41 // Class Description: 41 // 42 // 42 43 43 // ------------------------------------------- 44 // ------------------------------------------------------------------- 44 // 45 // 45 46 46 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 49 49 #include "G4LowEWentzelVIModel.hh" 50 #include "G4LowEWentzelVIModel.hh" 50 #include "G4PhysicalConstants.hh" 51 #include "G4PhysicalConstants.hh" 51 #include "G4SystemOfUnits.hh" 52 #include "G4SystemOfUnits.hh" 52 53 53 //....oooOO0OOooo........oooOO0OOooo........oo 54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 54 55 >> 56 using namespace std; >> 57 55 G4LowEWentzelVIModel::G4LowEWentzelVIModel() : 58 G4LowEWentzelVIModel::G4LowEWentzelVIModel() : 56 G4WentzelVIModel(true, "LowEnWentzelVI") << 59 G4WentzelVIModel(false,"LowEnWentzelVI") 57 { 60 { 58 SetSingleScatteringFactor(0.5); 61 SetSingleScatteringFactor(0.5); 59 } 62 } 60 63 61 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 62 65 >> 66 G4LowEWentzelVIModel::~G4LowEWentzelVIModel() >> 67 {} >> 68 >> 69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 70 63 G4double G4LowEWentzelVIModel::ComputeTruePath 71 G4double G4LowEWentzelVIModel::ComputeTruePathLengthLimit( 64 const G4Track& tr 72 const G4Track& track, 65 G4double& currentMinimalStep) 73 G4double& currentMinimalStep) 66 { 74 { 67 G4double tlimit = currentMinimalStep; 75 G4double tlimit = currentMinimalStep; 68 const G4DynamicParticle* dp = track.GetDynam 76 const G4DynamicParticle* dp = track.GetDynamicParticle(); 69 G4StepPoint* sp = track.GetStep()->GetPreSte 77 G4StepPoint* sp = track.GetStep()->GetPreStepPoint(); 70 G4StepStatus stepStatus = sp->GetStepStatus( 78 G4StepStatus stepStatus = sp->GetStepStatus(); 71 singleScatteringMode = false; 79 singleScatteringMode = false; >> 80 //G4cout << "G4LowEWentzelVIModel::ComputeTruePathLengthLimit stepStatus= " >> 81 // << stepStatus << " " << track.GetDefinition()->GetParticleName() >> 82 // << G4endl; 72 83 73 // initialisation for each step, lambda may 84 // initialisation for each step, lambda may be computed from scratch 74 preKinEnergy = dp->GetKineticEnergy(); 85 preKinEnergy = dp->GetKineticEnergy(); 75 DefineMaterial(track.GetMaterialCutsCouple() 86 DefineMaterial(track.GetMaterialCutsCouple()); 76 lambdaeff = GetTransportMeanFreePath(particl 87 lambdaeff = GetTransportMeanFreePath(particle,preKinEnergy); 77 currentRange = GetRange(particle,preKinEnerg 88 currentRange = GetRange(particle,preKinEnergy,currentCouple); 78 cosTetMaxNuc = wokvi->SetupKinematic(preKinE 89 cosTetMaxNuc = wokvi->SetupKinematic(preKinEnergy, currentMaterial); 79 << 90 /* >> 91 G4cout << "lambdaeff= " << lambdaeff << " Range= " << currentRange >> 92 << " tlimit= " << tlimit << " 1-cost= " << 1 - cosTetMaxNuc << G4endl; >> 93 */ 80 // extra check for abnormal situation 94 // extra check for abnormal situation 81 // this check needed to run MSC with eIoni a 95 // this check needed to run MSC with eIoni and eBrem inactivated 82 tlimit = std::min(tlimit, currentRange); 96 tlimit = std::min(tlimit, currentRange); 83 97 84 // stop here if small range particle 98 // stop here if small range particle 85 if(tlimit < tlimitminfix) { 99 if(tlimit < tlimitminfix) { 86 return ConvertTrueToGeom(tlimit, currentMi 100 return ConvertTrueToGeom(tlimit, currentMinimalStep); 87 } 101 } 88 102 89 // pre step 103 // pre step 90 G4double presafety = sp->GetSafety(); 104 G4double presafety = sp->GetSafety(); 91 // far from geometry boundary 105 // far from geometry boundary 92 if(currentRange < presafety) { 106 if(currentRange < presafety) { 93 return ConvertTrueToGeom(tlimit, currentMi 107 return ConvertTrueToGeom(tlimit, currentMinimalStep); 94 } 108 } 95 109 96 // compute presafety again if presafety <= 0 110 // compute presafety again if presafety <= 0 and no boundary 97 // i.e. when it is needed for optimization p 111 // i.e. when it is needed for optimization purposes 98 if(stepStatus != fGeomBoundary && presafety 112 if(stepStatus != fGeomBoundary && presafety < tlimitminfix) { 99 presafety = ComputeSafety(sp->GetPosition( 113 presafety = ComputeSafety(sp->GetPosition(), tlimit); 100 if(currentRange < presafety) { 114 if(currentRange < presafety) { 101 return ConvertTrueToGeom(tlimit, current 115 return ConvertTrueToGeom(tlimit, currentMinimalStep); 102 } 116 } 103 } 117 } 104 /* 118 /* 105 G4cout << "e(MeV)= " << preKinEnergy/MeV 119 G4cout << "e(MeV)= " << preKinEnergy/MeV 106 << " " << particle->GetParticleName() 120 << " " << particle->GetParticleName() 107 << " CurLimit(mm)= " << tlimit/mm <<" safet 121 << " CurLimit(mm)= " << tlimit/mm <<" safety(mm)= " << presafety/mm 108 << " R(mm)= " <<currentRange/mm 122 << " R(mm)= " <<currentRange/mm 109 << " L0(mm^-1)= " << lambdaeff*mm 123 << " L0(mm^-1)= " << lambdaeff*mm 110 <<G4endl; 124 <<G4endl; 111 */ 125 */ 112 // natural limit for high energy 126 // natural limit for high energy 113 G4double rlimit = std::max(facrange*currentR 127 G4double rlimit = std::max(facrange*currentRange, lambdaeff); >> 128 //G4double rlimit = std::max(facrange*currentRange, >> 129 // 0.7*(1.0 - cosTetMaxNuc)*lambdaeff); 114 130 115 // low-energy e- 131 // low-energy e- 116 rlimit = std::max(rlimit, facsafety*presafet 132 rlimit = std::max(rlimit, facsafety*presafety); 117 << 133 >> 134 // cut correction >> 135 //G4double rcut = currentCouple->GetProductionCuts()->GetProductionCut(1); >> 136 //G4cout << "rcut= " << rcut << " rlimit= " << rlimit << " presafety= " >> 137 // << presafety << " 1-cosThetaMax= " <<1-cosThetaMax >> 138 //<< " 1-cosTetMaxNuc= " << 1-cosTetMaxNuc << G4endl; >> 139 //if(rcut > rlimit) { rlimit = std::min(rlimit, rcut*sqrt(rlimit/rcut)); } >> 140 118 tlimit = std::min(tlimit, rlimit); 141 tlimit = std::min(tlimit, rlimit); 119 tlimit = std::max(tlimit, tlimitminfix); 142 tlimit = std::max(tlimit, tlimitminfix); 120 143 121 // step limit in infinite media 144 // step limit in infinite media 122 tlimit = std::min(tlimit, 50*currentMaterial 145 tlimit = std::min(tlimit, 50*currentMaterial->GetRadlen()/facgeom); 123 146 124 //compute geomlimit and force few steps with 147 //compute geomlimit and force few steps within a volume 125 if (steppingAlgorithm == fUseDistanceToBound 148 if (steppingAlgorithm == fUseDistanceToBoundary 126 && stepStatus == fGeomBoundary) { 149 && stepStatus == fGeomBoundary) { 127 150 128 G4double geomlimit = ComputeGeomLimit(trac 151 G4double geomlimit = ComputeGeomLimit(track, presafety, currentRange); 129 tlimit = std::min(tlimit, geomlimit/facgeo 152 tlimit = std::min(tlimit, geomlimit/facgeom); 130 } 153 } 131 /* 154 /* 132 G4cout << particle->GetParticleName() << " E 155 G4cout << particle->GetParticleName() << " E(MeV)= " << preKinEnergy 133 << " L0= " << lambdaeff << " R= " << curren 156 << " L0= " << lambdaeff << " R= " << currentRange 134 << " tlimit= " << tlimit 157 << " tlimit= " << tlimit 135 << " currentMinimalStep= " << currentMini 158 << " currentMinimalStep= " << currentMinimalStep << G4endl; 136 */ 159 */ 137 return ConvertTrueToGeom(tlimit, currentMini 160 return ConvertTrueToGeom(tlimit, currentMinimalStep); 138 } 161 } 139 162 140 //....oooOO0OOooo........oooOO0OOooo........oo 163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 141 164