- Timestamp:
- Apr 6, 2009, 12:21:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/muons/src/G4EnergyLossForExtrapolator.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EnergyLossForExtrapolator.cc,v 1.1 3 2007/07/28 13:44:25vnivanch Exp $27 // GEANT4 tag $Name: $26 // $Id: G4EnergyLossForExtrapolator.cc,v 1.18 2008/11/13 14:14:07 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 //--------------------------------------------------------------------------- … … 67 67 #include "G4MuBremsstrahlungModel.hh" 68 68 #include "G4ProductionCuts.hh" 69 #include "G4LossTableManager.hh" 70 #include "G4WentzelVIModel.hh" 69 71 70 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 88 90 delete invRangePositron; 89 91 delete invRangeProton; 92 delete mscElectron; 90 93 delete cuts; 91 94 } … … 100 103 if(!isInitialised) Initialisation(); 101 104 G4double kinEnergyFinal = kinEnergy; 102 if( mat && part) {103 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);105 if(SetupKinematics(part, mat, kinEnergy)) { 106 G4double step = TrueStepLength(kinEnergy,stepLength,mat,part); 104 107 G4double r = ComputeRange(kinEnergy,part); 105 108 if(r <= step) { … … 125 128 G4double kinEnergyFinal = kinEnergy; 126 129 127 if( mat && part) {128 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);130 if(SetupKinematics(part, mat, kinEnergy)) { 131 G4double step = TrueStepLength(kinEnergy,stepLength,mat,part); 129 132 G4double r = ComputeRange(kinEnergy,part); 130 133 … … 141 144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 142 145 143 G4double G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat, 144 const G4ParticleDefinition* part, 145 G4double kinEnergy, G4double stepLength) 146 { 146 G4double G4EnergyLossForExtrapolator::TrueStepLength(G4double kinEnergy, 147 G4double stepLength, 148 const G4Material* mat, 149 const G4ParticleDefinition* part) 150 { 151 G4double res = stepLength; 152 if(!isInitialised) Initialisation(); 153 if(SetupKinematics(part, mat, kinEnergy)) { 154 if(part == electron || part == positron) { 155 G4double x = stepLength*ComputeValue(kinEnergy, mscElectron); 156 if(x < 0.2) res *= (1.0 + 0.5*x + x*x/3.0); 157 else if(x < 0.9999) res = -std::log(1.0 - x)*stepLength/x; 158 else res = ComputeRange(kinEnergy,part); 159 160 } else { 161 res = ComputeTrueStep(mat,part,kinEnergy,stepLength); 162 } 163 } 164 return res; 165 } 166 167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 168 169 G4bool G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part, 170 const G4Material* mat, 171 G4double kinEnergy) 172 { 173 if(!part || !mat || kinEnergy < keV) return false; 147 174 if(!isInitialised) Initialisation(); 148 175 G4bool flag = false; … … 182 209 if(tmax > maxEnergyTransfer) tmax = maxEnergyTransfer; 183 210 } 184 G4double theta = ComputeScatteringAngle(stepLength); 185 return stepLength*std::sqrt(1.0 + 0.625*theta*theta); 211 return true; 186 212 } 187 213 … … 231 257 invRangeMuon = PrepareTable(); 232 258 invRangeProton = PrepareTable(); 259 mscElectron = PrepareTable(); 233 260 234 261 G4LossTableBuilder builder; … … 262 289 builder.BuildInverseRangeTable(rangeProton, invRangeProton); 263 290 291 ComputeTrasportXS(electron, mscElectron); 264 292 } 265 293 … … 273 301 274 302 G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins); 303 v->SetSpline(G4LossTableManager::Instance()->SplineFlag()); 275 304 table->push_back(v); 276 305 } … … 488 517 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 489 518 519 void G4EnergyLossForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part, 520 G4PhysicsTable* table) 521 { 522 G4DataVector v; 523 G4WentzelVIModel* msc = new G4WentzelVIModel(); 524 msc->SetPolarAngleLimit(CLHEP::pi); 525 msc->Initialise(part, v); 526 527 mass = part->GetPDGMass(); 528 charge2 = 1.0; 529 currentParticle = part; 530 531 const G4MaterialTable* mtable = G4Material::GetMaterialTable(); 532 533 if(0<verbose) { 534 G4cout << "G4EnergyLossForExtrapolator::ComputeProtonDEDX for " << part->GetParticleName() 535 << G4endl; 536 } 537 538 for(G4int i=0; i<nmat; i++) { 539 540 const G4Material* mat = (*mtable)[i]; 541 if(1<verbose) 542 G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl; 543 G4PhysicsVector* aVector = (*table)[i]; 544 for(G4int j=0; j<nbins; j++) { 545 546 G4double e = aVector->GetLowEdgeEnergy(j); 547 G4double xs = msc->CrossSectionPerVolume(mat,part,e); 548 aVector->PutValue(j,xs); 549 if(1<verbose) { 550 G4cout << "j= " << j << " e(MeV)= " << e/MeV 551 << " xs(1/mm)= " << xs*mm << G4endl; 552 } 553 } 554 } 555 delete msc; 556 } 557 558 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 559
Note: See TracChangeset
for help on using the changeset viewer.