- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/utils/include/G4VEmModel.hh
r1228 r1315 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmModel.hh,v 1.7 2 2009/09/23 14:42:47vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 3$26 // $Id: G4VEmModel.hh,v 1.75 2010/05/26 10:41:34 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 150 150 151 151 // Compute effective ion charge square 152 virtual G4double ChargeSquareRatio(const G4Track&); 153 154 // Compute effective ion charge square 152 155 virtual G4double GetChargeSquareRatio(const G4ParticleDefinition*, 153 156 const G4Material*, … … 228 231 G4double maxEnergy = DBL_MAX); 229 232 233 // select isotope in order to have precise mass of the nucleus 234 inline G4int SelectIsotopeNumber(const G4Element*); 235 230 236 // atom can be selected effitiantly if element selectors are initialised 231 237 inline const G4Element* SelectRandomAtom(const G4MaterialCutsCouple*, … … 236 242 237 243 // to select atom cross section per volume is recomputed for each element 238 inline const G4Element* SelectRandomAtom(const G4Material*, 239 const G4ParticleDefinition*, 240 G4double kineticEnergy, 241 G4double cutEnergy = 0.0, 242 G4double maxEnergy = DBL_MAX); 243 244 // select isotope in order to have precise mass of the nucleus 245 inline G4int SelectIsotopeNumber(const G4Element*); 244 const G4Element* SelectRandomAtom(const G4Material*, 245 const G4ParticleDefinition*, 246 G4double kineticEnergy, 247 G4double cutEnergy = 0.0, 248 G4double maxEnergy = DBL_MAX); 246 249 247 250 //------------------------------------------------------------------------ … … 291 294 inline void SetCurrentCouple(const G4MaterialCutsCouple*); 292 295 296 inline const G4Element* GetCurrentElement() const; 297 293 298 protected: 294 299 … … 296 301 297 302 inline void SetCurrentElement(const G4Element*); 298 299 inline const G4Element* GetCurrentElement() const;300 303 301 304 private: … … 341 344 }; 342 345 343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 346 // ======== Run time inline methods ================ 347 348 inline void G4VEmModel::SetCurrentCouple(const G4MaterialCutsCouple* p) 349 { 350 currentCouple = p; 351 } 352 353 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 354 355 inline const G4MaterialCutsCouple* G4VEmModel::CurrentCouple() const 356 { 357 return currentCouple; 358 } 359 360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 361 362 inline void G4VEmModel::SetCurrentElement(const G4Element* elm) 363 { 364 currentElement = elm; 365 } 366 367 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 368 369 inline const G4Element* G4VEmModel::GetCurrentElement() const 370 { 371 return currentElement; 372 } 373 374 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 375 376 inline 377 G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynPart) 378 { 379 return MaxSecondaryEnergy(dynPart->GetDefinition(), 380 dynPart->GetKineticEnergy()); 381 } 382 344 383 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 345 384 … … 375 414 G4double mfp = DBL_MAX; 376 415 G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax); 377 if (cross > DBL_MIN) mfp = 1./cross;416 if (cross > DBL_MIN) { mfp = 1./cross; } 378 417 return mfp; 379 418 } … … 415 454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 416 455 417 inline418 const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* material,419 const G4ParticleDefinition* pd,420 G4double kinEnergy,421 G4double tcut,422 G4double tmax)423 {424 const G4ElementVector* theElementVector = material->GetElementVector();425 G4int n = material->GetNumberOfElements() - 1;426 currentElement = (*theElementVector)[n];427 if (n > 0) {428 G4double x = G4UniformRand()*429 G4VEmModel::CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);430 for(G4int i=0; i<n; i++) {431 if (x <= xsec[i]) {432 currentElement = (*theElementVector)[i];433 break;434 }435 }436 }437 return currentElement;438 }439 440 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......441 442 456 inline G4int G4VEmModel::SelectIsotopeNumber(const G4Element* elm) 443 457 { … … 450 464 G4double* ab = elm->GetRelativeAbundanceVector(); 451 465 G4double x = G4UniformRand(); 452 for(; idx<ni; idx++) {466 for(; idx<ni; ++idx) { 453 467 x -= ab[idx]; 454 if (x <= 0.0) break;468 if (x <= 0.0) { break; } 455 469 } 456 if(idx >= ni) idx = ni - 1;470 if(idx >= ni) { idx = ni - 1; } 457 471 } 458 472 N = elm->GetIsotope(idx)->GetN(); … … 461 475 } 462 476 463 // ....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......477 // ======== Get/Set inline methods used at initialisation ================ 464 478 465 479 inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations() … … 578 592 { 579 593 nuclearStopping = val; 580 }581 582 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......583 584 inline585 G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynPart)586 {587 return MaxSecondaryEnergy(dynPart->GetDefinition(),588 dynPart->GetKineticEnergy());589 594 } 590 595 … … 601 606 G4VEmFluctuationModel* f = 0) 602 607 { 603 if(p && pParticleChange != p) pParticleChange = p;608 if(p && pParticleChange != p) { pParticleChange = p; } 604 609 fluc = f; 605 610 } … … 607 612 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 608 613 609 inline void G4VEmModel::SetCurrentCouple(const G4MaterialCutsCouple* p)610 {611 currentCouple = p;612 }613 614 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......615 616 inline const G4MaterialCutsCouple* G4VEmModel::CurrentCouple() const617 {618 return currentCouple;619 }620 621 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......622 623 inline void G4VEmModel::SetCurrentElement(const G4Element* elm)624 {625 currentElement = elm;626 }627 628 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......629 630 inline const G4Element* G4VEmModel::GetCurrentElement() const631 {632 return currentElement;633 }634 635 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......636 637 614 #endif 638 615
Note: See TracChangeset
for help on using the changeset viewer.