- Timestamp:
- Apr 6, 2009, 12:21:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/utils/src/G4VEmProcess.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmProcess.cc,v 1. 48 2007/10/29 08:38:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4VEmProcess.cc,v 1.62 2009/02/19 09:57:36 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 82 82 83 83 G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type): 84 G4VDiscreteProcess(name, type), 85 selectedModel(0), 84 G4VDiscreteProcess(name, type), 85 secondaryParticle(0), 86 buildLambdaTable(true), 86 87 theLambdaTable(0), 87 88 theEnergyOfCrossSectionMax(0), 88 89 theCrossSectionMax(0), 89 particle(0),90 secondaryParticle(0),91 nLambdaBins(90),92 lambdaFactor(0.8),93 currentCouple(0),94 90 integral(false), 95 buildLambdaTable(true),96 91 applyCuts(false), 97 92 startFromNull(true), 98 nRegions(0) 93 useDeexcitation(false), 94 nDERegions(0), 95 idxDERegions(0), 96 currentModel(0), 97 particle(0), 98 currentCouple(0) 99 99 { 100 100 SetVerboseLevel(1); 101 102 // Size of tables assuming spline 101 103 minKinEnergy = 0.1*keV; 102 maxKinEnergy = 100.0*GeV; 104 maxKinEnergy = 100.0*TeV; 105 nLambdaBins = 84; 106 107 // default lambda factor 108 lambdaFactor = 0.8; 109 110 // default limit on polar angle 111 polarAngleLimit = 0.0; 112 113 // particle types 103 114 theGamma = G4Gamma::Gamma(); 104 115 theElectron = G4Electron::Electron(); … … 126 137 delete modelManager; 127 138 (G4LossTableManager::Instance())->DeRegister(this); 139 } 140 141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 142 143 void G4VEmProcess::Clear() 144 { 145 delete [] theEnergyOfCrossSectionMax; 146 delete [] theCrossSectionMax; 147 delete [] idxDERegions; 148 theEnergyOfCrossSectionMax = 0; 149 theCrossSectionMax = 0; 150 idxDERegions = 0; 151 currentCouple = 0; 152 preStepLambda = 0.0; 153 mfpKinEnergy = DBL_MAX; 154 deRegions.clear(); 155 nDERegions = 0; 128 156 } 129 157 … … 153 181 theLambdaTable = G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable); 154 182 } 155 } 156 157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 158 159 void G4VEmProcess::Clear() 160 { 161 if(theEnergyOfCrossSectionMax) delete [] theEnergyOfCrossSectionMax; 162 if(theCrossSectionMax) delete [] theCrossSectionMax; 163 theEnergyOfCrossSectionMax = 0; 164 theCrossSectionMax = 0; 165 currentCouple = 0; 166 preStepLambda = 0.0; 167 mfpKinEnergy = DBL_MAX; 183 // Sub Cutoff and Deexcitation 184 if (nDERegions>0) { 185 186 const G4ProductionCutsTable* theCoupleTable= 187 G4ProductionCutsTable::GetProductionCutsTable(); 188 size_t numOfCouples = theCoupleTable->GetTableSize(); 189 190 idxDERegions = new G4bool[numOfCouples]; 191 192 for (size_t j=0; j<numOfCouples; j++) { 193 194 const G4MaterialCutsCouple* couple = 195 theCoupleTable->GetMaterialCutsCouple(j); 196 const G4ProductionCuts* pcuts = couple->GetProductionCuts(); 197 G4bool reg = false; 198 for(G4int i=0; i<nDERegions; i++) { 199 if(deRegions[i]) { 200 if(pcuts == deRegions[i]->GetProductionCuts()) reg = true; 201 } 202 } 203 idxDERegions[j] = reg; 204 } 205 } 206 if (1 < verboseLevel && nDERegions>0) { 207 G4cout << " Deexcitation is activated for regions: " << G4endl; 208 for (G4int i=0; i<nDERegions; i++) { 209 const G4Region* r = deRegions[i]; 210 G4cout << " " << r->GetName() << G4endl; 211 } 212 } 168 213 } 169 214 … … 228 273 G4cout << *theLambdaTable << G4endl; 229 274 } 275 } 276 } 277 278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 279 280 void G4VEmProcess::PrintInfoDefinition() 281 { 282 if(verboseLevel > 0) { 283 G4cout << G4endl << GetProcessName() << ": for " 284 << particle->GetParticleName(); 285 if(integral) G4cout << ", integral: 1 "; 286 if(applyCuts) G4cout << ", applyCuts: 1 "; 287 G4cout << " SubType= " << GetProcessSubType() << G4endl; 288 if(buildLambdaTable) { 289 G4cout << " Lambda tables from " 290 << G4BestUnit(minKinEnergy,"Energy") 291 << " to " 292 << G4BestUnit(maxKinEnergy,"Energy") 293 << " in " << nLambdaBins << " bins, spline: " 294 << (G4LossTableManager::Instance())->SplineFlag() 295 << G4endl; 296 } 297 PrintInfo(); 298 modelManager->DumpModelList(verboseLevel); 299 } 300 301 if(verboseLevel > 2 && buildLambdaTable) { 302 G4cout << " LambdaTable address= " << theLambdaTable << G4endl; 303 if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl; 230 304 } 231 305 } … … 295 369 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 296 370 297 G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,298 G4double,299 G4ForceCondition* condition)300 {301 *condition = NotForced;302 return G4VEmProcess::MeanFreePath(track);303 }304 305 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....306 307 371 G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track, 308 372 const G4Step&) … … 333 397 } 334 398 335 G4VEmModel* currentModel = SelectModel(finalT); 336 399 SelectModel(finalT); 400 if(useDeexcitation) { 401 currentModel->SetDeexcitationFlag(idxDERegions[currentMaterialIndex]); 402 } 337 403 /* 338 404 if(0 < verboseLevel) { … … 373 439 374 440 } else if (p == thePositron) { 375 if (e < (*theCutsPositron)[currentMaterialIndex]) { 441 if (electron_mass_c2 < (*theCutsGamma)[currentMaterialIndex] && 442 e < (*theCutsPositron)[currentMaterialIndex]) { 376 443 good = false; 377 444 e += 2.0*electron_mass_c2; … … 394 461 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 395 462 396 void G4VEmProcess::PrintInfoDefinition()397 {398 if(verboseLevel > 0) {399 G4cout << G4endl << GetProcessName() << ": " ;400 PrintInfo();401 if(integral) {402 G4cout << " Integral mode is used "<< G4endl;403 }404 }405 406 if (!buildLambdaTable) return;407 408 if(verboseLevel > 0) {409 G4cout << " tables are built for "410 << particle->GetParticleName()411 << G4endl412 << " Lambda tables from "413 << G4BestUnit(minKinEnergy,"Energy")414 << " to "415 << G4BestUnit(maxKinEnergy,"Energy")416 << " in " << nLambdaBins << " bins."417 << G4endl;418 }419 420 if(verboseLevel > 1) {421 G4cout << "Tables are built for " << particle->GetParticleName()422 << G4endl;423 424 if(verboseLevel > 2) {425 G4cout << "LambdaTable address= " << theLambdaTable << G4endl;426 if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;427 }428 }429 }430 431 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....432 433 G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,434 const G4MaterialCutsCouple* couple)435 {436 // Cross section per atom is calculated437 DefineMaterial(couple);438 G4double cross = 0.0;439 G4bool b;440 if(theLambdaTable) {441 cross = (((*theLambdaTable)[currentMaterialIndex])->442 GetValue(kineticEnergy, b));443 444 cross /= currentMaterial->GetTotNbOfAtomsPerVolume();445 } else {446 G4VEmModel* model = SelectModel(kineticEnergy);447 cross =448 model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);449 }450 451 return cross;452 }453 454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....455 456 463 G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part, 457 464 const G4String& directory, … … 508 515 << G4endl; 509 516 } 517 if((G4LossTableManager::Instance())->SplineFlag()) { 518 size_t n = theLambdaTable->length(); 519 for(size_t i=0; i<n; i++) {(* theLambdaTable)[i]->SetSpline(true);} 520 } 510 521 } else { 511 522 if (1 < verboseLevel) { … … 517 528 518 529 return yes; 530 } 531 532 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 533 534 void G4VEmProcess::ActivateDeexcitation(G4bool val, const G4Region* r) 535 { 536 G4RegionStore* regionStore = G4RegionStore::GetInstance(); 537 const G4Region* reg = r; 538 if (!reg) {reg = regionStore->GetRegion("DefaultRegionForTheWorld", false);} 539 540 // the region is in the list 541 if (nDERegions) { 542 for (G4int i=0; i<nDERegions; i++) { 543 if (reg == deRegions[i]) { 544 if(!val) deRegions[i] = 0; 545 return; 546 } 547 } 548 } 549 550 // new region 551 if(val) { 552 useDeexcitation = true; 553 deRegions.push_back(reg); 554 nDERegions++; 555 } else { 556 useDeexcitation = false; 557 } 558 } 559 560 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 561 562 G4double G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy, 563 const G4MaterialCutsCouple* couple) 564 { 565 // Cross section per atom is calculated 566 DefineMaterial(couple); 567 G4double cross = 0.0; 568 G4bool b; 569 if(theLambdaTable) { 570 cross = (((*theLambdaTable)[currentMaterialIndex])-> 571 GetValue(kineticEnergy, b)); 572 } else { 573 SelectModel(kineticEnergy); 574 cross = currentModel->CrossSectionPerVolume(currentMaterial, 575 particle,kineticEnergy); 576 } 577 578 return cross; 579 } 580 581 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 582 583 G4double G4VEmProcess::GetMeanFreePath(const G4Track& track, 584 G4double, 585 G4ForceCondition* condition) 586 { 587 *condition = NotForced; 588 return G4VEmProcess::MeanFreePath(track); 519 589 } 520 590 … … 568 638 G4PhysicsVector* v = 569 639 new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins); 640 v->SetSpline((G4LossTableManager::Instance())->SplineFlag()); 570 641 return v; 571 642 }
Note: See TracChangeset
for help on using the changeset viewer.