Changeset 1055 for trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedComptonModel.cc
- Timestamp:
- May 28, 2009, 4:26:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedComptonModel.cc
r1007 r1055 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4LivermorePolarizedComptonModel.cc,v 1. 1 2008/10/30 14:16:35 sincerti Exp $27 // GEANT4 tag $Name: geant4-09-0 2$26 // $Id: G4LivermorePolarizedComptonModel.cc,v 1.6 2009/05/03 08:29:55 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $ 28 28 // 29 // History: 30 // -------- 31 // 02 May 2009 S Incerti as V. Ivanchenko proposed in G4LivermoreComptonModel.cc 32 // 33 // Cleanup initialisation and generation of secondaries: 34 // - apply internal high-energy limit only in constructor 35 // - do not apply low-energy limit (default is 0) 36 // - remove GetMeanFreePath method and table 37 // - added protection against numerical problem in energy sampling 38 // - use G4ElementSelector 29 39 30 40 #include "G4LivermorePolarizedComptonModel.hh" … … 38 48 G4LivermorePolarizedComptonModel::G4LivermorePolarizedComptonModel(const G4ParticleDefinition*, 39 49 const G4String& nam) 40 :G4VEmModel(nam),isInitialised(false) 41 { 42 lowEnergyLimit = 250 * eV; // SI - Could be 10 eV ?50 :G4VEmModel(nam),isInitialised(false),meanFreePathTable(0),scatterFunctionData(0),crossSectionHandler(0) 51 { 52 lowEnergyLimit = 250 * eV; 43 53 highEnergyLimit = 100 * GeV; 44 SetLowEnergyLimit(lowEnergyLimit);54 //SetLowEnergyLimit(lowEnergyLimit); 45 55 SetHighEnergyLimit(highEnergyLimit); 46 56 … … 53 63 // 4 = entering in methods 54 64 65 if( verboseLevel>0 ) { 55 66 G4cout << "Livermore Polarized Compton is constructed " << G4endl 56 67 << "Energy range: " 57 << lowEnergyLimit / keV << " keV - "68 << lowEnergyLimit / eV << " eV - " 58 69 << highEnergyLimit / GeV << " GeV" 59 70 << G4endl; 60 71 } 61 72 } 62 73 … … 65 76 G4LivermorePolarizedComptonModel::~G4LivermorePolarizedComptonModel() 66 77 { 67 delete meanFreePathTable;68 delete crossSectionHandler;69 delete scatterFunctionData;78 if (meanFreePathTable) delete meanFreePathTable; 79 if (crossSectionHandler) delete crossSectionHandler; 80 if (scatterFunctionData) delete scatterFunctionData; 70 81 } 71 82 … … 78 89 G4cout << "Calling G4LivermorePolarizedComptonModel::Initialise()" << G4endl; 79 90 80 InitialiseElementSelectors(particle,cuts); 81 82 // Energy limits 83 84 if (LowEnergyLimit() < lowEnergyLimit) 85 { 86 G4cout << "G4LivermorePolarizedComptonModel: low energy limit increased from " << 87 LowEnergyLimit()/eV << " eV to " << lowEnergyLimit << " eV" << G4endl; 88 SetLowEnergyLimit(lowEnergyLimit); 89 } 90 91 if (HighEnergyLimit() > highEnergyLimit) 92 { 93 G4cout << "G4LivermorePolarizedComptonModel: high energy limit decreased from " << 94 HighEnergyLimit()/GeV << " GeV to " << highEnergyLimit << " GeV" << G4endl; 95 SetHighEnergyLimit(highEnergyLimit); 96 } 91 if (crossSectionHandler) 92 { 93 crossSectionHandler->Clear(); 94 delete crossSectionHandler; 95 } 97 96 98 97 // Reading of data files - all materials are read … … 116 115 shellData.LoadData(file); 117 116 118 //119 117 if (verboseLevel > 2) 120 118 G4cout << "Loaded cross section files for Livermore Polarized Compton model" << G4endl; 121 119 122 G4cout << "Livermore Polarized Compton model is initialized " << G4endl 120 InitialiseElementSelectors(particle,cuts); 121 122 if( verboseLevel>0 ) { 123 G4cout << "Livermore Polarized Compton model is initialized " << G4endl 123 124 << "Energy range: " 124 << LowEnergyLimit() / keV << " keV - "125 << LowEnergyLimit() / eV << " eV - " 125 126 << HighEnergyLimit() / GeV << " GeV" 126 127 << G4endl; 127 128 } 129 128 130 // 129 131 130 132 if(isInitialised) return; 131 132 if(pParticleChange) 133 fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange); 134 else 135 fParticleChange = new G4ParticleChangeForGamma(); 136 133 fParticleChange = GetParticleChangeForGamma(); 137 134 isInitialised = true; 138 135 } … … 149 146 G4cout << "Calling ComputeCrossSectionPerAtom() of G4LivermorePolarizedComptonModel" << G4endl; 150 147 148 if (GammaEnergy < lowEnergyLimit || GammaEnergy > highEnergyLimit) return 0.0; 149 151 150 G4double cs = crossSectionHandler->FindValue(G4int(Z), GammaEnergy); 152 151 return cs; … … 203 202 fParticleChange->SetProposedKineticEnergy(0.); 204 203 fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy0); 205 // SI - IS THE FOLLOWING RETURN NECESSARY ?206 204 return; 207 205 } … … 210 208 211 209 // Select randomly one element in the current material 212 213 G4int Z = crossSectionHandler->SelectRandomAtom(couple,gammaEnergy0); 210 //G4int Z = crossSectionHandler->SelectRandomAtom(couple,gammaEnergy0); 211 const G4ParticleDefinition* particle = aDynamicGamma->GetDefinition(); 212 const G4Element* elm = SelectRandomAtom(couple,particle,gammaEnergy0); 213 G4int Z = (G4int)elm->GetZ(); 214 214 215 215 // Sample the energy and the polarization of the scattered photon … … 429 429 else 430 430 { 431 gammaEnergy1 = 0.; 431 432 fParticleChange->SetProposedKineticEnergy(0.) ; 432 433 fParticleChange->ProposeTrackStatus(fStopAndKill); … … 439 440 G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 -bindingE; 440 441 442 // SI -protection against negative final energy: no e- is created 443 // like in G4LivermoreComptonModel.cc 444 if(ElecKineEnergy < 0.0) { 445 fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy0 - gammaEnergy1); 446 return; 447 } 448 441 449 // SI - Removed range test 442 450 … … 664 672 } 665 673 666 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 667 668 G4double G4LivermorePolarizedComptonModel::GetMeanFreePath(const G4Track& track, 669 G4double, 670 G4ForceCondition*) 671 { 672 const G4DynamicParticle* photon = track.GetDynamicParticle(); 673 G4double energy = photon->GetKineticEnergy(); 674 const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple(); 675 size_t materialIndex = couple->GetIndex(); 676 G4double meanFreePath; 677 if (energy > highEnergyLimit) meanFreePath = meanFreePathTable->FindValue(highEnergyLimit,materialIndex); 678 else if (energy < lowEnergyLimit) meanFreePath = DBL_MAX; 679 else meanFreePath = meanFreePathTable->FindValue(energy,materialIndex); 680 return meanFreePath; 681 } 682 683 674
Note: See TracChangeset
for help on using the changeset viewer.